From: Jonathan Cameron <jic23@kernel.org>
To: Olivier Moysan <olivier.moysan@foss.st.com>
Cc: Lars-Peter Clausen <lars@metafoo.de>,
Maxime Coquelin <mcoquelin.stm32@gmail.com>,
Alexandre Torgue <alexandre.torgue@foss.st.com>,
Jonathan Cameron <Jonathan.Cameron@huawei.com>,
<linux-iio@vger.kernel.org>,
<linux-stm32@st-md-mailman.stormreply.com>,
<linux-arm-kernel@lists.infradead.org>,
<linux-kernel@vger.kernel.org>
Subject: Re: [PATCH] iio: adc: stm32-dfsdm: handle label as an optional property
Date: Sun, 24 Nov 2024 13:02:41 +0000 [thread overview]
Message-ID: <20241124130241.60e922ff@jic23-huawei> (raw)
In-Reply-To: <20241114102459.2497178-1-olivier.moysan@foss.st.com>
On Thu, 14 Nov 2024 11:24:59 +0100
Olivier Moysan <olivier.moysan@foss.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@foss.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];
prev parent reply other threads:[~2024-11-24 13:10 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-11-14 10:24 [PATCH] iio: adc: stm32-dfsdm: handle label as an optional property Olivier Moysan
2024-11-24 13:02 ` Jonathan Cameron [this message]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20241124130241.60e922ff@jic23-huawei \
--to=jic23@kernel.org \
--cc=Jonathan.Cameron@huawei.com \
--cc=alexandre.torgue@foss.st.com \
--cc=lars@metafoo.de \
--cc=linux-arm-kernel@lists.infradead.org \
--cc=linux-iio@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-stm32@st-md-mailman.stormreply.com \
--cc=mcoquelin.stm32@gmail.com \
--cc=olivier.moysan@foss.st.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox