rtc: rx8025: Switch to use %ptR
Use %ptR instead of open coded variant to print content of struct rtc_time in human readable format. Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com> Signed-off-by: Alexandre Belloni <alexandre.belloni@bootlin.com>
This commit is contained in:
parent
a3f60bb35f
commit
1921cab117
@ -193,10 +193,7 @@ static int rx8025_get_time(struct device *dev, struct rtc_time *dt)
|
|||||||
if (err)
|
if (err)
|
||||||
return err;
|
return err;
|
||||||
|
|
||||||
dev_dbg(dev, "%s: read 0x%02x 0x%02x "
|
dev_dbg(dev, "%s: read %7ph\n", __func__, date);
|
||||||
"0x%02x 0x%02x 0x%02x 0x%02x 0x%02x\n", __func__,
|
|
||||||
date[0], date[1], date[2], date[3], date[4],
|
|
||||||
date[5], date[6]);
|
|
||||||
|
|
||||||
dt->tm_sec = bcd2bin(date[RX8025_REG_SEC] & 0x7f);
|
dt->tm_sec = bcd2bin(date[RX8025_REG_SEC] & 0x7f);
|
||||||
dt->tm_min = bcd2bin(date[RX8025_REG_MIN] & 0x7f);
|
dt->tm_min = bcd2bin(date[RX8025_REG_MIN] & 0x7f);
|
||||||
@ -210,9 +207,7 @@ static int rx8025_get_time(struct device *dev, struct rtc_time *dt)
|
|||||||
dt->tm_mon = bcd2bin(date[RX8025_REG_MONTH] & 0x1f) - 1;
|
dt->tm_mon = bcd2bin(date[RX8025_REG_MONTH] & 0x1f) - 1;
|
||||||
dt->tm_year = bcd2bin(date[RX8025_REG_YEAR]) + 100;
|
dt->tm_year = bcd2bin(date[RX8025_REG_YEAR]) + 100;
|
||||||
|
|
||||||
dev_dbg(dev, "%s: date %ds %dm %dh %dmd %dm %dy\n", __func__,
|
dev_dbg(dev, "%s: date %ptRr\n", __func__, dt);
|
||||||
dt->tm_sec, dt->tm_min, dt->tm_hour,
|
|
||||||
dt->tm_mday, dt->tm_mon, dt->tm_year);
|
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
@ -243,10 +238,7 @@ static int rx8025_set_time(struct device *dev, struct rtc_time *dt)
|
|||||||
date[RX8025_REG_MONTH] = bin2bcd(dt->tm_mon + 1);
|
date[RX8025_REG_MONTH] = bin2bcd(dt->tm_mon + 1);
|
||||||
date[RX8025_REG_YEAR] = bin2bcd(dt->tm_year - 100);
|
date[RX8025_REG_YEAR] = bin2bcd(dt->tm_year - 100);
|
||||||
|
|
||||||
dev_dbg(dev,
|
dev_dbg(dev, "%s: write %7ph\n", __func__, date);
|
||||||
"%s: write 0x%02x 0x%02x 0x%02x 0x%02x 0x%02x 0x%02x 0x%02x\n",
|
|
||||||
__func__,
|
|
||||||
date[0], date[1], date[2], date[3], date[4], date[5], date[6]);
|
|
||||||
|
|
||||||
ret = rx8025_write_regs(rx8025->client, RX8025_REG_SEC, 7, date);
|
ret = rx8025_write_regs(rx8025->client, RX8025_REG_SEC, 7, date);
|
||||||
if (ret < 0)
|
if (ret < 0)
|
||||||
@ -319,10 +311,7 @@ static int rx8025_read_alarm(struct device *dev, struct rtc_wkalrm *t)
|
|||||||
t->time.tm_hour = bcd2bin(ald[1] & 0x1f) % 12
|
t->time.tm_hour = bcd2bin(ald[1] & 0x1f) % 12
|
||||||
+ (ald[1] & 0x20 ? 12 : 0);
|
+ (ald[1] & 0x20 ? 12 : 0);
|
||||||
|
|
||||||
dev_dbg(dev, "%s: date: %ds %dm %dh %dmd %dm %dy\n",
|
dev_dbg(dev, "%s: date: %ptRr\n", __func__, t);
|
||||||
__func__,
|
|
||||||
t->time.tm_sec, t->time.tm_min, t->time.tm_hour,
|
|
||||||
t->time.tm_mday, t->time.tm_mon, t->time.tm_year);
|
|
||||||
t->enabled = !!(rx8025->ctrl1 & RX8025_BIT_CTRL1_DALE);
|
t->enabled = !!(rx8025->ctrl1 & RX8025_BIT_CTRL1_DALE);
|
||||||
t->pending = (ctrl2 & RX8025_BIT_CTRL2_DAFG) && t->enabled;
|
t->pending = (ctrl2 & RX8025_BIT_CTRL2_DAFG) && t->enabled;
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user