+ rtc-file-close-consistently-disables-repeating-irqs.patch added to -mm tree

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



The patch titled
     rtc: file close() consistently disables repeating irqs
has been added to the -mm tree.  Its filename is
     rtc-file-close-consistently-disables-repeating-irqs.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://www.zip.com.au/~akpm/linux/patches/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: file close() consistently disables repeating irqs
From: David Brownell <dbrownell@xxxxxxxxxxxxxxxxxxxxx>

Make the rtc framework consistent about disabling 1/second update IRQs
that may have been activated through the /dev interface, when that /dev
file is closed.  (It may have closed because of coredump, etc.) This was
previously done only for emulated update IRQs ...  now, do it always.

Also comment the current policy: repeating IRQs (periodic, update) that
userspace enabled will be cleanly disabled, but alarms are left alone. 
Such repeating IRQs are a constant and pointless system load.

Update some RTC drivers to remove now-needless release() methods.  Most
such methods just enforce that policy.  The others all seem to be buggy,
and mistreat in-kernel clients of periodic or alarm IRQs.

Signed-off-by: David Brownell <dbrownell@xxxxxxxxxxxxxxxxxxxxx>
Acked-by: Andrew Sharp <andy.sharp@xxxxxxxxxx>
Cc: Angelo Castello <angelo.castello@xxxxxx>
Acked-by: Atsushi Nemoto <anemo@xxxxxxxxxxxxx>
Acked-by: Paul Mundt <lethal@xxxxxxxxxxxx>
Cc: Thomas Hommel <thomas.hommel@xxxxxxxxxxx>
Acked-by: Alessandro Zummo <a.zummo@xxxxxxxxxxxx>
Signed-off-by: Andrew Morton <akpm@xxxxxxxxxxxxxxxxxxxx>
---

 drivers/rtc/rtc-dev.c      |   12 +++++++++---
 drivers/rtc/rtc-ds1511.c   |   13 -------------
 drivers/rtc/rtc-ds1553.c   |   12 ------------
 drivers/rtc/rtc-sh.c       |    7 -------
 drivers/rtc/rtc-stk17ta8.c |   12 ------------
 5 files changed, 9 insertions(+), 47 deletions(-)

diff -puN drivers/rtc/rtc-dev.c~rtc-file-close-consistently-disables-repeating-irqs drivers/rtc/rtc-dev.c
--- a/drivers/rtc/rtc-dev.c~rtc-file-close-consistently-disables-repeating-irqs
+++ a/drivers/rtc/rtc-dev.c
@@ -423,9 +423,15 @@ static int rtc_dev_release(struct inode 
 {
 	struct rtc_device *rtc = file->private_data;
 
-#ifdef CONFIG_RTC_INTF_DEV_UIE_EMUL
-	clear_uie(rtc);
-#endif
+	/* We shut down the repeating IRQs that userspace enabled,
+	 * since nothing is listening to them.
+	 *  - Update (UIE) ... currently only managed through ioctls
+	 *  - Periodic (PIE) ... also used through rtc_*() interface calls
+	 *
+	 * Leave the alarm alone; it may be set to trigger a system wakeup
+	 * later, or be used by kernel code, and is a one-shot event anyway.
+	 */
+	rtc_dev_ioctl(file, RTC_UIE_OFF, 0);
 	rtc_irq_set_state(rtc, NULL, 0);
 
 	if (rtc->ops->release)
diff -puN drivers/rtc/rtc-ds1511.c~rtc-file-close-consistently-disables-repeating-irqs drivers/rtc/rtc-ds1511.c
--- a/drivers/rtc/rtc-ds1511.c~rtc-file-close-consistently-disables-repeating-irqs
+++ a/drivers/rtc/rtc-ds1511.c
@@ -379,18 +379,6 @@ ds1511_interrupt(int irq, void *dev_id)
 	return IRQ_HANDLED;
 }
 
- static void
-ds1511_rtc_release(struct device *dev)
-{
-	struct platform_device *pdev = to_platform_device(dev);
-	struct rtc_plat_data *pdata = platform_get_drvdata(pdev);
-
-	if (pdata->irq >= 0) {
-		pdata->irqen = 0;
-		ds1511_rtc_update_alarm(pdata);
-	}
-}
-
  static int
 ds1511_rtc_ioctl(struct device *dev, unsigned int cmd, unsigned long arg)
 {
@@ -428,7 +416,6 @@ static const struct rtc_class_ops ds1511
 	.set_time	= ds1511_rtc_set_time,
 	.read_alarm	= ds1511_rtc_read_alarm,
 	.set_alarm	= ds1511_rtc_set_alarm,
-	.release	= ds1511_rtc_release,
 	.ioctl		= ds1511_rtc_ioctl,
 };
 
diff -puN drivers/rtc/rtc-ds1553.c~rtc-file-close-consistently-disables-repeating-irqs drivers/rtc/rtc-ds1553.c
--- a/drivers/rtc/rtc-ds1553.c~rtc-file-close-consistently-disables-repeating-irqs
+++ a/drivers/rtc/rtc-ds1553.c
@@ -207,17 +207,6 @@ static irqreturn_t ds1553_rtc_interrupt(
 	return IRQ_HANDLED;
 }
 
-static void ds1553_rtc_release(struct device *dev)
-{
-	struct platform_device *pdev = to_platform_device(dev);
-	struct rtc_plat_data *pdata = platform_get_drvdata(pdev);
-
-	if (pdata->irq >= 0) {
-		pdata->irqen = 0;
-		ds1553_rtc_update_alarm(pdata);
-	}
-}
-
 static int ds1553_rtc_ioctl(struct device *dev, unsigned int cmd,
 			    unsigned long arg)
 {
@@ -254,7 +243,6 @@ static const struct rtc_class_ops ds1553
 	.set_time	= ds1553_rtc_set_time,
 	.read_alarm	= ds1553_rtc_read_alarm,
 	.set_alarm	= ds1553_rtc_set_alarm,
-	.release	= ds1553_rtc_release,
 	.ioctl		= ds1553_rtc_ioctl,
 };
 
diff -puN drivers/rtc/rtc-sh.c~rtc-file-close-consistently-disables-repeating-irqs drivers/rtc/rtc-sh.c
--- a/drivers/rtc/rtc-sh.c~rtc-file-close-consistently-disables-repeating-irqs
+++ a/drivers/rtc/rtc-sh.c
@@ -257,12 +257,6 @@ static inline void sh_rtc_setaie(struct 
 	spin_unlock_irq(&rtc->lock);
 }
 
-static void sh_rtc_release(struct device *dev)
-{
-	sh_rtc_setpie(dev, 0);
-	sh_rtc_setaie(dev, 0);
-}
-
 static int sh_rtc_proc(struct device *dev, struct seq_file *seq)
 {
 	struct sh_rtc *rtc = dev_get_drvdata(dev);
@@ -559,7 +553,6 @@ static int sh_rtc_irq_set_freq(struct de
 }
 
 static struct rtc_class_ops sh_rtc_ops = {
-	.release	= sh_rtc_release,
 	.ioctl		= sh_rtc_ioctl,
 	.read_time	= sh_rtc_read_time,
 	.set_time	= sh_rtc_set_time,
diff -puN drivers/rtc/rtc-stk17ta8.c~rtc-file-close-consistently-disables-repeating-irqs drivers/rtc/rtc-stk17ta8.c
--- a/drivers/rtc/rtc-stk17ta8.c~rtc-file-close-consistently-disables-repeating-irqs
+++ a/drivers/rtc/rtc-stk17ta8.c
@@ -215,17 +215,6 @@ static irqreturn_t stk17ta8_rtc_interrup
 	return IRQ_HANDLED;
 }
 
-static void stk17ta8_rtc_release(struct device *dev)
-{
-	struct platform_device *pdev = to_platform_device(dev);
-	struct rtc_plat_data *pdata = platform_get_drvdata(pdev);
-
-	if (pdata->irq >= 0) {
-		pdata->irqen = 0;
-		stk17ta8_rtc_update_alarm(pdata);
-	}
-}
-
 static int stk17ta8_rtc_ioctl(struct device *dev, unsigned int cmd,
 			    unsigned long arg)
 {
@@ -254,7 +243,6 @@ static const struct rtc_class_ops stk17t
 	.set_time	= stk17ta8_rtc_set_time,
 	.read_alarm	= stk17ta8_rtc_read_alarm,
 	.set_alarm	= stk17ta8_rtc_set_alarm,
-	.release	= stk17ta8_rtc_release,
 	.ioctl		= stk17ta8_rtc_ioctl,
 };
 
_

Patches currently in -mm which might be from dbrownell@xxxxxxxxxxxxxxxxxxxxx are

revert-rtc-cdev-lock_kernel-pushdown.patch
linux-next.patch
usb-hso-driver-fix-kconfig.patch
rtc-ds1307-alarm-support-for-ds1337-ds1339.patch
rtc-remove-some-nop-open-release-methods.patch
legacy-rtc-remove-needless-confusing-hpet_rtc_irq-option.patch
rtc-file-close-consistently-disables-repeating-irqs.patch
irq-warn-about-irqf_disabledirqf_shared.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

[Index of Archives]     [Kernel Newbies FAQ]     [Kernel Archive]     [IETF Annouce]     [DCCP]     [Netdev]     [Networking]     [Security]     [Bugtraq]     [Photo]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux SCSI]

  Powered by Linux