diff options
author | Geert Uytterhoeven <geert+renesas@glider.be> | 2014-03-27 16:47:36 -0400 |
---|---|---|
committer | Linus Walleij <linus.walleij@linaro.org> | 2014-03-28 16:54:41 -0400 |
commit | b22978fc33dec72e5f8e17f90eb63ea9137aafd5 (patch) | |
tree | 5c1f213dd3402be696c26923c63ef3f87732137f /drivers/gpio | |
parent | 8650ea1ebc31e9b0ab17c31d844dc106e60269db (diff) |
gpio: rcar: Add helper variable dev = &pdev->dev
Signed-off-by: Geert Uytterhoeven <geert+renesas@glider.be>
Cc: linux-gpio@vger.kernel.org
Acked-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
Diffstat (limited to 'drivers/gpio')
-rw-r--r-- | drivers/gpio/gpio-rcar.c | 32 |
1 files changed, 16 insertions, 16 deletions
diff --git a/drivers/gpio/gpio-rcar.c b/drivers/gpio/gpio-rcar.c index ca76ce751540..03c91482432c 100644 --- a/drivers/gpio/gpio-rcar.c +++ b/drivers/gpio/gpio-rcar.c | |||
@@ -356,12 +356,13 @@ static int gpio_rcar_probe(struct platform_device *pdev) | |||
356 | struct resource *io, *irq; | 356 | struct resource *io, *irq; |
357 | struct gpio_chip *gpio_chip; | 357 | struct gpio_chip *gpio_chip; |
358 | struct irq_chip *irq_chip; | 358 | struct irq_chip *irq_chip; |
359 | const char *name = dev_name(&pdev->dev); | 359 | struct device *dev = &pdev->dev; |
360 | const char *name = dev_name(dev); | ||
360 | int ret; | 361 | int ret; |
361 | 362 | ||
362 | p = devm_kzalloc(&pdev->dev, sizeof(*p), GFP_KERNEL); | 363 | p = devm_kzalloc(dev, sizeof(*p), GFP_KERNEL); |
363 | if (!p) { | 364 | if (!p) { |
364 | dev_err(&pdev->dev, "failed to allocate driver data\n"); | 365 | dev_err(dev, "failed to allocate driver data\n"); |
365 | ret = -ENOMEM; | 366 | ret = -ENOMEM; |
366 | goto err0; | 367 | goto err0; |
367 | } | 368 | } |
@@ -380,15 +381,14 @@ static int gpio_rcar_probe(struct platform_device *pdev) | |||
380 | irq = platform_get_resource(pdev, IORESOURCE_IRQ, 0); | 381 | irq = platform_get_resource(pdev, IORESOURCE_IRQ, 0); |
381 | 382 | ||
382 | if (!io || !irq) { | 383 | if (!io || !irq) { |
383 | dev_err(&pdev->dev, "missing IRQ or IOMEM\n"); | 384 | dev_err(dev, "missing IRQ or IOMEM\n"); |
384 | ret = -EINVAL; | 385 | ret = -EINVAL; |
385 | goto err0; | 386 | goto err0; |
386 | } | 387 | } |
387 | 388 | ||
388 | p->base = devm_ioremap_nocache(&pdev->dev, io->start, | 389 | p->base = devm_ioremap_nocache(dev, io->start, resource_size(io)); |
389 | resource_size(io)); | ||
390 | if (!p->base) { | 390 | if (!p->base) { |
391 | dev_err(&pdev->dev, "failed to remap I/O memory\n"); | 391 | dev_err(dev, "failed to remap I/O memory\n"); |
392 | ret = -ENXIO; | 392 | ret = -ENXIO; |
393 | goto err0; | 393 | goto err0; |
394 | } | 394 | } |
@@ -402,7 +402,7 @@ static int gpio_rcar_probe(struct platform_device *pdev) | |||
402 | gpio_chip->set = gpio_rcar_set; | 402 | gpio_chip->set = gpio_rcar_set; |
403 | gpio_chip->to_irq = gpio_rcar_to_irq; | 403 | gpio_chip->to_irq = gpio_rcar_to_irq; |
404 | gpio_chip->label = name; | 404 | gpio_chip->label = name; |
405 | gpio_chip->dev = &pdev->dev; | 405 | gpio_chip->dev = dev; |
406 | gpio_chip->owner = THIS_MODULE; | 406 | gpio_chip->owner = THIS_MODULE; |
407 | gpio_chip->base = p->config.gpio_base; | 407 | gpio_chip->base = p->config.gpio_base; |
408 | gpio_chip->ngpio = p->config.number_of_pins; | 408 | gpio_chip->ngpio = p->config.number_of_pins; |
@@ -421,30 +421,30 @@ static int gpio_rcar_probe(struct platform_device *pdev) | |||
421 | &gpio_rcar_irq_domain_ops, p); | 421 | &gpio_rcar_irq_domain_ops, p); |
422 | if (!p->irq_domain) { | 422 | if (!p->irq_domain) { |
423 | ret = -ENXIO; | 423 | ret = -ENXIO; |
424 | dev_err(&pdev->dev, "cannot initialize irq domain\n"); | 424 | dev_err(dev, "cannot initialize irq domain\n"); |
425 | goto err0; | 425 | goto err0; |
426 | } | 426 | } |
427 | 427 | ||
428 | if (devm_request_irq(&pdev->dev, irq->start, | 428 | if (devm_request_irq(dev, irq->start, gpio_rcar_irq_handler, |
429 | gpio_rcar_irq_handler, IRQF_SHARED, name, p)) { | 429 | IRQF_SHARED, name, p)) { |
430 | dev_err(&pdev->dev, "failed to request IRQ\n"); | 430 | dev_err(dev, "failed to request IRQ\n"); |
431 | ret = -ENOENT; | 431 | ret = -ENOENT; |
432 | goto err1; | 432 | goto err1; |
433 | } | 433 | } |
434 | 434 | ||
435 | ret = gpiochip_add(gpio_chip); | 435 | ret = gpiochip_add(gpio_chip); |
436 | if (ret) { | 436 | if (ret) { |
437 | dev_err(&pdev->dev, "failed to add GPIO controller\n"); | 437 | dev_err(dev, "failed to add GPIO controller\n"); |
438 | goto err1; | 438 | goto err1; |
439 | } | 439 | } |
440 | 440 | ||
441 | dev_info(&pdev->dev, "driving %d GPIOs\n", p->config.number_of_pins); | 441 | dev_info(dev, "driving %d GPIOs\n", p->config.number_of_pins); |
442 | 442 | ||
443 | /* warn in case of mismatch if irq base is specified */ | 443 | /* warn in case of mismatch if irq base is specified */ |
444 | if (p->config.irq_base) { | 444 | if (p->config.irq_base) { |
445 | ret = irq_find_mapping(p->irq_domain, 0); | 445 | ret = irq_find_mapping(p->irq_domain, 0); |
446 | if (p->config.irq_base != ret) | 446 | if (p->config.irq_base != ret) |
447 | dev_warn(&pdev->dev, "irq base mismatch (%u/%u)\n", | 447 | dev_warn(dev, "irq base mismatch (%u/%u)\n", |
448 | p->config.irq_base, ret); | 448 | p->config.irq_base, ret); |
449 | } | 449 | } |
450 | 450 | ||
@@ -452,7 +452,7 @@ static int gpio_rcar_probe(struct platform_device *pdev) | |||
452 | ret = gpiochip_add_pin_range(gpio_chip, p->config.pctl_name, 0, | 452 | ret = gpiochip_add_pin_range(gpio_chip, p->config.pctl_name, 0, |
453 | gpio_chip->base, gpio_chip->ngpio); | 453 | gpio_chip->base, gpio_chip->ngpio); |
454 | if (ret < 0) | 454 | if (ret < 0) |
455 | dev_warn(&pdev->dev, "failed to add pin range\n"); | 455 | dev_warn(dev, "failed to add pin range\n"); |
456 | } | 456 | } |
457 | 457 | ||
458 | return 0; | 458 | return 0; |