Skip to contentSkip to conversation

of/spi: Supply proper "spi:" modalias prefixes.

PATCH Applied David Daney 2 participants 2 messages May 22, 2012

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

From: David Daney <david.daney-YGCgFSpz5w/[email protected]>

To get modprobe to automatically load the proper modules, we need to prefix things with "spi:". Partially based on Grant Likely's suggestions.

---
 drivers/of/of_spi.c |    6 +++++-
 drivers/spi/spi.c   |    2 +-
 2 files changed, 6 insertions(+), 2 deletions(-)
drivers/of/of_spi.c +5 -1
index 6dbc074..3486d2d 100644
@@ -25,6 +25,7 @@ void of_register_spi_devices(struct spi_master *master)
 	struct spi_device *spi;
 	struct device_node *nc;
 	const __be32 *prop;
+	char request_module_modalias[SPI_NAME_SIZE + 4];
 	int rc;
 	int len;
 
@@ -86,7 +87,10 @@ void of_register_spi_devices(struct spi_master *master)
 		spi->dev.of_node = nc;
 
 		/* Register the new device */
-		request_module(spi->modalias);
+		snprintf(request_module_modalias,
+			 sizeof(request_module_modalias),
+			 "%s%s", SPI_MODULE_PREFIX, spi->modalias);
+		request_module(request_module_modalias);
 		rc = spi_add_device(spi);
 		if (rc) {
 			dev_err(&master->dev, "spi_device register error %s\n",
drivers/spi/spi.c +1 -1
index 3d8f662..da8aac7 100644
@@ -51,7 +51,7 @@ modalias_show(struct device *dev, struct device_attribute *a, char *buf)
 {
 	const struct spi_device	*spi = to_spi_device(dev);
 
-	return sprintf(buf, "%s\n", spi->modalias);
+	return sprintf(buf, "%s%s\n", SPI_MODULE_PREFIX, spi->modalias);
 }
 
 static struct device_attribute spi_dev_attrs[] = {

------------------------------------------------------------------------------
Live Security Virtual Conference
Exclusive live event will cover all the ways today's security and threat landscape has changed and how IT managers can respond. Discussions will include endpoint security, mobile security and the latest in malware threats. http://www.accelacomm.com/jaw/sfrnl04242012/114/50122263/

Applied
#1 lore raw
Quoted 6 lines · David Daney

From: David Daney <david.daney-YGCgFSpz5w/[email protected]>

To get modprobe to automatically load the proper modules, we need to prefix things with "spi:". Partially based on Grant Likely's suggestions.

Applied, thanks.

g.

Quoted 42 lines
---
 drivers/of/of_spi.c |    6 +++++-
 drivers/spi/spi.c   |    2 +-
 2 files changed, 6 insertions(+), 2 deletions(-)
drivers/of/of_spi.c +5 -1
index 6dbc074..3486d2d 100644
@@ -25,6 +25,7 @@ void of_register_spi_devices(struct spi_master *master)
 	struct spi_device *spi;
 	struct device_node *nc;
 	const __be32 *prop;
+	char request_module_modalias[SPI_NAME_SIZE + 4];
 	int rc;
 	int len;
 
@@ -86,7 +87,10 @@ void of_register_spi_devices(struct spi_master *master)
 		spi->dev.of_node = nc;
 
 		/* Register the new device */
-		request_module(spi->modalias);
+		snprintf(request_module_modalias,
+			 sizeof(request_module_modalias),
+			 "%s%s", SPI_MODULE_PREFIX, spi->modalias);
+		request_module(request_module_modalias);
 		rc = spi_add_device(spi);
 		if (rc) {
 			dev_err(&master->dev, "spi_device register error %s\n",
drivers/spi/spi.c +1 -1
index 3d8f662..da8aac7 100644
@@ -51,7 +51,7 @@ modalias_show(struct device *dev, struct device_attribute *a, char *buf)
 {
 	const struct spi_device	*spi = to_spi_device(dev);
 
-	return sprintf(buf, "%s\n", spi->modalias);
+	return sprintf(buf, "%s%s\n", SPI_MODULE_PREFIX, spi->modalias);
 }
 
 static struct device_attribute spi_dev_attrs[] = {
Signature · 9 lines
Grant Likely, B.Sc, P.Eng.
Secret Lab Technologies, Ltd.

------------------------------------------------------------------------------
Live Security Virtual Conference
Exclusive live event will cover all the ways today's security and 
threat landscape has changed and how IT managers can respond. Discussions 
will include endpoint security, mobile security and the latest in malware 
threats. http://www.accelacomm.com/jaw/sfrnl04242012/114/50122263/