From: Jonathan Cameron <jic23@kernel.org>
To: Rodrigo Alencar via B4 Relay
<devnull+rodrigo.alencar.analog.com@kernel.org>
Cc: rodrigo.alencar@analog.com, linux-kernel@vger.kernel.org,
linux-iio@vger.kernel.org, devicetree@vger.kernel.org,
Michael Hennerich <Michael.Hennerich@analog.com>,
Lars-Peter Clausen <lars@metafoo.de>,
David Lechner <dlechner@baylibre.com>,
Andy Shevchenko <andy@kernel.org>, Rob Herring <robh@kernel.org>,
Krzysztof Kozlowski <krzk+dt@kernel.org>,
Conor Dooley <conor+dt@kernel.org>
Subject: Re: [PATCH v4 09/11] iio: amplifiers: ad8366: add device tree support
Date: Sat, 14 Feb 2026 19:00:21 +0000 [thread overview]
Message-ID: <20260214190021.4eee6215@jic23-huawei> (raw)
In-Reply-To: <20260210-iio-ad8366-update-v4-9-15505f7b15b4@analog.com>
On Tue, 10 Feb 2026 19:42:09 +0000
Rodrigo Alencar via B4 Relay <devnull+rodrigo.alencar.analog.com@kernel.org> wrote:
> From: Rodrigo Alencar <rodrigo.alencar@analog.com>
>
> Drop the enum ID, split chip info table into per-device structs
> and add of_match_table.
>
> Signed-off-by: Rodrigo Alencar <rodrigo.alencar@analog.com>
Hi Rodrigo
A few more related things to update whilst you are doing this.
In general looks good.
Thanks
Jonathan
> +
> +static const struct ad8366_info hmc1119_chip_info = {
> + .gain_min = -31750,
As below. Add
.name = hmc1119,
and similar to all of these.
> + .gain_max = 0,
> + .gain_step = -250,
> + .num_channels = 1,
> };
>
> static int ad8366_write_code(struct ad8366_state *st)
> @@ -229,7 +224,7 @@ static int ad8366_probe(struct spi_device *spi)
> return dev_err_probe(dev, ret, "Failed to get regulator\n");
>
> st->spi = spi;
> - st->info = &ad8366_infos[spi_get_device_id(spi)->driver_data];
> + st->info = spi_get_device_match_data(spi);
Also drop the remaining use of spi_get_device_id() in setting the
name. There are fun issues that arise with using spi_get_device_id() at all
when fallback compatibles are a possibility (which they always are) and
so we are much better off just having the name strings also in the
ad8366_info structures.
>
> rstc = devm_reset_control_get_optional_exclusive_deasserted(dev, NULL);
> if (IS_ERR(rstc))
> @@ -250,18 +245,29 @@ static int ad8366_probe(struct spi_device *spi)
> }
>
> static const struct spi_device_id ad8366_id[] = {
> - {"ad8366", ID_AD8366},
> - {"ada4961", ID_ADA4961},
> - {"adl5240", ID_ADL5240},
> - {"hmc792a", ID_HMC792},
> - {"hmc1119", ID_HMC1119},
> + {"ad8366", (kernel_ulong_t)&ad8366_chip_info},
Given you are touching it anyway can you add space after { and before }
Thanks!
> + {"ada4961", (kernel_ulong_t)&ada4961_chip_info},
> + {"adl5240", (kernel_ulong_t)&adl5240_chip_info},
> + {"hmc792a", (kernel_ulong_t)&hmc792_chip_info},
> + {"hmc1119", (kernel_ulong_t)&hmc1119_chip_info},
> { }
> };
> MODULE_DEVICE_TABLE(spi, ad8366_id);
>
> +static const struct of_device_id ad8366_of_match[] = {
> + { .compatible = "adi,ad8366", .data = &ad8366_chip_info },
> + { .compatible = "adi,ada4961", .data = &ada4961_chip_info },
> + { .compatible = "adi,adl5240", .data = &adl5240_chip_info },
> + { .compatible = "adi,hmc792a", .data = &hmc792_chip_info },
> + { .compatible = "adi,hmc1119", .data = &hmc1119_chip_info },
> + { }
> +};
> +MODULE_DEVICE_TABLE(of, ad8366_of_match);
> +
> static struct spi_driver ad8366_driver = {
> .driver = {
> - .name = KBUILD_MODNAME,
> + .name = KBUILD_MODNAME,
> + .of_match_table = ad8366_of_match,
> },
> .probe = ad8366_probe,
> .id_table = ad8366_id,
>
next prev parent reply other threads:[~2026-02-14 19:00 UTC|newest]
Thread overview: 32+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-02-10 19:42 [PATCH v4 00/11] iio: amplifiers: ad8366: driver update and dt support Rodrigo Alencar via B4 Relay
2026-02-10 19:42 ` [PATCH v4 01/11] MAINTAINERS: Add missing maintainer entry for AD8366 driver Rodrigo Alencar via B4 Relay
2026-02-10 19:42 ` [PATCH v4 02/11] dt-bindings: iio: amplifiers: Add AD8366 support Rodrigo Alencar via B4 Relay
2026-02-10 19:42 ` [PATCH v4 03/11] iio: amplifiers: ad8366: remove unused include headers Rodrigo Alencar via B4 Relay
2026-02-10 19:57 ` Andy Shevchenko
2026-02-11 12:55 ` Rodrigo Alencar
2026-02-11 13:35 ` Andy Shevchenko
2026-02-14 18:30 ` Jonathan Cameron
2026-02-15 7:31 ` Andy Shevchenko
2026-02-15 16:03 ` Jonathan Cameron
2026-02-10 19:42 ` [PATCH v4 04/11] iio: amplifiers: ad8366: add local dev pointer to the probe function Rodrigo Alencar via B4 Relay
2026-02-10 19:58 ` Andy Shevchenko
2026-02-10 20:03 ` Andy Shevchenko
2026-02-14 18:34 ` Jonathan Cameron
2026-02-10 19:42 ` [PATCH v4 05/11] iio: amplifiers: ad8366: use devm_mutex_init() and drop mutex_init() Rodrigo Alencar via B4 Relay
2026-02-10 20:00 ` Andy Shevchenko
2026-02-14 18:36 ` Jonathan Cameron
2026-02-15 7:50 ` Andy Shevchenko
2026-02-10 19:42 ` [PATCH v4 06/11] iio: amplifiers: ad8366: replace reset-gpio with reset controller Rodrigo Alencar via B4 Relay
2026-02-14 18:37 ` Jonathan Cameron
2026-02-10 19:42 ` [PATCH v4 07/11] iio: amplifiers: ad8366: refactor device resource management Rodrigo Alencar via B4 Relay
2026-02-10 20:05 ` Andy Shevchenko
2026-02-11 12:10 ` Rodrigo Alencar
2026-02-11 13:30 ` Andy Shevchenko
2026-02-14 18:44 ` Jonathan Cameron
2026-02-10 19:42 ` [PATCH v4 08/11] iio: amplifiers: ad8366: prepare for device-tree support Rodrigo Alencar via B4 Relay
2026-02-14 18:56 ` Jonathan Cameron
2026-02-10 19:42 ` [PATCH v4 09/11] iio: amplifiers: ad8366: add device tree support Rodrigo Alencar via B4 Relay
2026-02-14 19:00 ` Jonathan Cameron [this message]
2026-02-10 19:42 ` [PATCH v4 10/11] iio: amplifiers: ad8366: consume enable gpio Rodrigo Alencar via B4 Relay
2026-02-10 19:42 ` [PATCH v4 11/11] iio: amplifiers: ad8366: update device support Rodrigo Alencar via B4 Relay
2026-02-14 19:02 ` 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=20260214190021.4eee6215@jic23-huawei \
--to=jic23@kernel.org \
--cc=Michael.Hennerich@analog.com \
--cc=andy@kernel.org \
--cc=conor+dt@kernel.org \
--cc=devicetree@vger.kernel.org \
--cc=devnull+rodrigo.alencar.analog.com@kernel.org \
--cc=dlechner@baylibre.com \
--cc=krzk+dt@kernel.org \
--cc=lars@metafoo.de \
--cc=linux-iio@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=robh@kernel.org \
--cc=rodrigo.alencar@analog.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