aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/rtc/rtc-max8907.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/rtc/rtc-max8907.c')
-rw-r--r--drivers/rtc/rtc-max8907.c20
1 files changed, 4 insertions, 16 deletions
diff --git a/drivers/rtc/rtc-max8907.c b/drivers/rtc/rtc-max8907.c
index 31ca8faf9f05..86afb797125d 100644
--- a/drivers/rtc/rtc-max8907.c
+++ b/drivers/rtc/rtc-max8907.c
@@ -190,7 +190,7 @@ static int max8907_rtc_probe(struct platform_device *pdev)
190 rtc->max8907 = max8907; 190 rtc->max8907 = max8907;
191 rtc->regmap = max8907->regmap_rtc; 191 rtc->regmap = max8907->regmap_rtc;
192 192
193 rtc->rtc_dev = rtc_device_register("max8907-rtc", &pdev->dev, 193 rtc->rtc_dev = devm_rtc_device_register(&pdev->dev, "max8907-rtc",
194 &max8907_rtc_ops, THIS_MODULE); 194 &max8907_rtc_ops, THIS_MODULE);
195 if (IS_ERR(rtc->rtc_dev)) { 195 if (IS_ERR(rtc->rtc_dev)) {
196 ret = PTR_ERR(rtc->rtc_dev); 196 ret = PTR_ERR(rtc->rtc_dev);
@@ -200,33 +200,21 @@ static int max8907_rtc_probe(struct platform_device *pdev)
200 200
201 rtc->irq = regmap_irq_get_virq(max8907->irqc_rtc, 201 rtc->irq = regmap_irq_get_virq(max8907->irqc_rtc,
202 MAX8907_IRQ_RTC_ALARM0); 202 MAX8907_IRQ_RTC_ALARM0);
203 if (rtc->irq < 0) { 203 if (rtc->irq < 0)
204 ret = rtc->irq; 204 return rtc->irq;
205 goto err_unregister;
206 }
207 205
208 ret = devm_request_threaded_irq(&pdev->dev, rtc->irq, NULL, 206 ret = devm_request_threaded_irq(&pdev->dev, rtc->irq, NULL,
209 max8907_irq_handler, 207 max8907_irq_handler,
210 IRQF_ONESHOT, "max8907-alarm0", rtc); 208 IRQF_ONESHOT, "max8907-alarm0", rtc);
211 if (ret < 0) { 209 if (ret < 0)
212 dev_err(&pdev->dev, "Failed to request IRQ%d: %d\n", 210 dev_err(&pdev->dev, "Failed to request IRQ%d: %d\n",
213 rtc->irq, ret); 211 rtc->irq, ret);
214 goto err_unregister;
215 }
216 212
217 return 0;
218
219err_unregister:
220 rtc_device_unregister(rtc->rtc_dev);
221 return ret; 213 return ret;
222} 214}
223 215
224static int max8907_rtc_remove(struct platform_device *pdev) 216static int max8907_rtc_remove(struct platform_device *pdev)
225{ 217{
226 struct max8907_rtc *rtc = platform_get_drvdata(pdev);
227
228 rtc_device_unregister(rtc->rtc_dev);
229
230 return 0; 218 return 0;
231} 219}
232 220