On Mon, Nov 18, 2019 at 10:48:25PM +0800, Kent Gibson wrote: > On Mon, Nov 18, 2019 at 02:52:04PM +0100, Bartosz Golaszewski > > > + > > > +int gpiod_line_set_flags_bulk(struct gpiod_line_bulk *bulk, int flags) > > > +{ > > > + struct gpiod_line *line; > > > + int values[GPIOD_LINE_BULK_MAX_LINES]; > > > + unsigned int i; > > > + int direction; > > > + > > > + line = gpiod_line_bulk_get_line(bulk, 0); > > > + if (line->as_is) { > > > > Can you explain the purpose of this as_is field? I'm not sure this is > > really needed. > > > > It is there for gpiod_set_flags, which has to populate the direction > flags in the SET_CONFIG ioctl. The existing line->direction is > either input or output. It is drawn from GPIOLINE_FLAG_IS_OUT, so > as-is is gets mapped to input. > I didn't want to change the existing line->direction, and adding the > as-is seemed clearer than adding another flavour of direction that > contained all three. > Hmmm, I think I see what you were getting at - the line->direction is the direction from the kernel, so it doesn't hurt to use that value to set the corresponding request flags - even if the original request was as-is?? If that is the case then the line->as_is can be dropped throughout. Kent.