From: Jonathan Cameron <jic23@kernel.org>
To: Andy Shevchenko <andriy.shevchenko@intel.com>
Cc: "Vidhu Sarwal" <vidhu.linux@gmail.com>,
"David Lechner" <dlechner@baylibre.com>,
"Nuno Sá" <nuno.sa@analog.com>,
"Andy Shevchenko" <andy@kernel.org>,
linux-iio@vger.kernel.org, linux-kernel@vger.kernel.org,
"Shuah Khan" <skhan@linuxfoundation.org>,
linux-kernel-mentees@lists.linux.dev
Subject: Re: [PATCH] iio: light: al3010: fix incorrect scale for the highest gain range
Date: Thu, 2 Jul 2026 18:33:03 +0100 [thread overview]
Message-ID: <20260702183303.28c29671@jic23-huawei> (raw)
In-Reply-To: <akYzFtxKhq5U2kFY@ashevche-desk.local>
On Thu, 2 Jul 2026 12:44:54 +0300
Andy Shevchenko <andriy.shevchenko@intel.com> wrote:
> On Thu, Jul 02, 2026 at 10:59:13AM +0530, Vidhu Sarwal wrote:
> > al3010_scales[] encodes the highest gain range as {0, 1187200}.
> > For IIO_VAL_INT_PLUS_MICRO, the fractional part must be less than
> > 1000000, so the scale 1.1872 should instead be represented as
> > {1, 187200}.
> >
> > Since write_raw() compares the value from userspace against this
> > table, writing 1.1872 scale never matches the malformed
> > entry and returns -EINVAL. As a result, the highest gain range cannot
> > be selected. Reading the scale in that state also reports the malformed
> > value.
>
> Trailing spaces in the last line of the above paragraph.
>
> >
> > Fixes: c36b5195ab70 ("iio: light: add Dyna-Image AL3010 driver")
> > Signed-off-by: Vidhu Sarwal <vidhu.linux@gmail.com>
>
> ...
>
> > static const int al3010_scales[][2] = {
> > - {0, 1187200}, {0, 296800}, {0, 74200}, {0, 18600}
> > + {1, 187200}, {0, 296800}, {0, 74200}, {0, 18600}
>
> While at it, add a trailing comma.
Can we take opportunity to move to IIO (well my) preferred formatting
{ 1, 187200 }, { 0, 296800 }, { 0, 74200 }, { 0, 18600 },
Thanks,
Jonathan
>
> > };
>
> Otherwise LGTM, thanks.
>
next prev parent reply other threads:[~2026-07-02 17:33 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-07-02 5:29 [PATCH] iio: light: al3010: fix incorrect scale for the highest gain range Vidhu Sarwal
2026-07-02 9:44 ` Andy Shevchenko
2026-07-02 17:33 ` Jonathan Cameron [this message]
2026-07-04 11:52 ` [PATCH v2] " Vidhu Sarwal
2026-07-04 12:13 ` Andy Shevchenko
2026-07-04 23:06 ` Jonathan Cameron
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=20260702183303.28c29671@jic23-huawei \
--to=jic23@kernel.org \
--cc=andriy.shevchenko@intel.com \
--cc=andy@kernel.org \
--cc=dlechner@baylibre.com \
--cc=linux-iio@vger.kernel.org \
--cc=linux-kernel-mentees@lists.linux.dev \
--cc=linux-kernel@vger.kernel.org \
--cc=nuno.sa@analog.com \
--cc=skhan@linuxfoundation.org \
--cc=vidhu.linux@gmail.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.