Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > linux.kernel > #1477231
| From | Gabriele Mazzotta <gabriele.mzt@gmail.com> |
|---|---|
| Newsgroups | linux.kernel |
| Subject | Re: [PATCH v2 1/2] rtc-cmos: Ensure no expired alarm is left enabled after resume |
| Date | 2016-09-06 11:50 +0200 |
| Message-ID | <selaV-cW-5@gated-at.bofh.it> (permalink) |
| References | <scmE9-8pI-5@gated-at.bofh.it> <seayT-1Af-85@gated-at.bofh.it> |
| Organization | linux.* mail to news gateway |
2016-09-06 0:26 GMT+02:00 Alexandre Belloni
<alexandre.belloni@free-electrons.com>:
> Hi
>
> On 01/09/2016 at 00:58:59 +0200, Gabriele Mazzotta wrote :
>> static int cmos_resume(struct device *dev)
>> {
>> struct cmos_rtc *cmos = dev_get_drvdata(dev);
>> unsigned char tmp;
>> + bool is_wkalrm_expired;
>>
>> if (cmos->enabled_wake) {
>> if (cmos->wake_off)
>> @@ -913,6 +935,8 @@ static int cmos_resume(struct device *dev)
>> cmos->enabled_wake = 0;
>> }
>>
>> + is_wkalrm_expired = cmos_is_wkalrm_expired(dev);
>> +
>> spin_lock_irq(&rtc_lock);
>> tmp = cmos->suspend_ctrl;
>> cmos->suspend_ctrl = 0;
>> @@ -939,6 +963,17 @@ static int cmos_resume(struct device *dev)
>> tmp &= ~RTC_AIE;
>> hpet_mask_rtc_irq_bit(RTC_AIE);
>> } while (mask & RTC_AIE);
>> +
>> + /*
>> + * If RTC_AIE is set and we have an alarm set to go off in the
>> + * past, then the BIOS woke the system when the alarm went off
>> + * and we now have to clear it.
>> + */
>> + if ((tmp & RTC_AIE) && is_wkalrm_expired) {
>
> Is there any issue dropping is_wkalrm_expired and calling
> cmos_is_wkalrm_expired() here? That would avoid calling
> cmos_is_wkalrm_expired on each wakeup.
Yes, get_rtc_time() (cmos_read_time()) tries to aquire rtc_lock.
> --
> Alexandre Belloni, Free Electrons
> Embedded Linux and Kernel engineering
> http://free-electrons.com
Back to linux.kernel | Previous | Next — Previous in thread | Find similar | Unroll thread
[PATCH v2 1/2] rtc-cmos: Ensure no expired alarm is left enabled after resume Gabriele Mazzotta <gabriele.mzt@gmail.com> - 2016-09-01 01:00 +0200
Re: [PATCH v2 1/2] rtc-cmos: Ensure no expired alarm is left enabled after resume Gabriele Mazzotta <gabriele.mzt@gmail.com> - 2016-09-02 21:50 +0200
Re: [PATCH v2 1/2] rtc-cmos: Ensure no expired alarm is left enabled after resume Alexandre Belloni <alexandre.belloni@free-electrons.com> - 2016-09-06 00:30 +0200
Re: [PATCH v2 1/2] rtc-cmos: Ensure no expired alarm is left enabled after resume Gabriele Mazzotta <gabriele.mzt@gmail.com> - 2016-09-06 11:50 +0200
csiph-web