aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/irqchip
diff options
context:
space:
mode:
authorGeert Uytterhoeven <geert+renesas@glider.be>2014-09-12 09:15:17 -0400
committerJason Cooper <jason@lakedaemon.net>2014-09-14 02:47:31 -0400
commit36845f1b54edc3237626d48270bbf3bc26d45f4f (patch)
treee9ced178ab828151925b73a7a348525020cf448c /drivers/irqchip
parent46eedb901c2a1784f2b781dccd3ec0bcf55d2f7c (diff)
irqchip: renesas-intc-irqpin: Add helper variable dev = &pdev->dev
Signed-off-by: Geert Uytterhoeven <geert+renesas@glider.be> Link: https://lkml.kernel.org/r/1410527720-18061-2-git-send-email-geert+renesas@glider.be Signed-off-by: Jason Cooper <jason@lakedaemon.net>
Diffstat (limited to 'drivers/irqchip')
-rw-r--r--drivers/irqchip/irq-renesas-intc-irqpin.c45
1 files changed, 22 insertions, 23 deletions
diff --git a/drivers/irqchip/irq-renesas-intc-irqpin.c b/drivers/irqchip/irq-renesas-intc-irqpin.c
index a9efceb0c4a0..a6b205b72c9b 100644
--- a/drivers/irqchip/irq-renesas-intc-irqpin.c
+++ b/drivers/irqchip/irq-renesas-intc-irqpin.c
@@ -329,7 +329,8 @@ static struct irq_domain_ops intc_irqpin_irq_domain_ops = {
329 329
330static int intc_irqpin_probe(struct platform_device *pdev) 330static int intc_irqpin_probe(struct platform_device *pdev)
331{ 331{
332 struct renesas_intc_irqpin_config *pdata = pdev->dev.platform_data; 332 struct device *dev = &pdev->dev;
333 struct renesas_intc_irqpin_config *pdata = dev->platform_data;
333 struct intc_irqpin_priv *p; 334 struct intc_irqpin_priv *p;
334 struct intc_irqpin_iomem *i; 335 struct intc_irqpin_iomem *i;
335 struct resource *io[INTC_IRQPIN_REG_NR]; 336 struct resource *io[INTC_IRQPIN_REG_NR];
@@ -337,14 +338,14 @@ static int intc_irqpin_probe(struct platform_device *pdev)
337 struct irq_chip *irq_chip; 338 struct irq_chip *irq_chip;
338 void (*enable_fn)(struct irq_data *d); 339 void (*enable_fn)(struct irq_data *d);
339 void (*disable_fn)(struct irq_data *d); 340 void (*disable_fn)(struct irq_data *d);
340 const char *name = dev_name(&pdev->dev); 341 const char *name = dev_name(dev);
341 int ref_irq; 342 int ref_irq;
342 int ret; 343 int ret;
343 int k; 344 int k;
344 345
345 p = devm_kzalloc(&pdev->dev, sizeof(*p), GFP_KERNEL); 346 p = devm_kzalloc(dev, sizeof(*p), GFP_KERNEL);
346 if (!p) { 347 if (!p) {
347 dev_err(&pdev->dev, "failed to allocate driver data\n"); 348 dev_err(dev, "failed to allocate driver data\n");
348 ret = -ENOMEM; 349 ret = -ENOMEM;
349 goto err0; 350 goto err0;
350 } 351 }
@@ -353,9 +354,9 @@ static int intc_irqpin_probe(struct platform_device *pdev)
353 if (pdata) { 354 if (pdata) {
354 memcpy(&p->config, pdata, sizeof(*pdata)); 355 memcpy(&p->config, pdata, sizeof(*pdata));
355 } else { 356 } else {
356 of_property_read_u32(pdev->dev.of_node, "sense-bitfield-width", 357 of_property_read_u32(dev->of_node, "sense-bitfield-width",
357 &p->config.sense_bitfield_width); 358 &p->config.sense_bitfield_width);
358 p->config.control_parent = of_property_read_bool(pdev->dev.of_node, 359 p->config.control_parent = of_property_read_bool(dev->of_node,
359 "control-parent"); 360 "control-parent");
360 } 361 }
361 if (!p->config.sense_bitfield_width) 362 if (!p->config.sense_bitfield_width)
@@ -368,7 +369,7 @@ static int intc_irqpin_probe(struct platform_device *pdev)
368 for (k = 0; k < INTC_IRQPIN_REG_NR; k++) { 369 for (k = 0; k < INTC_IRQPIN_REG_NR; k++) {
369 io[k] = platform_get_resource(pdev, IORESOURCE_MEM, k); 370 io[k] = platform_get_resource(pdev, IORESOURCE_MEM, k);
370 if (!io[k]) { 371 if (!io[k]) {
371 dev_err(&pdev->dev, "not enough IOMEM resources\n"); 372 dev_err(dev, "not enough IOMEM resources\n");
372 ret = -EINVAL; 373 ret = -EINVAL;
373 goto err0; 374 goto err0;
374 } 375 }
@@ -386,7 +387,7 @@ static int intc_irqpin_probe(struct platform_device *pdev)
386 387
387 p->number_of_irqs = k; 388 p->number_of_irqs = k;
388 if (p->number_of_irqs < 1) { 389 if (p->number_of_irqs < 1) {
389 dev_err(&pdev->dev, "not enough IRQ resources\n"); 390 dev_err(dev, "not enough IRQ resources\n");
390 ret = -EINVAL; 391 ret = -EINVAL;
391 goto err0; 392 goto err0;
392 } 393 }
@@ -407,15 +408,15 @@ static int intc_irqpin_probe(struct platform_device *pdev)
407 i->write = intc_irqpin_write32; 408 i->write = intc_irqpin_write32;
408 break; 409 break;
409 default: 410 default:
410 dev_err(&pdev->dev, "IOMEM size mismatch\n"); 411 dev_err(dev, "IOMEM size mismatch\n");
411 ret = -EINVAL; 412 ret = -EINVAL;
412 goto err0; 413 goto err0;
413 } 414 }
414 415
415 i->iomem = devm_ioremap_nocache(&pdev->dev, io[k]->start, 416 i->iomem = devm_ioremap_nocache(dev, io[k]->start,
416 resource_size(io[k])); 417 resource_size(io[k]));
417 if (!i->iomem) { 418 if (!i->iomem) {
418 dev_err(&pdev->dev, "failed to remap IOMEM\n"); 419 dev_err(dev, "failed to remap IOMEM\n");
419 ret = -ENXIO; 420 ret = -ENXIO;
420 goto err0; 421 goto err0;
421 } 422 }
@@ -457,34 +458,32 @@ static int intc_irqpin_probe(struct platform_device *pdev)
457 irq_chip->irq_set_type = intc_irqpin_irq_set_type; 458 irq_chip->irq_set_type = intc_irqpin_irq_set_type;
458 irq_chip->flags = IRQCHIP_SKIP_SET_WAKE | IRQCHIP_MASK_ON_SUSPEND; 459 irq_chip->flags = IRQCHIP_SKIP_SET_WAKE | IRQCHIP_MASK_ON_SUSPEND;
459 460
460 p->irq_domain = irq_domain_add_simple(pdev->dev.of_node, 461 p->irq_domain = irq_domain_add_simple(dev->of_node,
461 p->number_of_irqs, 462 p->number_of_irqs,
462 p->config.irq_base, 463 p->config.irq_base,
463 &intc_irqpin_irq_domain_ops, p); 464 &intc_irqpin_irq_domain_ops, p);
464 if (!p->irq_domain) { 465 if (!p->irq_domain) {
465 ret = -ENXIO; 466 ret = -ENXIO;
466 dev_err(&pdev->dev, "cannot initialize irq domain\n"); 467 dev_err(dev, "cannot initialize irq domain\n");
467 goto err0; 468 goto err0;
468 } 469 }
469 470
470 if (p->shared_irqs) { 471 if (p->shared_irqs) {
471 /* request one shared interrupt */ 472 /* request one shared interrupt */
472 if (devm_request_irq(&pdev->dev, p->irq[0].requested_irq, 473 if (devm_request_irq(dev, p->irq[0].requested_irq,
473 intc_irqpin_shared_irq_handler, 474 intc_irqpin_shared_irq_handler,
474 IRQF_SHARED, name, p)) { 475 IRQF_SHARED, name, p)) {
475 dev_err(&pdev->dev, "failed to request low IRQ\n"); 476 dev_err(dev, "failed to request low IRQ\n");
476 ret = -ENOENT; 477 ret = -ENOENT;
477 goto err1; 478 goto err1;
478 } 479 }
479 } else { 480 } else {
480 /* request interrupts one by one */ 481 /* request interrupts one by one */
481 for (k = 0; k < p->number_of_irqs; k++) { 482 for (k = 0; k < p->number_of_irqs; k++) {
482 if (devm_request_irq(&pdev->dev, 483 if (devm_request_irq(dev, p->irq[k].requested_irq,
483 p->irq[k].requested_irq, 484 intc_irqpin_irq_handler, 0, name,
484 intc_irqpin_irq_handler, 485 &p->irq[k])) {
485 0, name, &p->irq[k])) { 486 dev_err(dev, "failed to request low IRQ\n");
486 dev_err(&pdev->dev,
487 "failed to request low IRQ\n");
488 ret = -ENOENT; 487 ret = -ENOENT;
489 goto err1; 488 goto err1;
490 } 489 }
@@ -495,12 +494,12 @@ static int intc_irqpin_probe(struct platform_device *pdev)
495 for (k = 0; k < p->number_of_irqs; k++) 494 for (k = 0; k < p->number_of_irqs; k++)
496 intc_irqpin_mask_unmask_prio(p, k, 0); 495 intc_irqpin_mask_unmask_prio(p, k, 0);
497 496
498 dev_info(&pdev->dev, "driving %d irqs\n", p->number_of_irqs); 497 dev_info(dev, "driving %d irqs\n", p->number_of_irqs);
499 498
500 /* warn in case of mismatch if irq base is specified */ 499 /* warn in case of mismatch if irq base is specified */
501 if (p->config.irq_base) { 500 if (p->config.irq_base) {
502 if (p->config.irq_base != p->irq[0].domain_irq) 501 if (p->config.irq_base != p->irq[0].domain_irq)
503 dev_warn(&pdev->dev, "irq base mismatch (%d/%d)\n", 502 dev_warn(dev, "irq base mismatch (%d/%d)\n",
504 p->config.irq_base, p->irq[0].domain_irq); 503 p->config.irq_base, p->irq[0].domain_irq);
505 } 504 }
506 505