Re: [PATCH 2/8] Revert "rtc: sc27xx: Always read normal alarm when registering RTC device"

From: Alexandre Belloni
Date: Tue Nov 17 2020 - 16:23:33 EST


On 09/11/2020 17:34:03+0100, Bartosz Golaszewski wrote:
> From: Bartosz Golaszewski <bgolaszewski@xxxxxxxxxxxx>
>
> This reverts commit 3822d1bb0df18aa28930f19bc46e0704aea1be0f.
>
> The registered field in struct rtc_device is not supposed to be used by
> drivers and is going to be removed soon. In this function it will be
> always 0 so the check is useless anyway.

This is actually the opposite, rtc->rtc->registered being always 0 means
that the auxiliary alarm will never be read. I've sent the proper patch.

>
> Signed-off-by: Bartosz Golaszewski <bgolaszewski@xxxxxxxxxxxx>
> ---
> drivers/rtc/rtc-sc27xx.c | 8 ++------
> 1 file changed, 2 insertions(+), 6 deletions(-)
>
> diff --git a/drivers/rtc/rtc-sc27xx.c b/drivers/rtc/rtc-sc27xx.c
> index 36810dd40cd3..8e3d6be990c5 100644
> --- a/drivers/rtc/rtc-sc27xx.c
> +++ b/drivers/rtc/rtc-sc27xx.c
> @@ -415,14 +415,10 @@ static int sprd_rtc_read_alarm(struct device *dev, struct rtc_wkalrm *alrm)
> u32 val;
>
> /*
> - * Before RTC device is registered, it will check to see if there is an
> - * alarm already set in RTC hardware, and we always read the normal
> - * alarm at this time.
> - *
> - * Or if aie_timer is enabled, we should get the normal alarm time.
> + * If aie_timer is enabled, we should get the normal alarm time.
> * Otherwise we should get auxiliary alarm time.
> */
> - if (rtc->rtc && rtc->rtc->registered && rtc->rtc->aie_timer.enabled == 0)
> + if (rtc->rtc && rtc->rtc->aie_timer.enabled == 0)
> return sprd_rtc_read_aux_alarm(dev, alrm);
>
> ret = sprd_rtc_get_secs(rtc, SPRD_RTC_ALARM, &secs);
> --
> 2.29.1
>

--
Alexandre Belloni, Bootlin
Embedded Linux and Kernel engineering
https://bootlin.com