diff options
author | John Stultz <john.stultz@linaro.org> | 2011-02-02 20:02:41 -0500 |
---|---|---|
committer | John Stultz <john.stultz@linaro.org> | 2011-02-03 16:02:35 -0500 |
commit | 16380c153a69c3784d2afaddfe0a22f353046cf6 (patch) | |
tree | e923f26334d999a1e456ca80c446fbf8b1c2eedd /drivers/rtc/rtc-m41t80.c | |
parent | ac54cd2bd5b4db4f1c03392d63daf355627ea180 (diff) |
RTC: Convert rtc drivers to use the alarm_irq_enable method
Some rtc drivers use the ioctl method instead of the alarm_irq_enable
method for enabling alarm interupts. With the new virtualized RTC
rework, its important for drivers to use the alarm_irq_enable instead.
This patch converts the drivers that use the AIE ioctl method to
use the alarm_irq_enable method. Other ioctl cmds are left untouched.
I have not been able to test or even compile most of these drivers.
Any help to make sure this change is correct would be appreciated!
CC: Alessandro Zummo <a.zummo@towertech.it>
CC: Thomas Gleixner <tglx@linutronix.de>
CC: Marcelo Roberto Jimenez <mroberto@cpti.cetuc.puc-rio.br>
Reported-by: Marcelo Roberto Jimenez <mroberto@cpti.cetuc.puc-rio.br>
Tested-by: Marcelo Roberto Jimenez <mroberto@cpti.cetuc.puc-rio.br>
Signed-off-by: John Stultz <john.stultz@linaro.org>
Diffstat (limited to 'drivers/rtc/rtc-m41t80.c')
-rw-r--r-- | drivers/rtc/rtc-m41t80.c | 30 |
1 files changed, 8 insertions, 22 deletions
diff --git a/drivers/rtc/rtc-m41t80.c b/drivers/rtc/rtc-m41t80.c index 5a8daa358066..69fe664a2228 100644 --- a/drivers/rtc/rtc-m41t80.c +++ b/drivers/rtc/rtc-m41t80.c | |||
@@ -213,41 +213,27 @@ static int m41t80_rtc_set_time(struct device *dev, struct rtc_time *tm) | |||
213 | return m41t80_set_datetime(to_i2c_client(dev), tm); | 213 | return m41t80_set_datetime(to_i2c_client(dev), tm); |
214 | } | 214 | } |
215 | 215 | ||
216 | #if defined(CONFIG_RTC_INTF_DEV) || defined(CONFIG_RTC_INTF_DEV_MODULE) | 216 | static int m41t80_rtc_alarm_irq_enable(struct device *dev, unsigned int enabled) |
217 | static int | ||
218 | m41t80_rtc_ioctl(struct device *dev, unsigned int cmd, unsigned long arg) | ||
219 | { | 217 | { |
220 | struct i2c_client *client = to_i2c_client(dev); | 218 | struct i2c_client *client = to_i2c_client(dev); |
221 | int rc; | 219 | int rc; |
222 | 220 | ||
223 | switch (cmd) { | ||
224 | case RTC_AIE_OFF: | ||
225 | case RTC_AIE_ON: | ||
226 | break; | ||
227 | default: | ||
228 | return -ENOIOCTLCMD; | ||
229 | } | ||
230 | |||
231 | rc = i2c_smbus_read_byte_data(client, M41T80_REG_ALARM_MON); | 221 | rc = i2c_smbus_read_byte_data(client, M41T80_REG_ALARM_MON); |
232 | if (rc < 0) | 222 | if (rc < 0) |
233 | goto err; | 223 | goto err; |
234 | switch (cmd) { | 224 | |
235 | case RTC_AIE_OFF: | 225 | if (enabled) |
236 | rc &= ~M41T80_ALMON_AFE; | ||
237 | break; | ||
238 | case RTC_AIE_ON: | ||
239 | rc |= M41T80_ALMON_AFE; | 226 | rc |= M41T80_ALMON_AFE; |
240 | break; | 227 | else |
241 | } | 228 | rc &= ~M41T80_ALMON_AFE; |
229 | |||
242 | if (i2c_smbus_write_byte_data(client, M41T80_REG_ALARM_MON, rc) < 0) | 230 | if (i2c_smbus_write_byte_data(client, M41T80_REG_ALARM_MON, rc) < 0) |
243 | goto err; | 231 | goto err; |
232 | |||
244 | return 0; | 233 | return 0; |
245 | err: | 234 | err: |
246 | return -EIO; | 235 | return -EIO; |
247 | } | 236 | } |
248 | #else | ||
249 | #define m41t80_rtc_ioctl NULL | ||
250 | #endif | ||
251 | 237 | ||
252 | static int m41t80_rtc_set_alarm(struct device *dev, struct rtc_wkalrm *t) | 238 | static int m41t80_rtc_set_alarm(struct device *dev, struct rtc_wkalrm *t) |
253 | { | 239 | { |
@@ -374,7 +360,7 @@ static struct rtc_class_ops m41t80_rtc_ops = { | |||
374 | .read_alarm = m41t80_rtc_read_alarm, | 360 | .read_alarm = m41t80_rtc_read_alarm, |
375 | .set_alarm = m41t80_rtc_set_alarm, | 361 | .set_alarm = m41t80_rtc_set_alarm, |
376 | .proc = m41t80_rtc_proc, | 362 | .proc = m41t80_rtc_proc, |
377 | .ioctl = m41t80_rtc_ioctl, | 363 | .alarm_irq_enable = m41t80_rtc_alarm_irq_enable, |
378 | }; | 364 | }; |
379 | 365 | ||
380 | #if defined(CONFIG_RTC_INTF_SYSFS) || defined(CONFIG_RTC_INTF_SYSFS_MODULE) | 366 | #if defined(CONFIG_RTC_INTF_SYSFS) || defined(CONFIG_RTC_INTF_SYSFS_MODULE) |