Commit 743e6a50 authored by David Brownell's avatar David Brownell Committed by Linus Torvalds

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: default avatarDavid Brownell <dbrownell@users.sourceforge.net>
Acked-by: default avatarAndrew Sharp <andy.sharp@onstor.com>
Cc: Angelo Castello <angelo.castello@st.com>
Acked-by: default avatarAtsushi Nemoto <anemo@mba.ocn.ne.jp>
Acked-by: default avatarPaul Mundt <lethal@linux-sh.org>
Cc: Thomas Hommel <thomas.hommel@gefanuc.com>
Acked-by: default avatarAlessandro Zummo <a.zummo@towertech.it>
Signed-off-by: default avatarAndrew Morton <akpm@linux-foundation.org>
Signed-off-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>
parent 37fc5e2c
...@@ -432,9 +432,15 @@ static int rtc_dev_release(struct inode *inode, struct file *file) ...@@ -432,9 +432,15 @@ static int rtc_dev_release(struct inode *inode, struct file *file)
{ {
struct rtc_device *rtc = file->private_data; struct rtc_device *rtc = file->private_data;
#ifdef CONFIG_RTC_INTF_DEV_UIE_EMUL /* We shut down the repeating IRQs that userspace enabled,
clear_uie(rtc); * since nothing is listening to them.
#endif * - 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); rtc_irq_set_state(rtc, NULL, 0);
if (rtc->ops->release) if (rtc->ops->release)
......
...@@ -379,18 +379,6 @@ ds1511_interrupt(int irq, void *dev_id) ...@@ -379,18 +379,6 @@ ds1511_interrupt(int irq, void *dev_id)
return IRQ_HANDLED; 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 static int
ds1511_rtc_ioctl(struct device *dev, unsigned int cmd, unsigned long arg) ds1511_rtc_ioctl(struct device *dev, unsigned int cmd, unsigned long arg)
{ {
...@@ -428,7 +416,6 @@ static const struct rtc_class_ops ds1511_rtc_ops = { ...@@ -428,7 +416,6 @@ static const struct rtc_class_ops ds1511_rtc_ops = {
.set_time = ds1511_rtc_set_time, .set_time = ds1511_rtc_set_time,
.read_alarm = ds1511_rtc_read_alarm, .read_alarm = ds1511_rtc_read_alarm,
.set_alarm = ds1511_rtc_set_alarm, .set_alarm = ds1511_rtc_set_alarm,
.release = ds1511_rtc_release,
.ioctl = ds1511_rtc_ioctl, .ioctl = ds1511_rtc_ioctl,
}; };
......
...@@ -207,17 +207,6 @@ static irqreturn_t ds1553_rtc_interrupt(int irq, void *dev_id) ...@@ -207,17 +207,6 @@ static irqreturn_t ds1553_rtc_interrupt(int irq, void *dev_id)
return IRQ_HANDLED; 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, static int ds1553_rtc_ioctl(struct device *dev, unsigned int cmd,
unsigned long arg) unsigned long arg)
{ {
...@@ -254,7 +243,6 @@ static const struct rtc_class_ops ds1553_rtc_ops = { ...@@ -254,7 +243,6 @@ static const struct rtc_class_ops ds1553_rtc_ops = {
.set_time = ds1553_rtc_set_time, .set_time = ds1553_rtc_set_time,
.read_alarm = ds1553_rtc_read_alarm, .read_alarm = ds1553_rtc_read_alarm,
.set_alarm = ds1553_rtc_set_alarm, .set_alarm = ds1553_rtc_set_alarm,
.release = ds1553_rtc_release,
.ioctl = ds1553_rtc_ioctl, .ioctl = ds1553_rtc_ioctl,
}; };
......
...@@ -257,12 +257,6 @@ static inline void sh_rtc_setaie(struct device *dev, unsigned int enable) ...@@ -257,12 +257,6 @@ static inline void sh_rtc_setaie(struct device *dev, unsigned int enable)
spin_unlock_irq(&rtc->lock); 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) static int sh_rtc_proc(struct device *dev, struct seq_file *seq)
{ {
struct sh_rtc *rtc = dev_get_drvdata(dev); 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,7 +553,6 @@ static int sh_rtc_irq_set_freq(struct device *dev, int freq)
} }
static struct rtc_class_ops sh_rtc_ops = { static struct rtc_class_ops sh_rtc_ops = {
.release = sh_rtc_release,
.ioctl = sh_rtc_ioctl, .ioctl = sh_rtc_ioctl,
.read_time = sh_rtc_read_time, .read_time = sh_rtc_read_time,
.set_time = sh_rtc_set_time, .set_time = sh_rtc_set_time,
......
...@@ -215,17 +215,6 @@ static irqreturn_t stk17ta8_rtc_interrupt(int irq, void *dev_id) ...@@ -215,17 +215,6 @@ static irqreturn_t stk17ta8_rtc_interrupt(int irq, void *dev_id)
return IRQ_HANDLED; 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, static int stk17ta8_rtc_ioctl(struct device *dev, unsigned int cmd,
unsigned long arg) unsigned long arg)
{ {
...@@ -254,7 +243,6 @@ static const struct rtc_class_ops stk17ta8_rtc_ops = { ...@@ -254,7 +243,6 @@ static const struct rtc_class_ops stk17ta8_rtc_ops = {
.set_time = stk17ta8_rtc_set_time, .set_time = stk17ta8_rtc_set_time,
.read_alarm = stk17ta8_rtc_read_alarm, .read_alarm = stk17ta8_rtc_read_alarm,
.set_alarm = stk17ta8_rtc_set_alarm, .set_alarm = stk17ta8_rtc_set_alarm,
.release = stk17ta8_rtc_release,
.ioctl = stk17ta8_rtc_ioctl, .ioctl = stk17ta8_rtc_ioctl,
}; };
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment