Commit 36845f1b authored by Geert Uytterhoeven's avatar Geert Uytterhoeven Committed by Jason Cooper

irqchip: renesas-intc-irqpin: Add helper variable dev = &pdev->dev

Signed-off-by: default avatarGeert Uytterhoeven <geert+renesas@glider.be>
Link: https://lkml.kernel.org/r/1410527720-18061-2-git-send-email-geert+renesas@glider.beSigned-off-by: default avatarJason Cooper <jason@lakedaemon.net>
parent 46eedb90
...@@ -329,7 +329,8 @@ static struct irq_domain_ops intc_irqpin_irq_domain_ops = { ...@@ -329,7 +329,8 @@ static struct irq_domain_ops intc_irqpin_irq_domain_ops = {
static int intc_irqpin_probe(struct platform_device *pdev) static int intc_irqpin_probe(struct platform_device *pdev)
{ {
struct renesas_intc_irqpin_config *pdata = pdev->dev.platform_data; struct device *dev = &pdev->dev;
struct renesas_intc_irqpin_config *pdata = dev->platform_data;
struct intc_irqpin_priv *p; struct intc_irqpin_priv *p;
struct intc_irqpin_iomem *i; struct intc_irqpin_iomem *i;
struct resource *io[INTC_IRQPIN_REG_NR]; struct resource *io[INTC_IRQPIN_REG_NR];
...@@ -337,14 +338,14 @@ static int intc_irqpin_probe(struct platform_device *pdev) ...@@ -337,14 +338,14 @@ static int intc_irqpin_probe(struct platform_device *pdev)
struct irq_chip *irq_chip; struct irq_chip *irq_chip;
void (*enable_fn)(struct irq_data *d); void (*enable_fn)(struct irq_data *d);
void (*disable_fn)(struct irq_data *d); void (*disable_fn)(struct irq_data *d);
const char *name = dev_name(&pdev->dev); const char *name = dev_name(dev);
int ref_irq; int ref_irq;
int ret; int ret;
int k; int k;
p = devm_kzalloc(&pdev->dev, sizeof(*p), GFP_KERNEL); p = devm_kzalloc(dev, sizeof(*p), GFP_KERNEL);
if (!p) { if (!p) {
dev_err(&pdev->dev, "failed to allocate driver data\n"); dev_err(dev, "failed to allocate driver data\n");
ret = -ENOMEM; ret = -ENOMEM;
goto err0; goto err0;
} }
...@@ -353,9 +354,9 @@ static int intc_irqpin_probe(struct platform_device *pdev) ...@@ -353,9 +354,9 @@ static int intc_irqpin_probe(struct platform_device *pdev)
if (pdata) { if (pdata) {
memcpy(&p->config, pdata, sizeof(*pdata)); memcpy(&p->config, pdata, sizeof(*pdata));
} else { } else {
of_property_read_u32(pdev->dev.of_node, "sense-bitfield-width", of_property_read_u32(dev->of_node, "sense-bitfield-width",
&p->config.sense_bitfield_width); &p->config.sense_bitfield_width);
p->config.control_parent = of_property_read_bool(pdev->dev.of_node, p->config.control_parent = of_property_read_bool(dev->of_node,
"control-parent"); "control-parent");
} }
if (!p->config.sense_bitfield_width) if (!p->config.sense_bitfield_width)
...@@ -368,7 +369,7 @@ static int intc_irqpin_probe(struct platform_device *pdev) ...@@ -368,7 +369,7 @@ static int intc_irqpin_probe(struct platform_device *pdev)
for (k = 0; k < INTC_IRQPIN_REG_NR; k++) { for (k = 0; k < INTC_IRQPIN_REG_NR; k++) {
io[k] = platform_get_resource(pdev, IORESOURCE_MEM, k); io[k] = platform_get_resource(pdev, IORESOURCE_MEM, k);
if (!io[k]) { if (!io[k]) {
dev_err(&pdev->dev, "not enough IOMEM resources\n"); dev_err(dev, "not enough IOMEM resources\n");
ret = -EINVAL; ret = -EINVAL;
goto err0; goto err0;
} }
...@@ -386,7 +387,7 @@ static int intc_irqpin_probe(struct platform_device *pdev) ...@@ -386,7 +387,7 @@ static int intc_irqpin_probe(struct platform_device *pdev)
p->number_of_irqs = k; p->number_of_irqs = k;
if (p->number_of_irqs < 1) { if (p->number_of_irqs < 1) {
dev_err(&pdev->dev, "not enough IRQ resources\n"); dev_err(dev, "not enough IRQ resources\n");
ret = -EINVAL; ret = -EINVAL;
goto err0; goto err0;
} }
...@@ -407,15 +408,15 @@ static int intc_irqpin_probe(struct platform_device *pdev) ...@@ -407,15 +408,15 @@ static int intc_irqpin_probe(struct platform_device *pdev)
i->write = intc_irqpin_write32; i->write = intc_irqpin_write32;
break; break;
default: default:
dev_err(&pdev->dev, "IOMEM size mismatch\n"); dev_err(dev, "IOMEM size mismatch\n");
ret = -EINVAL; ret = -EINVAL;
goto err0; goto err0;
} }
i->iomem = devm_ioremap_nocache(&pdev->dev, io[k]->start, i->iomem = devm_ioremap_nocache(dev, io[k]->start,
resource_size(io[k])); resource_size(io[k]));
if (!i->iomem) { if (!i->iomem) {
dev_err(&pdev->dev, "failed to remap IOMEM\n"); dev_err(dev, "failed to remap IOMEM\n");
ret = -ENXIO; ret = -ENXIO;
goto err0; goto err0;
} }
...@@ -457,34 +458,32 @@ static int intc_irqpin_probe(struct platform_device *pdev) ...@@ -457,34 +458,32 @@ static int intc_irqpin_probe(struct platform_device *pdev)
irq_chip->irq_set_type = intc_irqpin_irq_set_type; irq_chip->irq_set_type = intc_irqpin_irq_set_type;
irq_chip->flags = IRQCHIP_SKIP_SET_WAKE | IRQCHIP_MASK_ON_SUSPEND; irq_chip->flags = IRQCHIP_SKIP_SET_WAKE | IRQCHIP_MASK_ON_SUSPEND;
p->irq_domain = irq_domain_add_simple(pdev->dev.of_node, p->irq_domain = irq_domain_add_simple(dev->of_node,
p->number_of_irqs, p->number_of_irqs,
p->config.irq_base, p->config.irq_base,
&intc_irqpin_irq_domain_ops, p); &intc_irqpin_irq_domain_ops, p);
if (!p->irq_domain) { if (!p->irq_domain) {
ret = -ENXIO; ret = -ENXIO;
dev_err(&pdev->dev, "cannot initialize irq domain\n"); dev_err(dev, "cannot initialize irq domain\n");
goto err0; goto err0;
} }
if (p->shared_irqs) { if (p->shared_irqs) {
/* request one shared interrupt */ /* request one shared interrupt */
if (devm_request_irq(&pdev->dev, p->irq[0].requested_irq, if (devm_request_irq(dev, p->irq[0].requested_irq,
intc_irqpin_shared_irq_handler, intc_irqpin_shared_irq_handler,
IRQF_SHARED, name, p)) { IRQF_SHARED, name, p)) {
dev_err(&pdev->dev, "failed to request low IRQ\n"); dev_err(dev, "failed to request low IRQ\n");
ret = -ENOENT; ret = -ENOENT;
goto err1; goto err1;
} }
} else { } else {
/* request interrupts one by one */ /* request interrupts one by one */
for (k = 0; k < p->number_of_irqs; k++) { for (k = 0; k < p->number_of_irqs; k++) {
if (devm_request_irq(&pdev->dev, if (devm_request_irq(dev, p->irq[k].requested_irq,
p->irq[k].requested_irq, intc_irqpin_irq_handler, 0, name,
intc_irqpin_irq_handler, &p->irq[k])) {
0, name, &p->irq[k])) { dev_err(dev, "failed to request low IRQ\n");
dev_err(&pdev->dev,
"failed to request low IRQ\n");
ret = -ENOENT; ret = -ENOENT;
goto err1; goto err1;
} }
...@@ -495,12 +494,12 @@ static int intc_irqpin_probe(struct platform_device *pdev) ...@@ -495,12 +494,12 @@ static int intc_irqpin_probe(struct platform_device *pdev)
for (k = 0; k < p->number_of_irqs; k++) for (k = 0; k < p->number_of_irqs; k++)
intc_irqpin_mask_unmask_prio(p, k, 0); intc_irqpin_mask_unmask_prio(p, k, 0);
dev_info(&pdev->dev, "driving %d irqs\n", p->number_of_irqs); dev_info(dev, "driving %d irqs\n", p->number_of_irqs);
/* warn in case of mismatch if irq base is specified */ /* warn in case of mismatch if irq base is specified */
if (p->config.irq_base) { if (p->config.irq_base) {
if (p->config.irq_base != p->irq[0].domain_irq) if (p->config.irq_base != p->irq[0].domain_irq)
dev_warn(&pdev->dev, "irq base mismatch (%d/%d)\n", dev_warn(dev, "irq base mismatch (%d/%d)\n",
p->config.irq_base, p->irq[0].domain_irq); p->config.irq_base, p->irq[0].domain_irq);
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment