diff options
Diffstat (limited to 'drivers/rtc/rtc-mc13783.c')
| -rw-r--r-- | drivers/rtc/rtc-mc13783.c | 24 |
1 files changed, 14 insertions, 10 deletions
diff --git a/drivers/rtc/rtc-mc13783.c b/drivers/rtc/rtc-mc13783.c index d60c81b7b693..675bfb515367 100644 --- a/drivers/rtc/rtc-mc13783.c +++ b/drivers/rtc/rtc-mc13783.c | |||
| @@ -13,6 +13,7 @@ | |||
| 13 | #include <linux/platform_device.h> | 13 | #include <linux/platform_device.h> |
| 14 | #include <linux/kernel.h> | 14 | #include <linux/kernel.h> |
| 15 | #include <linux/module.h> | 15 | #include <linux/module.h> |
| 16 | #include <linux/slab.h> | ||
| 16 | #include <linux/rtc.h> | 17 | #include <linux/rtc.h> |
| 17 | 18 | ||
| 18 | #define DRIVER_NAME "mc13783-rtc" | 19 | #define DRIVER_NAME "mc13783-rtc" |
| @@ -319,35 +320,38 @@ static int __devinit mc13783_rtc_probe(struct platform_device *pdev) | |||
| 319 | { | 320 | { |
| 320 | int ret; | 321 | int ret; |
| 321 | struct mc13783_rtc *priv; | 322 | struct mc13783_rtc *priv; |
| 323 | struct mc13783 *mc13783; | ||
| 322 | int rtcrst_pending; | 324 | int rtcrst_pending; |
| 323 | 325 | ||
| 324 | priv = kzalloc(sizeof(*priv), GFP_KERNEL); | 326 | priv = kzalloc(sizeof(*priv), GFP_KERNEL); |
| 325 | if (!priv) | 327 | if (!priv) |
| 326 | return -ENOMEM; | 328 | return -ENOMEM; |
| 327 | 329 | ||
| 328 | priv->mc13783 = dev_get_drvdata(pdev->dev.parent); | 330 | mc13783 = dev_get_drvdata(pdev->dev.parent); |
| 331 | priv->mc13783 = mc13783; | ||
| 332 | |||
| 329 | platform_set_drvdata(pdev, priv); | 333 | platform_set_drvdata(pdev, priv); |
| 330 | 334 | ||
| 331 | mc13783_lock(priv->mc13783); | 335 | mc13783_lock(mc13783); |
| 332 | 336 | ||
| 333 | ret = mc13783_irq_request(priv->mc13783, MC13783_IRQ_RTCRST, | 337 | ret = mc13783_irq_request(mc13783, MC13783_IRQ_RTCRST, |
| 334 | mc13783_rtc_reset_handler, DRIVER_NAME, priv); | 338 | mc13783_rtc_reset_handler, DRIVER_NAME, priv); |
| 335 | if (ret) | 339 | if (ret) |
| 336 | goto err_reset_irq_request; | 340 | goto err_reset_irq_request; |
| 337 | 341 | ||
| 338 | ret = mc13783_irq_status(priv->mc13783, MC13783_IRQ_RTCRST, | 342 | ret = mc13783_irq_status(mc13783, MC13783_IRQ_RTCRST, |
| 339 | NULL, &rtcrst_pending); | 343 | NULL, &rtcrst_pending); |
| 340 | if (ret) | 344 | if (ret) |
| 341 | goto err_reset_irq_status; | 345 | goto err_reset_irq_status; |
| 342 | 346 | ||
| 343 | priv->valid = !rtcrst_pending; | 347 | priv->valid = !rtcrst_pending; |
| 344 | 348 | ||
| 345 | ret = mc13783_irq_request_nounmask(priv->mc13783, MC13783_IRQ_1HZ, | 349 | ret = mc13783_irq_request_nounmask(mc13783, MC13783_IRQ_1HZ, |
| 346 | mc13783_rtc_update_handler, DRIVER_NAME, priv); | 350 | mc13783_rtc_update_handler, DRIVER_NAME, priv); |
| 347 | if (ret) | 351 | if (ret) |
| 348 | goto err_update_irq_request; | 352 | goto err_update_irq_request; |
| 349 | 353 | ||
| 350 | ret = mc13783_irq_request_nounmask(priv->mc13783, MC13783_IRQ_TODA, | 354 | ret = mc13783_irq_request_nounmask(mc13783, MC13783_IRQ_TODA, |
| 351 | mc13783_rtc_alarm_handler, DRIVER_NAME, priv); | 355 | mc13783_rtc_alarm_handler, DRIVER_NAME, priv); |
| 352 | if (ret) | 356 | if (ret) |
| 353 | goto err_alarm_irq_request; | 357 | goto err_alarm_irq_request; |
| @@ -357,22 +361,22 @@ static int __devinit mc13783_rtc_probe(struct platform_device *pdev) | |||
| 357 | if (IS_ERR(priv->rtc)) { | 361 | if (IS_ERR(priv->rtc)) { |
| 358 | ret = PTR_ERR(priv->rtc); | 362 | ret = PTR_ERR(priv->rtc); |
| 359 | 363 | ||
| 360 | mc13783_irq_free(priv->mc13783, MC13783_IRQ_TODA, priv); | 364 | mc13783_irq_free(mc13783, MC13783_IRQ_TODA, priv); |
| 361 | err_alarm_irq_request: | 365 | err_alarm_irq_request: |
| 362 | 366 | ||
| 363 | mc13783_irq_free(priv->mc13783, MC13783_IRQ_1HZ, priv); | 367 | mc13783_irq_free(mc13783, MC13783_IRQ_1HZ, priv); |
| 364 | err_update_irq_request: | 368 | err_update_irq_request: |
| 365 | 369 | ||
| 366 | err_reset_irq_status: | 370 | err_reset_irq_status: |
| 367 | 371 | ||
| 368 | mc13783_irq_free(priv->mc13783, MC13783_IRQ_RTCRST, priv); | 372 | mc13783_irq_free(mc13783, MC13783_IRQ_RTCRST, priv); |
| 369 | err_reset_irq_request: | 373 | err_reset_irq_request: |
| 370 | 374 | ||
| 371 | platform_set_drvdata(pdev, NULL); | 375 | platform_set_drvdata(pdev, NULL); |
| 372 | kfree(priv); | 376 | kfree(priv); |
| 373 | } | 377 | } |
| 374 | 378 | ||
| 375 | mc13783_unlock(priv->mc13783); | 379 | mc13783_unlock(mc13783); |
| 376 | 380 | ||
| 377 | return ret; | 381 | return ret; |
| 378 | } | 382 | } |
