X-Git-Url: https://git.sur5r.net/?a=blobdiff_plain;f=common%2Fcmd_date.c;h=0ac032cf3092e5fe7e182c63f9a23619b2bd6a7f;hb=fd622f239f9145cff1121297d2ac2ebf17d5ec0a;hp=b4d9649bddea8de360049da09672badc282a4633;hpb=cb5473205206c7f14cbb1e747f28ec75b48826e2;p=u-boot diff --git a/common/cmd_date.c b/common/cmd_date.c index b4d9649bdd..0ac032cf30 100644 --- a/common/cmd_date.c +++ b/common/cmd_date.c @@ -31,15 +31,19 @@ DECLARE_GLOBAL_DATA_PTR; -const char *weekdays[] = { +static const char * const weekdays[] = { "Sun", "Mon", "Tues", "Wednes", "Thurs", "Fri", "Satur", }; +#ifdef CONFIG_NEEDS_MANUAL_RELOC #define RELOC(a) ((typeof(a))((unsigned long)(a) + gd->reloc_off)) +#else +#define RELOC(a) a +#endif -int mk_date (char *, struct rtc_time *); +int mk_date (const char *, struct rtc_time *); -int do_date (cmd_tbl_t *cmdtp, int flag, int argc, char *argv[]) +static int do_date(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[]) { struct rtc_time tm; int rcode = 0; @@ -67,9 +71,9 @@ int do_date (cmd_tbl_t *cmdtp, int flag, int argc, char *argv[]) /* and write to RTC */ rcode = rtc_set (&tm); if(rcode) - puts("## Set date failled\n"); + puts("## Set date failed\n"); } else { - puts("## Get date failled\n"); + puts("## Get date failed\n"); } } /* FALL TROUGH */ @@ -77,7 +81,7 @@ int do_date (cmd_tbl_t *cmdtp, int flag, int argc, char *argv[]) rcode = rtc_get (&tm); if (rcode) { - puts("## Get date failled\n"); + puts("## Get date failed\n"); break; } @@ -89,8 +93,7 @@ int do_date (cmd_tbl_t *cmdtp, int flag, int argc, char *argv[]) break; default: - printf ("Usage:\n%s\n", cmdtp->usage); - rcode = 1; + rcode = CMD_RET_USAGE; } /* switch back to original I2C bus */ @@ -102,7 +105,7 @@ int do_date (cmd_tbl_t *cmdtp, int flag, int argc, char *argv[]) /* * simple conversion of two-digit string with error checking */ -static int cnvrt2 (char *str, int *valp) +static int cnvrt2 (const char *str, int *valp) { int val; @@ -127,7 +130,7 @@ static int cnvrt2 (char *str, int *valp) * Some basic checking for valid values is done, but this will not catch * all possible error conditions. */ -int mk_date (char *datestr, struct rtc_time *tmp) +int mk_date (const char *datestr, struct rtc_time *tmp) { int len, val; char *ptr; @@ -214,9 +217,9 @@ int mk_date (char *datestr, struct rtc_time *tmp) U_BOOT_CMD( date, 2, 1, do_date, - "date - get/set/reset date & time\n", + "get/set/reset date & time", "[MMDDhhmm[[CC]YY][.ss]]\ndate reset\n" " - without arguments: print date & time\n" " - with numeric argument: set the system date & time\n" - " - with 'reset' argument: reset the RTC\n" + " - with 'reset' argument: reset the RTC" );