diff options
Diffstat (limited to 'drivers/rtc/rtc-max8925.c')
| -rw-r--r-- | drivers/rtc/rtc-max8925.c | 42 |
1 files changed, 13 insertions, 29 deletions
diff --git a/drivers/rtc/rtc-max8925.c b/drivers/rtc/rtc-max8925.c index 1459055a83a..951d1a78e19 100644 --- a/drivers/rtc/rtc-max8925.c +++ b/drivers/rtc/rtc-max8925.c @@ -69,6 +69,7 @@ struct max8925_rtc_info { struct max8925_chip *chip; struct i2c_client *rtc; struct device *dev; + int irq; }; static irqreturn_t rtc_update_handler(int irq, void *data) @@ -246,26 +247,28 @@ static const struct rtc_class_ops max8925_rtc_ops = { .set_alarm = max8925_rtc_set_alarm, }; -static int __devinit max8925_rtc_probe(struct platform_device *pdev) +static int max8925_rtc_probe(struct platform_device *pdev) { struct max8925_chip *chip = dev_get_drvdata(pdev->dev.parent); struct max8925_rtc_info *info; - int irq, ret; + int ret; - info = kzalloc(sizeof(struct max8925_rtc_info), GFP_KERNEL); + info = devm_kzalloc(&pdev->dev, sizeof(struct max8925_rtc_info), + GFP_KERNEL); if (!info) return -ENOMEM; info->chip = chip; info->rtc = chip->rtc; info->dev = &pdev->dev; - irq = chip->irq_base + MAX8925_IRQ_RTC_ALARM0; + info->irq = platform_get_irq(pdev, 0); - ret = request_threaded_irq(irq, NULL, rtc_update_handler, - IRQF_ONESHOT, "rtc-alarm0", info); + ret = devm_request_threaded_irq(&pdev->dev, info->irq, NULL, + rtc_update_handler, IRQF_ONESHOT, + "rtc-alarm0", info); if (ret < 0) { dev_err(chip->dev, "Failed to request IRQ: #%d: %d\n", - irq, ret); - goto out_irq; + info->irq, ret); + return ret; } dev_set_drvdata(&pdev->dev, info); @@ -274,33 +277,15 @@ static int __devinit max8925_rtc_probe(struct platform_device *pdev) device_init_wakeup(&pdev->dev, 1); - info->rtc_dev = rtc_device_register("max8925-rtc", &pdev->dev, + info->rtc_dev = devm_rtc_device_register(&pdev->dev, "max8925-rtc", &max8925_rtc_ops, THIS_MODULE); ret = PTR_ERR(info->rtc_dev); if (IS_ERR(info->rtc_dev)) { dev_err(&pdev->dev, "Failed to register RTC device: %d\n", ret); - goto out_rtc; + return ret; } return 0; -out_rtc: - platform_set_drvdata(pdev, NULL); - free_irq(chip->irq_base + MAX8925_IRQ_RTC_ALARM0, info); -out_irq: - kfree(info); - return ret; -} - -static int __devexit max8925_rtc_remove(struct platform_device *pdev) -{ - struct max8925_rtc_info *info = platform_get_drvdata(pdev); - - if (info) { - free_irq(info->chip->irq_base + MAX8925_IRQ_RTC_ALARM0, info); - rtc_device_unregister(info->rtc_dev); - kfree(info); - } - return 0; } #ifdef CONFIG_PM_SLEEP @@ -333,7 +318,6 @@ static struct platform_driver max8925_rtc_driver = { .pm = &max8925_rtc_pm_ops, }, .probe = max8925_rtc_probe, - .remove = __devexit_p(max8925_rtc_remove), }; module_platform_driver(max8925_rtc_driver); |
