rtc: simplify implementations of read_alarm
Since commit d68778b80d
("rtc: initialize output parameter for read
alarm to "uninitialized"") there is no need to explicitly set
unsupported members to -1. So drop the respective assignments from
drivers.
Signed-off-by: Uwe Kleine-König <uwe@kleine-koenig.org>
Signed-off-by: Alexandre Belloni <alexandre.belloni@free-electrons.com>
This commit is contained in:

committed by
Alexandre Belloni

parent
e29385fab0
commit
56d86a7e79
@@ -419,25 +419,19 @@ ds1685_rtc_read_alarm(struct device *dev, struct rtc_wkalrm *alrm)
|
||||
*
|
||||
* The Linux RTC system doesn't support the "don't care" capability
|
||||
* of this RTC chip. We check for it anyways in case support is
|
||||
* added in the future.
|
||||
* added in the future and only assign when we care.
|
||||
*/
|
||||
if (unlikely(seconds >= 0xc0))
|
||||
alrm->time.tm_sec = -1;
|
||||
else
|
||||
if (likely(seconds < 0xc0))
|
||||
alrm->time.tm_sec = ds1685_rtc_bcd2bin(rtc, seconds,
|
||||
RTC_SECS_BCD_MASK,
|
||||
RTC_SECS_BIN_MASK);
|
||||
|
||||
if (unlikely(minutes >= 0xc0))
|
||||
alrm->time.tm_min = -1;
|
||||
else
|
||||
if (likely(minutes < 0xc0))
|
||||
alrm->time.tm_min = ds1685_rtc_bcd2bin(rtc, minutes,
|
||||
RTC_MINS_BCD_MASK,
|
||||
RTC_MINS_BIN_MASK);
|
||||
|
||||
if (unlikely(hours >= 0xc0))
|
||||
alrm->time.tm_hour = -1;
|
||||
else
|
||||
if (likely(hours < 0xc0))
|
||||
alrm->time.tm_hour = ds1685_rtc_bcd2bin(rtc, hours,
|
||||
RTC_HRS_24_BCD_MASK,
|
||||
RTC_HRS_24_BIN_MASK);
|
||||
@@ -445,11 +439,6 @@ ds1685_rtc_read_alarm(struct device *dev, struct rtc_wkalrm *alrm)
|
||||
/* Write the data to rtc_wkalrm. */
|
||||
alrm->time.tm_mday = ds1685_rtc_bcd2bin(rtc, mday, RTC_MDAY_BCD_MASK,
|
||||
RTC_MDAY_BIN_MASK);
|
||||
alrm->time.tm_mon = -1;
|
||||
alrm->time.tm_year = -1;
|
||||
alrm->time.tm_wday = -1;
|
||||
alrm->time.tm_yday = -1;
|
||||
alrm->time.tm_isdst = -1;
|
||||
alrm->enabled = !!(ctrlb & RTC_CTRL_B_AIE);
|
||||
alrm->pending = !!(ctrlc & RTC_CTRL_C_AF);
|
||||
|
||||
|
Reference in New Issue
Block a user