On Wed, Feb 26, 2025 at 1:43 PM Marek Vasut <marex@xxxxxxx> wrote: > > Can we really make do without export/unexport ? > > Consider this scenario: > > - User open()s and write()s /sys/bus/gpio/gpiochip0/gpio0/value > - User keeps FD to /sys/bus/gpio/gpiochip0/gpio0/value open > - Kernel module gets loaded, binds to DT node which references the same GPIO > - User write()s /sys/bus/gpio/gpiochip0/gpio0/value open again > > I wonder if this could pose a problem ? > > I suspect the kernel module loading should fail , right ? If the kernel module in question registers a driver that will bind to a device which wants to request the same GPIO that sysfs already holds, then gpiod_get() will fail with -EBUSY. In other words: even if we drop export, there still has to be some way of "claiming" the GPIOs. /sys/bus/gpio/gpiochip0/gpio0/request? I think I prefer export/unexport. Bartosz