diff options
author | Andy Shevchenko <andriy.shevchenko@linux.intel.com> | 2018-12-04 23:23:12 +0200 |
---|---|---|
committer | Alexandre Belloni <alexandre.belloni@bootlin.com> | 2018-12-10 22:39:37 +0100 |
commit | 5548cbf7f148b9a039b19fa4697f1b9beaba2c78 (patch) | |
tree | d061de9fb7217922bb26d9c008729d26b0d6eb93 /drivers/rtc/rtc-proc.c | |
parent | 4d42c44727a062e233e446c6c86da1c84d762d79 (diff) | |
download | linux-5548cbf7f148b9a039b19fa4697f1b9beaba2c78.tar.bz2 |
rtc: Switch to use %ptR
Use %ptR instead of open coded variant to print content of
struct rtc_time in human readable format.
Note, we drop the validation option. This is only used in
a deprecated ABI and is mostly wrong as many RTCs will still be valid
after 2100.
Cc: Arnd Bergmann <arnd@arndb.de>
Acked-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Signed-off-by: Alexandre Belloni <alexandre.belloni@bootlin.com>
Diffstat (limited to 'drivers/rtc/rtc-proc.c')
-rw-r--r-- | drivers/rtc/rtc-proc.c | 36 |
1 files changed, 5 insertions, 31 deletions
diff --git a/drivers/rtc/rtc-proc.c b/drivers/rtc/rtc-proc.c index a9dd9218fae2..4d74e4f4ff30 100644 --- a/drivers/rtc/rtc-proc.c +++ b/drivers/rtc/rtc-proc.c @@ -50,41 +50,15 @@ static int rtc_proc_show(struct seq_file *seq, void *offset) err = rtc_read_time(rtc, &tm); if (err == 0) { seq_printf(seq, - "rtc_time\t: %02d:%02d:%02d\n" - "rtc_date\t: %04d-%02d-%02d\n", - tm.tm_hour, tm.tm_min, tm.tm_sec, - tm.tm_year + 1900, tm.tm_mon + 1, tm.tm_mday); + "rtc_time\t: %ptRt\n" + "rtc_date\t: %ptRd\n", + &tm, &tm); } err = rtc_read_alarm(rtc, &alrm); if (err == 0) { - seq_printf(seq, "alrm_time\t: "); - if ((unsigned int)alrm.time.tm_hour <= 24) - seq_printf(seq, "%02d:", alrm.time.tm_hour); - else - seq_printf(seq, "**:"); - if ((unsigned int)alrm.time.tm_min <= 59) - seq_printf(seq, "%02d:", alrm.time.tm_min); - else - seq_printf(seq, "**:"); - if ((unsigned int)alrm.time.tm_sec <= 59) - seq_printf(seq, "%02d\n", alrm.time.tm_sec); - else - seq_printf(seq, "**\n"); - - seq_printf(seq, "alrm_date\t: "); - if ((unsigned int)alrm.time.tm_year <= 200) - seq_printf(seq, "%04d-", alrm.time.tm_year + 1900); - else - seq_printf(seq, "****-"); - if ((unsigned int)alrm.time.tm_mon <= 11) - seq_printf(seq, "%02d-", alrm.time.tm_mon + 1); - else - seq_printf(seq, "**-"); - if (alrm.time.tm_mday && (unsigned int)alrm.time.tm_mday <= 31) - seq_printf(seq, "%02d\n", alrm.time.tm_mday); - else - seq_printf(seq, "**\n"); + seq_printf(seq, "alrm_time\t: %ptRt\n", &alrm.time); + seq_printf(seq, "alrm_date\t: %ptRd\n", &alrm.time); seq_printf(seq, "alarm_IRQ\t: %s\n", alrm.enabled ? "yes" : "no"); seq_printf(seq, "alrm_pending\t: %s\n", |