On Tue, Feb 25, 2025 at 03:43:29PM +0100, Bartosz Golaszewski wrote: > On Tue, Feb 25, 2025 at 2:22 PM Andy Shevchenko > <andriy.shevchenko@xxxxxxxxxxxxxxx> wrote: > > On Tue, Feb 25, 2025 at 12:56:23PM +0100, Bartosz Golaszewski wrote: > > > During chip registration we should neither check the return value of > > > gc->get_direction() nor hold the SRCU lock when calling it. The former > > > is because pin controllers may have pins set to alternate functions and > > > return errors from their get_direction() callbacks. That's alright - we > > > should default to the safe INPUT state and not bail-out. The latter is > > > not needed because we haven't registered the chip yet so there's nothing > > > to protect against dynamic removal. In fact: we currently hit a lockdep > > > splat. Revert to calling the gc->get_direction() callback directly not > > > not checking its value. ... > > I think the below code deserves a commit (as a summary of the above commit > > message). > > Can you rephrase? I'm not getting this one. Ah, s/commit/comment/ > > > + if (gc->get_direction && gpiochip_line_is_valid(gc, desc_index)) > > > + assign_bit(FLAG_IS_OUT, &desc->flags, > > > + !gc->get_direction(gc, desc_index)); > > > + else > > > assign_bit(FLAG_IS_OUT, > > > &desc->flags, !gc->direction_input); > > > > Otherwise LGTM, > > Reviewed-by: Andy Shevchenko <andriy.shevchenko@xxxxxxxxxxxxxxx> -- With Best Regards, Andy Shevchenko