diff options
Diffstat (limited to 'drivers/rtc/rtc-ds1685.c')
-rw-r--r-- | drivers/rtc/rtc-ds1685.c | 18 |
1 files changed, 8 insertions, 10 deletions
diff --git a/drivers/rtc/rtc-ds1685.c b/drivers/rtc/rtc-ds1685.c index 8c3bfcb115b7..803869c7d7c2 100644 --- a/drivers/rtc/rtc-ds1685.c +++ b/drivers/rtc/rtc-ds1685.c | |||
@@ -399,21 +399,21 @@ ds1685_rtc_read_alarm(struct device *dev, struct rtc_wkalrm *alrm) | |||
399 | * of this RTC chip. We check for it anyways in case support is | 399 | * of this RTC chip. We check for it anyways in case support is |
400 | * added in the future. | 400 | * added in the future. |
401 | */ | 401 | */ |
402 | if (unlikely((seconds >= 0xc0) && (seconds <= 0xff))) | 402 | if (unlikely(seconds >= 0xc0)) |
403 | alrm->time.tm_sec = -1; | 403 | alrm->time.tm_sec = -1; |
404 | else | 404 | else |
405 | alrm->time.tm_sec = ds1685_rtc_bcd2bin(rtc, seconds, | 405 | alrm->time.tm_sec = ds1685_rtc_bcd2bin(rtc, seconds, |
406 | RTC_SECS_BCD_MASK, | 406 | RTC_SECS_BCD_MASK, |
407 | RTC_SECS_BIN_MASK); | 407 | RTC_SECS_BIN_MASK); |
408 | 408 | ||
409 | if (unlikely((minutes >= 0xc0) && (minutes <= 0xff))) | 409 | if (unlikely(minutes >= 0xc0)) |
410 | alrm->time.tm_min = -1; | 410 | alrm->time.tm_min = -1; |
411 | else | 411 | else |
412 | alrm->time.tm_min = ds1685_rtc_bcd2bin(rtc, minutes, | 412 | alrm->time.tm_min = ds1685_rtc_bcd2bin(rtc, minutes, |
413 | RTC_MINS_BCD_MASK, | 413 | RTC_MINS_BCD_MASK, |
414 | RTC_MINS_BIN_MASK); | 414 | RTC_MINS_BIN_MASK); |
415 | 415 | ||
416 | if (unlikely((hours >= 0xc0) && (hours <= 0xff))) | 416 | if (unlikely(hours >= 0xc0)) |
417 | alrm->time.tm_hour = -1; | 417 | alrm->time.tm_hour = -1; |
418 | else | 418 | else |
419 | alrm->time.tm_hour = ds1685_rtc_bcd2bin(rtc, hours, | 419 | alrm->time.tm_hour = ds1685_rtc_bcd2bin(rtc, hours, |
@@ -472,13 +472,13 @@ ds1685_rtc_set_alarm(struct device *dev, struct rtc_wkalrm *alrm) | |||
472 | * field, and we only support four fields. We put the support | 472 | * field, and we only support four fields. We put the support |
473 | * here anyways for the future. | 473 | * here anyways for the future. |
474 | */ | 474 | */ |
475 | if (unlikely((seconds >= 0xc0) && (seconds <= 0xff))) | 475 | if (unlikely(seconds >= 0xc0)) |
476 | seconds = 0xff; | 476 | seconds = 0xff; |
477 | 477 | ||
478 | if (unlikely((minutes >= 0xc0) && (minutes <= 0xff))) | 478 | if (unlikely(minutes >= 0xc0)) |
479 | minutes = 0xff; | 479 | minutes = 0xff; |
480 | 480 | ||
481 | if (unlikely((hours >= 0xc0) && (hours <= 0xff))) | 481 | if (unlikely(hours >= 0xc0)) |
482 | hours = 0xff; | 482 | hours = 0xff; |
483 | 483 | ||
484 | alrm->time.tm_mon = -1; | 484 | alrm->time.tm_mon = -1; |
@@ -528,7 +528,6 @@ ds1685_rtc_set_alarm(struct device *dev, struct rtc_wkalrm *alrm) | |||
528 | /* ----------------------------------------------------------------------- */ | 528 | /* ----------------------------------------------------------------------- */ |
529 | /* /dev/rtcX Interface functions */ | 529 | /* /dev/rtcX Interface functions */ |
530 | 530 | ||
531 | #ifdef CONFIG_RTC_INTF_DEV | ||
532 | /** | 531 | /** |
533 | * ds1685_rtc_alarm_irq_enable - replaces ioctl() RTC_AIE on/off. | 532 | * ds1685_rtc_alarm_irq_enable - replaces ioctl() RTC_AIE on/off. |
534 | * @dev: pointer to device structure. | 533 | * @dev: pointer to device structure. |
@@ -557,7 +556,6 @@ ds1685_rtc_alarm_irq_enable(struct device *dev, unsigned int enabled) | |||
557 | 556 | ||
558 | return 0; | 557 | return 0; |
559 | } | 558 | } |
560 | #endif | ||
561 | /* ----------------------------------------------------------------------- */ | 559 | /* ----------------------------------------------------------------------- */ |
562 | 560 | ||
563 | 561 | ||
@@ -1612,7 +1610,7 @@ ds1685_rtc_sysfs_time_regs_show(struct device *dev, | |||
1612 | ds1685_rtc_sysfs_time_regs_lookup(attr->attr.name, false); | 1610 | ds1685_rtc_sysfs_time_regs_lookup(attr->attr.name, false); |
1613 | 1611 | ||
1614 | /* Make sure we actually matched something. */ | 1612 | /* Make sure we actually matched something. */ |
1615 | if (!bcd_reg_info && !bin_reg_info) | 1613 | if (!bcd_reg_info || !bin_reg_info) |
1616 | return -EINVAL; | 1614 | return -EINVAL; |
1617 | 1615 | ||
1618 | /* bcd_reg_info->reg == bin_reg_info->reg. */ | 1616 | /* bcd_reg_info->reg == bin_reg_info->reg. */ |
@@ -1650,7 +1648,7 @@ ds1685_rtc_sysfs_time_regs_store(struct device *dev, | |||
1650 | return -EINVAL; | 1648 | return -EINVAL; |
1651 | 1649 | ||
1652 | /* Make sure we actually matched something. */ | 1650 | /* Make sure we actually matched something. */ |
1653 | if (!bcd_reg_info && !bin_reg_info) | 1651 | if (!bcd_reg_info || !bin_reg_info) |
1654 | return -EINVAL; | 1652 | return -EINVAL; |
1655 | 1653 | ||
1656 | /* Check for a valid range. */ | 1654 | /* Check for a valid range. */ |