From: Jorijn van der Graaf <jorijnvdgraaf@catcrafts.net>
To: Andy Shevchenko <andriy.shevchenko@intel.com>
Cc: "Jorijn van der Graaf" <jorijnvdgraaf@catcrafts.net>,
"Jonathan Cameron" <jic23@kernel.org>,
linux-iio@vger.kernel.org,
"David Lechner" <dlechner@baylibre.com>,
"Nuno Sá" <nuno.sa@analog.com>,
"Andy Shevchenko" <andy@kernel.org>,
"Rob Herring" <robh@kernel.org>,
"Krzysztof Kozlowski" <krzk+dt@kernel.org>,
"Conor Dooley" <conor+dt@kernel.org>,
devicetree@vger.kernel.org, "Kees Cook" <kees@kernel.org>,
"Gustavo A. R. Silva" <gustavoars@kernel.org>,
linux-hardening@vger.kernel.org, linux-kernel@vger.kernel.org,
"Luca Weiss" <luca.weiss@fairphone.com>
Subject: Re: [PATCH 3/3] iio: light: stk3310: support the Sensortek STK36C61
Date: Mon, 10 Aug 2026 23:52:16 +0200 [thread overview]
Message-ID: <20260810215216.154484-1-jorijnvdgraaf@catcrafts.net> (raw)
In-Reply-To: <anoaYQNHKSNE8Pci@ashevche-desk.local>
On Mon, Aug 10, 2026 at 09:37:21PM +0300, Andy Shevchenko wrote:
> > - if (chan->type != IIO_LIGHT && chan->type != IIO_PROXIMITY)
> > + if (chan->type != IIO_LIGHT && chan->type != IIO_PROXIMITY &&
> > + chan->type != IIO_INTENSITY)
> > return -EINVAL;
>
> Is this now a duplicating a bit with the below choices?
A bit, in the int_time and scale arms. The check at the top is
pre-existing (this patch only adds IIO_INTENSITY to it) and is the
only type filter for the RAW case, which serves all three types
through chan->address with no per-type branching of its own.
> > case IIO_CHAN_INFO_INT_TIME:
> > if (chan->type == IIO_LIGHT)
> > ret = regmap_field_read(data->reg_als_it, &index);
> > - else
> > + else if (chan->type == IIO_PROXIMITY)
> > ret = regmap_field_read(data->reg_ps_it, &index);
> > + else
> > + return -EINVAL;
>
> If you want to keep a single point of return, use
>
> ret = -EINVAL;
>
> here and below in _read_raw().
Neither of the new else branches is reachable today: the colour
channels declare RAW only, so no int_time or scale attribute exists
for them, and in-kernel readers are gated by iio_channel_has_info().
I would rather keep them than have a bare else read as proximity for
a colour channel. v2 writes them with ret = -EINVAL as you suggest,
falling into the existing if (ret < 0) return ret.
Thanks,
Jorijn
prev parent reply other threads:[~2026-08-10 21:57 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-08-10 11:04 [PATCH 0/3] iio: light: stk3310: per-chip match data and STK36C61 support Jorijn van der Graaf
2026-08-10 11:04 ` [PATCH 1/3] dt-bindings: iio: light: stk33xx: document the Sensortek STK36C61 Jorijn van der Graaf
2026-08-10 11:04 ` [PATCH 2/3] iio: light: stk3310: add per-chip match data Jorijn van der Graaf
2026-08-10 18:34 ` Andy Shevchenko
2026-08-10 21:51 ` Jorijn van der Graaf
2026-08-10 11:04 ` [PATCH 3/3] iio: light: stk3310: support the Sensortek STK36C61 Jorijn van der Graaf
2026-08-10 11:28 ` sashiko-bot
2026-08-10 18:37 ` Andy Shevchenko
2026-08-10 21:52 ` Jorijn van der Graaf [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=20260810215216.154484-1-jorijnvdgraaf@catcrafts.net \
--to=jorijnvdgraaf@catcrafts.net \
--cc=andriy.shevchenko@intel.com \
--cc=andy@kernel.org \
--cc=conor+dt@kernel.org \
--cc=devicetree@vger.kernel.org \
--cc=dlechner@baylibre.com \
--cc=gustavoars@kernel.org \
--cc=jic23@kernel.org \
--cc=kees@kernel.org \
--cc=krzk+dt@kernel.org \
--cc=linux-hardening@vger.kernel.org \
--cc=linux-iio@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=luca.weiss@fairphone.com \
--cc=nuno.sa@analog.com \
--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