All of lore.kernel.org
 help / color / mirror / Atom feed
From: Wei Yongjun <weiyongjun@huaweicloud.com>
To: "Jonathan Cameron" <jic23@kernel.org>,
	"Lars-Peter Clausen" <lars@metafoo.de>,
	"Nuno Sá" <nuno.sa@analog.com>,
	"Andy Shevchenko" <andy.shevchenko@gmail.com>,
	"Uwe Kleine-König" <u.kleine-koenig@pengutronix.de>
Cc: Wei Yongjun <weiyongjun1@huawei.com>, linux-iio@vger.kernel.org
Subject: [PATCH 1/5 v3] iio: adc: ti-ads131e08: Silence no spi_device_id warnings
Date: Wed, 21 Sep 2022 16:36:16 +0000	[thread overview]
Message-ID: <20220921163620.805879-2-weiyongjun@huaweicloud.com> (raw)
In-Reply-To: <20220921163620.805879-1-weiyongjun@huaweicloud.com>

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 ads131e08 has no spi_device_id for ti,ads131e04
SPI driver ads131e08 has no spi_device_id for ti,ads131e06

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

Signed-off-by: Wei Yongjun <weiyongjun1@huawei.com>
---
 drivers/iio/adc/ti-ads131e08.c | 11 +++++++++++
 1 file changed, 11 insertions(+)

diff --git a/drivers/iio/adc/ti-ads131e08.c b/drivers/iio/adc/ti-ads131e08.c
index 5235a93f28bc..fcfc46254313 100644
--- a/drivers/iio/adc/ti-ads131e08.c
+++ b/drivers/iio/adc/ti-ads131e08.c
@@ -807,6 +807,8 @@ static int ads131e08_probe(struct spi_device *spi)
 	int ret;
 
 	info = device_get_match_data(&spi->dev);
+	if (!info)
+		info = (void *)spi_get_device_id(spi)->driver_data;
 	if (!info) {
 		dev_err(&spi->dev, "failed to get match data\n");
 		return -ENODEV;
@@ -926,12 +928,21 @@ static const struct of_device_id ads131e08_of_match[] = {
 };
 MODULE_DEVICE_TABLE(of, ads131e08_of_match);
 
+static const struct spi_device_id ads131e08_ids[] = {
+	{ "ads131e04", (kernel_ulong_t)&ads131e08_info_tbl[ads131e04] },
+	{ "ads131e06", (kernel_ulong_t)&ads131e08_info_tbl[ads131e06] },
+	{ "ads131e08", (kernel_ulong_t)&ads131e08_info_tbl[ads131e08] },
+	{}
+};
+MODULE_DEVICE_TABLE(spi, ads131e08_ids);
+
 static struct spi_driver ads131e08_driver = {
 	.driver = {
 		.name = "ads131e08",
 		.of_match_table = ads131e08_of_match,
 	},
 	.probe = ads131e08_probe,
+	.id_table = ads131e08_ids,
 };
 module_spi_driver(ads131e08_driver);
 
-- 
2.34.1


  reply	other threads:[~2022-09-21 16:36 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-09-21 16:36 [PATCH 0/5 v3] iio: Silence no spi_device_id warnings Wei Yongjun
2022-09-21 16:36 ` Wei Yongjun [this message]
2022-09-22  5:43   ` [PATCH 1/5 v3] iio: adc: ti-ads131e08: " Uwe Kleine-König
2022-09-22 11:13     ` Jonathan Cameron
2022-09-22 13:26       ` Andy Shevchenko
2022-09-21 16:36 ` [PATCH 2/5 v3] iio: accel: sca3300: Silence no spi_device_id warning Wei Yongjun
2022-09-22  6:12   ` Tomas Melin
2022-09-21 16:36 ` [PATCH 3/5 v3] iio: adc: ad9467: Silence no spi_device_id warnings Wei Yongjun
2022-09-21 16:36 ` [PATCH 4/5 v3] iio: adc: ad7192: " Wei Yongjun
2022-09-21 16:36 ` [PATCH 5/5 v3] iio: adc: ad7124: " Wei Yongjun
2022-09-21 20:41 ` [PATCH 0/5 v3] iio: " Andy Shevchenko
2022-10-02 14:03   ` Jonathan Cameron
2022-10-03  7:29     ` Andy Shevchenko

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=20220921163620.805879-2-weiyongjun@huaweicloud.com \
    --to=weiyongjun@huaweicloud.com \
    --cc=andy.shevchenko@gmail.com \
    --cc=jic23@kernel.org \
    --cc=lars@metafoo.de \
    --cc=linux-iio@vger.kernel.org \
    --cc=nuno.sa@analog.com \
    --cc=u.kleine-koenig@pengutronix.de \
    --cc=weiyongjun1@huawei.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 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.