From: Jonathan Cameron <jic23@kernel.org>
To: Andy Shevchenko <andriy.shevchenko@intel.com>
Cc: "Antony Kurniawan Soemardi" <linux@smankusors.com>,
"Bjorn Andersson" <andersson@kernel.org>,
"Konrad Dybcio" <konradybcio@kernel.org>,
"Rob Herring" <robh@kernel.org>,
"Krzysztof Kozlowski" <krzk+dt@kernel.org>,
"Conor Dooley" <conor+dt@kernel.org>,
"David Lechner" <dlechner@baylibre.com>,
"Nuno Sá" <nuno.sa@analog.com>,
"Andy Shevchenko" <andy@kernel.org>,
linux-arm-msm@vger.kernel.org, devicetree@vger.kernel.org,
linux-kernel@vger.kernel.org, linux-iio@vger.kernel.org,
phone-devel@vger.kernel.org,
"Dmitry Baryshkov" <dmitry.baryshkov@oss.qualcomm.com>
Subject: Re: [PATCH v3 3/3] iio: adc: qcom-pm8xxx-xoadc: add support for reading channel labels
Date: Mon, 20 Apr 2026 18:58:07 +0100 [thread overview]
Message-ID: <20260420185807.24817684@jic23-huawei> (raw)
In-Reply-To: <adQNlfiq4aaOJ2ll@ashevche-desk.local>
On Mon, 6 Apr 2026 22:46:29 +0300
Andy Shevchenko <andriy.shevchenko@intel.com> wrote:
> On Sun, Apr 05, 2026 at 04:52:21PM +0000, Antony Kurniawan Soemardi wrote:
> > Implement the .read_label callback to allow userspace to identify ADC
> > channels via the "label" property in the device tree. The name field in
> > pm8xxx_chan_info is renamed to label to better reflect its purpose. If
> > no label is provided in the device tree, it defaults to the hardware
> > datasheet name.
>
> > The change has been tested on Sony Xperia SP (PM8921).
>
> ...
>
> > +static int pm8xxx_read_label(struct iio_dev *indio_dev,
> > + struct iio_chan_spec const *chan, char *label)
> > +{
> > + struct pm8xxx_xoadc *adc = iio_priv(indio_dev);
>
> > + struct pm8xxx_chan_info *ch = pm8xxx_get_channel(adc, chan->address);
>
> When you have a validation the better style is to split definition and
> assignment. This makes code robust against (theoretically) possible changes
> that might reuse the same variable for something else.
I think you just mean
struct pm8xx_chan_info *ch;
ch = pm8xx_get_...
if (!ch)
return -EINVAL?
I suppose slightly better but it's a very small function and unlikely to have
much complexity added to it.
>
> > + if (!ch)
> > + return -EINVAL;
> > + return sysfs_emit(label, "%s\n", ch->label);
> > +}
>
> Again, no need to resend now, just make it in the next version if that version
> is asked for.
>
next prev parent reply other threads:[~2026-04-20 17:58 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-04-05 16:52 [PATCH v3 0/3] iio: adc: qcom-pm8xxx-xoadc: add support for reading channel labels from DT Antony Kurniawan Soemardi
2026-04-05 16:52 ` [PATCH v3 1/3] ARM: dts: qcom: pm8921: add labels for ADC channels Antony Kurniawan Soemardi
2026-04-05 16:52 ` [PATCH v3 2/3] iio: adc: qcom-pm8xxx-xoadc: remove redundant error logs when reading values Antony Kurniawan Soemardi
2026-04-06 1:07 ` Dmitry Baryshkov
2026-04-06 19:44 ` Andy Shevchenko
2026-04-20 17:59 ` Jonathan Cameron
2026-04-05 16:52 ` [PATCH v3 3/3] iio: adc: qcom-pm8xxx-xoadc: add support for reading channel labels Antony Kurniawan Soemardi
2026-04-06 19:46 ` Andy Shevchenko
2026-04-20 17:58 ` Jonathan Cameron [this message]
2026-04-20 18:22 ` Andy Shevchenko
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=20260420185807.24817684@jic23-huawei \
--to=jic23@kernel.org \
--cc=andersson@kernel.org \
--cc=andriy.shevchenko@intel.com \
--cc=andy@kernel.org \
--cc=conor+dt@kernel.org \
--cc=devicetree@vger.kernel.org \
--cc=dlechner@baylibre.com \
--cc=dmitry.baryshkov@oss.qualcomm.com \
--cc=konradybcio@kernel.org \
--cc=krzk+dt@kernel.org \
--cc=linux-arm-msm@vger.kernel.org \
--cc=linux-iio@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux@smankusors.com \
--cc=nuno.sa@analog.com \
--cc=phone-devel@vger.kernel.org \
--cc=robh@kernel.org \
/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