diff options
author | David Brownell <david-b@pacbell.net> | 2008-07-24 00:30:33 -0400 |
---|---|---|
committer | Linus Torvalds <torvalds@linux-foundation.org> | 2008-07-24 13:47:33 -0400 |
commit | 5ad31a575157147b43fa84ef1e21471661653878 (patch) | |
tree | c4a42d45957362aa8391938ae3e11496321c19d8 /include/linux | |
parent | 53f1b1433da7eac2607a4a0898a221a4485fd732 (diff) |
rtc: remove BKL for ioctl()
Remove implicit use of BKL in ioctl() from the RTC framework.
Instead, the rtc->ops_lock is used. That's the same lock that already
protects the RTC operations when they're issued through the exported
rtc_*() calls in drivers/rtc/interface.c ... making this a bugfix, not
just a cleanup, since both ioctl calls and set_alarm() need to update IRQ
enable flags and that implies a common lock (which RTC drivers as a rule
do not provide on their own).
A new comment at the declaration of "struct rtc_class_ops" summarizes
current locking rules. It's not clear to me that the exceptions listed
there should exist ... if not, those are pre-existing problems which can
be fixed in a patch that doesn't relate to BKL removal.
Signed-off-by: David Brownell <dbrownell@users.sourceforge.net>
Cc: Alan Cox <alan@lxorguk.ukuu.org.uk>
Cc: Jonathan Corbet <corbet@lwn.net>
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 'include/linux')
-rw-r--r-- | include/linux/rtc.h | 17 |
1 files changed, 17 insertions, 0 deletions
diff --git a/include/linux/rtc.h b/include/linux/rtc.h index f2d0d1527721..b01fe004cb5e 100644 --- a/include/linux/rtc.h +++ b/include/linux/rtc.h | |||
@@ -115,6 +115,23 @@ extern void rtc_time_to_tm(unsigned long time, struct rtc_time *tm); | |||
115 | 115 | ||
116 | extern struct class *rtc_class; | 116 | extern struct class *rtc_class; |
117 | 117 | ||
118 | /* | ||
119 | * For these RTC methods the device parameter is the physical device | ||
120 | * on whatever bus holds the hardware (I2C, Platform, SPI, etc), which | ||
121 | * was passed to rtc_device_register(). Its driver_data normally holds | ||
122 | * device state, including the rtc_device pointer for the RTC. | ||
123 | * | ||
124 | * Most of these methods are called with rtc_device.ops_lock held, | ||
125 | * through the rtc_*(struct rtc_device *, ...) calls. | ||
126 | * | ||
127 | * The (current) exceptions are mostly filesystem hooks: | ||
128 | * - the proc() hook for procfs | ||
129 | * - non-ioctl() chardev hooks: open(), release(), read_callback() | ||
130 | * - periodic irq calls: irq_set_state(), irq_set_freq() | ||
131 | * | ||
132 | * REVISIT those periodic irq calls *do* have ops_lock when they're | ||
133 | * issued through ioctl() ... | ||
134 | */ | ||
118 | struct rtc_class_ops { | 135 | struct rtc_class_ops { |
119 | int (*open)(struct device *); | 136 | int (*open)(struct device *); |
120 | void (*release)(struct device *); | 137 | void (*release)(struct device *); |