Linux IIO development
 help / color / mirror / Atom feed
From: Jonathan Cameron <jic23@kernel.org>
To: Jun Yan <jerrysteve1101@gmail.com>
Cc: lars@metafoo.de, linux-iio@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH v2 1/2] iio: gyro: bmg160_spi: add of_match_table
Date: Sat, 22 Feb 2025 16:37:52 +0000	[thread overview]
Message-ID: <20250222163752.5eb0d694@jic23-huawei> (raw)
In-Reply-To: <20250220165001.273325-2-jerrysteve1101@gmail.com>

On Fri, 21 Feb 2025 00:50:00 +0800
Jun Yan <jerrysteve1101@gmail.com> wrote:

> Add of_match_table to bmg160_spi driver.
> 
> This fixes automatic driver loading by userspace
> When using the device tree and the driver is built
> as a module, devices can be probed.
Wrap patch descriptions at 75 chars as mentioned in submitting-patches.rst

> 
> Signed-off-by: Jun Yan <jerrysteve1101@gmail.com>
Hi.

The patch content is fine, but I'm doubtful about the autoloading.
Did you actually try this and see a failure without this patch?

For SPI autoloading even with device tree compatibles should work without
the of_match_table though it will match against the compatible without
the bosch, part.  Maybe I missed a change that means that no longer
works.

I in general don't mind the actual change because it does ensure
we have the manufacturer in the match as well so makes future
problems less likely.

Jonathan



> ---
>  drivers/iio/gyro/bmg160_spi.c | 10 ++++++++++
>  1 file changed, 10 insertions(+)
> 
> diff --git a/drivers/iio/gyro/bmg160_spi.c b/drivers/iio/gyro/bmg160_spi.c
> index fc2e453527b9..ac04b3b1b554 100644
> --- a/drivers/iio/gyro/bmg160_spi.c
> +++ b/drivers/iio/gyro/bmg160_spi.c
> @@ -41,9 +41,19 @@ static const struct spi_device_id bmg160_spi_id[] = {
>  
>  MODULE_DEVICE_TABLE(spi, bmg160_spi_id);
>  
> +static const struct of_device_id bmg160_of_match[] = {
> +	{ .compatible = "bosch,bmg160" },
> +	{ .compatible = "bosch,bmi055_gyro" },
> +	{ .compatible = "bosch,bmi088_gyro" },
> +	{ }
> +};
> +
> +MODULE_DEVICE_TABLE(of, bmg160_of_match);
> +
>  static struct spi_driver bmg160_spi_driver = {
>  	.driver = {
>  		.name	= "bmg160_spi",
> +		.of_match_table = bmg160_of_match,
>  		.pm	= &bmg160_pm_ops,
>  	},
>  	.probe		= bmg160_spi_probe,


  reply	other threads:[~2025-02-22 16:37 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-02-20 16:49 [PATCH v2 0/2] iio: gyro: bmg160: Improve BMG160 driver with of_match_table support Jun Yan
2025-02-20 16:50 ` [PATCH v2 1/2] iio: gyro: bmg160_spi: add of_match_table Jun Yan
2025-02-22 16:37   ` Jonathan Cameron [this message]
2025-03-06 14:18     ` yjun
2025-02-20 16:50 ` [PATCH v2 2/2] iio: gyro: bmg160_i2c: add BMI088 to of_match_table Jun Yan
2025-02-22 16:40   ` 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=20250222163752.5eb0d694@jic23-huawei \
    --to=jic23@kernel.org \
    --cc=jerrysteve1101@gmail.com \
    --cc=lars@metafoo.de \
    --cc=linux-iio@vger.kernel.org \
    --cc=linux-kernel@vger.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