* rtc: ds1307: fix compile warning if RTC_DRV_DS1307_CENTURY isn't defined
@ 2017-07-06 20:01 Heiner Kallweit
0 siblings, 0 replies; only message in thread
From: Heiner Kallweit @ 2017-07-06 20:01 UTC (permalink / raw)
To: Alexandre Belloni; +Cc: linux-rtc, Stephen Rothwell
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 <sfr@canb.auug.org.au>
Signed-off-by: Heiner Kallweit <hkallweit1@gmail.com>
---
drivers/rtc/rtc-ds1307.c | 5 ++---
1 file changed, 2 insertions(+), 3 deletions(-)
diff --git a/drivers/rtc/rtc-ds1307.c b/drivers/rtc/rtc-ds1307.c
index 43e9dc6f..18b6a6af 100644
--- a/drivers/rtc/rtc-ds1307.c
+++ b/drivers/rtc/rtc-ds1307.c
@@ -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",
--
2.13.1
^ permalink raw reply related [flat|nested] only message in thread
only message in thread, other threads:[~2017-07-06 20:02 UTC | newest]
Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2017-07-06 20:01 rtc: ds1307: fix compile warning if RTC_DRV_DS1307_CENTURY isn't defined Heiner Kallweit
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox