rtc: ds1307: fix compile warning if RTC_DRV_DS1307_CENTURY isn't defined
Fix the following warning if RTC_DRV_DS1307_CENTURY isn't defined.
drivers/rtc/rtc-ds1307.c: In function 'ds1307_get_time':drivers/rtc/rtc-ds1307.c:342:26: warning: unused variable 'chip' [-Wunused-variable]
const struct chip_desc *chip = &chips[ds1307->type];
^Fixes 436c93db60a4 ("rtc: ds1307: factor out century bit handling")
Reported-by Stephen Rothwell <[email protected]>
Signed-off-by Heiner Kallweit <[email protected]>
--- drivers/rtc/rtc-ds1307.c | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-)
drivers/rtc/rtc-ds1307.c +2 -3
@@ -368,10 +368,9 @@ static int ds1307_get_time(struct device *dev, struct rtc_time *t) t->tm_mon =bcd2bin (tmp) -1 ; t->tm_year =bcd2bin (ds1307->regs[DS1307_REG_YEAR ]) +100 ; -#ifdef CONFIG_RTC_DRV_DS1307_CENTURY -if (ds1307->regs[chip->century_reg] & chip->century_bit) +if (ds1307->regs[chip->century_reg] & chip->century_bit && +IS_ENABLED (CONFIG_RTC_DRV_DS1307_CENTURY )) t->tm_year +=100 ; -#endif dev_dbg(dev, "%s secs=%d, mins=%d, " "hours=%d, mday=%d, mon=%d, year=%d, wday=%d\n",
Signature · 1 line
2.13.1