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-ds1374.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-ds1374.c')
-rw-r--r-- | drivers/rtc/rtc-ds1374.c | 37 |
1 files changed, 10 insertions, 27 deletions
diff --git a/drivers/rtc/rtc-ds1374.c b/drivers/rtc/rtc-ds1374.c index 47fb6357c346..d834a63ec4b0 100644 --- a/drivers/rtc/rtc-ds1374.c +++ b/drivers/rtc/rtc-ds1374.c | |||
@@ -307,42 +307,25 @@ unlock: | |||
307 | mutex_unlock(&ds1374->mutex); | 307 | mutex_unlock(&ds1374->mutex); |
308 | } | 308 | } |
309 | 309 | ||
310 | static int ds1374_ioctl(struct device *dev, unsigned int cmd, unsigned long arg) | 310 | static int ds1374_alarm_irq_enable(struct device *dev, unsigned int enabled) |
311 | { | 311 | { |
312 | struct i2c_client *client = to_i2c_client(dev); | 312 | struct i2c_client *client = to_i2c_client(dev); |
313 | struct ds1374 *ds1374 = i2c_get_clientdata(client); | 313 | struct ds1374 *ds1374 = i2c_get_clientdata(client); |
314 | int ret = -ENOIOCTLCMD; | 314 | int ret; |
315 | 315 | ||
316 | mutex_lock(&ds1374->mutex); | 316 | mutex_lock(&ds1374->mutex); |
317 | 317 | ||
318 | switch (cmd) { | 318 | ret = i2c_smbus_read_byte_data(client, DS1374_REG_CR); |
319 | case RTC_AIE_OFF: | 319 | if (ret < 0) |
320 | ret = i2c_smbus_read_byte_data(client, DS1374_REG_CR); | 320 | goto out; |
321 | if (ret < 0) | ||
322 | goto out; | ||
323 | |||
324 | ret &= ~DS1374_REG_CR_WACE; | ||
325 | |||
326 | ret = i2c_smbus_write_byte_data(client, DS1374_REG_CR, ret); | ||
327 | if (ret < 0) | ||
328 | goto out; | ||
329 | |||
330 | break; | ||
331 | |||
332 | case RTC_AIE_ON: | ||
333 | ret = i2c_smbus_read_byte_data(client, DS1374_REG_CR); | ||
334 | if (ret < 0) | ||
335 | goto out; | ||
336 | 321 | ||
322 | if (enabled) { | ||
337 | ret |= DS1374_REG_CR_WACE | DS1374_REG_CR_AIE; | 323 | ret |= DS1374_REG_CR_WACE | DS1374_REG_CR_AIE; |
338 | ret &= ~DS1374_REG_CR_WDALM; | 324 | ret &= ~DS1374_REG_CR_WDALM; |
339 | 325 | } else { | |
340 | ret = i2c_smbus_write_byte_data(client, DS1374_REG_CR, ret); | 326 | ret &= ~DS1374_REG_CR_WACE; |
341 | if (ret < 0) | ||
342 | goto out; | ||
343 | |||
344 | break; | ||
345 | } | 327 | } |
328 | ret = i2c_smbus_write_byte_data(client, DS1374_REG_CR, ret); | ||
346 | 329 | ||
347 | out: | 330 | out: |
348 | mutex_unlock(&ds1374->mutex); | 331 | mutex_unlock(&ds1374->mutex); |
@@ -354,7 +337,7 @@ static const struct rtc_class_ops ds1374_rtc_ops = { | |||
354 | .set_time = ds1374_set_time, | 337 | .set_time = ds1374_set_time, |
355 | .read_alarm = ds1374_read_alarm, | 338 | .read_alarm = ds1374_read_alarm, |
356 | .set_alarm = ds1374_set_alarm, | 339 | .set_alarm = ds1374_set_alarm, |
357 | .ioctl = ds1374_ioctl, | 340 | .alarm_irq_enable = ds1374_alarm_irq_enable, |
358 | }; | 341 | }; |
359 | 342 | ||
360 | static int ds1374_probe(struct i2c_client *client, | 343 | static int ds1374_probe(struct i2c_client *client, |