The patch titled rtc: make rtc_update_irq callable with irqs enabled has been added to the -mm tree. Its filename is rtc-make-rtc_update_irq-callable-with-irqs-enabled-v2.patch Before you just go and hit "reply", please: a) Consider who else should be cc'ed b) Prefer to cc a suitable mailing list as well c) Ideally: find the original patch on the mailing list and do a reply-to-all to that, adding suitable additional cc's *** Remember to use Documentation/SubmitChecklist when testing your code *** See http://userweb.kernel.org/~akpm/stuff/added-to-mm.txt to find out what to do about this The current -mm tree may be found at http://userweb.kernel.org/~akpm/mmotm/ ------------------------------------------------------ Subject: rtc: make rtc_update_irq callable with irqs enabled From: Atsushi Nemoto <anemo@xxxxxxxxxxxxx> The rtc_update_irq() might be called with irqs enabled, if a interrupt handler was registered without IRQF_DISABLED. Use spin_lock_irqsave/spin_unlock_irqrestore instead of spin_lock/spin_unlock. Also update kerneldoc and drivers which do extra work to follow the current interface spec, as suggestted by David Brownell. Signed-off-by: Atsushi Nemoto <anemo@xxxxxxxxxxxxx> Cc: Alessandro Zummo <a.zummo@xxxxxxxxxxxx> Cc: David Brownell <david-b@xxxxxxxxxxx> Signed-off-by: Andrew Morton <akpm@xxxxxxxxxxxxxxxxxxxx> --- drivers/rtc/interface.c | 12 +++++++----- drivers/rtc/rtc-dev.c | 6 ++---- drivers/rtc/rtc-ds1305.c | 3 --- drivers/rtc/rtc-ds1307.c | 5 ----- drivers/rtc/rtc-ds1374.c | 5 ----- drivers/rtc/rtc-test.c | 2 -- 6 files changed, 9 insertions(+), 24 deletions(-) diff -puN drivers/rtc/interface.c~rtc-make-rtc_update_irq-callable-with-irqs-enabled-v2 drivers/rtc/interface.c --- a/drivers/rtc/interface.c~rtc-make-rtc_update_irq-callable-with-irqs-enabled-v2 +++ a/drivers/rtc/interface.c @@ -371,19 +371,21 @@ EXPORT_SYMBOL_GPL(rtc_update_irq_enable) * @rtc: the rtc device * @num: how many irqs are being reported (usually one) * @events: mask of RTC_IRQF with one or more of RTC_PF, RTC_AF, RTC_UF - * Context: in_interrupt(), irqs blocked + * Context: any */ void rtc_update_irq(struct rtc_device *rtc, unsigned long num, unsigned long events) { - spin_lock(&rtc->irq_lock); + unsigned long flags; + + spin_lock_irqsave(&rtc->irq_lock, flags); rtc->irq_data = (rtc->irq_data + (num << 8)) | events; - spin_unlock(&rtc->irq_lock); + spin_unlock_irqrestore(&rtc->irq_lock, flags); - spin_lock(&rtc->irq_task_lock); + spin_lock_irqsave(&rtc->irq_task_lock, flags); if (rtc->irq_task) rtc->irq_task->func(rtc->irq_task->private_data); - spin_unlock(&rtc->irq_task_lock); + spin_unlock_irqrestore(&rtc->irq_task_lock, flags); wake_up_interruptible(&rtc->irq_queue); kill_fasync(&rtc->async_queue, SIGIO, POLL_IN); diff -puN drivers/rtc/rtc-dev.c~rtc-make-rtc_update_irq-callable-with-irqs-enabled-v2 drivers/rtc/rtc-dev.c --- a/drivers/rtc/rtc-dev.c~rtc-make-rtc_update_irq-callable-with-irqs-enabled-v2 +++ a/drivers/rtc/rtc-dev.c @@ -60,8 +60,7 @@ static void rtc_uie_task(struct work_str err = rtc_read_time(rtc, &tm); - local_irq_disable(); - spin_lock(&rtc->irq_lock); + spin_lock_irq(&rtc->irq_lock); if (rtc->stop_uie_polling || err) { rtc->uie_task_active = 0; } else if (rtc->oldsecs != tm.tm_sec) { @@ -74,10 +73,9 @@ static void rtc_uie_task(struct work_str } else if (schedule_work(&rtc->uie_task) == 0) { rtc->uie_task_active = 0; } - spin_unlock(&rtc->irq_lock); + spin_unlock_irq(&rtc->irq_lock); if (num) rtc_update_irq(rtc, num, RTC_UF | RTC_IRQF); - local_irq_enable(); } static void rtc_uie_timer(unsigned long data) { diff -puN drivers/rtc/rtc-ds1305.c~rtc-make-rtc_update_irq-callable-with-irqs-enabled-v2 drivers/rtc/rtc-ds1305.c --- a/drivers/rtc/rtc-ds1305.c~rtc-make-rtc_update_irq-callable-with-irqs-enabled-v2 +++ a/drivers/rtc/rtc-ds1305.c @@ -499,10 +499,7 @@ static void ds1305_work(struct work_stru if (!test_bit(FLAG_EXITING, &ds1305->flags)) enable_irq(spi->irq); - /* rtc_update_irq() requires an IRQ-disabled context */ - local_irq_disable(); rtc_update_irq(ds1305->rtc, 1, RTC_AF | RTC_IRQF); - local_irq_enable(); } /* diff -puN drivers/rtc/rtc-ds1307.c~rtc-make-rtc_update_irq-callable-with-irqs-enabled-v2 drivers/rtc/rtc-ds1307.c --- a/drivers/rtc/rtc-ds1307.c~rtc-make-rtc_update_irq-callable-with-irqs-enabled-v2 +++ a/drivers/rtc/rtc-ds1307.c @@ -267,12 +267,7 @@ static void ds1307_work(struct work_stru control &= ~DS1337_BIT_A1IE; i2c_smbus_write_byte_data(client, DS1337_REG_CONTROL, control); - /* rtc_update_irq() assumes that it is called - * from IRQ-disabled context. - */ - local_irq_disable(); rtc_update_irq(ds1307->rtc, 1, RTC_AF | RTC_IRQF); - local_irq_enable(); } out: diff -puN drivers/rtc/rtc-ds1374.c~rtc-make-rtc_update_irq-callable-with-irqs-enabled-v2 drivers/rtc/rtc-ds1374.c --- a/drivers/rtc/rtc-ds1374.c~rtc-make-rtc_update_irq-callable-with-irqs-enabled-v2 +++ a/drivers/rtc/rtc-ds1374.c @@ -296,12 +296,7 @@ static void ds1374_work(struct work_stru control &= ~(DS1374_REG_CR_WACE | DS1374_REG_CR_AIE); i2c_smbus_write_byte_data(client, DS1374_REG_CR, control); - /* rtc_update_irq() assumes that it is called - * from IRQ-disabled context. - */ - local_irq_disable(); rtc_update_irq(ds1374->rtc, 1, RTC_AF | RTC_IRQF); - local_irq_enable(); } out: diff -puN drivers/rtc/rtc-test.c~rtc-make-rtc_update_irq-callable-with-irqs-enabled-v2 drivers/rtc/rtc-test.c --- a/drivers/rtc/rtc-test.c~rtc-make-rtc_update_irq-callable-with-irqs-enabled-v2 +++ a/drivers/rtc/rtc-test.c @@ -93,7 +93,6 @@ static ssize_t test_irq_store(struct dev struct rtc_device *rtc = platform_get_drvdata(plat_dev); retval = count; - local_irq_disable(); if (strncmp(buf, "tick", 4) == 0) rtc_update_irq(rtc, 1, RTC_PF | RTC_IRQF); else if (strncmp(buf, "alarm", 5) == 0) @@ -102,7 +101,6 @@ static ssize_t test_irq_store(struct dev rtc_update_irq(rtc, 1, RTC_UF | RTC_IRQF); else retval = -EINVAL; - local_irq_enable(); return retval; } _ Patches currently in -mm which might be from anemo@xxxxxxxxxxxxx are linux-next.patch kgdb-kgdboc-console-poll-hooks-for-serial_txx9-uart.patch serial_txx9-use-container_of-instead-of-direct-cast.patch rtc-rtc-ds1742-nvram-attribute-fix.patch rtc-make-rtc_update_irq-callable-with-irqs-enabled-v2.patch -- To unsubscribe from this list: send the line "unsubscribe mm-commits" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html