diff options
author | Alessandro Zummo <alessandro.zummo@towertech.it> | 2006-06-25 08:48:20 -0400 |
---|---|---|
committer | Linus Torvalds <torvalds@g5.osdl.org> | 2006-06-25 13:01:13 -0400 |
commit | 56f10c634e145d75e45b56a73f59fb6dff1caa8e (patch) | |
tree | d8a845dccfaf16dc7ef59d1ad9192a6b6923e6ff /drivers/rtc | |
parent | 9c0c570576d02000063e28faadcce8c07396755d (diff) |
[PATCH] rtc subsystem, fix capability checks in kernel interface
Remove commented capability checks and add some others.
Signed-off-by: Alessandro Zummo <a.zummo@towertech.it>
Signed-off-by: Andrew Morton <akpm@osdl.org>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
Diffstat (limited to 'drivers/rtc')
-rw-r--r-- | drivers/rtc/interface.c | 22 |
1 files changed, 6 insertions, 16 deletions
diff --git a/drivers/rtc/interface.c b/drivers/rtc/interface.c index 56e490709b87..579cd667b16f 100644 --- a/drivers/rtc/interface.c +++ b/drivers/rtc/interface.c | |||
@@ -229,6 +229,9 @@ int rtc_irq_set_state(struct class_device *class_dev, struct rtc_task *task, int | |||
229 | unsigned long flags; | 229 | unsigned long flags; |
230 | struct rtc_device *rtc = to_rtc_device(class_dev); | 230 | struct rtc_device *rtc = to_rtc_device(class_dev); |
231 | 231 | ||
232 | if (rtc->ops->irq_set_state == NULL) | ||
233 | return -ENXIO; | ||
234 | |||
232 | spin_lock_irqsave(&rtc->irq_task_lock, flags); | 235 | spin_lock_irqsave(&rtc->irq_task_lock, flags); |
233 | if (rtc->irq_task != task) | 236 | if (rtc->irq_task != task) |
234 | err = -ENXIO; | 237 | err = -ENXIO; |
@@ -243,25 +246,12 @@ EXPORT_SYMBOL_GPL(rtc_irq_set_state); | |||
243 | 246 | ||
244 | int rtc_irq_set_freq(struct class_device *class_dev, struct rtc_task *task, int freq) | 247 | int rtc_irq_set_freq(struct class_device *class_dev, struct rtc_task *task, int freq) |
245 | { | 248 | { |
246 | int err = 0, tmp = 0; | 249 | int err = 0; |
247 | unsigned long flags; | 250 | unsigned long flags; |
248 | struct rtc_device *rtc = to_rtc_device(class_dev); | 251 | struct rtc_device *rtc = to_rtc_device(class_dev); |
249 | 252 | ||
250 | /* allowed range is 2-8192 */ | 253 | if (rtc->ops->irq_set_freq == NULL) |
251 | if (freq < 2 || freq > 8192) | 254 | return -ENXIO; |
252 | return -EINVAL; | ||
253 | /* | ||
254 | FIXME: this does not belong here, will move where appropriate | ||
255 | at a later stage. It cannot hurt right now, trust me :) | ||
256 | if ((freq > rtc_max_user_freq) && (!capable(CAP_SYS_RESOURCE))) | ||
257 | return -EACCES; | ||
258 | */ | ||
259 | /* check if freq is a power of 2 */ | ||
260 | while (freq > (1 << tmp)) | ||
261 | tmp++; | ||
262 | |||
263 | if (freq != (1 << tmp)) | ||
264 | return -EINVAL; | ||
265 | 255 | ||
266 | spin_lock_irqsave(&rtc->irq_task_lock, flags); | 256 | spin_lock_irqsave(&rtc->irq_task_lock, flags); |
267 | if (rtc->irq_task != task) | 257 | if (rtc->irq_task != task) |