aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/rtc/rtc-at91rm9200.c
diff options
context:
space:
mode:
authorLinus Torvalds <torvalds@linux-foundation.org>2013-11-13 01:45:43 -0500
committerLinus Torvalds <torvalds@linux-foundation.org>2013-11-13 01:45:43 -0500
commit5cbb3d216e2041700231bcfc383ee5f8b7fc8b74 (patch)
treea738fa82dbcefa9bd283c08bc67f38827be63937 /drivers/rtc/rtc-at91rm9200.c
parent9bc9ccd7db1c9f043f75380b5a5b94912046a60e (diff)
parent4e9b45a19241354daec281d7a785739829b52359 (diff)
Merge branch 'akpm' (patches from Andrew Morton)
Merge first patch-bomb from Andrew Morton: "Quite a lot of other stuff is banked up awaiting further next->mainline merging, but this batch contains: - Lots of random misc patches - OCFS2 - Most of MM - backlight updates - lib/ updates - printk updates - checkpatch updates - epoll tweaking - rtc updates - hfs - hfsplus - documentation - procfs - update gcov to gcc-4.7 format - IPC" * emailed patches from Andrew Morton <akpm@linux-foundation.org>: (269 commits) ipc, msg: fix message length check for negative values ipc/util.c: remove unnecessary work pending test devpts: plug the memory leak in kill_sb ./Makefile: export initial ramdisk compression config option init/Kconfig: add option to disable kernel compression drivers: w1: make w1_slave::flags long to avoid memory corruption drivers/w1/masters/ds1wm.cuse dev_get_platdata() drivers/memstick/core/ms_block.c: fix unreachable state in h_msb_read_page() drivers/memstick/core/mspro_block.c: fix attributes array allocation drivers/pps/clients/pps-gpio.c: remove redundant of_match_ptr kernel/panic.c: reduce 1 byte usage for print tainted buffer gcov: reuse kbasename helper kernel/gcov/fs.c: use pr_warn() kernel/module.c: use pr_foo() gcov: compile specific gcov implementation based on gcc version gcov: add support for gcc 4.7 gcov format gcov: move gcov structs definitions to a gcc version specific file kernel/taskstats.c: return -ENOMEM when alloc memory fails in add_del_listener() kernel/taskstats.c: add nla_nest_cancel() for failure processing between nla_nest_start() and nla_nest_end() kernel/sysctl_binary.c: use scnprintf() instead of snprintf() ...
Diffstat (limited to 'drivers/rtc/rtc-at91rm9200.c')
-rw-r--r--drivers/rtc/rtc-at91rm9200.c28
1 files changed, 7 insertions, 21 deletions
diff --git a/drivers/rtc/rtc-at91rm9200.c b/drivers/rtc/rtc-at91rm9200.c
index 741892632ae0..8b2cd8a5a2ff 100644
--- a/drivers/rtc/rtc-at91rm9200.c
+++ b/drivers/rtc/rtc-at91rm9200.c
@@ -376,7 +376,8 @@ static int __init at91_rtc_probe(struct platform_device *pdev)
376 return -ENXIO; 376 return -ENXIO;
377 } 377 }
378 378
379 at91_rtc_regs = ioremap(regs->start, resource_size(regs)); 379 at91_rtc_regs = devm_ioremap(&pdev->dev, regs->start,
380 resource_size(regs));
380 if (!at91_rtc_regs) { 381 if (!at91_rtc_regs) {
381 dev_err(&pdev->dev, "failed to map registers, aborting.\n"); 382 dev_err(&pdev->dev, "failed to map registers, aborting.\n");
382 return -ENOMEM; 383 return -ENOMEM;
@@ -390,12 +391,12 @@ static int __init at91_rtc_probe(struct platform_device *pdev)
390 AT91_RTC_SECEV | AT91_RTC_TIMEV | 391 AT91_RTC_SECEV | AT91_RTC_TIMEV |
391 AT91_RTC_CALEV); 392 AT91_RTC_CALEV);
392 393
393 ret = request_irq(irq, at91_rtc_interrupt, 394 ret = devm_request_irq(&pdev->dev, irq, at91_rtc_interrupt,
394 IRQF_SHARED, 395 IRQF_SHARED,
395 "at91_rtc", pdev); 396 "at91_rtc", pdev);
396 if (ret) { 397 if (ret) {
397 dev_err(&pdev->dev, "IRQ %d already in use.\n", irq); 398 dev_err(&pdev->dev, "IRQ %d already in use.\n", irq);
398 goto err_unmap; 399 return ret;
399 } 400 }
400 401
401 /* cpu init code should really have flagged this device as 402 /* cpu init code should really have flagged this device as
@@ -404,23 +405,14 @@ static int __init at91_rtc_probe(struct platform_device *pdev)
404 if (!device_can_wakeup(&pdev->dev)) 405 if (!device_can_wakeup(&pdev->dev))
405 device_init_wakeup(&pdev->dev, 1); 406 device_init_wakeup(&pdev->dev, 1);
406 407
407 rtc = rtc_device_register(pdev->name, &pdev->dev, 408 rtc = devm_rtc_device_register(&pdev->dev, pdev->name,
408 &at91_rtc_ops, THIS_MODULE); 409 &at91_rtc_ops, THIS_MODULE);
409 if (IS_ERR(rtc)) { 410 if (IS_ERR(rtc))
410 ret = PTR_ERR(rtc); 411 return PTR_ERR(rtc);
411 goto err_free_irq;
412 }
413 platform_set_drvdata(pdev, rtc); 412 platform_set_drvdata(pdev, rtc);
414 413
415 dev_info(&pdev->dev, "AT91 Real Time Clock driver.\n"); 414 dev_info(&pdev->dev, "AT91 Real Time Clock driver.\n");
416 return 0; 415 return 0;
417
418err_free_irq:
419 free_irq(irq, pdev);
420err_unmap:
421 iounmap(at91_rtc_regs);
422
423 return ret;
424} 416}
425 417
426/* 418/*
@@ -428,16 +420,10 @@ err_unmap:
428 */ 420 */
429static int __exit at91_rtc_remove(struct platform_device *pdev) 421static int __exit at91_rtc_remove(struct platform_device *pdev)
430{ 422{
431 struct rtc_device *rtc = platform_get_drvdata(pdev);
432
433 /* Disable all interrupts */ 423 /* Disable all interrupts */
434 at91_rtc_write_idr(AT91_RTC_ACKUPD | AT91_RTC_ALARM | 424 at91_rtc_write_idr(AT91_RTC_ACKUPD | AT91_RTC_ALARM |
435 AT91_RTC_SECEV | AT91_RTC_TIMEV | 425 AT91_RTC_SECEV | AT91_RTC_TIMEV |
436 AT91_RTC_CALEV); 426 AT91_RTC_CALEV);
437 free_irq(irq, pdev);
438
439 rtc_device_unregister(rtc);
440 iounmap(at91_rtc_regs);
441 427
442 return 0; 428 return 0;
443} 429}