diff mbox series

[v2,20/21] mk68/mac: Switch to use %ptR

Message ID 20180220214400.66749-21-andriy.shevchenko@linux.intel.com
State Not Applicable
Headers show
Series lib, rtc: Print rtc_time via %ptR[dt][rv] | expand

Commit Message

Andy Shevchenko Feb. 20, 2018, 9:43 p.m. UTC
Use %ptR instead of open coded variant to print content of
struct rtc_time in human readable format.

Cc: Geert Uytterhoeven <geert@linux-m68k.org>
Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
---
 arch/m68k/Kconfig.machine | 1 +
 arch/m68k/mac/misc.c      | 8 ++------
 2 files changed, 3 insertions(+), 6 deletions(-)

Comments

Geert Uytterhoeven Feb. 21, 2018, 9:38 a.m. UTC | #1
Hi Andy,

On Tue, Feb 20, 2018 at 10:43 PM, Andy Shevchenko
<andriy.shevchenko@linux.intel.com> wrote:
> Use %ptR instead of open coded variant to print content of
> struct rtc_time in human readable format.
>
> Cc: Geert Uytterhoeven <geert@linux-m68k.org>
> Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
> ---
>  arch/m68k/Kconfig.machine | 1 +
>  arch/m68k/mac/misc.c      | 8 ++------
>  2 files changed, 3 insertions(+), 6 deletions(-)
>
> diff --git a/arch/m68k/Kconfig.machine b/arch/m68k/Kconfig.machine
> index 64a641467736..620a55da648e 100644
> --- a/arch/m68k/Kconfig.machine
> +++ b/arch/m68k/Kconfig.machine
> @@ -26,6 +26,7 @@ config MAC
>         bool "Macintosh support"
>         depends on MMU
>         select MMU_MOTOROLA if MMU
> +       select PRINTK_PEXT_TIMEDATE

Yeah, now you have to track whatever code uses the new %p extension...

Note that the user below uses pr_debug(), so technically it depends on
DYNAMIC_DEBUG, or (more likely) someone manually inserting "#define DEBUG"
at the top of the file for a short debug session ;-)

> --- a/arch/m68k/mac/misc.c
> +++ b/arch/m68k/mac/misc.c
> @@ -673,13 +673,9 @@ int mac_hwclk(int op, struct rtc_time *t)
>                 unmktime(now, 0,
>                          &t->tm_year, &t->tm_mon, &t->tm_mday,
>                          &t->tm_hour, &t->tm_min, &t->tm_sec);
> -               pr_debug("%s: read %04d-%02d-%-2d %02d:%02d:%02d\n",
> -                        __func__, t->tm_year + 1900, t->tm_mon + 1, t->tm_mday,
> -                        t->tm_hour, t->tm_min, t->tm_sec);
> +               pr_debug("%s: read %ptR\n", __func__, t);
>         } else { /* write */
> -               pr_debug("%s: tried to write %04d-%02d-%-2d %02d:%02d:%02d\n",
> -                        __func__, t->tm_year + 1900, t->tm_mon + 1, t->tm_mday,
> -                        t->tm_hour, t->tm_min, t->tm_sec);
> +               pr_debug("%s: tried to write %ptR\n", __func__, t);
>
>                 now = mktime(t->tm_year + 1900, t->tm_mon + 1, t->tm_mday,
>                              t->tm_hour, t->tm_min, t->tm_sec);

Gr{oetje,eeting}s,

                        Geert

--
Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- geert@linux-m68k.org

In personal conversations with technical people, I call myself a hacker. But
when I'm talking to journalists I just say "programmer" or something like that.
                                -- Linus Torvalds
Andy Shevchenko Feb. 21, 2018, 2:04 p.m. UTC | #2
On Wed, 2018-02-21 at 10:38 +0100, Geert Uytterhoeven wrote:

> > +       select PRINTK_PEXT_TIMEDATE
> 
> Yeah, now you have to track whatever code uses the new %p extension...

I don't like this. People had an opinion that 750+ bytes is way too much
for tiny kernel configuration.
diff mbox series

Patch

diff --git a/arch/m68k/Kconfig.machine b/arch/m68k/Kconfig.machine
index 64a641467736..620a55da648e 100644
--- a/arch/m68k/Kconfig.machine
+++ b/arch/m68k/Kconfig.machine
@@ -26,6 +26,7 @@  config MAC
 	bool "Macintosh support"
 	depends on MMU
 	select MMU_MOTOROLA if MMU
+	select PRINTK_PEXT_TIMEDATE
 	help
 	  This option enables support for the Apple Macintosh series of
 	  computers (yes, there is experimental support now, at least for part
diff --git a/arch/m68k/mac/misc.c b/arch/m68k/mac/misc.c
index 4956edaac926..0002bb0ebbfc 100644
--- a/arch/m68k/mac/misc.c
+++ b/arch/m68k/mac/misc.c
@@ -673,13 +673,9 @@  int mac_hwclk(int op, struct rtc_time *t)
 		unmktime(now, 0,
 			 &t->tm_year, &t->tm_mon, &t->tm_mday,
 			 &t->tm_hour, &t->tm_min, &t->tm_sec);
-		pr_debug("%s: read %04d-%02d-%-2d %02d:%02d:%02d\n",
-		         __func__, t->tm_year + 1900, t->tm_mon + 1, t->tm_mday,
-		         t->tm_hour, t->tm_min, t->tm_sec);
+		pr_debug("%s: read %ptR\n", __func__, t);
 	} else { /* write */
-		pr_debug("%s: tried to write %04d-%02d-%-2d %02d:%02d:%02d\n",
-		         __func__, t->tm_year + 1900, t->tm_mon + 1, t->tm_mday,
-		         t->tm_hour, t->tm_min, t->tm_sec);
+		pr_debug("%s: tried to write %ptR\n", __func__, t);
 
 		now = mktime(t->tm_year + 1900, t->tm_mon + 1, t->tm_mday,
 			     t->tm_hour, t->tm_min, t->tm_sec);