diff options
Diffstat (limited to 'drivers/rtc/rtc-max8997.c')
| -rw-r--r-- | drivers/rtc/rtc-max8997.c | 17 |
1 files changed, 4 insertions, 13 deletions
diff --git a/drivers/rtc/rtc-max8997.c b/drivers/rtc/rtc-max8997.c index 00e505b6bee3..5693619614f4 100644 --- a/drivers/rtc/rtc-max8997.c +++ b/drivers/rtc/rtc-max8997.c | |||
| @@ -479,8 +479,8 @@ static int max8997_rtc_probe(struct platform_device *pdev) | |||
| 479 | 479 | ||
| 480 | device_init_wakeup(&pdev->dev, 1); | 480 | device_init_wakeup(&pdev->dev, 1); |
| 481 | 481 | ||
| 482 | info->rtc_dev = rtc_device_register("max8997-rtc", &pdev->dev, | 482 | info->rtc_dev = devm_rtc_device_register(&pdev->dev, "max8997-rtc", |
| 483 | &max8997_rtc_ops, THIS_MODULE); | 483 | &max8997_rtc_ops, THIS_MODULE); |
| 484 | 484 | ||
| 485 | if (IS_ERR(info->rtc_dev)) { | 485 | if (IS_ERR(info->rtc_dev)) { |
| 486 | ret = PTR_ERR(info->rtc_dev); | 486 | ret = PTR_ERR(info->rtc_dev); |
| @@ -491,6 +491,7 @@ static int max8997_rtc_probe(struct platform_device *pdev) | |||
| 491 | virq = irq_create_mapping(max8997->irq_domain, MAX8997_PMICIRQ_RTCA1); | 491 | virq = irq_create_mapping(max8997->irq_domain, MAX8997_PMICIRQ_RTCA1); |
| 492 | if (!virq) { | 492 | if (!virq) { |
| 493 | dev_err(&pdev->dev, "Failed to create mapping alarm IRQ\n"); | 493 | dev_err(&pdev->dev, "Failed to create mapping alarm IRQ\n"); |
| 494 | ret = -ENXIO; | ||
| 494 | goto err_out; | 495 | goto err_out; |
| 495 | } | 496 | } |
| 496 | info->virq = virq; | 497 | info->virq = virq; |
| @@ -498,26 +499,16 @@ static int max8997_rtc_probe(struct platform_device *pdev) | |||
| 498 | ret = devm_request_threaded_irq(&pdev->dev, virq, NULL, | 499 | ret = devm_request_threaded_irq(&pdev->dev, virq, NULL, |
| 499 | max8997_rtc_alarm_irq, 0, | 500 | max8997_rtc_alarm_irq, 0, |
| 500 | "rtc-alarm0", info); | 501 | "rtc-alarm0", info); |
| 501 | if (ret < 0) { | 502 | if (ret < 0) |
| 502 | dev_err(&pdev->dev, "Failed to request alarm IRQ: %d: %d\n", | 503 | dev_err(&pdev->dev, "Failed to request alarm IRQ: %d: %d\n", |
| 503 | info->virq, ret); | 504 | info->virq, ret); |
| 504 | goto err_out; | ||
| 505 | } | ||
| 506 | |||
| 507 | return ret; | ||
| 508 | 505 | ||
| 509 | err_out: | 506 | err_out: |
| 510 | rtc_device_unregister(info->rtc_dev); | ||
| 511 | return ret; | 507 | return ret; |
| 512 | } | 508 | } |
| 513 | 509 | ||
| 514 | static int max8997_rtc_remove(struct platform_device *pdev) | 510 | static int max8997_rtc_remove(struct platform_device *pdev) |
| 515 | { | 511 | { |
| 516 | struct max8997_rtc_info *info = platform_get_drvdata(pdev); | ||
| 517 | |||
| 518 | if (info) | ||
| 519 | rtc_device_unregister(info->rtc_dev); | ||
| 520 | |||
| 521 | return 0; | 512 | return 0; |
| 522 | } | 513 | } |
| 523 | 514 | ||
