Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

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>

authored by

Andy Shevchenko and committed by
Linus Walleij
db67aa33 672de527

+6 -8
+6 -8
drivers/gpio/gpio-mb86s7x.c
··· 145 145 146 146 for (index = 0;; index++) { 147 147 irq = platform_get_irq(to_platform_device(gc->parent), index); 148 - if (irq <= 0) 148 + if (irq < 0) 149 + return irq; 150 + if (irq == 0) 149 151 break; 150 152 if (irq_get_irq_data(irq)->hwirq == offset) 151 153 return irq; ··· 186 184 gchip->gc.free = mb86s70_gpio_free; 187 185 gchip->gc.get = mb86s70_gpio_get; 188 186 gchip->gc.set = mb86s70_gpio_set; 187 + gchip->gc.to_irq = mb86s70_gpio_to_irq; 189 188 gchip->gc.label = dev_name(&pdev->dev); 190 189 gchip->gc.ngpio = 32; 191 190 gchip->gc.owner = THIS_MODULE; 192 191 gchip->gc.parent = &pdev->dev; 193 192 gchip->gc.base = -1; 194 - 195 - if (has_acpi_companion(&pdev->dev)) 196 - gchip->gc.to_irq = mb86s70_gpio_to_irq; 197 193 198 194 ret = gpiochip_add_data(&gchip->gc, gchip); 199 195 if (ret) { ··· 200 200 return ret; 201 201 } 202 202 203 - if (has_acpi_companion(&pdev->dev)) 204 - acpi_gpiochip_request_interrupts(&gchip->gc); 203 + acpi_gpiochip_request_interrupts(&gchip->gc); 205 204 206 205 return 0; 207 206 } ··· 209 210 { 210 211 struct mb86s70_gpio_chip *gchip = platform_get_drvdata(pdev); 211 212 212 - if (has_acpi_companion(&pdev->dev)) 213 - acpi_gpiochip_free_interrupts(&gchip->gc); 213 + acpi_gpiochip_free_interrupts(&gchip->gc); 214 214 gpiochip_remove(&gchip->gc); 215 215 clk_disable_unprepare(gchip->clk); 216 216