aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/rtc/rtc-isl1208.c
diff options
context:
space:
mode:
authorSachin Kamat <sachin.kamat@linaro.org>2013-11-12 18:10:30 -0500
committerLinus Torvalds <torvalds@linux-foundation.org>2013-11-12 22:09:27 -0500
commitadce8c14c9eaf8e184d9410f4a0bdfa8be07ee6f (patch)
tree9e22b7049a45955e3920ad78523a9efcc94a5395 /drivers/rtc/rtc-isl1208.c
parentf3766250b2e9f2920c3c9ef9821827ac82fa7a84 (diff)
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/rtc-isl1208.c')
-rw-r--r--drivers/rtc/rtc-isl1208.c36
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)
643 "chip found, driver version " DRV_VERSION "\n"); 643 "chip found, driver version " DRV_VERSION "\n");
644 644
645 if (client->irq > 0) { 645 if (client->irq > 0) {
646 rc = request_threaded_irq(client->irq, NULL, 646 rc = devm_request_threaded_irq(&client->dev, client->irq, NULL,
647 isl1208_rtc_interrupt, 647 isl1208_rtc_interrupt,
648 IRQF_SHARED, 648 IRQF_SHARED,
649 isl1208_driver.driver.name, client); 649 isl1208_driver.driver.name,
650 client);
650 if (!rc) { 651 if (!rc) {
651 device_init_wakeup(&client->dev, 1); 652 device_init_wakeup(&client->dev, 1);
652 enable_irq_wake(client->irq); 653 enable_irq_wake(client->irq);
@@ -658,20 +659,18 @@ isl1208_probe(struct i2c_client *client, const struct i2c_device_id *id)
658 } 659 }
659 } 660 }
660 661
661 rtc = rtc_device_register(isl1208_driver.driver.name, 662 rtc = devm_rtc_device_register(&client->dev, isl1208_driver.driver.name,
662 &client->dev, &isl1208_rtc_ops, 663 &isl1208_rtc_ops,
663 THIS_MODULE); 664 THIS_MODULE);
664 if (IS_ERR(rtc)) { 665 if (IS_ERR(rtc))
665 rc = PTR_ERR(rtc); 666 return PTR_ERR(rtc);
666 goto exit_free_irq;
667 }
668 667
669 i2c_set_clientdata(client, rtc); 668 i2c_set_clientdata(client, rtc);
670 669
671 rc = isl1208_i2c_get_sr(client); 670 rc = isl1208_i2c_get_sr(client);
672 if (rc < 0) { 671 if (rc < 0) {
673 dev_err(&client->dev, "reading status failed\n"); 672 dev_err(&client->dev, "reading status failed\n");
674 goto exit_unregister; 673 return rc;
675 } 674 }
676 675
677 if (rc & ISL1208_REG_SR_RTCF) 676 if (rc & ISL1208_REG_SR_RTCF)
@@ -680,28 +679,15 @@ isl1208_probe(struct i2c_client *client, const struct i2c_device_id *id)
680 679
681 rc = sysfs_create_group(&client->dev.kobj, &isl1208_rtc_sysfs_files); 680 rc = sysfs_create_group(&client->dev.kobj, &isl1208_rtc_sysfs_files);
682 if (rc) 681 if (rc)
683 goto exit_unregister; 682 return rc;
684 683
685 return 0; 684 return 0;
686
687exit_unregister:
688 rtc_device_unregister(rtc);
689exit_free_irq:
690 if (client->irq)
691 free_irq(client->irq, client);
692
693 return rc;
694} 685}
695 686
696static int 687static int
697isl1208_remove(struct i2c_client *client) 688isl1208_remove(struct i2c_client *client)
698{ 689{
699 struct rtc_device *rtc = i2c_get_clientdata(client);
700
701 sysfs_remove_group(&client->dev.kobj, &isl1208_rtc_sysfs_files); 690 sysfs_remove_group(&client->dev.kobj, &isl1208_rtc_sysfs_files);
702 rtc_device_unregister(rtc);
703 if (client->irq)
704 free_irq(client->irq, client);
705 691
706 return 0; 692 return 0;
707} 693}