diff options
author | Herton Ronaldo Krzesinski <herton@mandriva.com.br> | 2009-12-15 19:45:56 -0500 |
---|---|---|
committer | Linus Torvalds <torvalds@linux-foundation.org> | 2009-12-16 10:19:58 -0500 |
commit | a8462ef63c961639a743f9fcddf408da46641281 (patch) | |
tree | f5f44eebf731d7d0b3f1f34f848ce84a84766fb4 /drivers/rtc/rtc-cmos.c | |
parent | b74d2caa64f8e542e9c6716ae6ed4a60d681ea9f (diff) |
rtc-cmos: convert RTC_AIE/RTC_UIE to rtc irq API
Drop ioctl function that handles RTC_AIE/RTC_UIE, and use instead the
rtc subsystem API (alarm_irq_enable/update_irq_enable callbacks).
Signed-off-by: Herton Ronaldo Krzesinski <herton@mandriva.com.br>
Cc: Alessandro Zummo <a.zummo@towertech.it>
Cc: David Brownell <david-b@pacbell.net>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Diffstat (limited to 'drivers/rtc/rtc-cmos.c')
-rw-r--r-- | drivers/rtc/rtc-cmos.c | 75 |
1 files changed, 35 insertions, 40 deletions
diff --git a/drivers/rtc/rtc-cmos.c b/drivers/rtc/rtc-cmos.c index 876e3fcffca4..eb154dc57164 100644 --- a/drivers/rtc/rtc-cmos.c +++ b/drivers/rtc/rtc-cmos.c | |||
@@ -420,49 +420,43 @@ static int cmos_irq_set_state(struct device *dev, int enabled) | |||
420 | return 0; | 420 | return 0; |
421 | } | 421 | } |
422 | 422 | ||
423 | #if defined(CONFIG_RTC_INTF_DEV) || defined(CONFIG_RTC_INTF_DEV_MODULE) | 423 | static int cmos_alarm_irq_enable(struct device *dev, unsigned int enabled) |
424 | |||
425 | static int | ||
426 | cmos_rtc_ioctl(struct device *dev, unsigned int cmd, unsigned long arg) | ||
427 | { | 424 | { |
428 | struct cmos_rtc *cmos = dev_get_drvdata(dev); | 425 | struct cmos_rtc *cmos = dev_get_drvdata(dev); |
429 | unsigned long flags; | 426 | unsigned long flags; |
430 | 427 | ||
431 | switch (cmd) { | 428 | if (!is_valid_irq(cmos->irq)) |
432 | case RTC_AIE_OFF: | 429 | return -EINVAL; |
433 | case RTC_AIE_ON: | ||
434 | case RTC_UIE_OFF: | ||
435 | case RTC_UIE_ON: | ||
436 | if (!is_valid_irq(cmos->irq)) | ||
437 | return -EINVAL; | ||
438 | break; | ||
439 | /* PIE ON/OFF is handled by cmos_irq_set_state() */ | ||
440 | default: | ||
441 | return -ENOIOCTLCMD; | ||
442 | } | ||
443 | 430 | ||
444 | spin_lock_irqsave(&rtc_lock, flags); | 431 | spin_lock_irqsave(&rtc_lock, flags); |
445 | switch (cmd) { | 432 | |
446 | case RTC_AIE_OFF: /* alarm off */ | 433 | if (enabled) |
447 | cmos_irq_disable(cmos, RTC_AIE); | ||
448 | break; | ||
449 | case RTC_AIE_ON: /* alarm on */ | ||
450 | cmos_irq_enable(cmos, RTC_AIE); | 434 | cmos_irq_enable(cmos, RTC_AIE); |
451 | break; | 435 | else |
452 | case RTC_UIE_OFF: /* update off */ | 436 | cmos_irq_disable(cmos, RTC_AIE); |
453 | cmos_irq_disable(cmos, RTC_UIE); | 437 | |
454 | break; | ||
455 | case RTC_UIE_ON: /* update on */ | ||
456 | cmos_irq_enable(cmos, RTC_UIE); | ||
457 | break; | ||
458 | } | ||
459 | spin_unlock_irqrestore(&rtc_lock, flags); | 438 | spin_unlock_irqrestore(&rtc_lock, flags); |
460 | return 0; | 439 | return 0; |
461 | } | 440 | } |
462 | 441 | ||
463 | #else | 442 | static int cmos_update_irq_enable(struct device *dev, unsigned int enabled) |
464 | #define cmos_rtc_ioctl NULL | 443 | { |
465 | #endif | 444 | struct cmos_rtc *cmos = dev_get_drvdata(dev); |
445 | unsigned long flags; | ||
446 | |||
447 | if (!is_valid_irq(cmos->irq)) | ||
448 | return -EINVAL; | ||
449 | |||
450 | spin_lock_irqsave(&rtc_lock, flags); | ||
451 | |||
452 | if (enabled) | ||
453 | cmos_irq_enable(cmos, RTC_UIE); | ||
454 | else | ||
455 | cmos_irq_disable(cmos, RTC_UIE); | ||
456 | |||
457 | spin_unlock_irqrestore(&rtc_lock, flags); | ||
458 | return 0; | ||
459 | } | ||
466 | 460 | ||
467 | #if defined(CONFIG_RTC_INTF_PROC) || defined(CONFIG_RTC_INTF_PROC_MODULE) | 461 | #if defined(CONFIG_RTC_INTF_PROC) || defined(CONFIG_RTC_INTF_PROC_MODULE) |
468 | 462 | ||
@@ -503,14 +497,15 @@ static int cmos_procfs(struct device *dev, struct seq_file *seq) | |||
503 | #endif | 497 | #endif |
504 | 498 | ||
505 | static const struct rtc_class_ops cmos_rtc_ops = { | 499 | static const struct rtc_class_ops cmos_rtc_ops = { |
506 | .ioctl = cmos_rtc_ioctl, | 500 | .read_time = cmos_read_time, |
507 | .read_time = cmos_read_time, | 501 | .set_time = cmos_set_time, |
508 | .set_time = cmos_set_time, | 502 | .read_alarm = cmos_read_alarm, |
509 | .read_alarm = cmos_read_alarm, | 503 | .set_alarm = cmos_set_alarm, |
510 | .set_alarm = cmos_set_alarm, | 504 | .proc = cmos_procfs, |
511 | .proc = cmos_procfs, | 505 | .irq_set_freq = cmos_irq_set_freq, |
512 | .irq_set_freq = cmos_irq_set_freq, | 506 | .irq_set_state = cmos_irq_set_state, |
513 | .irq_set_state = cmos_irq_set_state, | 507 | .alarm_irq_enable = cmos_alarm_irq_enable, |
508 | .update_irq_enable = cmos_update_irq_enable, | ||
514 | }; | 509 | }; |
515 | 510 | ||
516 | /*----------------------------------------------------------------*/ | 511 | /*----------------------------------------------------------------*/ |