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

gpio: dwapb: Remove unneeded has_irq member in struct dwapb_port_property

has_irq member of struct dwapb_port_property is used only in one place,
so, make it local test instead and remove from the structure.
This local test is using memchr_inv() which is quite efficient in comparison
to the original loop and possible little overhead can be neglected.

Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Tested-by: Serge Semin <fancer.lancer@gmail.com>
Acked-by: Lee Jones <lee.jones@linaro.org>
Acked-by: Serge Semin <fancer.lancer@gmail.com>
Link: https://lore.kernel.org/r/20200519131233.59032-4-andriy.shevchenko@linux.intel.com
Signed-off-by: Linus Walleij <linus.walleij@linaro.org>

authored by

Andy Shevchenko and committed by
Linus Walleij
551cb86c aa90939d

+7 -9
+7 -7
drivers/gpio/gpio-dwapb.c
··· 366 366 irq_hw_number_t hwirq; 367 367 int err, i; 368 368 369 + if (memchr_inv(pp->irq, 0, sizeof(pp->irq)) == NULL) { 370 + dev_warn(gpio->dev, "no IRQ for port%d\n", pp->idx); 371 + return; 372 + } 373 + 369 374 gpio->domain = irq_domain_create_linear(fwnode, ngpio, 370 375 &irq_generic_chip_ops, gpio); 371 376 if (!gpio->domain) ··· 506 501 if (pp->idx == 0) 507 502 port->gc.set_config = dwapb_gpio_set_config; 508 503 509 - if (pp->has_irq) 504 + /* Only port A can provide interrupts in all configurations of the IP */ 505 + if (pp->idx == 0) 510 506 dwapb_configure_irqs(gpio, port, pp); 511 507 512 508 err = gpiochip_add_data(&port->gc, port); ··· 556 550 irq = platform_get_irq_optional(to_platform_device(dev), j); 557 551 if (irq > 0) 558 552 pp->irq[j] = irq; 559 - 560 - if (pp->irq[j]) 561 - pp->has_irq = true; 562 553 } 563 - 564 - if (!pp->has_irq) 565 - dev_warn(dev, "no irq for port%d\n", pp->idx); 566 554 } 567 555 568 556 static struct dwapb_platform_data *dwapb_gpio_get_pdata(struct device *dev)
-1
drivers/mfd/intel_quark_i2c_gpio.c
··· 216 216 pdata->properties->ngpio = INTEL_QUARK_MFD_NGPIO; 217 217 pdata->properties->gpio_base = INTEL_QUARK_MFD_GPIO_BASE; 218 218 pdata->properties->irq[0] = pdev->irq; 219 - pdata->properties->has_irq = true; 220 219 pdata->properties->irq_shared = true; 221 220 222 221 cell->platform_data = pdata;
-1
include/linux/platform_data/gpio-dwapb.h
··· 12 12 unsigned int ngpio; 13 13 unsigned int gpio_base; 14 14 int irq[32]; 15 - bool has_irq; 16 15 bool irq_shared; 17 16 }; 18 17