On Wed, Oct 16, 2024 at 9:02 AM Greg Kroah-Hartman <gregkh@xxxxxxxxxxxxxxxxxxx> wrote: > > > > > The existence of the sysfs API in the kernel makes us stick to some > > sub-optimal design decisions (like the global GPIO numberspace) that > > we'll be able to entirely remove once sysfs is gone. We want people to > > use the GPIO character device and if it takes a layer emulating the > > old API on top of it to make them switch then it's still better than > > keeping the API in the kernel. > > How are you going to emulate the "global numberspace" in usersapce if > the kernel isn't exposing that? Why can't you just do it in the same > way that you would in userspace here? > In the new kernel API, users don't care about the GPIO numbers. Even the GPIO drivers only care about hardware offsets within the chip they control. But we still use the numbers for the sake of the sysfs interface, users of the legacy in-kernel API and some really old drivers that used to set a hard-coded base GPIO number. For most part the dynamic base assignment algorithm can be simply moved to user-space. For those few instances where the base needs to be a specific value, the FUSE program will take an argument allowing to specify it. > Again, the issue is "do not remove apis that userspace relies on". > That's all. I'm going to add another one called "do not mount any > filesystem at /sys/devices/class/ as that is insane" as well :) > I know you're not being 100% serious but I think it's worth mentioning that the mounting is not done from the kernel. You can't really impose the second one on user-space. If user-space decides to go "mount -t configfs none /sys/bus/platform/devices/" or "mount -t devtmpfs none /proc", then AFAIK there's nothing you can do to stop it. Bart