linux-spi.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* of/spi: Supply proper "spi:" modalias prefixes.
@ 2012-05-22 22:47 David Daney
       [not found] ` <1337726839-7710-1-git-send-email-ddaney.cavm-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
  0 siblings, 1 reply; 2+ messages in thread
From: David Daney @ 2012-05-22 22:47 UTC (permalink / raw)
  To: Grant Likely, Rob Herring,
	spi-devel-general-5NWGOfrQmneRv+LV9MX5uipxlwaOVQ5f
  Cc: linux-kernel-u79uwXL29TY76Z2rM5mHXA, David Daney

From: David Daney <david.daney-YGCgFSpz5w/QT0dZR+AlfA@public.gmane.org>

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 <david.daney-YGCgFSpz5w/QT0dZR+AlfA@public.gmane.org>
---
 drivers/of/of_spi.c |    6 +++++-
 drivers/spi/spi.c   |    2 +-
 2 files changed, 6 insertions(+), 2 deletions(-)

diff --git a/drivers/of/of_spi.c b/drivers/of/of_spi.c
index 6dbc074..3486d2d 100644
--- a/drivers/of/of_spi.c
+++ b/drivers/of/of_spi.c
@@ -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",
diff --git a/drivers/spi/spi.c b/drivers/spi/spi.c
index 3d8f662..da8aac7 100644
--- a/drivers/spi/spi.c
+++ b/drivers/spi/spi.c
@@ -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/

^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: of/spi: Supply proper "spi:" modalias prefixes.
       [not found] ` <1337726839-7710-1-git-send-email-ddaney.cavm-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
@ 2012-05-22 23:14   ` Grant Likely
  0 siblings, 0 replies; 2+ messages in thread
From: Grant Likely @ 2012-05-22 23:14 UTC (permalink / raw)
  To: David Daney, Rob Herring,
	spi-devel-general-5NWGOfrQmneRv+LV9MX5uipxlwaOVQ5f
  Cc: linux-kernel-u79uwXL29TY76Z2rM5mHXA, David Daney

On Tue, 22 May 2012 15:47:19 -0700, David Daney <ddaney.cavm-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:
> From: David Daney <david.daney-YGCgFSpz5w/QT0dZR+AlfA@public.gmane.org>
> 
> 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 <david.daney-YGCgFSpz5w/QT0dZR+AlfA@public.gmane.org>

Applied, thanks.

g.

> ---
>  drivers/of/of_spi.c |    6 +++++-
>  drivers/spi/spi.c   |    2 +-
>  2 files changed, 6 insertions(+), 2 deletions(-)
> 
> diff --git a/drivers/of/of_spi.c b/drivers/of/of_spi.c
> index 6dbc074..3486d2d 100644
> --- a/drivers/of/of_spi.c
> +++ b/drivers/of/of_spi.c
> @@ -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",
> diff --git a/drivers/spi/spi.c b/drivers/spi/spi.c
> index 3d8f662..da8aac7 100644
> --- a/drivers/spi/spi.c
> +++ b/drivers/spi/spi.c
> @@ -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[] = {

-- 
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/

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2012-05-22 23:14 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2012-05-22 22:47 of/spi: Supply proper "spi:" modalias prefixes David Daney
     [not found] ` <1337726839-7710-1-git-send-email-ddaney.cavm-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
2012-05-22 23:14   ` Grant Likely

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).