Comments
Patch
@@ -161,10 +161,18 @@ static int mpc5121_rtc_set_alarm(struct device *dev, struct rtc_wkalrm *alarm)
{
struct mpc5121_rtc_data *rtc = dev_get_drvdata(dev);
struct mpc5121_rtc_regs __iomem *regs = rtc->regs;
+ struct rtc_time now;
/*
- * the alarm has no seconds so deal with it
+ * the alarm has no seconds so deal with it:
+ * - return -EINVAL if the interval is < 1 minute
+ * - round up to one minute if it's > 1 minute
*/
+ mpc5121_rtc_read_time(dev, &now);
+ if (alarm->time.tm_min == now.tm_min &&
+ alarm->time.tm_hour == now.tm_hour)
+ return -EINVAL;
+
if (alarm->time.tm_sec) {
alarm->time.tm_sec = 0;
alarm->time.tm_min++;