diff mbox series

[2/5,v3] iio: accel: sca3300: Silence no spi_device_id warning

Message ID 20220921163620.805879-3-weiyongjun@huaweicloud.com (mailing list archive)
State Accepted
Headers show
Series iio: Silence no spi_device_id warnings | expand

Commit Message

Wei Yongjun Sept. 21, 2022, 4:36 p.m. UTC
From: Wei Yongjun <weiyongjun1@huawei.com>

SPI devices use the spi_device_id for module autoloading even on
systems using device tree, after commit 5fa6863ba692 ("spi: Check
we have a spi_device_id for each DT compatible"), kernel warns as
follows since the spi_device_id is missing:

SPI driver sca3300 has no spi_device_id for murata,scl3300

Add spi_device_id entries to silence the warning, and ensure driver
module autoloading works.

Signed-off-by: Wei Yongjun <weiyongjun1@huawei.com>
---
 drivers/iio/accel/sca3300.c | 12 ++++++++++--
 1 file changed, 10 insertions(+), 2 deletions(-)

Comments

Tomas Melin Sept. 22, 2022, 6:12 a.m. UTC | #1
On 21/09/2022 19:36, Wei Yongjun wrote:
> From: Wei Yongjun <weiyongjun1@huawei.com>
> 
> SPI devices use the spi_device_id for module autoloading even on
> systems using device tree, after commit 5fa6863ba692 ("spi: Check
> we have a spi_device_id for each DT compatible"), kernel warns as
> follows since the spi_device_id is missing:
> 
> SPI driver sca3300 has no spi_device_id for murata,scl3300
> 
> Add spi_device_id entries to silence the warning, and ensure driver
> module autoloading works.
> 
> Signed-off-by: Wei Yongjun <weiyongjun1@huawei.com>

Reviewed-by: Tomas Melin <tomas.melin@vaisala.com>

> ---
>  drivers/iio/accel/sca3300.c | 12 ++++++++++--
>  1 file changed, 10 insertions(+), 2 deletions(-)
> 
> diff --git a/drivers/iio/accel/sca3300.c b/drivers/iio/accel/sca3300.c
> index eaa0c9cfda44..306482b70fad 100644
> --- a/drivers/iio/accel/sca3300.c
> +++ b/drivers/iio/accel/sca3300.c
> @@ -679,12 +679,20 @@ static const struct of_device_id sca3300_dt_ids[] = {
>  };
>  MODULE_DEVICE_TABLE(of, sca3300_dt_ids);
>  
> +static const struct spi_device_id sca3300_ids[] = {
> +	{ "sca3300" },
> +	{ "scl3300" },
> +	{}
> +};
> +MODULE_DEVICE_TABLE(spi, sca3300_ids);
> +
>  static struct spi_driver sca3300_driver = {
> -	.driver = {
> +	.driver   = {
>  		.name		= SCA3300_ALIAS,
>  		.of_match_table = sca3300_dt_ids,
>  	},
> -	.probe	= sca3300_probe,
> +	.probe	  = sca3300_probe,
> +	.id_table = sca3300_ids,
>  };
>  module_spi_driver(sca3300_driver);
>
diff mbox series

Patch

diff --git a/drivers/iio/accel/sca3300.c b/drivers/iio/accel/sca3300.c
index eaa0c9cfda44..306482b70fad 100644
--- a/drivers/iio/accel/sca3300.c
+++ b/drivers/iio/accel/sca3300.c
@@ -679,12 +679,20 @@  static const struct of_device_id sca3300_dt_ids[] = {
 };
 MODULE_DEVICE_TABLE(of, sca3300_dt_ids);
 
+static const struct spi_device_id sca3300_ids[] = {
+	{ "sca3300" },
+	{ "scl3300" },
+	{}
+};
+MODULE_DEVICE_TABLE(spi, sca3300_ids);
+
 static struct spi_driver sca3300_driver = {
-	.driver = {
+	.driver   = {
 		.name		= SCA3300_ALIAS,
 		.of_match_table = sca3300_dt_ids,
 	},
-	.probe	= sca3300_probe,
+	.probe	  = sca3300_probe,
+	.id_table = sca3300_ids,
 };
 module_spi_driver(sca3300_driver);