Message ID | 1411661364-19620-2-git-send-email-grygorii.strashko@ti.com |
---|---|
State | Not Applicable, archived |
Headers | show |
On Thu, Sep 25, 2014 at 6:09 PM, Grygorii Strashko <grygorii.strashko@ti.com> wrote: > Remove irq_base from struct gpio_chip, as it is seems to > be unused. > Aslo, using this field by drivers is unsafe because it's > uncompatible with Sparse IRQ feature. > > Signed-off-by: Grygorii Strashko <grygorii.strashko@ti.com> > --- > Hi Linus, > > I've not found users of this field in drivers/gpio/ folder, > so I've decided to created this patch to get more comments. Wut? git grep '>irq_base' (...) drivers/gpio/gpio-max732x.c: return chip->irq_base + off; drivers/gpio/gpio-ml-ioh.c: return chip->irq_base + offset; drivers/gpio/gpio-pch.c: chip->irq_base = irq_base; etc etc Yours, Linus Walleij -- To unsubscribe from this list: send the line "unsubscribe linux-gpio" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
On 09/26/2014 11:44 AM, Linus Walleij wrote: > On Thu, Sep 25, 2014 at 6:09 PM, Grygorii Strashko > <grygorii.strashko@ti.com> wrote: > >> Remove irq_base from struct gpio_chip, as it is seems to >> be unused. >> Aslo, using this field by drivers is unsafe because it's >> uncompatible with Sparse IRQ feature. >> >> Signed-off-by: Grygorii Strashko <grygorii.strashko@ti.com> >> --- >> Hi Linus, >> >> I've not found users of this field in drivers/gpio/ folder, >> so I've decided to created this patch to get more comments. > > Wut? > > git grep '>irq_base' > (...) > drivers/gpio/gpio-max732x.c: return chip->irq_base + off; ^struct max732x_chip *chip; > drivers/gpio/gpio-ml-ioh.c: return chip->irq_base + offset; ^struct ioh_gpio *chip > drivers/gpio/gpio-pch.c: chip->irq_base = irq_base; ^struct pch_gpio *chip > etc etc etc ;) I've spent some time checking it, but it's possible that I missed smth or it's used outside gpio directory. Best regards, -grygorii -- To unsubscribe from this list: send the line "unsubscribe linux-gpio" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
On Fri, Sep 26, 2014 at 12:44 PM, Grygorii Strashko <grygorii.strashko@ti.com> wrote: > On 09/26/2014 11:44 AM, Linus Walleij wrote: >> >> On Thu, Sep 25, 2014 at 6:09 PM, Grygorii Strashko >> <grygorii.strashko@ti.com> wrote: >> >>> Remove irq_base from struct gpio_chip, as it is seems to >>> be unused. >>> Aslo, using this field by drivers is unsafe because it's >>> uncompatible with Sparse IRQ feature. >>> >>> Signed-off-by: Grygorii Strashko <grygorii.strashko@ti.com> >>> --- >>> Hi Linus, >>> >>> I've not found users of this field in drivers/gpio/ folder, >>> so I've decided to created this patch to get more comments. >> >> >> Wut? >> >> git grep '>irq_base' >> (...) >> drivers/gpio/gpio-max732x.c: return chip->irq_base + off; > > ^struct max732x_chip *chip; > >> drivers/gpio/gpio-ml-ioh.c: return chip->irq_base + offset; > > ^struct ioh_gpio *chip > >> drivers/gpio/gpio-pch.c: chip->irq_base = irq_base; > > ^struct pch_gpio *chip > >> etc etc > > etc ;) Aha now the variable names are confusing me at no end too :-) > I've spent some time checking it, but it's possible > that I missed smth or it's used outside gpio directory. It'd be good if we could estimate this, I'd prefer if we could do some semantic grep like cocinelle does to see if the (foo)->irq_base affects a case where (foo) is struct gpio_chip... But I guess I can also just apply the patch and throw it at the autobuilders. I'm just worried about cases the autobuilder would miss. Yours, Linus Walleij -- To unsubscribe from this list: send the line "unsubscribe linux-gpio" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
diff --git a/drivers/gpio/gpiolib.c b/drivers/gpio/gpiolib.c index f6bf368..8aa84d5 100644 --- a/drivers/gpio/gpiolib.c +++ b/drivers/gpio/gpiolib.c @@ -605,15 +605,8 @@ int gpiochip_irqchip_add(struct gpio_chip *gpiochip, * any gpiochip calls. If the first_irq was zero, this is * necessary to allocate descriptors for all IRQs. */ - for (offset = 0; offset < gpiochip->ngpio; offset++) { + for (offset = 0; offset < gpiochip->ngpio; offset++) irq_base = irq_create_mapping(gpiochip->irqdomain, offset); - if (offset == 0) - /* - * Store the base into the gpiochip to be used when - * unmapping the irqs. - */ - gpiochip->irq_base = irq_base; - } acpi_gpiochip_request_interrupts(gpiochip); diff --git a/include/linux/gpio/driver.h b/include/linux/gpio/driver.h index e78a237..976276a 100644 --- a/include/linux/gpio/driver.h +++ b/include/linux/gpio/driver.h @@ -110,7 +110,6 @@ struct gpio_chip { */ struct irq_chip *irqchip; struct irq_domain *irqdomain; - unsigned int irq_base; irq_flow_handler_t irq_handler; unsigned int irq_default_type; #endif
Remove irq_base from struct gpio_chip, as it is seems to be unused. Aslo, using this field by drivers is unsafe because it's uncompatible with Sparse IRQ feature. Signed-off-by: Grygorii Strashko <grygorii.strashko@ti.com> --- Hi Linus, I've not found users of this field in drivers/gpio/ folder, so I've decided to created this patch to get more comments. drivers/gpio/gpiolib.c | 9 +-------- include/linux/gpio/driver.h | 1 - 2 files changed, 1 insertion(+), 9 deletions(-)