On Mon, May 25, 2020 at 4:19 PM Kent Gibson <warthog618@xxxxxxxxx> wrote: > > > +struct gpioline_config { > > > + __u8 default_values[GPIOLINES_MAX]; > > > > So 32 bytes > > > > Actually that one is 64 bytes, which is the same as v1, i.e. GPIOLINES_MAX > is the same as GPIOHANDLES_MAX - just renamed. > > On the subject of values, is there any reason to use a byte for each line > rather value than a bit? Not really, other than making things simple for userspace. > when adding future fields, the idea was to have a bit > in the flags that indicates that the corresponding field is now valid. > If the flag is not set then whatever value is there is irrelevant. You would need to document that idea, say in the kerneldoc, else when someone else comes along to do this they will get it wrong. > But definitely better to play it safe - will check the padding is > zeroed as well, as well as any field for which the flag bit is clear. Yeah better like that. You can write a comment in the code too, such like "when adding new parameters, update this validation code to accept it". > Back on retired ioctls, I notice that 5, 6, and 7 are missing from gpio. > Have those been retired, or just skipped over by accident? Just thought it was nice to use jump to 8 for line info. They should be used when adding generic chip information ioctls(). Yours, Linus Walleij