summaryrefslogtreecommitdiff
path: root/drivers/w1
diff options
context:
space:
mode:
authorLily Zhang <r58066@freescale.com>2009-10-12 16:01:07 +0800
committerAlejandro Gonzalez <alex.gonzalez@digi.com>2010-02-12 17:19:21 +0100
commitb5583f017b320a53e91b6ccfd50b9ce5a729ea19 (patch)
tree4c7a1c773ab5ece4fc6af219023747bfed982d7c /drivers/w1
parentcaa67437381721e598f7e64f1e91f5a2e932213a (diff)
ENGR00116779 OneWire: Clear the information when removing the module
1.When inserting OneWire module at the second time, the error is reported. This is because irq information isnot cleaned when removing the module. 2. Correct error handling in probe function. Signed-off-by: Lily Zhang <r58066@freescale.com>
Diffstat (limited to 'drivers/w1')
-rw-r--r--drivers/w1/masters/mxc_w1.c12
1 files changed, 12 insertions, 0 deletions
diff --git a/drivers/w1/masters/mxc_w1.c b/drivers/w1/masters/mxc_w1.c
index e73d6d20a9fb..0d51b737ea78 100644
--- a/drivers/w1/masters/mxc_w1.c
+++ b/drivers/w1/masters/mxc_w1.c
@@ -296,6 +296,10 @@ static int __init mxc_w1_probe(struct platform_device *pdev)
mdev->bus_master.read_byte = &mxc_w1_ds2_read_byte;
mdev->bus_master.search = &search_ROM_accelerator;
irq = platform_get_irq(pdev, 0);
+ if (irq < 0) {
+ err = -ENOENT;
+ goto failed_irq;
+ }
err = request_irq(irq, w1_interrupt_handler, 0, "mxc_w1", mdev);
if (err) {
pr_debug("OWire:request_irq(%d) returned error %d\n",
@@ -333,6 +337,9 @@ static int mxc_w1_remove(struct platform_device *pdev)
{
struct mxc_w1_device *mdev = platform_get_drvdata(pdev);
struct resource *res;
+ struct mxc_w1_config *data =
+ (struct mxc_w1_config *)pdev->dev.platform_data;
+ int irq;
res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
@@ -340,6 +347,11 @@ static int mxc_w1_remove(struct platform_device *pdev)
iounmap(mdev->regs);
release_mem_region(res->start, resource_size(res));
+
+ irq = platform_get_irq(pdev, 0);
+ if ((irq >= 0) && (data->search_rom_accelerator))
+ free_irq(irq, mdev);
+
clk_disable(mdev->clk);
clk_put(mdev->clk);