[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <20241124130241.60e922ff@jic23-huawei>
Date: Sun, 24 Nov 2024 13:02:41 +0000
From: Jonathan Cameron <jic23@...nel.org>
To: Olivier Moysan <olivier.moysan@...s.st.com>
Cc: Lars-Peter Clausen <lars@...afoo.de>, Maxime Coquelin
<mcoquelin.stm32@...il.com>, Alexandre Torgue
<alexandre.torgue@...s.st.com>, Jonathan Cameron
<Jonathan.Cameron@...wei.com>, <linux-iio@...r.kernel.org>,
<linux-stm32@...md-mailman.stormreply.com>,
<linux-arm-kernel@...ts.infradead.org>, <linux-kernel@...r.kernel.org>
Subject: Re: [PATCH] iio: adc: stm32-dfsdm: handle label as an optional
property
On Thu, 14 Nov 2024 11:24:59 +0100
Olivier Moysan <olivier.moysan@...s.st.com> wrote:
> The label property is defined as optional in the DFSDM binding.
> Parse the label property only when it is defined in the device tree.
>
> Fixes: 3208fa0cd919 ("iio: adc: stm32-dfsdm: adopt generic channels bindings")
> Signed-off-by: Olivier Moysan <olivier.moysan@...s.st.com>
This could be done by just ignoring the return of fw_node_property_read_string()
but your fix will do a little more such as report an error if the property is
the wrong type etc, so I'll take it.
Applied to the fixes-togreg branch of iio.git.
Thanks,
Jonathan
> ---
> drivers/iio/adc/stm32-dfsdm-adc.c | 13 ++++++++-----
> 1 file changed, 8 insertions(+), 5 deletions(-)
>
> diff --git a/drivers/iio/adc/stm32-dfsdm-adc.c b/drivers/iio/adc/stm32-dfsdm-adc.c
> index 2037f73426d4..e304e3714020 100644
> --- a/drivers/iio/adc/stm32-dfsdm-adc.c
> +++ b/drivers/iio/adc/stm32-dfsdm-adc.c
> @@ -691,11 +691,14 @@ static int stm32_dfsdm_generic_channel_parse_of(struct stm32_dfsdm *dfsdm,
> return -EINVAL;
> }
>
> - ret = fwnode_property_read_string(node, "label", &ch->datasheet_name);
> - if (ret < 0) {
> - dev_err(&indio_dev->dev,
> - " Error parsing 'label' for idx %d\n", ch->channel);
> - return ret;
> + if (fwnode_property_present(node, "label")) {
> + /* label is optional */
> + ret = fwnode_property_read_string(node, "label", &ch->datasheet_name);
> + if (ret < 0) {
> + dev_err(&indio_dev->dev,
> + " Error parsing 'label' for idx %d\n", ch->channel);
> + return ret;
> + }
> }
>
> df_ch = &dfsdm->ch_list[ch->channel];
Powered by blists - more mailing lists