On Fri, Oct 18, 2024 at 1:30 PM Andy Shevchenko <andriy.shevchenko@xxxxxxxxx> wrote: > First one is why? What the *practical* issue you have? Can you elaborate > on that? Sure, there are these hardwares that probe directly from the gpio-mmio driver: Documentation/devicetree/bindings/gpio/gpio-mmio.yaml properties: compatible: enum: - brcm,bcm6345-gpio - ni,169445-nand-gpio - wd,mbl-gpio # Western Digital MyBook Live memory-mapped GPIO controller The practical issue is (similar to what was responded to Rob in patch 2/2) that non-existing GPIOs will get exposed to userspace. For patch 1/2 (adding the DT binding) it would be that without ngpios we do not model the hardware properly. The objection "it makes no harm to register GPIO lines for all bits in the register" can likewise be raised to the other 28 (if I count correctly) GPIO drivers that use this property (git grep ngpios drivers/gpio) and I think the train left the station long ago to object to the property in general, people don't want to expose non-existing GPIOs to the GPIO framework. > Second one, is there any other way to avoid duplication of the code so > we have one place of the property parsing? > > For the background I have to mention this commit: > 55b2395e4e92 ("gpio: mmio: handle "ngpios" properly in bgpio_init()") Oh well spotted! I completely missed the fact that we already added ngpios parsing elsewhere in the driver. Bartosz, can you please drop patch 2/2? Patch 1/2 is needed however: it is just documenting the behaviour that is already implemented. Yours, Linus Walleij