From: "Siratul Islam" <siratul.islam@linux.dev>
To: "Jorijn van der Graaf" <jorijnvdgraaf@catcrafts.net>,
"Jonathan Cameron" <jic23@kernel.org>
Cc: "Jorijn van der Graaf" <jorijnvdgraaf@catcrafts.net>,
"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>,
"Luca Weiss" <luca.weiss@fairphone.com>,
linux-iio@vger.kernel.org, devicetree@vger.kernel.org,
linux-kernel@vger.kernel.org
Subject: Re: [PATCH 2/2] iio: magnetometer: add support for QST QMC6308
Date: Thu, 16 Jul 2026 19:06:51 +0000 [thread overview]
Message-ID: <ea6f4eaeb0535d607d77920515e9cb1739266624@linux.dev> (raw)
In-Reply-To: <20260716141837.83326-1-jorijnvdgraaf@catcrafts.net>
July 16, 2026 at 8:18 PM, "Jorijn van der Graaf" wrote:
...
> > +#define QMC6308_AUTOSUSPEND_DELAY_MS 500
> > You can call it QMC6308_SLEEP_DELAY_MS to align with other values.
> >
> I'd prefer to keep AUTOSUSPEND here: it names the mechanism the value
> feeds (pm_runtime_set_autosuspend_delay()) and matches yamaha-yas530
> and ak8974 in this directory.
>
I can find atleast 10 drivers in IIO that uses *_SLEEP_DELAY_MS postfix
for autosuspend delay value. So it's not a strong reason not to use it.
>
...
> >
> > Why not use a switch here instead of depending on 'i'. In it's
> > current form, we would need to keep going back to check what the
> > scales, odr, osr arrays look like.
> > I would suggest following the same pattern as the QMC5883L driver.
> >
> > The arrays could also be flattened like this if you follow the
> > above suggestion.
> > +static const int qmc6308_odr_avail[] = { 10, 50, 100, 200 };
> >
> The arrays are designated-initializer tables indexed by the register
> field code, and the same tables back read_raw(), write_raw() and
> read_avail() - so the value <-> field-code mapping lives in one place
> and the accepted writes stay in lockstep with the advertised
> _available values. Switches would duplicate that mapping per
> direction, and the flattened form only works once the tables stop
> being indexed by field code. I'd prefer to keep the tables, but if
> Jonathan wants the qmc5883l shape for consistency across the two
> drivers I'm fine changing it.
>
I know what the code is doing here. But I'm emphasizing readability. You
are using 'i' with double responsibility. You already have #define
values that you are only ever using as array indecies. Using a switch
here combining with the #define(s) would be more readable and explicit.
But it is more about preferences and following existing conventions
(i.e., the sibling driver). Jonathan, Andy, or David may have more idea
about the "preferred" way to do this.
>
...
>
> Thanks,
> Jorijn
>
--
Best regards,
Sirat
prev parent reply other threads:[~2026-07-16 19:07 UTC|newest]
Thread overview: 15+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-07-14 20:28 [PATCH 0/2] iio: magnetometer: add support for QST QMC6308 Jorijn van der Graaf
2026-07-14 20:28 ` [PATCH 1/2] dt-bindings: iio: magnetometer: add " Jorijn van der Graaf
2026-07-15 18:32 ` Siratul Islam
2026-07-15 20:46 ` Jorijn van der Graaf
2026-07-15 22:16 ` Siratul Islam
2026-07-16 14:18 ` Jorijn van der Graaf
2026-07-14 20:28 ` [PATCH 2/2] iio: magnetometer: add support for " Jorijn van der Graaf
2026-07-14 20:38 ` sashiko-bot
2026-07-14 21:21 ` Uwe Kleine-König
2026-07-15 20:46 ` Jorijn van der Graaf
2026-07-16 9:52 ` Siratul Islam
2026-07-16 10:11 ` Siratul Islam
2026-07-16 14:18 ` Jorijn van der Graaf
2026-07-16 14:45 ` Siratul Islam
2026-07-16 19:06 ` Siratul Islam [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=ea6f4eaeb0535d607d77920515e9cb1739266624@linux.dev \
--to=siratul.islam@linux.dev \
--cc=andy@kernel.org \
--cc=conor+dt@kernel.org \
--cc=devicetree@vger.kernel.org \
--cc=dlechner@baylibre.com \
--cc=jic23@kernel.org \
--cc=jorijnvdgraaf@catcrafts.net \
--cc=krzk+dt@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 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.