Merge https://source.denx.de/u-boot/custodians/u-boot-riscv
[platform/kernel/u-boot.git] / cmd / osd.c
index 0b1fa49..c8c62d4 100644 (file)
--- a/cmd/osd.c
+++ b/cmd/osd.c
@@ -10,6 +10,7 @@
  */
 
 #include <common.h>
+#include <command.h>
 #include <dm.h>
 #include <hexdump.h>
 #include <video_osd.h>
@@ -74,14 +75,14 @@ static int osd_get_osd_cur(struct udevice **osdp)
  */
 static void show_osd(struct udevice *osd)
 {
-       printf("OSD %d:\t%s", osd->req_seq, osd->name);
+       printf("OSD %d:\t%s", dev_seq(osd), osd->name);
        if (device_active(osd))
-               printf("  (active %d)", osd->seq);
+               printf("  (active)");
        printf("\n");
 }
 
-static int do_osd_write(cmd_tbl_t *cmdtp, int flag, int argc,
-                       char * const argv[])
+static int do_osd_write(struct cmd_tbl *cmdtp, int flag, int argc,
+                       char *const argv[])
 {
        uint x, y;
        uint count;
@@ -98,10 +99,10 @@ static int do_osd_write(cmd_tbl_t *cmdtp, int flag, int argc,
                return CMD_RET_FAILURE;
        }
 
-       x = simple_strtoul(argv[1], NULL, 16);
-       y = simple_strtoul(argv[2], NULL, 16);
+       x = hextoul(argv[1], NULL);
+       y = hextoul(argv[2], NULL);
        hexstr = argv[3];
-       count = (argc > 4) ? simple_strtoul(argv[4], NULL, 16) : 1;
+       count = (argc > 4) ? hextoul(argv[4], NULL) : 1;
 
        buflen = strlen(hexstr) / 2;
 
@@ -131,8 +132,8 @@ static int do_osd_write(cmd_tbl_t *cmdtp, int flag, int argc,
        return CMD_RET_SUCCESS;
 }
 
-static int do_osd_print(cmd_tbl_t *cmdtp, int flag, int argc,
-                       char * const argv[])
+static int do_osd_print(struct cmd_tbl *cmdtp, int flag, int argc,
+                       char *const argv[])
 {
        uint x, y;
        u8 color;
@@ -147,9 +148,9 @@ static int do_osd_print(cmd_tbl_t *cmdtp, int flag, int argc,
                return CMD_RET_FAILURE;
        }
 
-       x = simple_strtoul(argv[1], NULL, 16);
-       y = simple_strtoul(argv[2], NULL, 16);
-       color = simple_strtoul(argv[3], NULL, 16);
+       x = hextoul(argv[1], NULL);
+       y = hextoul(argv[2], NULL);
+       color = hextoul(argv[3], NULL);
        text = argv[4];
 
        res = video_osd_print(osd_cur, x, y, color, text);
@@ -161,8 +162,8 @@ static int do_osd_print(cmd_tbl_t *cmdtp, int flag, int argc,
        return CMD_RET_SUCCESS;
 }
 
-static int do_osd_size(cmd_tbl_t *cmdtp, int flag, int argc,
-                      char * const argv[])
+static int do_osd_size(struct cmd_tbl *cmdtp, int flag, int argc,
+                      char *const argv[])
 {
        uint x, y;
        int res;
@@ -175,8 +176,8 @@ static int do_osd_size(cmd_tbl_t *cmdtp, int flag, int argc,
                return CMD_RET_FAILURE;
        }
 
-       x = simple_strtoul(argv[1], NULL, 16);
-       y = simple_strtoul(argv[2], NULL, 16);
+       x = hextoul(argv[1], NULL);
+       y = hextoul(argv[2], NULL);
 
        res = video_osd_set_size(osd_cur, x, y);
        if (res) {
@@ -187,8 +188,8 @@ static int do_osd_size(cmd_tbl_t *cmdtp, int flag, int argc,
        return CMD_RET_SUCCESS;
 }
 
-static int do_show_osd(cmd_tbl_t *cmdtp, int flag, int argc,
-                      char * const argv[])
+static int do_show_osd(struct cmd_tbl *cmdtp, int flag, int argc,
+                      char *const argv[])
 {
        struct udevice *osd;
 
@@ -210,7 +211,7 @@ static int do_show_osd(cmd_tbl_t *cmdtp, int flag, int argc,
                int i, res;
 
                /* show specific OSD */
-               i = simple_strtoul(argv[1], NULL, 10);
+               i = dectoul(argv[1], NULL);
 
                res = uclass_get_device_by_seq(UCLASS_VIDEO_OSD, i, &osd);
                if (res) {
@@ -223,8 +224,8 @@ static int do_show_osd(cmd_tbl_t *cmdtp, int flag, int argc,
        return CMD_RET_SUCCESS;
 }
 
-static int do_osd_num(cmd_tbl_t *cmdtp, int flag, int argc,
-                     char * const argv[])
+static int do_osd_num(struct cmd_tbl *cmdtp, int flag, int argc,
+                     char *const argv[])
 {
        int osd_no;
        int res = 0;
@@ -234,12 +235,12 @@ static int do_osd_num(cmd_tbl_t *cmdtp, int flag, int argc,
                struct udevice *osd;
 
                if (!osd_get_osd_cur(&osd))
-                       osd_no = osd->seq;
+                       osd_no = dev_seq(osd);
                else
                        osd_no = -1;
                printf("Current osd is %d\n", osd_no);
        } else {
-               osd_no = simple_strtoul(argv[1], NULL, 10);
+               osd_no = dectoul(argv[1], NULL);
                printf("Setting osd to %d\n", osd_no);
 
                res = cmd_osd_set_osd_num(osd_no);
@@ -250,7 +251,7 @@ static int do_osd_num(cmd_tbl_t *cmdtp, int flag, int argc,
        return res ? CMD_RET_FAILURE : CMD_RET_SUCCESS;
 }
 
-static cmd_tbl_t cmd_osd_sub[] = {
+static struct cmd_tbl cmd_osd_sub[] = {
        U_BOOT_CMD_MKENT(show, 1, 1, do_show_osd, "", ""),
        U_BOOT_CMD_MKENT(dev, 1, 1, do_osd_num, "", ""),
        U_BOOT_CMD_MKENT(write, 4, 1, do_osd_write, "", ""),
@@ -258,9 +259,9 @@ static cmd_tbl_t cmd_osd_sub[] = {
        U_BOOT_CMD_MKENT(size, 2, 1, do_osd_size, "", ""),
 };
 
-static int do_osd(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
+static int do_osd(struct cmd_tbl *cmdtp, int flag, int argc, char *const argv[])
 {
-       cmd_tbl_t *c;
+       struct cmd_tbl *c;
 
        if (argc < 2)
                return CMD_RET_USAGE;