diff options
| -rw-r--r-- | drivers/rtc/rtc-s3c.c | 67 |
1 files changed, 25 insertions, 42 deletions
diff --git a/drivers/rtc/rtc-s3c.c b/drivers/rtc/rtc-s3c.c index 067207afc086..4e7c04e773e0 100644 --- a/drivers/rtc/rtc-s3c.c +++ b/drivers/rtc/rtc-s3c.c | |||
| @@ -319,49 +319,7 @@ static int s3c_rtc_proc(struct device *dev, struct seq_file *seq) | |||
| 319 | return 0; | 319 | return 0; |
| 320 | } | 320 | } |
| 321 | 321 | ||
| 322 | static int s3c_rtc_open(struct device *dev) | ||
| 323 | { | ||
| 324 | struct platform_device *pdev = to_platform_device(dev); | ||
| 325 | struct rtc_device *rtc_dev = platform_get_drvdata(pdev); | ||
| 326 | int ret; | ||
| 327 | |||
| 328 | ret = request_irq(s3c_rtc_alarmno, s3c_rtc_alarmirq, | ||
| 329 | IRQF_DISABLED, "s3c2410-rtc alarm", rtc_dev); | ||
| 330 | |||
| 331 | if (ret) { | ||
| 332 | dev_err(dev, "IRQ%d error %d\n", s3c_rtc_alarmno, ret); | ||
| 333 | return ret; | ||
| 334 | } | ||
| 335 | |||
| 336 | ret = request_irq(s3c_rtc_tickno, s3c_rtc_tickirq, | ||
| 337 | IRQF_DISABLED, "s3c2410-rtc tick", rtc_dev); | ||
| 338 | |||
| 339 | if (ret) { | ||
| 340 | dev_err(dev, "IRQ%d error %d\n", s3c_rtc_tickno, ret); | ||
| 341 | goto tick_err; | ||
| 342 | } | ||
| 343 | |||
| 344 | return ret; | ||
| 345 | |||
| 346 | tick_err: | ||
| 347 | free_irq(s3c_rtc_alarmno, rtc_dev); | ||
| 348 | return ret; | ||
| 349 | } | ||
| 350 | |||
| 351 | static void s3c_rtc_release(struct device *dev) | ||
| 352 | { | ||
| 353 | struct platform_device *pdev = to_platform_device(dev); | ||
| 354 | struct rtc_device *rtc_dev = platform_get_drvdata(pdev); | ||
| 355 | |||
| 356 | /* do not clear AIE here, it may be needed for wake */ | ||
| 357 | |||
| 358 | free_irq(s3c_rtc_alarmno, rtc_dev); | ||
| 359 | free_irq(s3c_rtc_tickno, rtc_dev); | ||
| 360 | } | ||
| 361 | |||
| 362 | static const struct rtc_class_ops s3c_rtcops = { | 322 | static const struct rtc_class_ops s3c_rtcops = { |
| 363 | .open = s3c_rtc_open, | ||
| 364 | .release = s3c_rtc_release, | ||
| 365 | .read_time = s3c_rtc_gettime, | 323 | .read_time = s3c_rtc_gettime, |
| 366 | .set_time = s3c_rtc_settime, | 324 | .set_time = s3c_rtc_settime, |
| 367 | .read_alarm = s3c_rtc_getalarm, | 325 | .read_alarm = s3c_rtc_getalarm, |
| @@ -425,6 +383,9 @@ static int __devexit s3c_rtc_remove(struct platform_device *dev) | |||
| 425 | { | 383 | { |
| 426 | struct rtc_device *rtc = platform_get_drvdata(dev); | 384 | struct rtc_device *rtc = platform_get_drvdata(dev); |
| 427 | 385 | ||
| 386 | free_irq(s3c_rtc_alarmno, rtc); | ||
| 387 | free_irq(s3c_rtc_tickno, rtc); | ||
| 388 | |||
| 428 | platform_set_drvdata(dev, NULL); | 389 | platform_set_drvdata(dev, NULL); |
| 429 | rtc_device_unregister(rtc); | 390 | rtc_device_unregister(rtc); |
| 430 | 391 | ||
| @@ -548,10 +509,32 @@ static int __devinit s3c_rtc_probe(struct platform_device *pdev) | |||
| 548 | 509 | ||
| 549 | s3c_rtc_setfreq(&pdev->dev, 1); | 510 | s3c_rtc_setfreq(&pdev->dev, 1); |
| 550 | 511 | ||
| 512 | ret = request_irq(s3c_rtc_alarmno, s3c_rtc_alarmirq, | ||
| 513 | IRQF_DISABLED, "s3c2410-rtc alarm", rtc); | ||
| 514 | if (ret) { | ||
| 515 | dev_err(&pdev->dev, "IRQ%d error %d\n", s3c_rtc_alarmno, ret); | ||
| 516 | goto err_alarm_irq; | ||
| 517 | } | ||
| 518 | |||
| 519 | ret = request_irq(s3c_rtc_tickno, s3c_rtc_tickirq, | ||
| 520 | IRQF_DISABLED, "s3c2410-rtc tick", rtc); | ||
| 521 | if (ret) { | ||
| 522 | dev_err(&pdev->dev, "IRQ%d error %d\n", s3c_rtc_tickno, ret); | ||
| 523 | free_irq(s3c_rtc_alarmno, rtc); | ||
| 524 | goto err_tick_irq; | ||
| 525 | } | ||
| 526 | |||
| 551 | clk_disable(rtc_clk); | 527 | clk_disable(rtc_clk); |
| 552 | 528 | ||
| 553 | return 0; | 529 | return 0; |
| 554 | 530 | ||
| 531 | err_tick_irq: | ||
| 532 | free_irq(s3c_rtc_alarmno, rtc); | ||
| 533 | |||
| 534 | err_alarm_irq: | ||
| 535 | platform_set_drvdata(pdev, NULL); | ||
| 536 | rtc_device_unregister(rtc); | ||
| 537 | |||
| 555 | err_nortc: | 538 | err_nortc: |
| 556 | s3c_rtc_enable(pdev, 0); | 539 | s3c_rtc_enable(pdev, 0); |
| 557 | clk_disable(rtc_clk); | 540 | clk_disable(rtc_clk); |
