On Fri, 29 Mar 2024 15:11:21 +0100, Hans de Goede <hans@xxxxxxxxx> said: > Hi All, > > I've already tried to fix this, so let me just copy and paste my half finished patch > to explain the problem. > > I was planning on submitting this as a RFC patch at least, but there are also some > other new issues with 6.9 on this tablet and I'm not sure how this interacts > with those issues and I don't have time to work on this any further this weekend. > > Anyways below is the patch / bug report. > > I'm wondering if a better fix would be to add a "ready" flag to gdev > and may gpiochip_find ignore not yet ready chips (we need them on > the list before they are ready to reserve the GPIO numbers) ? > > Regards, > > Hans > Hi Hans! Thanks for the report. I hope I'm not being naive here but would the following one-liner work? diff --git a/drivers/gpio/gpiolib.c b/drivers/gpio/gpiolib.c index ce94e37bcbee..69f365ccbfd8 100644 --- a/drivers/gpio/gpiolib.c +++ b/drivers/gpio/gpiolib.c @@ -1179,7 +1179,7 @@ struct gpio_device *gpio_device_find(const void *data, gc = srcu_dereference(gdev->chip, &gdev->srcu); - if (gc && match(gc, data)) + if (device_is_registered(&gdev->dev) && gc && match(gc, data)) return gpio_device_get(gdev); } This would make gpio_device_find() ignore any GPIO device that's not yet registered on the GPIO bus which is almost the last step of the registration process right before creating the sysfs attributes. Bartosz