Skip to contentSkip to conversation

rtc: Ensure DT compatibles have SPI device IDs

PATCH Applied Mark Brown 2 participants 5 messages Sep 23, 2021 – Sep 25, 2021 Real time clock (RTC)

lore
Share & tools
lore

Mark Brown

author
#0 lore raw

cover rtc: Ensure DT compatibles have SPI device IDs

Currently autoloading for SPI devices does not use the DT ID table, it uses SPI modalises. Supporting OF modalises is going to be difficult if not impractical, an attempt was made but has been reverted, so this series adds SPI IDs where they aren't provided for a given modalias.

Mark Brown (3):
rtc: ds1302: Add SPI ID table
rtc: ds1390: Add SPI ID table
rtc: pcf2123: Add SPI ID table

 drivers/rtc/rtc-ds1302.c  | 7 +++++++
 drivers/rtc/rtc-ds1390.c  | 7 +++++++
 drivers/rtc/rtc-pcf2123.c | 9 +++++++++
 3 files changed, 23 insertions(+)

base-commit: e73f0f0ee7541171d89f2e2491130c7771ba58d3

Signature · 1 line
2.20.1
author
#1 lore raw

PATCH 1/3 rtc: ds1302: Add SPI ID table

Currently autoloading for SPI devices does not use the DT ID table, it uses SPI modalises. Supporting OF modalises is going to be difficult if not impractical, an attempt was made but has been reverted, so ensure that module autoloading works for this driver by adding an id_table listing the SPI IDs for everything.

Fixes 96c8395e2166 ("spi: Revert modalias changes")
---
 drivers/rtc/rtc-ds1302.c | 7 +++++++
 1 file changed, 7 insertions(+)
drivers/rtc/rtc-ds1302.c +7 -0
index b3de6d2e680a..2f83adef966e 100644
@@ -199,11 +199,18 @@ static const struct of_device_id ds1302_dt_ids[] = {
 MODULE_DEVICE_TABLE(of, ds1302_dt_ids);
 #endif
 
+static const struct spi_device_id ds1302_spi_ids[] = {
+	{ .name = "ds1302", },
+	{ /* sentinel */ }
+};
+MODULE_DEVICE_TABLE(spi, ds1302_spi_ids);
+
 static struct spi_driver ds1302_driver = {
 	.driver.name	= "rtc-ds1302",
 	.driver.of_match_table = of_match_ptr(ds1302_dt_ids),
 	.probe		= ds1302_probe,
 	.remove		= ds1302_remove,
+	.id_table	= ds1302_spi_ids,
 };
 
 module_spi_driver(ds1302_driver);
Signature · 1 line
2.20.1
author
#2 lore raw

PATCH 2/3 rtc: ds1390: Add SPI ID table

In reply to Mark Brown

Currently autoloading for SPI devices does not use the DT ID table, it uses SPI modalises. Supporting OF modalises is going to be difficult if not impractical, an attempt was made but has been reverted, so ensure that module autoloading works for this driver by adding an id_table listing the SPI IDs for everything.

Fixes 96c8395e2166 ("spi: Revert modalias changes")
---
 drivers/rtc/rtc-ds1390.c | 7 +++++++
 1 file changed, 7 insertions(+)
drivers/rtc/rtc-ds1390.c +7 -0
index 66fc8617d07e..93ce72b9ae59 100644
@@ -219,12 +219,19 @@ static const struct of_device_id ds1390_of_match[] = {
 };
 MODULE_DEVICE_TABLE(of, ds1390_of_match);
 
+static const struct spi_device_id ds1390_spi_ids[] = {
+	{ .name = "ds1390" },
+	{}
+};
+MODULE_DEVICE_TABLE(spi, ds1390_spi_ids);
+
 static struct spi_driver ds1390_driver = {
 	.driver = {
 		.name	= "rtc-ds1390",
 		.of_match_table = of_match_ptr(ds1390_of_match),
 	},
 	.probe	= ds1390_probe,
+	.id_table = ds1390_spi_ids,
 };
 
 module_spi_driver(ds1390_driver);
Signature · 1 line
2.20.1
author
#3 lore raw

PATCH 3/3 rtc: pcf2123: Add SPI ID table

In reply to Mark Brown

Currently autoloading for SPI devices does not use the DT ID table, it uses SPI modalises. Supporting OF modalises is going to be difficult if not impractical, an attempt was made but has been reverted, so ensure that module autoloading works for this driver by adding an id_table listing the SPI IDs for everything.

Fixes 96c8395e2166 ("spi: Revert modalias changes")
---
 drivers/rtc/rtc-pcf2123.c | 9 +++++++++
 1 file changed, 9 insertions(+)
drivers/rtc/rtc-pcf2123.c +9 -0
index 0f58cac81d8c..7473e6c8a183 100644
@@ -451,12 +451,21 @@ static const struct of_device_id pcf2123_dt_ids[] = {
 MODULE_DEVICE_TABLE(of, pcf2123_dt_ids);
 #endif
 
+static const struct spi_device_id pcf2123_spi_ids[] = {
+	{ .name = "pcf2123", },
+	{ .name = "rv2123", },
+	{ .name = "rtc-pcf2123", },
+	{ /* sentinel */ }
+};
+MODULE_DEVICE_TABLE(spi, pcf2123_spi_ids);
+
 static struct spi_driver pcf2123_driver = {
 	.driver	= {
 			.name	= "rtc-pcf2123",
 			.of_match_table = of_match_ptr(pcf2123_dt_ids),
 	},
 	.probe	= pcf2123_probe,
+	.id_table = pcf2123_spi_ids,
 };
 
 module_spi_driver(pcf2123_driver);
Signature · 1 line
2.20.1
maintainer Applied
#4 lore raw
In reply to Mark Brown
Quoted 11 lines · Mark Brown

Currently autoloading for SPI devices does not use the DT ID table, it uses SPI modalises. Supporting OF modalises is going to be difficult if not impractical, an attempt was made but has been reverted, so this series adds SPI IDs where they aren't provided for a given modalias.

Mark Brown (3):
rtc: ds1302: Add SPI ID table
rtc: ds1390: Add SPI ID table
rtc: pcf2123: Add SPI ID table

[...]

Applied, thanks!

[1/3] rtc: ds1302: Add SPI ID table

      commit: 8719a17613e0233d707eb22e1645d217594631ef
[2/3] rtc: ds1390: Add SPI ID table
      commit: da87639d6312afb8855717c791768bf2d4ca8ac8
[3/3] rtc: pcf2123: Add SPI ID table
      commit: 5f84478e14aa8b43a4ea85d2e091931741947749

Best regards,

Signature · 1 line
Alexandre Belloni <[email protected]>