Mon, Feb 24, 2025 at 08:55:26PM +0100, Bartosz Golaszewski kirjoitti: > On Mon, Feb 24, 2025 at 5:33 PM Andy Shevchenko > <andriy.shevchenko@xxxxxxxxx> wrote: > > On Mon, Feb 10, 2025 at 11:52:02AM +0100, Bartosz Golaszewski wrote: ... > > > +static int gpiochip_get_direction(struct gpio_chip *gc, unsigned int offset) > > > +{ > > > + int ret; > > > + > > > + lockdep_assert_held(&gc->gpiodev->srcu); > > > + > > > + if (WARN_ON(!gc->get_direction)) > > > + return -EOPNOTSUPP; > > > + > > > + ret = gc->get_direction(gc, offset); > > > + if (ret > 1) > > > > Would it be better to use the respective GPIO*... macro instead of 1? > > > > I did consider it but I don't like comparing against enums, it doesn't > feel right as the value behind the name can change. I think I prefer > it like this even if it's not the best solution either. Maybe we could > be more explicit and say: > > if (!(ret == IN || ret == OUT || ret < 0) > > ? Yep, I like this. -- With Best Regards, Andy Shevchenko