public inbox for linux-spi@vger.kernel.org
 help / color / mirror / Atom feed
From: Gustav Wiklander <gustav.wiklander@axis.com>
To: Mark Brown <broonie@kernel.org>
Cc: <kernel@axis.com>, Gustav Wiklander <gustavwi@axis.com>,
	<linux-spi@vger.kernel.org>, <linux-kernel@vger.kernel.org>
Subject: [PATCH] spi: spidev: Fix so the module is autoloaded when built as external
Date: Mon, 4 Jan 2021 16:34:35 +0100	[thread overview]
Message-ID: <20210104153436.20083-1-gustav.wiklander@axis.com> (raw)

From: Gustav Wiklander <gustavwi@axis.com>

The spi framework sets the modalias for the spi device to belong in
either the acpi device table or the SPI device table. It can never
be in the OF table. Therefore the spidev driver should populate the
spi device table rather than the OF table.

NOTE: platform drivers and i2c drivers support aliases in the
      OF device table.

Signed-off-by: Gustav Wiklander <gustavwi@axis.com>
---
 drivers/spi/spidev.c | 15 ++++++++++++++-
 1 file changed, 14 insertions(+), 1 deletion(-)

diff --git a/drivers/spi/spidev.c b/drivers/spi/spidev.c
index 859910ec8d9f..5cf419a046da 100644
--- a/drivers/spi/spidev.c
+++ b/drivers/spi/spidev.c
@@ -687,6 +687,19 @@ static const struct of_device_id spidev_dt_ids[] = {
 MODULE_DEVICE_TABLE(of, spidev_dt_ids);
 #endif
 
+static const struct spi_device_id spidev_ids[] = {
+	{ .name = "dh2228fv" },
+	{ .name = "ltc2488" },
+	{ .name = "achc" },
+	{ .name = "sx1301" },
+	{ .name = "bk4" },
+	{ .name = "dhcom-board" },
+	{ .name = "m53cpld" },
+	{ .name = "xc7a35t" },
+	{},
+};
+MODULE_DEVICE_TABLE(spi, spidev_ids);
+
 #ifdef CONFIG_ACPI
 
 /* Dummy SPI devices not to be used in production systems */
@@ -817,7 +830,7 @@ static struct spi_driver spidev_spi_driver = {
 	},
 	.probe =	spidev_probe,
 	.remove =	spidev_remove,
-
+	.id_table = spidev_ids,
 	/* NOTE:  suspend/resume methods are not necessary here.
 	 * We don't do anything except pass the requests to/from
 	 * the underlying controller.  The refrigerator handles
-- 
2.11.0


             reply	other threads:[~2021-01-04 15:44 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-01-04 15:34 Gustav Wiklander [this message]
2021-01-04 21:34 ` [PATCH] spi: spidev: Fix so the module is autoloaded when built as external Mark Brown
2021-01-05  9:44   ` Gustav Wiklander
2021-01-07 17:40     ` Mark Brown

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=20210104153436.20083-1-gustav.wiklander@axis.com \
    --to=gustav.wiklander@axis.com \
    --cc=broonie@kernel.org \
    --cc=gustavwi@axis.com \
    --cc=kernel@axis.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-spi@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