mirror of
https://github.com/AuxXxilium/linux_dsm_epyc7002.git
synced 2024-11-24 01:10:54 +07:00
gpio: mb86s7x: Remove superfluous test for ACPI companion
acpi_gpiochip_request_interrupts() will check for ACPI handle of the GPIO chip parent device and bail out if there is none defined. Thus, has_acpi_companion() is effectively repeating above and is not needed in the individual driver. Assigning ->to_irq() unconditionally doesn't change anything, except an error code, but this we fix as well by propagating it from platform_get_irq(). Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com> Link: https://lore.kernel.org/r/20200512182623.54990-2-andriy.shevchenko@linux.intel.com Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
This commit is contained in:
parent
672de52744
commit
db67aa33d5
@ -145,7 +145,9 @@ static int mb86s70_gpio_to_irq(struct gpio_chip *gc, unsigned int offset)
|
||||
|
||||
for (index = 0;; index++) {
|
||||
irq = platform_get_irq(to_platform_device(gc->parent), index);
|
||||
if (irq <= 0)
|
||||
if (irq < 0)
|
||||
return irq;
|
||||
if (irq == 0)
|
||||
break;
|
||||
if (irq_get_irq_data(irq)->hwirq == offset)
|
||||
return irq;
|
||||
@ -184,15 +186,13 @@ static int mb86s70_gpio_probe(struct platform_device *pdev)
|
||||
gchip->gc.free = mb86s70_gpio_free;
|
||||
gchip->gc.get = mb86s70_gpio_get;
|
||||
gchip->gc.set = mb86s70_gpio_set;
|
||||
gchip->gc.to_irq = mb86s70_gpio_to_irq;
|
||||
gchip->gc.label = dev_name(&pdev->dev);
|
||||
gchip->gc.ngpio = 32;
|
||||
gchip->gc.owner = THIS_MODULE;
|
||||
gchip->gc.parent = &pdev->dev;
|
||||
gchip->gc.base = -1;
|
||||
|
||||
if (has_acpi_companion(&pdev->dev))
|
||||
gchip->gc.to_irq = mb86s70_gpio_to_irq;
|
||||
|
||||
ret = gpiochip_add_data(&gchip->gc, gchip);
|
||||
if (ret) {
|
||||
dev_err(&pdev->dev, "couldn't register gpio driver\n");
|
||||
@ -200,8 +200,7 @@ static int mb86s70_gpio_probe(struct platform_device *pdev)
|
||||
return ret;
|
||||
}
|
||||
|
||||
if (has_acpi_companion(&pdev->dev))
|
||||
acpi_gpiochip_request_interrupts(&gchip->gc);
|
||||
acpi_gpiochip_request_interrupts(&gchip->gc);
|
||||
|
||||
return 0;
|
||||
}
|
||||
@ -210,8 +209,7 @@ static int mb86s70_gpio_remove(struct platform_device *pdev)
|
||||
{
|
||||
struct mb86s70_gpio_chip *gchip = platform_get_drvdata(pdev);
|
||||
|
||||
if (has_acpi_companion(&pdev->dev))
|
||||
acpi_gpiochip_free_interrupts(&gchip->gc);
|
||||
acpi_gpiochip_free_interrupts(&gchip->gc);
|
||||
gpiochip_remove(&gchip->gc);
|
||||
clk_disable_unprepare(gchip->clk);
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user