aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/rtc/rtc-wm831x.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/rtc/rtc-wm831x.c')
-rw-r--r--drivers/rtc/rtc-wm831x.c36
1 files changed, 2 insertions, 34 deletions
diff --git a/drivers/rtc/rtc-wm831x.c b/drivers/rtc/rtc-wm831x.c
index bdc909bd56da..3b6e6a67e765 100644
--- a/drivers/rtc/rtc-wm831x.c
+++ b/drivers/rtc/rtc-wm831x.c
@@ -324,15 +324,6 @@ static irqreturn_t wm831x_alm_irq(int irq, void *data)
324 return IRQ_HANDLED; 324 return IRQ_HANDLED;
325} 325}
326 326
327static irqreturn_t wm831x_per_irq(int irq, void *data)
328{
329 struct wm831x_rtc *wm831x_rtc = data;
330
331 rtc_update_irq(wm831x_rtc->rtc, 1, RTC_IRQF | RTC_UF);
332
333 return IRQ_HANDLED;
334}
335
336static const struct rtc_class_ops wm831x_rtc_ops = { 327static const struct rtc_class_ops wm831x_rtc_ops = {
337 .read_time = wm831x_rtc_readtime, 328 .read_time = wm831x_rtc_readtime,
338 .set_mmss = wm831x_rtc_set_mmss, 329 .set_mmss = wm831x_rtc_set_mmss,
@@ -405,11 +396,10 @@ static int wm831x_rtc_probe(struct platform_device *pdev)
405{ 396{
406 struct wm831x *wm831x = dev_get_drvdata(pdev->dev.parent); 397 struct wm831x *wm831x = dev_get_drvdata(pdev->dev.parent);
407 struct wm831x_rtc *wm831x_rtc; 398 struct wm831x_rtc *wm831x_rtc;
408 int per_irq = platform_get_irq_byname(pdev, "PER");
409 int alm_irq = platform_get_irq_byname(pdev, "ALM"); 399 int alm_irq = platform_get_irq_byname(pdev, "ALM");
410 int ret = 0; 400 int ret = 0;
411 401
412 wm831x_rtc = kzalloc(sizeof(*wm831x_rtc), GFP_KERNEL); 402 wm831x_rtc = devm_kzalloc(&pdev->dev, sizeof(*wm831x_rtc), GFP_KERNEL);
413 if (wm831x_rtc == NULL) 403 if (wm831x_rtc == NULL)
414 return -ENOMEM; 404 return -ENOMEM;
415 405
@@ -433,14 +423,6 @@ static int wm831x_rtc_probe(struct platform_device *pdev)
433 goto err; 423 goto err;
434 } 424 }
435 425
436 ret = request_threaded_irq(per_irq, NULL, wm831x_per_irq,
437 IRQF_TRIGGER_RISING, "RTC period",
438 wm831x_rtc);
439 if (ret != 0) {
440 dev_err(&pdev->dev, "Failed to request periodic IRQ %d: %d\n",
441 per_irq, ret);
442 }
443
444 ret = request_threaded_irq(alm_irq, NULL, wm831x_alm_irq, 426 ret = request_threaded_irq(alm_irq, NULL, wm831x_alm_irq,
445 IRQF_TRIGGER_RISING, "RTC alarm", 427 IRQF_TRIGGER_RISING, "RTC alarm",
446 wm831x_rtc); 428 wm831x_rtc);
@@ -452,20 +434,16 @@ static int wm831x_rtc_probe(struct platform_device *pdev)
452 return 0; 434 return 0;
453 435
454err: 436err:
455 kfree(wm831x_rtc);
456 return ret; 437 return ret;
457} 438}
458 439
459static int __devexit wm831x_rtc_remove(struct platform_device *pdev) 440static int __devexit wm831x_rtc_remove(struct platform_device *pdev)
460{ 441{
461 struct wm831x_rtc *wm831x_rtc = platform_get_drvdata(pdev); 442 struct wm831x_rtc *wm831x_rtc = platform_get_drvdata(pdev);
462 int per_irq = platform_get_irq_byname(pdev, "PER");
463 int alm_irq = platform_get_irq_byname(pdev, "ALM"); 443 int alm_irq = platform_get_irq_byname(pdev, "ALM");
464 444
465 free_irq(alm_irq, wm831x_rtc); 445 free_irq(alm_irq, wm831x_rtc);
466 free_irq(per_irq, wm831x_rtc);
467 rtc_device_unregister(wm831x_rtc->rtc); 446 rtc_device_unregister(wm831x_rtc->rtc);
468 kfree(wm831x_rtc);
469 447
470 return 0; 448 return 0;
471} 449}
@@ -490,17 +468,7 @@ static struct platform_driver wm831x_rtc_driver = {
490 }, 468 },
491}; 469};
492 470
493static int __init wm831x_rtc_init(void) 471module_platform_driver(wm831x_rtc_driver);
494{
495 return platform_driver_register(&wm831x_rtc_driver);
496}
497module_init(wm831x_rtc_init);
498
499static void __exit wm831x_rtc_exit(void)
500{
501 platform_driver_unregister(&wm831x_rtc_driver);
502}
503module_exit(wm831x_rtc_exit);
504 472
505MODULE_AUTHOR("Mark Brown <broonie@opensource.wolfsonmicro.com>"); 473MODULE_AUTHOR("Mark Brown <broonie@opensource.wolfsonmicro.com>");
506MODULE_DESCRIPTION("RTC driver for the WM831x series PMICs"); 474MODULE_DESCRIPTION("RTC driver for the WM831x series PMICs");