2021-11-30 11:24:59

by Jon Hunter

[permalink] [raw]
Subject: [PATCH V2] mtd: dataflash: Add device-tree SPI IDs

Commit 5fa6863ba692 ("spi: Check we have a spi_device_id for each DT
compatible") added a test to check that every SPI driver has a
spi_device_id for each DT compatiable string defined by the driver
and warns if the spi_device_id is missing. The spi_device_ids are
missing for the dataflash driver and the following warnings are now
seen.

WARNING KERN SPI driver mtd_dataflash has no spi_device_id for atmel,at45
WARNING KERN SPI driver mtd_dataflash has no spi_device_id for atmel,dataflash

Fix this by adding the necessary spi_device_ids.

Fixes: 96c8395e2166 ("spi: Revert modalias changes")
Signed-off-by: Jon Hunter <[email protected]>
---
Changes since V1:
- Added Fixes tag

drivers/mtd/devices/mtd_dataflash.c | 8 ++++++++
1 file changed, 8 insertions(+)

diff --git a/drivers/mtd/devices/mtd_dataflash.c b/drivers/mtd/devices/mtd_dataflash.c
index 293cab758299..734878abaa23 100644
--- a/drivers/mtd/devices/mtd_dataflash.c
+++ b/drivers/mtd/devices/mtd_dataflash.c
@@ -96,6 +96,13 @@ struct dataflash {
struct mtd_info mtd;
};

+static const struct spi_device_id dataflash_dev_ids[] = {
+ { "at45" },
+ { "dataflash" },
+ { },
+};
+MODULE_DEVICE_TABLE(spi, dataflash_dev_ids);
+
#ifdef CONFIG_OF
static const struct of_device_id dataflash_dt_ids[] = {
{ .compatible = "atmel,at45", },
@@ -927,6 +934,7 @@ static struct spi_driver dataflash_driver = {
.name = "mtd_dataflash",
.of_match_table = of_match_ptr(dataflash_dt_ids),
},
+ .id_table = dataflash_dev_ids,

.probe = dataflash_probe,
.remove = dataflash_remove,
--
2.25.1



2021-12-03 13:36:20

by Miquel Raynal

[permalink] [raw]
Subject: Re: [PATCH V2] mtd: dataflash: Add device-tree SPI IDs

On Tue, 2021-11-30 at 11:24:43 UTC, Jon Hunter wrote:
> Commit 5fa6863ba692 ("spi: Check we have a spi_device_id for each DT
> compatible") added a test to check that every SPI driver has a
> spi_device_id for each DT compatiable string defined by the driver
> and warns if the spi_device_id is missing. The spi_device_ids are
> missing for the dataflash driver and the following warnings are now
> seen.
>
> WARNING KERN SPI driver mtd_dataflash has no spi_device_id for atmel,at45
> WARNING KERN SPI driver mtd_dataflash has no spi_device_id for atmel,dataflash
>
> Fix this by adding the necessary spi_device_ids.
>
> Fixes: 96c8395e2166 ("spi: Revert modalias changes")
> Signed-off-by: Jon Hunter <[email protected]>

Applied to https://git.kernel.org/pub/scm/linux/kernel/git/mtd/linux.git mtd/fixes, thanks.

Miquel