|
@@ -399,21 +399,21 @@ ds1685_rtc_read_alarm(struct device *dev, struct rtc_wkalrm *alrm)
|
|
* of this RTC chip. We check for it anyways in case support is
|
|
* of this RTC chip. We check for it anyways in case support is
|
|
* added in the future.
|
|
* added in the future.
|
|
*/
|
|
*/
|
|
- if (unlikely((seconds >= 0xc0) && (seconds <= 0xff)))
|
|
|
|
|
|
+ if (unlikely(seconds >= 0xc0))
|
|
alrm->time.tm_sec = -1;
|
|
alrm->time.tm_sec = -1;
|
|
else
|
|
else
|
|
alrm->time.tm_sec = ds1685_rtc_bcd2bin(rtc, seconds,
|
|
alrm->time.tm_sec = ds1685_rtc_bcd2bin(rtc, seconds,
|
|
RTC_SECS_BCD_MASK,
|
|
RTC_SECS_BCD_MASK,
|
|
RTC_SECS_BIN_MASK);
|
|
RTC_SECS_BIN_MASK);
|
|
|
|
|
|
- if (unlikely((minutes >= 0xc0) && (minutes <= 0xff)))
|
|
|
|
|
|
+ if (unlikely(minutes >= 0xc0))
|
|
alrm->time.tm_min = -1;
|
|
alrm->time.tm_min = -1;
|
|
else
|
|
else
|
|
alrm->time.tm_min = ds1685_rtc_bcd2bin(rtc, minutes,
|
|
alrm->time.tm_min = ds1685_rtc_bcd2bin(rtc, minutes,
|
|
RTC_MINS_BCD_MASK,
|
|
RTC_MINS_BCD_MASK,
|
|
RTC_MINS_BIN_MASK);
|
|
RTC_MINS_BIN_MASK);
|
|
|
|
|
|
- if (unlikely((hours >= 0xc0) && (hours <= 0xff)))
|
|
|
|
|
|
+ if (unlikely(hours >= 0xc0))
|
|
alrm->time.tm_hour = -1;
|
|
alrm->time.tm_hour = -1;
|
|
else
|
|
else
|
|
alrm->time.tm_hour = ds1685_rtc_bcd2bin(rtc, hours,
|
|
alrm->time.tm_hour = ds1685_rtc_bcd2bin(rtc, hours,
|
|
@@ -472,13 +472,13 @@ ds1685_rtc_set_alarm(struct device *dev, struct rtc_wkalrm *alrm)
|
|
* field, and we only support four fields. We put the support
|
|
* field, and we only support four fields. We put the support
|
|
* here anyways for the future.
|
|
* here anyways for the future.
|
|
*/
|
|
*/
|
|
- if (unlikely((seconds >= 0xc0) && (seconds <= 0xff)))
|
|
|
|
|
|
+ if (unlikely(seconds >= 0xc0))
|
|
seconds = 0xff;
|
|
seconds = 0xff;
|
|
|
|
|
|
- if (unlikely((minutes >= 0xc0) && (minutes <= 0xff)))
|
|
|
|
|
|
+ if (unlikely(minutes >= 0xc0))
|
|
minutes = 0xff;
|
|
minutes = 0xff;
|
|
|
|
|
|
- if (unlikely((hours >= 0xc0) && (hours <= 0xff)))
|
|
|
|
|
|
+ if (unlikely(hours >= 0xc0))
|
|
hours = 0xff;
|
|
hours = 0xff;
|
|
|
|
|
|
alrm->time.tm_mon = -1;
|
|
alrm->time.tm_mon = -1;
|
|
@@ -528,7 +528,6 @@ ds1685_rtc_set_alarm(struct device *dev, struct rtc_wkalrm *alrm)
|
|
/* ----------------------------------------------------------------------- */
|
|
/* ----------------------------------------------------------------------- */
|
|
/* /dev/rtcX Interface functions */
|
|
/* /dev/rtcX Interface functions */
|
|
|
|
|
|
-#ifdef CONFIG_RTC_INTF_DEV
|
|
|
|
/**
|
|
/**
|
|
* ds1685_rtc_alarm_irq_enable - replaces ioctl() RTC_AIE on/off.
|
|
* ds1685_rtc_alarm_irq_enable - replaces ioctl() RTC_AIE on/off.
|
|
* @dev: pointer to device structure.
|
|
* @dev: pointer to device structure.
|
|
@@ -557,7 +556,6 @@ ds1685_rtc_alarm_irq_enable(struct device *dev, unsigned int enabled)
|
|
|
|
|
|
return 0;
|
|
return 0;
|
|
}
|
|
}
|
|
-#endif
|
|
|
|
/* ----------------------------------------------------------------------- */
|
|
/* ----------------------------------------------------------------------- */
|
|
|
|
|
|
|
|
|
|
@@ -1612,7 +1610,7 @@ ds1685_rtc_sysfs_time_regs_show(struct device *dev,
|
|
ds1685_rtc_sysfs_time_regs_lookup(attr->attr.name, false);
|
|
ds1685_rtc_sysfs_time_regs_lookup(attr->attr.name, false);
|
|
|
|
|
|
/* Make sure we actually matched something. */
|
|
/* Make sure we actually matched something. */
|
|
- if (!bcd_reg_info && !bin_reg_info)
|
|
|
|
|
|
+ if (!bcd_reg_info || !bin_reg_info)
|
|
return -EINVAL;
|
|
return -EINVAL;
|
|
|
|
|
|
/* bcd_reg_info->reg == bin_reg_info->reg. */
|
|
/* bcd_reg_info->reg == bin_reg_info->reg. */
|
|
@@ -1650,7 +1648,7 @@ ds1685_rtc_sysfs_time_regs_store(struct device *dev,
|
|
return -EINVAL;
|
|
return -EINVAL;
|
|
|
|
|
|
/* Make sure we actually matched something. */
|
|
/* Make sure we actually matched something. */
|
|
- if (!bcd_reg_info && !bin_reg_info)
|
|
|
|
|
|
+ if (!bcd_reg_info || !bin_reg_info)
|
|
return -EINVAL;
|
|
return -EINVAL;
|
|
|
|
|
|
/* Check for a valid range. */
|
|
/* Check for a valid range. */
|