Re: [PATCH v2 2/2] iio: adc: ti-ads112c14: add gpio support
From: Andy Shevchenko
Date: Tue Oct 13 2026 - 10:53:37 EST
On Sat, Oct 10, 2026 at 08:46:30AM -0500, David Lechner wrote:
> On 10/10/26 4:00 AM, Bartosz Golaszewski wrote:
> > On Sat, 10 Oct 2026 01:25:52 +0200, "David Lechner (TI)"
> > <dlechner@xxxxxxxxxxxx> said:
...
> >> + if (device_property_read_bool(dev, "gpio-controller")) {
> >
> > I think the right one to use is device_property_present().
>
> I thought this was the one case where device_property_read_bool() is
> actually correct because gpio-controller property is a
> /schemas/types.yaml#/definitions/flag.
>
> Otherwise, we should just remove device_property_read_bool() from the tree
> because there would never be a reason to use it.
>
> My understanding is we should use device_property_present() for non-boolean
> properties when we want to know if it is present or not before reading the
> value of it.
That's not true. The _property_present() checks any type of property, while
_property_read_bool() returns an actual value of the flag, while they might
overlap in the behaviour, they are semantically completely different.
--
With Best Regards,
Andy Shevchenko