Re: [PATCH v2 2/2] iio: adc: ti-ads112c14: add gpio support

From: Bartosz Golaszewski

Date: Tue Oct 20 2026 - 09:31:17 EST


On Sat, 10 Oct 2026 15:46:30 +0200, David Lechner <dlechner@xxxxxxxxxxxx> said:
> 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:
>>> Add support for using the AIN4/GPIO0 to AIN7/GPIO3 pins as GPIOs when
>>> the gpio-controller property is present.
>>>
>
> ...
>
>>> @@ -2574,6 +2726,12 @@ static int ads112c14_probe(struct i2c_client *client)
>>> if (ret)
>>> return ret;
>>>
>>> + 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.
>

Right, I remembered seeing commits from Rob Herring changing read_bool() to
present() but it's like so:

commit a570feff16bd4fdaa247b4ef13f4d28f8c73903b
Author: Rob Herring (Arm) <robh@xxxxxxxxxx>
Date: Mon Nov 4 13:06:49 2024 -0600

interconnect: Use of_property_present() for non-boolean properties

The use of of_property_read_bool() for non-boolean properties is
deprecated in favor of of_property_present() when testing for property
presence.

Signed-off-by: "Rob Herring (Arm)" <robh@xxxxxxxxxx>
Link: https://lore.kernel.org/r/20241104190650.275278-1-robh@xxxxxxxxxx
Signed-off-by: Georgi Djakov <djakov@xxxxxxxxxx>

So only for non-boolean properties. You're right.

Bart