Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 126367
b: refs/heads/master
c: 0417ce2
h: refs/heads/master
i:
  126365: b7291b1
  126363: 307a4a6
  126359: 546ebe2
  126351: 84e4df2
  126335: 7c9003f
v: v3
  • Loading branch information
Alessandro Zummo authored and Linus Torvalds committed Jan 6, 2009
1 parent 54ed64c commit 60dda74
Show file tree
Hide file tree
Showing 2 changed files with 24 additions and 28 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: dc9443688e76733e43eebe8d6f31cc6dc34ccda9
refs/heads/master: 0417ce2ad81f719c72e948705134c3d502300d4f
50 changes: 23 additions & 27 deletions trunk/drivers/rtc/rtc-pxa.c
Original file line number Diff line number Diff line change
Expand Up @@ -19,13 +19,13 @@
*
*/

#include <linux/init.h>
#include <linux/platform_device.h>
#include <linux/module.h>
#include <linux/rtc.h>
#include <linux/seq_file.h>
#include <linux/interrupt.h>

#include <asm/io.h>
#include <linux/io.h>

#define TIMER_FREQ CLOCK_TICK_RATE
#define RTC_DEF_DIVIDER (32768 - 1)
Expand Down Expand Up @@ -347,17 +347,19 @@ static const struct rtc_class_ops pxa_rtc_ops = {
.irq_set_freq = pxa_periodic_irq_set_freq,
};

static int __devinit pxa_rtc_probe(struct platform_device *pdev)
static int __init pxa_rtc_probe(struct platform_device *pdev)
{
struct device *dev = &pdev->dev;
struct pxa_rtc *pxa_rtc;
int ret;
u32 rttr;

ret = -ENOMEM;
pxa_rtc = kzalloc(sizeof(struct pxa_rtc), GFP_KERNEL);
if (!pxa_rtc)
goto err_alloc;
return -ENOMEM;

spin_lock_init(&pxa_rtc->lock);
platform_set_drvdata(pdev, pxa_rtc);

ret = -ENXIO;
pxa_rtc->ress = platform_get_resource(pdev, IORESOURCE_MEM, 0);
Expand All @@ -377,20 +379,9 @@ static int __devinit pxa_rtc_probe(struct platform_device *pdev)
goto err_ress;
}

pxa_rtc->rtc = rtc_device_register(pdev->name, &pdev->dev, &pxa_rtc_ops,
THIS_MODULE);
ret = PTR_ERR(pxa_rtc->rtc);
if (IS_ERR(pxa_rtc->rtc)) {
dev_err(dev, "Failed to register RTC device -> %d\n", ret);
goto err_rtc_reg;
}

spin_lock_init(&pxa_rtc->lock);
platform_set_drvdata(pdev, pxa_rtc);

ret = -ENOMEM;
pxa_rtc->base = ioremap(pxa_rtc->ress->start,
pxa_rtc->ress->end - pxa_rtc->ress->start + 1);
resource_size(pxa_rtc->ress));
if (!pxa_rtc->base) {
dev_err(&pdev->dev, "Unable to map pxa RTC I/O memory\n");
goto err_map;
Expand All @@ -408,31 +399,37 @@ static int __devinit pxa_rtc_probe(struct platform_device *pdev)
}

rtsr_clear_bits(pxa_rtc, RTSR_PIALE | RTSR_RDALE1 | RTSR_HZE);

pxa_rtc->rtc = rtc_device_register("pxa-rtc", &pdev->dev, &pxa_rtc_ops,
THIS_MODULE);
ret = PTR_ERR(pxa_rtc->rtc);
if (IS_ERR(pxa_rtc->rtc)) {
dev_err(dev, "Failed to register RTC device -> %d\n", ret);
goto err_rtc_reg;
}

device_init_wakeup(dev, 1);

return 0;

err_map:
platform_set_drvdata(pdev, NULL);
rtc_device_unregister(pxa_rtc->rtc);
err_rtc_reg:
iounmap(pxa_rtc->base);
err_ress:
err_map:
kfree(pxa_rtc);
err_alloc:
return ret;
}

static int __devexit pxa_rtc_remove(struct platform_device *pdev)
static int __exit pxa_rtc_remove(struct platform_device *pdev)
{
struct pxa_rtc *pxa_rtc = platform_get_drvdata(pdev);

rtc_device_unregister(pxa_rtc->rtc);

spin_lock_irq(&pxa_rtc->lock);
iounmap(pxa_rtc->base);
pxa_rtc->base = NULL;
platform_set_drvdata(pdev, NULL);
spin_unlock_irq(&pxa_rtc->lock);

rtc_device_unregister(pxa_rtc->rtc);
kfree(pxa_rtc);

return 0;
Expand Down Expand Up @@ -462,7 +459,6 @@ static int pxa_rtc_resume(struct platform_device *pdev)
#endif

static struct platform_driver pxa_rtc_driver = {
.probe = pxa_rtc_probe,
.remove = __exit_p(pxa_rtc_remove),
.suspend = pxa_rtc_suspend,
.resume = pxa_rtc_resume,
Expand All @@ -474,7 +470,7 @@ static struct platform_driver pxa_rtc_driver = {
static int __init pxa_rtc_init(void)
{
if (cpu_is_pxa27x() || cpu_is_pxa3xx())
return platform_driver_register(&pxa_rtc_driver);
return platform_driver_probe(&pxa_rtc_driver, pxa_rtc_probe);

return -ENODEV;
}
Expand Down

0 comments on commit 60dda74

Please sign in to comment.