linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] rtc: mv: let the core handle invalid alarms
@ 2018-10-01 22:05 Alexandre Belloni
  2018-10-02  9:14 ` Gregory CLEMENT
  0 siblings, 1 reply; 2+ messages in thread
From: Alexandre Belloni @ 2018-10-01 22:05 UTC (permalink / raw)
  To: linux-rtc; +Cc: linux-kernel, Gregory Clement, Alexandre Belloni

Instead of lying to the core when the alarm is invalid, let it handle that
by returning the error.

Signed-off-by: Alexandre Belloni <alexandre.belloni@bootlin.com>
---
 drivers/rtc/rtc-mv.c | 8 ++------
 1 file changed, 2 insertions(+), 6 deletions(-)

diff --git a/drivers/rtc/rtc-mv.c b/drivers/rtc/rtc-mv.c
index 4b198b3778d3..e7f14bd12fe3 100644
--- a/drivers/rtc/rtc-mv.c
+++ b/drivers/rtc/rtc-mv.c
@@ -125,13 +125,9 @@ static int mv_rtc_read_alarm(struct device *dev, struct rtc_wkalrm *alm)
 	/* hw counts from year 2000, but tm_year is relative to 1900 */
 	alm->time.tm_year = bcd2bin(year) + 100;
 
-	if (rtc_valid_tm(&alm->time) < 0) {
-		dev_err(dev, "retrieved alarm date/time is not valid.\n");
-		rtc_time_to_tm(0, &alm->time);
-	}
-
 	alm->enabled = !!readl(ioaddr + RTC_ALARM_INTERRUPT_MASK_REG_OFFS);
-	return 0;
+
+	return rtc_valid_tm(&alm->time);
 }
 
 static int mv_rtc_set_alarm(struct device *dev, struct rtc_wkalrm *alm)
-- 
2.19.0


^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [PATCH] rtc: mv: let the core handle invalid alarms
  2018-10-01 22:05 [PATCH] rtc: mv: let the core handle invalid alarms Alexandre Belloni
@ 2018-10-02  9:14 ` Gregory CLEMENT
  0 siblings, 0 replies; 2+ messages in thread
From: Gregory CLEMENT @ 2018-10-02  9:14 UTC (permalink / raw)
  To: Alexandre Belloni; +Cc: linux-rtc, linux-kernel

Hi Alexandre,
 
 On mar., oct. 02 2018, Alexandre Belloni <alexandre.belloni@bootlin.com> wrote:

> Instead of lying to the core when the alarm is invalid, let it handle that
> by returning the error.
>
> Signed-off-by: Alexandre Belloni <alexandre.belloni@bootlin.com>

Tested-by: Gregory CLEMENT <gregory.clement@bootlin.com>  (on Armada 375 DB)

Gregory

> ---
>  drivers/rtc/rtc-mv.c | 8 ++------
>  1 file changed, 2 insertions(+), 6 deletions(-)
>
> diff --git a/drivers/rtc/rtc-mv.c b/drivers/rtc/rtc-mv.c
> index 4b198b3778d3..e7f14bd12fe3 100644
> --- a/drivers/rtc/rtc-mv.c
> +++ b/drivers/rtc/rtc-mv.c
> @@ -125,13 +125,9 @@ static int mv_rtc_read_alarm(struct device *dev, struct rtc_wkalrm *alm)
>  	/* hw counts from year 2000, but tm_year is relative to 1900 */
>  	alm->time.tm_year = bcd2bin(year) + 100;
>  
> -	if (rtc_valid_tm(&alm->time) < 0) {
> -		dev_err(dev, "retrieved alarm date/time is not valid.\n");
> -		rtc_time_to_tm(0, &alm->time);
> -	}
> -
>  	alm->enabled = !!readl(ioaddr + RTC_ALARM_INTERRUPT_MASK_REG_OFFS);
> -	return 0;
> +
> +	return rtc_valid_tm(&alm->time);
>  }
>  
>  static int mv_rtc_set_alarm(struct device *dev, struct rtc_wkalrm *alm)
> -- 
> 2.19.0
>

-- 
Gregory Clement, Bootlin
Embedded Linux and Kernel engineering
http://bootlin.com

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2018-10-02  9:14 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-10-01 22:05 [PATCH] rtc: mv: let the core handle invalid alarms Alexandre Belloni
2018-10-02  9:14 ` Gregory CLEMENT

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).