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>
This commit is contained in:
committed by
Linus Torvalds
parent
b74d2caa64
commit
a8462ef63c
@@ -420,49 +420,43 @@ static int cmos_irq_set_state(struct device *dev, int enabled)
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
#if defined(CONFIG_RTC_INTF_DEV) || defined(CONFIG_RTC_INTF_DEV_MODULE)
|
static int cmos_alarm_irq_enable(struct device *dev, unsigned int enabled)
|
||||||
|
|
||||||
static int
|
|
||||||
cmos_rtc_ioctl(struct device *dev, unsigned int cmd, unsigned long arg)
|
|
||||||
{
|
{
|
||||||
struct cmos_rtc *cmos = dev_get_drvdata(dev);
|
struct cmos_rtc *cmos = dev_get_drvdata(dev);
|
||||||
unsigned long flags;
|
unsigned long flags;
|
||||||
|
|
||||||
switch (cmd) {
|
|
||||||
case RTC_AIE_OFF:
|
|
||||||
case RTC_AIE_ON:
|
|
||||||
case RTC_UIE_OFF:
|
|
||||||
case RTC_UIE_ON:
|
|
||||||
if (!is_valid_irq(cmos->irq))
|
if (!is_valid_irq(cmos->irq))
|
||||||
return -EINVAL;
|
return -EINVAL;
|
||||||
break;
|
|
||||||
/* PIE ON/OFF is handled by cmos_irq_set_state() */
|
|
||||||
default:
|
|
||||||
return -ENOIOCTLCMD;
|
|
||||||
}
|
|
||||||
|
|
||||||
spin_lock_irqsave(&rtc_lock, flags);
|
spin_lock_irqsave(&rtc_lock, flags);
|
||||||
switch (cmd) {
|
|
||||||
case RTC_AIE_OFF: /* alarm off */
|
if (enabled)
|
||||||
cmos_irq_disable(cmos, RTC_AIE);
|
|
||||||
break;
|
|
||||||
case RTC_AIE_ON: /* alarm on */
|
|
||||||
cmos_irq_enable(cmos, RTC_AIE);
|
cmos_irq_enable(cmos, RTC_AIE);
|
||||||
break;
|
else
|
||||||
case RTC_UIE_OFF: /* update off */
|
cmos_irq_disable(cmos, RTC_AIE);
|
||||||
cmos_irq_disable(cmos, RTC_UIE);
|
|
||||||
break;
|
|
||||||
case RTC_UIE_ON: /* update on */
|
|
||||||
cmos_irq_enable(cmos, RTC_UIE);
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
spin_unlock_irqrestore(&rtc_lock, flags);
|
spin_unlock_irqrestore(&rtc_lock, flags);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
#else
|
static int cmos_update_irq_enable(struct device *dev, unsigned int enabled)
|
||||||
#define cmos_rtc_ioctl NULL
|
{
|
||||||
#endif
|
struct cmos_rtc *cmos = dev_get_drvdata(dev);
|
||||||
|
unsigned long flags;
|
||||||
|
|
||||||
|
if (!is_valid_irq(cmos->irq))
|
||||||
|
return -EINVAL;
|
||||||
|
|
||||||
|
spin_lock_irqsave(&rtc_lock, flags);
|
||||||
|
|
||||||
|
if (enabled)
|
||||||
|
cmos_irq_enable(cmos, RTC_UIE);
|
||||||
|
else
|
||||||
|
cmos_irq_disable(cmos, RTC_UIE);
|
||||||
|
|
||||||
|
spin_unlock_irqrestore(&rtc_lock, flags);
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
#if defined(CONFIG_RTC_INTF_PROC) || defined(CONFIG_RTC_INTF_PROC_MODULE)
|
#if defined(CONFIG_RTC_INTF_PROC) || defined(CONFIG_RTC_INTF_PROC_MODULE)
|
||||||
|
|
||||||
@@ -503,7 +497,6 @@ static int cmos_procfs(struct device *dev, struct seq_file *seq)
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
static const struct rtc_class_ops cmos_rtc_ops = {
|
static const struct rtc_class_ops cmos_rtc_ops = {
|
||||||
.ioctl = cmos_rtc_ioctl,
|
|
||||||
.read_time = cmos_read_time,
|
.read_time = cmos_read_time,
|
||||||
.set_time = cmos_set_time,
|
.set_time = cmos_set_time,
|
||||||
.read_alarm = cmos_read_alarm,
|
.read_alarm = cmos_read_alarm,
|
||||||
@@ -511,6 +504,8 @@ static const struct rtc_class_ops cmos_rtc_ops = {
|
|||||||
.proc = cmos_procfs,
|
.proc = cmos_procfs,
|
||||||
.irq_set_freq = cmos_irq_set_freq,
|
.irq_set_freq = cmos_irq_set_freq,
|
||||||
.irq_set_state = cmos_irq_set_state,
|
.irq_set_state = cmos_irq_set_state,
|
||||||
|
.alarm_irq_enable = cmos_alarm_irq_enable,
|
||||||
|
.update_irq_enable = cmos_update_irq_enable,
|
||||||
};
|
};
|
||||||
|
|
||||||
/*----------------------------------------------------------------*/
|
/*----------------------------------------------------------------*/
|
||||||
|
Reference in New Issue
Block a user