[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <00a3c27f-34a4-4e56-8f7d-4eeaa3c19556@baylibre.com>
Date: Wed, 13 Aug 2025 16:19:10 -0500
From: David Lechner <dlechner@...libre.com>
To: Ben Collins <bcollins@...ter.com>, Jonathan Cameron <jic23@...nel.org>,
Nuno Sá <nuno.sa@...log.com>,
Andy Shevchenko <andy@...nel.org>
Cc: linux-iio@...r.kernel.org, linux-kernel@...r.kernel.org
Subject: Re: [PATCH v2 4/5] iio: mcp9600: Add support for dtbinding of
thermocouple-type
On 8/13/25 10:15 AM, Ben Collins wrote:
> Adds dtbinding check for thermocouple-type and sets sensor config
> to match. Add iio info attribute to show state as well.
>
> Signed-off-by: Ben Collins <bcollins@...ter.com>
> ---
...
> @@ -447,6 +492,20 @@ static int mcp9600_probe(struct i2c_client *client)
> data = iio_priv(indio_dev);
> data->client = client;
>
> + /* Accept type from dt with default of Type-K. */
> + data->thermocouple_type = THERMOCOUPLE_TYPE_K;
> + ret = device_property_read_u32(&client->dev, "thermocouple-type",
> + &data->thermocouple_type);
ret is not checked. We should either check it or drop it and add
a comment explaining why it is OK to ignore the return value.
Typically, for optional properties, we would ignore only -EINVAL
meaning the property is not present and fail on other errors.
We also need another dt-bindings patch to add the default in the
bindings.
> + if (data->thermocouple_type >= ARRAY_SIZE(mcp9600_type_map))
> + return dev_err_probe(&client->dev, -EINVAL,
> + "Invalid thermocouple-type property %d.\n",
> + data->thermocouple_type);
> +
> + /* Set initial config. */
> + ret = mcp9600_config(data);
> + if (ret < 0)
> + return ret;
> +
> ch_sel = mcp9600_probe_alerts(indio_dev);
> if (ch_sel < 0)
> return ch_sel;
Powered by blists - more mailing lists