diff options
author | Sachin Kamat <sachin.kamat@linaro.org> | 2013-11-13 00:10:30 +0100 |
---|---|---|
committer | Linus Torvalds <torvalds@linux-foundation.org> | 2013-11-13 04:09:27 +0100 |
commit | adce8c14c9eaf8e184d9410f4a0bdfa8be07ee6f (patch) | |
tree | 9e22b7049a45955e3920ad78523a9efcc94a5395 /drivers/rtc | |
parent | drivers/rtc/rtc-at91rm9200.c: use devm_* APIs (diff) | |
download | linux-adce8c14c9eaf8e184d9410f4a0bdfa8be07ee6f.tar.xz linux-adce8c14c9eaf8e184d9410f4a0bdfa8be07ee6f.zip |
drivers/rtc/rtc-isl1208.c: use devm_* APIs
devm_* APIs are device managed and make code simpler.
Signed-off-by: Sachin Kamat <sachin.kamat@linaro.org>
Cc: Herbert Valerio Riedel <hvr@gnu.org>
Cc: Jingoo Han <jg1.han@samsung.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Diffstat (limited to 'drivers/rtc')
-rw-r--r-- | drivers/rtc/rtc-isl1208.c | 36 |
1 files changed, 11 insertions, 25 deletions
diff --git a/drivers/rtc/rtc-isl1208.c b/drivers/rtc/rtc-isl1208.c index 5a0bf7ce1033..c3c549d511b9 100644 --- a/drivers/rtc/rtc-isl1208.c +++ b/drivers/rtc/rtc-isl1208.c @@ -643,10 +643,11 @@ isl1208_probe(struct i2c_client *client, const struct i2c_device_id *id) "chip found, driver version " DRV_VERSION "\n"); if (client->irq > 0) { - rc = request_threaded_irq(client->irq, NULL, - isl1208_rtc_interrupt, - IRQF_SHARED, - isl1208_driver.driver.name, client); + rc = devm_request_threaded_irq(&client->dev, client->irq, NULL, + isl1208_rtc_interrupt, + IRQF_SHARED, + isl1208_driver.driver.name, + client); if (!rc) { device_init_wakeup(&client->dev, 1); enable_irq_wake(client->irq); @@ -658,20 +659,18 @@ isl1208_probe(struct i2c_client *client, const struct i2c_device_id *id) } } - rtc = rtc_device_register(isl1208_driver.driver.name, - &client->dev, &isl1208_rtc_ops, + rtc = devm_rtc_device_register(&client->dev, isl1208_driver.driver.name, + &isl1208_rtc_ops, THIS_MODULE); - if (IS_ERR(rtc)) { - rc = PTR_ERR(rtc); - goto exit_free_irq; - } + if (IS_ERR(rtc)) + return PTR_ERR(rtc); i2c_set_clientdata(client, rtc); rc = isl1208_i2c_get_sr(client); if (rc < 0) { dev_err(&client->dev, "reading status failed\n"); - goto exit_unregister; + return rc; } if (rc & ISL1208_REG_SR_RTCF) @@ -680,28 +679,15 @@ isl1208_probe(struct i2c_client *client, const struct i2c_device_id *id) rc = sysfs_create_group(&client->dev.kobj, &isl1208_rtc_sysfs_files); if (rc) - goto exit_unregister; + return rc; return 0; - -exit_unregister: - rtc_device_unregister(rtc); -exit_free_irq: - if (client->irq) - free_irq(client->irq, client); - - return rc; } static int isl1208_remove(struct i2c_client *client) { - struct rtc_device *rtc = i2c_get_clientdata(client); - sysfs_remove_group(&client->dev.kobj, &isl1208_rtc_sysfs_files); - rtc_device_unregister(rtc); - if (client->irq) - free_irq(client->irq, client); return 0; } |