diff mbox

[v1,24/25] kdb: Switch to use %pt

Message ID 20170608134811.60786-25-andriy.shevchenko@linux.intel.com
State Changes Requested
Headers show

Commit Message

Andy Shevchenko June 8, 2017, 1:48 p.m. UTC
Use %pt instead of open coded variant to print content of
struct rtc_time in human readable format.

Cc: Jason Wessel <jason.wessel@windriver.com>
Cc: Ingo Molnar <mingo@kernel.org>
Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
---
 kernel/debug/kdb/kdb_main.c | 7 +------
 1 file changed, 1 insertion(+), 6 deletions(-)

Comments

Daniel Thompson June 9, 2017, 1:42 p.m. UTC | #1
On 08/06/17 14:48, Andy Shevchenko wrote:
> Use %pt instead of open coded variant to print content of
> struct rtc_time in human readable format.
> 
> Cc: Jason Wessel <jason.wessel@windriver.com>
> Cc: Ingo Molnar <mingo@kernel.org>
> Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>

Reviewed-by: Daniel Thompson <daniel.thompson@linaro.org>

> ---
>   kernel/debug/kdb/kdb_main.c | 7 +------
>   1 file changed, 1 insertion(+), 6 deletions(-)
> 
> diff --git a/kernel/debug/kdb/kdb_main.c b/kernel/debug/kdb/kdb_main.c
> index c8146d53ca67..2a6f12be79d8 100644
> --- a/kernel/debug/kdb/kdb_main.c
> +++ b/kernel/debug/kdb/kdb_main.c
> @@ -2556,12 +2556,7 @@ static int kdb_summary(int argc, const char **argv)
>   
>   	now = __current_kernel_time();
>   	kdb_gmtime(&now, &tm);
> -	kdb_printf("date       %04d-%02d-%02d %02d:%02d:%02d "
> -		   "tz_minuteswest %d\n",
> -		1900+tm.tm_year, tm.tm_mon+1, tm.tm_mday,
> -		tm.tm_hour, tm.tm_min, tm.tm_sec,
> -		sys_tz.tz_minuteswest);
> -
> +	kdb_printf("date       %pt tz_minuteswest %d\n", &tm, sys_tz.tz_minuteswest);
>   	kdb_sysinfo(&val);
>   	kdb_printf("uptime     ");
>   	if (val.uptime > (24*60*60)) {
>
Arnd Bergmann Oct. 12, 2017, 1:31 p.m. UTC | #2
On Thu, Jun 8, 2017 at 3:48 PM, Andy Shevchenko
<andriy.shevchenko@linux.intel.com> wrote:

> diff --git a/kernel/debug/kdb/kdb_main.c b/kernel/debug/kdb/kdb_main.c
> index c8146d53ca67..2a6f12be79d8 100644
> --- a/kernel/debug/kdb/kdb_main.c
> +++ b/kernel/debug/kdb/kdb_main.c
> @@ -2556,12 +2556,7 @@ static int kdb_summary(int argc, const char **argv)
>
>         now = __current_kernel_time();
>         kdb_gmtime(&now, &tm);
> -       kdb_printf("date       %04d-%02d-%02d %02d:%02d:%02d "
> -                  "tz_minuteswest %d\n",
> -               1900+tm.tm_year, tm.tm_mon+1, tm.tm_mday,
> -               tm.tm_hour, tm.tm_min, tm.tm_sec,
> -               sys_tz.tz_minuteswest);
> -

I just experimented with a similar change and noticed your version.

You forgot to remove the kdb_gmtime() function that is now completely
unneeded. My patch takes care of that now.

      Arnd
Andy Shevchenko Oct. 12, 2017, 5:05 p.m. UTC | #3
On Thu, 2017-10-12 at 15:31 +0200, Arnd Bergmann wrote:
> On Thu, Jun 8, 2017 at 3:48 PM, Andy Shevchenko
> <andriy.shevchenko@linux.intel.com> wrote:
> 
> > diff --git a/kernel/debug/kdb/kdb_main.c
> > b/kernel/debug/kdb/kdb_main.c
> > index c8146d53ca67..2a6f12be79d8 100644
> > --- a/kernel/debug/kdb/kdb_main.c
> > +++ b/kernel/debug/kdb/kdb_main.c
> > @@ -2556,12 +2556,7 @@ static int kdb_summary(int argc, const char
> > **argv)
> > 
> >         now = __current_kernel_time();
> >         kdb_gmtime(&now, &tm);
> > -       kdb_printf("date       %04d-%02d-%02d %02d:%02d:%02d "
> > -                  "tz_minuteswest %d\n",
> > -               1900+tm.tm_year, tm.tm_mon+1, tm.tm_mday,
> > -               tm.tm_hour, tm.tm_min, tm.tm_sec,
> > -               sys_tz.tz_minuteswest);
> > -
> 
> I just experimented with a similar change and noticed your version.
> 
> You forgot to remove the kdb_gmtime() function that is now completely
> unneeded. My patch takes care of that now.

So, are you going to substitute entire series by your variant?

What did you choose to be format for the %p extension?
Arnd Bergmann Oct. 13, 2017, 7:42 a.m. UTC | #4
On Thu, Oct 12, 2017 at 7:05 PM, Andy Shevchenko
<andriy.shevchenko@linux.intel.com> wrote:
> On Thu, 2017-10-12 at 15:31 +0200, Arnd Bergmann wrote:
>> On Thu, Jun 8, 2017 at 3:48 PM, Andy Shevchenko
>> <andriy.shevchenko@linux.intel.com> wrote:
>>
>> > diff --git a/kernel/debug/kdb/kdb_main.c
>> > b/kernel/debug/kdb/kdb_main.c
>> > index c8146d53ca67..2a6f12be79d8 100644
>> > --- a/kernel/debug/kdb/kdb_main.c
>> > +++ b/kernel/debug/kdb/kdb_main.c
>> > @@ -2556,12 +2556,7 @@ static int kdb_summary(int argc, const char
>> > **argv)
>> >
>> >         now = __current_kernel_time();
>> >         kdb_gmtime(&now, &tm);
>> > -       kdb_printf("date       %04d-%02d-%02d %02d:%02d:%02d "
>> > -                  "tz_minuteswest %d\n",
>> > -               1900+tm.tm_year, tm.tm_mon+1, tm.tm_mday,
>> > -               tm.tm_hour, tm.tm_min, tm.tm_sec,
>> > -               sys_tz.tz_minuteswest);
>> > -
>>
>> I just experimented with a similar change and noticed your version.
>>
>> You forgot to remove the kdb_gmtime() function that is now completely
>> unneeded. My patch takes care of that now.
>
> So, are you going to substitute entire series by your variant?
>
> What did you choose to be format for the %p extension?

My patch doesn't touch printf at all, instead it removes the
__current_kernel_time() function, so it's unrelated but happens
to change the same lines here. Since kdb_gmtime() doesn't
work with 64-bit time_t, I replaced it using the generic
time64_to_tm() helper and removed it here.

       Arnd
diff mbox

Patch

diff --git a/kernel/debug/kdb/kdb_main.c b/kernel/debug/kdb/kdb_main.c
index c8146d53ca67..2a6f12be79d8 100644
--- a/kernel/debug/kdb/kdb_main.c
+++ b/kernel/debug/kdb/kdb_main.c
@@ -2556,12 +2556,7 @@  static int kdb_summary(int argc, const char **argv)
 
 	now = __current_kernel_time();
 	kdb_gmtime(&now, &tm);
-	kdb_printf("date       %04d-%02d-%02d %02d:%02d:%02d "
-		   "tz_minuteswest %d\n",
-		1900+tm.tm_year, tm.tm_mon+1, tm.tm_mday,
-		tm.tm_hour, tm.tm_min, tm.tm_sec,
-		sys_tz.tz_minuteswest);
-
+	kdb_printf("date       %pt tz_minuteswest %d\n", &tm, sys_tz.tz_minuteswest);
 	kdb_sysinfo(&val);
 	kdb_printf("uptime     ");
 	if (val.uptime > (24*60*60)) {