diff options
author | David Brownell <dbrownell@users.sourceforge.net> | 2008-10-16 01:03:04 -0400 |
---|---|---|
committer | Linus Torvalds <torvalds@linux-foundation.org> | 2008-10-16 14:21:40 -0400 |
commit | 743e6a504f81d1e2f086e726b69fb6631d11f820 (patch) | |
tree | 6fe23cd6708db3e95fcad00ef7af12253e97d063 /drivers/rtc | |
parent | 37fc5e2c42833c32f7c8eb5d9b3a3115bb37d9c3 (diff) |
rtc: file close() consistently disables repeating irqs
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@users.sourceforge.net>
Acked-by: Andrew Sharp <andy.sharp@onstor.com>
Cc: Angelo Castello <angelo.castello@st.com>
Acked-by: Atsushi Nemoto <anemo@mba.ocn.ne.jp>
Acked-by: Paul Mundt <lethal@linux-sh.org>
Cc: Thomas Hommel <thomas.hommel@gefanuc.com>
Acked-by: Alessandro Zummo <a.zummo@towertech.it>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Diffstat (limited to 'drivers/rtc')
-rw-r--r-- | drivers/rtc/rtc-dev.c | 12 | ||||
-rw-r--r-- | drivers/rtc/rtc-ds1511.c | 13 | ||||
-rw-r--r-- | drivers/rtc/rtc-ds1553.c | 12 | ||||
-rw-r--r-- | drivers/rtc/rtc-sh.c | 7 | ||||
-rw-r--r-- | drivers/rtc/rtc-stk17ta8.c | 12 |
5 files changed, 9 insertions, 47 deletions
diff --git a/drivers/rtc/rtc-dev.c b/drivers/rtc/rtc-dev.c index 52e2743b04ec..079e9ed907e0 100644 --- a/drivers/rtc/rtc-dev.c +++ b/drivers/rtc/rtc-dev.c | |||
@@ -432,9 +432,15 @@ static int rtc_dev_release(struct inode *inode, struct file *file) | |||
432 | { | 432 | { |
433 | struct rtc_device *rtc = file->private_data; | 433 | struct rtc_device *rtc = file->private_data; |
434 | 434 | ||
435 | #ifdef CONFIG_RTC_INTF_DEV_UIE_EMUL | 435 | /* We shut down the repeating IRQs that userspace enabled, |
436 | clear_uie(rtc); | 436 | * since nothing is listening to them. |
437 | #endif | 437 | * - Update (UIE) ... currently only managed through ioctls |
438 | * - Periodic (PIE) ... also used through rtc_*() interface calls | ||
439 | * | ||
440 | * Leave the alarm alone; it may be set to trigger a system wakeup | ||
441 | * later, or be used by kernel code, and is a one-shot event anyway. | ||
442 | */ | ||
443 | rtc_dev_ioctl(file, RTC_UIE_OFF, 0); | ||
438 | rtc_irq_set_state(rtc, NULL, 0); | 444 | rtc_irq_set_state(rtc, NULL, 0); |
439 | 445 | ||
440 | if (rtc->ops->release) | 446 | if (rtc->ops->release) |
diff --git a/drivers/rtc/rtc-ds1511.c b/drivers/rtc/rtc-ds1511.c index 0f0d27d1c4ca..86981d34fbb6 100644 --- a/drivers/rtc/rtc-ds1511.c +++ b/drivers/rtc/rtc-ds1511.c | |||
@@ -379,18 +379,6 @@ ds1511_interrupt(int irq, void *dev_id) | |||
379 | return IRQ_HANDLED; | 379 | return IRQ_HANDLED; |
380 | } | 380 | } |
381 | 381 | ||
382 | static void | ||
383 | ds1511_rtc_release(struct device *dev) | ||
384 | { | ||
385 | struct platform_device *pdev = to_platform_device(dev); | ||
386 | struct rtc_plat_data *pdata = platform_get_drvdata(pdev); | ||
387 | |||
388 | if (pdata->irq >= 0) { | ||
389 | pdata->irqen = 0; | ||
390 | ds1511_rtc_update_alarm(pdata); | ||
391 | } | ||
392 | } | ||
393 | |||
394 | static int | 382 | static int |
395 | ds1511_rtc_ioctl(struct device *dev, unsigned int cmd, unsigned long arg) | 383 | ds1511_rtc_ioctl(struct device *dev, unsigned int cmd, unsigned long arg) |
396 | { | 384 | { |
@@ -428,7 +416,6 @@ static const struct rtc_class_ops ds1511_rtc_ops = { | |||
428 | .set_time = ds1511_rtc_set_time, | 416 | .set_time = ds1511_rtc_set_time, |
429 | .read_alarm = ds1511_rtc_read_alarm, | 417 | .read_alarm = ds1511_rtc_read_alarm, |
430 | .set_alarm = ds1511_rtc_set_alarm, | 418 | .set_alarm = ds1511_rtc_set_alarm, |
431 | .release = ds1511_rtc_release, | ||
432 | .ioctl = ds1511_rtc_ioctl, | 419 | .ioctl = ds1511_rtc_ioctl, |
433 | }; | 420 | }; |
434 | 421 | ||
diff --git a/drivers/rtc/rtc-ds1553.c b/drivers/rtc/rtc-ds1553.c index a19f11415540..4ef59285b489 100644 --- a/drivers/rtc/rtc-ds1553.c +++ b/drivers/rtc/rtc-ds1553.c | |||
@@ -207,17 +207,6 @@ static irqreturn_t ds1553_rtc_interrupt(int irq, void *dev_id) | |||
207 | return IRQ_HANDLED; | 207 | return IRQ_HANDLED; |
208 | } | 208 | } |
209 | 209 | ||
210 | static void ds1553_rtc_release(struct device *dev) | ||
211 | { | ||
212 | struct platform_device *pdev = to_platform_device(dev); | ||
213 | struct rtc_plat_data *pdata = platform_get_drvdata(pdev); | ||
214 | |||
215 | if (pdata->irq >= 0) { | ||
216 | pdata->irqen = 0; | ||
217 | ds1553_rtc_update_alarm(pdata); | ||
218 | } | ||
219 | } | ||
220 | |||
221 | static int ds1553_rtc_ioctl(struct device *dev, unsigned int cmd, | 210 | static int ds1553_rtc_ioctl(struct device *dev, unsigned int cmd, |
222 | unsigned long arg) | 211 | unsigned long arg) |
223 | { | 212 | { |
@@ -254,7 +243,6 @@ static const struct rtc_class_ops ds1553_rtc_ops = { | |||
254 | .set_time = ds1553_rtc_set_time, | 243 | .set_time = ds1553_rtc_set_time, |
255 | .read_alarm = ds1553_rtc_read_alarm, | 244 | .read_alarm = ds1553_rtc_read_alarm, |
256 | .set_alarm = ds1553_rtc_set_alarm, | 245 | .set_alarm = ds1553_rtc_set_alarm, |
257 | .release = ds1553_rtc_release, | ||
258 | .ioctl = ds1553_rtc_ioctl, | 246 | .ioctl = ds1553_rtc_ioctl, |
259 | }; | 247 | }; |
260 | 248 | ||
diff --git a/drivers/rtc/rtc-sh.c b/drivers/rtc/rtc-sh.c index 1f88e9e914ec..fcead4c4cd1f 100644 --- a/drivers/rtc/rtc-sh.c +++ b/drivers/rtc/rtc-sh.c | |||
@@ -257,12 +257,6 @@ static inline void sh_rtc_setaie(struct device *dev, unsigned int enable) | |||
257 | spin_unlock_irq(&rtc->lock); | 257 | spin_unlock_irq(&rtc->lock); |
258 | } | 258 | } |
259 | 259 | ||
260 | static void sh_rtc_release(struct device *dev) | ||
261 | { | ||
262 | sh_rtc_setpie(dev, 0); | ||
263 | sh_rtc_setaie(dev, 0); | ||
264 | } | ||
265 | |||
266 | static int sh_rtc_proc(struct device *dev, struct seq_file *seq) | 260 | static int sh_rtc_proc(struct device *dev, struct seq_file *seq) |
267 | { | 261 | { |
268 | struct sh_rtc *rtc = dev_get_drvdata(dev); | 262 | struct sh_rtc *rtc = dev_get_drvdata(dev); |
@@ -559,7 +553,6 @@ static int sh_rtc_irq_set_freq(struct device *dev, int freq) | |||
559 | } | 553 | } |
560 | 554 | ||
561 | static struct rtc_class_ops sh_rtc_ops = { | 555 | static struct rtc_class_ops sh_rtc_ops = { |
562 | .release = sh_rtc_release, | ||
563 | .ioctl = sh_rtc_ioctl, | 556 | .ioctl = sh_rtc_ioctl, |
564 | .read_time = sh_rtc_read_time, | 557 | .read_time = sh_rtc_read_time, |
565 | .set_time = sh_rtc_set_time, | 558 | .set_time = sh_rtc_set_time, |
diff --git a/drivers/rtc/rtc-stk17ta8.c b/drivers/rtc/rtc-stk17ta8.c index 31d3c8c28588..9a7e920315fa 100644 --- a/drivers/rtc/rtc-stk17ta8.c +++ b/drivers/rtc/rtc-stk17ta8.c | |||
@@ -215,17 +215,6 @@ static irqreturn_t stk17ta8_rtc_interrupt(int irq, void *dev_id) | |||
215 | return IRQ_HANDLED; | 215 | return IRQ_HANDLED; |
216 | } | 216 | } |
217 | 217 | ||
218 | static void stk17ta8_rtc_release(struct device *dev) | ||
219 | { | ||
220 | struct platform_device *pdev = to_platform_device(dev); | ||
221 | struct rtc_plat_data *pdata = platform_get_drvdata(pdev); | ||
222 | |||
223 | if (pdata->irq >= 0) { | ||
224 | pdata->irqen = 0; | ||
225 | stk17ta8_rtc_update_alarm(pdata); | ||
226 | } | ||
227 | } | ||
228 | |||
229 | static int stk17ta8_rtc_ioctl(struct device *dev, unsigned int cmd, | 218 | static int stk17ta8_rtc_ioctl(struct device *dev, unsigned int cmd, |
230 | unsigned long arg) | 219 | unsigned long arg) |
231 | { | 220 | { |
@@ -254,7 +243,6 @@ static const struct rtc_class_ops stk17ta8_rtc_ops = { | |||
254 | .set_time = stk17ta8_rtc_set_time, | 243 | .set_time = stk17ta8_rtc_set_time, |
255 | .read_alarm = stk17ta8_rtc_read_alarm, | 244 | .read_alarm = stk17ta8_rtc_read_alarm, |
256 | .set_alarm = stk17ta8_rtc_set_alarm, | 245 | .set_alarm = stk17ta8_rtc_set_alarm, |
257 | .release = stk17ta8_rtc_release, | ||
258 | .ioctl = stk17ta8_rtc_ioctl, | 246 | .ioctl = stk17ta8_rtc_ioctl, |
259 | }; | 247 | }; |
260 | 248 | ||