From: Jonathan Cameron <jic23@kernel.org>
To: Siddharth Menon <simeddon@gmail.com>
Cc: linux-iio@vger.kernel.org, lars@metafoo.de,
Michael.Hennerich@analog.com, gregkh@linuxfoundation.org,
linux-kernel@vger.kernel.org, linux-staging@lists.linux.dev,
marcelo.schmitt1@gmail.com
Subject: Re: [PATCH] iio: frequency: ad9832: devicetree probing support
Date: Sat, 22 Mar 2025 14:13:50 +0000 [thread overview]
Message-ID: <20250322141350.3fb7d560@jic23-huawei> (raw)
In-Reply-To: <20250322081108.202654-1-simeddon@gmail.com>
On Sat, 22 Mar 2025 13:37:45 +0530
Siddharth Menon <simeddon@gmail.com> wrote:
> Introduce struct for device match of_device_id
Good to say why. Key is that it will probe from a dts
entry without this due to the various matching fallback paths,
but it will be matching with the less informative bit after
the manufacturer. So we might get a false match in future
against some other ad9832 part.
>
> Suggested-by: Marcelo Schmitt <marcelo.schmitt1@gmail.com>
> Signed-off-by: Siddharth Menon <simeddon@gmail.com>
> ---
> drivers/staging/iio/frequency/ad9832.c | 8 ++++++++
> 1 file changed, 8 insertions(+)
>
> diff --git a/drivers/staging/iio/frequency/ad9832.c b/drivers/staging/iio/frequency/ad9832.c
> index 9a27acd88926..506478ddede3 100644
> --- a/drivers/staging/iio/frequency/ad9832.c
> +++ b/drivers/staging/iio/frequency/ad9832.c
> @@ -439,6 +439,13 @@ static int ad9832_probe(struct spi_device *spi)
> return devm_iio_device_register(&spi->dev, indio_dev);
> }
>
> +static const struct of_device_id ad9832_of_match[] = {
> + { .compatible = "adi,ad9832" },
> + { .compatible = "adi,ad9835" },
> + {},
No comma on a terminating entry like this. We don't want to make it easy
to add stuff after it!
Also, I'm trying to standardize the formatting of these tables
across IIO. So I made the random choice of having a space between
the brackets and am slowly changing drivers to that standard.
{ }
> +};
> +MODULE_DEVICE_TABLE(of, ad9832_of_match);
> +
> static const struct spi_device_id ad9832_id[] = {
> {"ad9832", 0},
> {"ad9835", 0},
> @@ -449,6 +456,7 @@ MODULE_DEVICE_TABLE(spi, ad9832_id);
> static struct spi_driver ad9832_driver = {
> .driver = {
> .name = "ad9832",
> + .of_match_table = ad9832_of_match,
> },
> .probe = ad9832_probe,
> .id_table = ad9832_id,
prev parent reply other threads:[~2025-03-22 14:14 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-03-22 8:07 [PATCH] iio: frequency: ad9832: devicetree probing support Siddharth Menon
2025-03-22 13:40 ` Marcelo Schmitt
2025-03-23 11:59 ` Jonathan Cameron
2025-03-22 14:13 ` Jonathan Cameron [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=20250322141350.3fb7d560@jic23-huawei \
--to=jic23@kernel.org \
--cc=Michael.Hennerich@analog.com \
--cc=gregkh@linuxfoundation.org \
--cc=lars@metafoo.de \
--cc=linux-iio@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-staging@lists.linux.dev \
--cc=marcelo.schmitt1@gmail.com \
--cc=simeddon@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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox