linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Baolin Wang <baolin.wang@linaro.org>
To: Alexandre Belloni <alexandre.belloni@bootlin.com>
Cc: Alessandro Zummo <a.zummo@towertech.it>,
	Mark Brown <broonie@kernel.org>,
	linux-rtc@vger.kernel.org, LKML <linux-kernel@vger.kernel.org>
Subject: Re: [PATCH 5/5] rtc: sc27xx: Always read normal alarm when registering RTC device
Date: Thu, 25 Oct 2018 09:57:15 +0800	[thread overview]
Message-ID: <CAMz4ku+ObP5vUijEbzMFF3hBe+RaQoOv7O2JxhGbq6Qs-t+iCQ@mail.gmail.com> (raw)
In-Reply-To: <20181025003456.GB2737@piout.net>

Hi Alexandre,

On 25 October 2018 at 08:34, Alexandre Belloni
<alexandre.belloni@bootlin.com> wrote:
> Hello,
>
> On 18/10/2018 16:52:30+0800, Baolin Wang wrote:
>> When registering one RTC device, it will check to see if there is an
>> alarm already set in RTC hardware by reading RTC alarm, at this time
>> we should always read the normal alarm put in always-on region by
>> checking the rtc->registered flag.
>>
>> Signed-off-by: Baolin Wang <baolin.wang@linaro.org>
>> ---
>>  drivers/rtc/rtc-sc27xx.c |    8 ++++++--
>>  1 file changed, 6 insertions(+), 2 deletions(-)
>>
>> diff --git a/drivers/rtc/rtc-sc27xx.c b/drivers/rtc/rtc-sc27xx.c
>> index 72bb002..b4eb3b3 100644
>> --- a/drivers/rtc/rtc-sc27xx.c
>> +++ b/drivers/rtc/rtc-sc27xx.c
>> @@ -415,10 +415,14 @@ static int sprd_rtc_read_alarm(struct device *dev, struct rtc_wkalrm *alrm)
>>       u32 val;
>>
>>       /*
>> -      * If aie_timer is enabled, we should get the normal alarm time.
>> +      * 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.
>>        * Otherwise we should get auxiliary alarm time.
>>        */
>> -     if (rtc->rtc && rtc->rtc->aie_timer.enabled == 0)
>> +     if (rtc->rtc && rtc->rtc->registered && rtc->rtc->aie_timer.enabled == 0)
>
> Note that the driver should not access rtc->registered and
> rtc->aie_timer.enabled and this is a bit fragile.
> But, on the other hand, I currently don't have anything better to
> suggest. I was also planning to add an in-kernel API for multiple alarms
> but I'm not sure it will actually help in your case.

Yes, I understand your concern. I will glad to help to test if you
introduce new APIs for multiple alarms to see if they can help in our
case. Thanks.

-- 
Baolin Wang
Best Regards

  reply	other threads:[~2018-10-25  1:57 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-10-18  8:52 [PATCH 0/5] Fix some issues for RTC alarm function Baolin Wang
2018-10-18  8:52 ` [PATCH 1/5] rtc: sc27xx: Set wakeup capability before registering rtc device Baolin Wang
2018-10-18  8:52 ` [PATCH 2/5] rtc: sc27xx: Clear SPG value update interrupt status Baolin Wang
2018-10-18  8:52 ` [PATCH 3/5] rtc: sc27xx: Remove interrupts disable and clear in probe() Baolin Wang
2018-10-18  8:52 ` [PATCH 4/5] rtc: sc27xx: Add check to see if need to enable the alarm interrupt Baolin Wang
2018-10-18  8:52 ` [PATCH 5/5] rtc: sc27xx: Always read normal alarm when registering RTC device Baolin Wang
2018-10-25  0:34   ` Alexandre Belloni
2018-10-25  1:57     ` Baolin Wang [this message]
2018-10-25  0:25 ` [PATCH 0/5] Fix some issues for RTC alarm function Alexandre Belloni

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=CAMz4ku+ObP5vUijEbzMFF3hBe+RaQoOv7O2JxhGbq6Qs-t+iCQ@mail.gmail.com \
    --to=baolin.wang@linaro.org \
    --cc=a.zummo@towertech.it \
    --cc=alexandre.belloni@bootlin.com \
    --cc=broonie@kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-rtc@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).