From: David Daney Date: Tue, 22 May 2012 22:47:19 +0000 (-0700) Subject: of/spi: Fix SPI module loading by using proper "spi:" modalias prefixes. X-Git-Tag: next-20120724~115^2 X-Git-Url: https://git.karo-electronics.de/?a=commitdiff_plain;h=d1c185bcb15184ebcbc1b2e003e9a6c4658985c4;p=karo-tx-linux.git of/spi: Fix SPI module loading by using proper "spi:" modalias prefixes. To get modprobe to automatically load the proper modules, we need to prefix things with "spi:". Partially based on Grant Likely's suggestions. Signed-off-by: David Daney [grant.likely: reworked because drivers/of/of_spi.c has been removed] Signed-off-by: Grant Likely --- diff --git a/drivers/spi/spi.c b/drivers/spi/spi.c index 1041cb83d67a..fc0da392c424 100644 --- a/drivers/spi/spi.c +++ b/drivers/spi/spi.c @@ -53,7 +53,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[] = { @@ -813,6 +813,7 @@ static void of_register_spi_devices(struct spi_master *master) struct spi_device *spi; struct device_node *nc; const __be32 *prop; + char modalias[SPI_NAME_SIZE + 4]; int rc; int len; @@ -874,7 +875,9 @@ static void of_register_spi_devices(struct spi_master *master) spi->dev.of_node = nc; /* Register the new device */ - request_module(spi->modalias); + snprintf(modalias, sizeof(modalias), "%s%s", SPI_MODULE_PREFIX, + spi->modalias); + request_module(modalias); rc = spi_add_device(spi); if (rc) { dev_err(&master->dev, "spi_device register error %s\n",