Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 100811
b: refs/heads/master
c: 2dba851
h: refs/heads/master
i:
  100809: 49b4f45
  100807: 9293755
v: v3
  • Loading branch information
Russell King authored and Russell King committed May 22, 2008
1 parent dbf03c2 commit 0849775
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 22 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: f70c5253b41444fd2779e1f76bfe25811d9b8c23
refs/heads/master: 2dba8518b7761aee3ba757b298efa15dd34eff18
36 changes: 15 additions & 21 deletions trunk/drivers/rtc/rtc-pl031.c
Original file line number Diff line number Diff line change
Expand Up @@ -12,23 +12,12 @@
* as published by the Free Software Foundation; either version
* 2 of the License, or (at your option) any later version.
*/

#include <linux/platform_device.h>
#include <linux/module.h>
#include <linux/rtc.h>
#include <linux/init.h>
#include <linux/fs.h>
#include <linux/interrupt.h>
#include <linux/string.h>
#include <linux/pm.h>
#include <linux/bitops.h>

#include <linux/amba/bus.h>

#include <asm/io.h>
#include <asm/hardware.h>
#include <asm/irq.h>
#include <asm/rtc.h>
#include <linux/io.h>

/*
* Register definitions
Expand Down Expand Up @@ -142,13 +131,12 @@ static int pl031_remove(struct amba_device *adev)
{
struct pl031_local *ldata = dev_get_drvdata(&adev->dev);

if (ldata) {
dev_set_drvdata(&adev->dev, NULL);
free_irq(adev->irq[0], ldata->rtc);
rtc_device_unregister(ldata->rtc);
iounmap(ldata->base);
kfree(ldata);
}
amba_set_drvdata(adev, NULL);
free_irq(adev->irq[0], ldata->rtc);
rtc_device_unregister(ldata->rtc);
iounmap(ldata->base);
kfree(ldata);
amba_release_regions(adev);

return 0;
}
Expand All @@ -158,13 +146,15 @@ static int pl031_probe(struct amba_device *adev, void *id)
int ret;
struct pl031_local *ldata;

ret = amba_request_regions(adev, NULL);
if (ret)
goto err_req;

ldata = kmalloc(sizeof(struct pl031_local), GFP_KERNEL);
if (!ldata) {
ret = -ENOMEM;
goto out;
}
dev_set_drvdata(&adev->dev, ldata);

ldata->base = ioremap(adev->res.start,
adev->res.end - adev->res.start + 1);
Expand All @@ -173,6 +163,8 @@ static int pl031_probe(struct amba_device *adev, void *id)
goto out_no_remap;
}

amba_set_drvdata(adev, ldata);

if (request_irq(adev->irq[0], pl031_interrupt, IRQF_DISABLED,
"rtc-pl031", ldata->rtc)) {
ret = -EIO;
Expand All @@ -192,10 +184,12 @@ static int pl031_probe(struct amba_device *adev, void *id)
free_irq(adev->irq[0], ldata->rtc);
out_no_irq:
iounmap(ldata->base);
amba_set_drvdata(adev, NULL);
out_no_remap:
dev_set_drvdata(&adev->dev, NULL);
kfree(ldata);
out:
amba_release_regions(adev);
err_req:
return ret;
}

Expand Down

0 comments on commit 0849775

Please sign in to comment.