From: Xiang W Date: Thu, 06 Jul 2023 20:33:22 +0800 Subject: [PATCH v8 06/11] lib: sbi: print add 'o' type In-Reply-To: <2766a679-587d-d44a-a1e1-bbb745adeb59@ventanamicro.com> References: <20230705143703.635254-1-wxjstz@126.com> <20230705143703.635254-7-wxjstz@126.com> <2766a679-587d-d44a-a1e1-bbb745adeb59@ventanamicro.com> Message-ID: <1e3941dd84c85ff2a79fceccb0971f22eb2734b9.camel@126.com> List-Id: To: opensbi@lists.infradead.org MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit ? 2023-07-06???? 16:47 +0530?Himanshu Chauhan??? > Hi Xiang, > > On 05/07/23 8:06 pm, Xiang W wrote: > > Add o type for print to print octal numbers > > > > Signed-off-by: Xiang W > > Reviewed-by: Anup Patel > > --- > > ? lib/sbi/sbi_console.c | 7 ++++--- > > ? 1 file changed, 4 insertions(+), 3 deletions(-) > > > > diff --git a/lib/sbi/sbi_console.c b/lib/sbi/sbi_console.c > > index 7dd023f..2a43e16 100644 > > --- a/lib/sbi/sbi_console.c > > +++ b/lib/sbi/sbi_console.c > > @@ -327,7 +327,8 @@ static int print(char **out, u32 *out_len, const char *format, va_list args) > > ???????????????????????????????????????????? width, flags, *format); > > ????????????????????????????????continue; > > ????????????????????????} > > -???????????????????????if ((*format == 'u') || (*format == 'x') || (*format == 'X')) { > > +???????????????????????if ((*format == 'u') || (*format == 'o') > > +??????????????????????????????????????? || (*format == 'x') || (*format == 'X')) { > > ????????????????????????????????pc += printi(out, out_len, va_arg(args, unsigned int), > > ???????????????????????????????????????????? width, flags, *format); > > ????????????????????????????????continue; > > @@ -341,7 +342,7 @@ static int print(char **out, u32 *out_len, const char *format, va_list args) > > ????????????????????????????????type = 'i'; > > ????????????????????????????????if (format[1] == 'l') { > > ????????????????????????????????????????++format; > > -???????????????????????????????????????if ((format[1] == 'u') > > +???????????????????????????????????????if ((format[1] == 'u') || (format[1] == 'o') > > ????????????????????????????????????????????????????????|| (format[1] == 'd') || (format[1] == 'i') > > ????????????????????????????????????????????????????????|| (format[1] == 'x') || (format[1] == 'X')) { > > With %ld format, I have seen than 'd' is printed as it is. Can you take > care of that in this patch? Your using mainline code will print out d as it is. The new code will not have this bug. Regards, Xiang W > > Regards > > Himanshu > > > > ????????????????????????????????????????????????++format; > > @@ -351,7 +352,7 @@ static int print(char **out, u32 *out_len, const char *format, va_list args) > > ????????????????????????????????????????????????width, flags, type); > > ????????????????????????????????????????continue; > > ????????????????????????????????} > > -???????????????????????????????if ((format[1] == 'u') > > +???????????????????????????????if ((format[1] == 'u') || (format[1] == 'o') > > ????????????????????????????????????????????????|| (format[1] == 'd') || (format[1] == 'i') > > ????????????????????????????????????????????????|| (format[1] == 'x') || (format[1] == 'X')) { > > ????????????????????????????????????????++format; >