Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 372257
b: refs/heads/master
c: 08eba5b
h: refs/heads/master
i:
  372255: 6e99acc
v: v3
  • Loading branch information
Magnus Damm authored and Simon Horman committed Mar 18, 2013
1 parent bb42ffe commit 359fa3d
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 29 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: d1b6aecde4ab146d115abcaf3bb1940d8e980b5a
refs/heads/master: 08eba5ba4f321c4b1806ecad0e626904f89263a1
41 changes: 13 additions & 28 deletions trunk/drivers/irqchip/irq-renesas-intc-irqpin.c
Original file line number Diff line number Diff line change
Expand Up @@ -294,7 +294,7 @@ static int intc_irqpin_probe(struct platform_device *pdev)
int ret;
int k;

p = kzalloc(sizeof(*p), GFP_KERNEL);
p = devm_kzalloc(&pdev->dev, sizeof(*p), GFP_KERNEL);
if (!p) {
dev_err(&pdev->dev, "failed to allocate driver data\n");
ret = -ENOMEM;
Expand All @@ -316,7 +316,7 @@ static int intc_irqpin_probe(struct platform_device *pdev)
if (!io[k]) {
dev_err(&pdev->dev, "not enough IOMEM resources\n");
ret = -EINVAL;
goto err1;
goto err0;
}
}

Expand All @@ -334,7 +334,7 @@ static int intc_irqpin_probe(struct platform_device *pdev)
if (p->number_of_irqs < 1) {
dev_err(&pdev->dev, "not enough IRQ resources\n");
ret = -EINVAL;
goto err1;
goto err0;
}

/* ioremap IOMEM and setup read/write callbacks */
Expand All @@ -355,14 +355,15 @@ static int intc_irqpin_probe(struct platform_device *pdev)
default:
dev_err(&pdev->dev, "IOMEM size mismatch\n");
ret = -EINVAL;
goto err2;
goto err0;
}

i->iomem = ioremap_nocache(io[k]->start, resource_size(io[k]));
i->iomem = devm_ioremap_nocache(&pdev->dev, io[k]->start,
resource_size(io[k]));
if (!i->iomem) {
dev_err(&pdev->dev, "failed to remap IOMEM\n");
ret = -ENXIO;
goto err2;
goto err0;
}
}

Expand Down Expand Up @@ -395,17 +396,17 @@ static int intc_irqpin_probe(struct platform_device *pdev)
if (!p->irq_domain) {
ret = -ENXIO;
dev_err(&pdev->dev, "cannot initialize irq domain\n");
goto err2;
goto err0;
}

/* request and set priority on interrupts one by one */
for (k = 0; k < p->number_of_irqs; k++) {
if (request_irq(p->irq[k].requested_irq,
intc_irqpin_irq_handler,
0, name, &p->irq[k])) {
if (devm_request_irq(&pdev->dev, p->irq[k].requested_irq,
intc_irqpin_irq_handler,
0, name, &p->irq[k])) {
dev_err(&pdev->dev, "failed to request low IRQ\n");
ret = -ENOENT;
goto err3;
goto err1;
}
intc_irqpin_mask_unmask_prio(p, k, 0);
}
Expand All @@ -421,34 +422,18 @@ static int intc_irqpin_probe(struct platform_device *pdev)

return 0;

err3:
for (; k >= 0; k--)
free_irq(p->irq[k - 1].requested_irq, &p->irq[k - 1]);

irq_domain_remove(p->irq_domain);
err2:
for (k = 0; k < INTC_IRQPIN_REG_NR; k++)
iounmap(p->iomem[k].iomem);
err1:
kfree(p);
irq_domain_remove(p->irq_domain);
err0:
return ret;
}

static int intc_irqpin_remove(struct platform_device *pdev)
{
struct intc_irqpin_priv *p = platform_get_drvdata(pdev);
int k;

for (k = 0; k < p->number_of_irqs; k++)
free_irq(p->irq[k].requested_irq, &p->irq[k]);

irq_domain_remove(p->irq_domain);

for (k = 0; k < INTC_IRQPIN_REG_NR; k++)
iounmap(p->iomem[k].iomem);

kfree(p);
return 0;
}

Expand Down

0 comments on commit 359fa3d

Please sign in to comment.