diff options
author | Guodong Xu <guodong.xu@linaro.org> | 2013-11-29 13:40:46 +0800 |
---|---|---|
committer | Guodong Xu <guodong.xu@linaro.org> | 2013-12-06 20:09:53 +0800 |
commit | 879368b7cae2a779123962b90f9ef8cc8defb38f (patch) | |
tree | 5991e6771830bb3762f066613ec6f18d264b615b | |
parent | f0dab2d3703ef82b8503971d83d5da49c6793333 (diff) |
rtc: rtc-hi6421: rtc_device_register should be called before devm_request_irq
info->rtc and info->pmic are used in hi6421_rtc_handler. They need to be
initialized before devm_request_irq is called.
Use devm_ version of 'rtc_device_register'
Signed-off-by: Guodong Xu <guodong.xu@linaro.org>
-rw-r--r-- | drivers/rtc/rtc-hi6421.c | 18 |
1 files changed, 8 insertions, 10 deletions
diff --git a/drivers/rtc/rtc-hi6421.c b/drivers/rtc/rtc-hi6421.c index 14e27b96e0ef..50ec3911861b 100644 --- a/drivers/rtc/rtc-hi6421.c +++ b/drivers/rtc/rtc-hi6421.c @@ -214,29 +214,27 @@ static int hi6421_rtc_probe(struct platform_device *pdev) if (info->irq < 0) return -ENOENT; - ret = devm_request_irq(&pdev->dev, info->irq, hi6421_rtc_handler, - IRQF_DISABLED, "alarm", info); - if (ret < 0) - return ret; info->pmic = dev_get_drvdata(pdev->dev.parent); platform_set_drvdata(pdev, info); /* enable RTC device */ hi6421_pmic_write(info->pmic, REG_RTCCTRL, 1); - info->rtc = rtc_device_register(pdev->name, &pdev->dev, - &hi6421_rtc_ops, - THIS_MODULE); + info->rtc = devm_rtc_device_register(&pdev->dev, pdev->name, + &hi6421_rtc_ops, THIS_MODULE); if (IS_ERR(info->rtc)) return PTR_ERR(info->rtc); + + ret = devm_request_irq(&pdev->dev, info->irq, hi6421_rtc_handler, + IRQF_DISABLED, "alarm", info); + if (ret < 0) + return ret; + return 0; } static int hi6421_rtc_remove(struct platform_device *pdev) { - struct hi6421_rtc_info *info = platform_get_drvdata(pdev); - - rtc_device_unregister(info->rtc); return 0; } |