X-Git-Url: https://git.sur5r.net/?a=blobdiff_plain;f=drivers%2Fvideo%2Fvidconsole-uclass.c;h=e9a90b1b9bc375137cb93d4bdb1efa1ad6f66e4f;hb=895549a2d994ecf1ca1636792e55019e56be2d7d;hp=bea563a6c5b7ebf25334df75aab8194842b8432b;hpb=58c733a70ff1967490af1fd69aab2ba7bb86eb2c;p=u-boot diff --git a/drivers/video/vidconsole-uclass.c b/drivers/video/vidconsole-uclass.c index bea563a6c5..e9a90b1b9b 100644 --- a/drivers/video/vidconsole-uclass.c +++ b/drivers/video/vidconsole-uclass.c @@ -57,9 +57,17 @@ static int vidconsole_entry_start(struct udevice *dev) } /* Move backwards one space */ -static void vidconsole_back(struct udevice *dev) +static int vidconsole_back(struct udevice *dev) { struct vidconsole_priv *priv = dev_get_uclass_priv(dev); + struct vidconsole_ops *ops = vidconsole_get_ops(dev); + int ret; + + if (ops->backspace) { + ret = ops->backspace(dev); + if (ret != -ENOSYS) + return ret; + } priv->xcur_frac -= VID_TO_POS(priv->x_charsize); if (priv->xcur_frac < priv->xstart_frac) { @@ -69,6 +77,8 @@ static void vidconsole_back(struct udevice *dev) if (priv->ycur < 0) priv->ycur = 0; } + + return 0; } /* Move to a newline, scrolling the display if necessary */ @@ -160,6 +170,7 @@ static void vidconsole_puts(struct stdio_dev *sdev, const char *s) while (*s) vidconsole_put_char(dev, *s++); + video_sync(dev->parent); } /* Set up the number of rows and colours (rotated drivers override this) */ @@ -179,7 +190,6 @@ static int vidconsole_post_probe(struct udevice *dev) { struct vidconsole_priv *priv = dev_get_uclass_priv(dev); struct stdio_dev *sdev = &priv->sdev; - int ret; if (!priv->tab_width_frac) priv->tab_width_frac = VID_TO_POS(priv->x_charsize) * 8; @@ -195,11 +205,8 @@ static int vidconsole_post_probe(struct udevice *dev) sdev->putc = vidconsole_putc; sdev->puts = vidconsole_puts; sdev->priv = dev; - ret = stdio_register(sdev); - if (ret) - return ret; - return 0; + return stdio_register(sdev); } UCLASS_DRIVER(vidconsole) = { @@ -229,8 +236,7 @@ static int do_video_setcursor(cmd_tbl_t *cmdtp, int flag, int argc, if (argc != 3) return CMD_RET_USAGE; - uclass_first_device(UCLASS_VIDEO_CONSOLE, &dev); - if (!dev) + if (uclass_first_device_err(UCLASS_VIDEO_CONSOLE, &dev)) return CMD_RET_FAILURE; col = simple_strtoul(argv[1], NULL, 10); row = simple_strtoul(argv[2], NULL, 10); @@ -248,8 +254,7 @@ static int do_video_puts(cmd_tbl_t *cmdtp, int flag, int argc, if (argc != 2) return CMD_RET_USAGE; - uclass_first_device(UCLASS_VIDEO_CONSOLE, &dev); - if (!dev) + if (uclass_first_device_err(UCLASS_VIDEO_CONSOLE, &dev)) return CMD_RET_FAILURE; for (s = argv[1]; *s; s++) vidconsole_put_char(dev, *s);