* [PATCH] drivers/spi/spi.c: when allocating a struct device_d specify id as -1
@ 2012-05-14 8:38 Jan Luebbe
2012-05-14 9:05 ` Sascha Hauer
0 siblings, 1 reply; 4+ messages in thread
From: Jan Luebbe @ 2012-05-14 8:38 UTC (permalink / raw)
To: barebox
This causes allocation of a free id and avoids conflicts if multiple
identical SPI devices are attached.
Signed-off-by: Jan Luebbe <jlu@pengutronix.de>
---
drivers/spi/spi.c | 1 +
1 file changed, 1 insertion(+)
diff --git a/drivers/spi/spi.c b/drivers/spi/spi.c
index 7a8aed4..b63d02f 100644
--- a/drivers/spi/spi.c
+++ b/drivers/spi/spi.c
@@ -78,6 +78,7 @@ struct spi_device *spi_new_device(struct spi_master *master,
proxy->bits_per_word = chip->bits_per_word ? chip->bits_per_word : 8;
proxy->dev.platform_data = chip->platform_data;
strcpy(proxy->dev.name, chip->name);
+ proxy->dev.id = -1; /* allocate a free id for this chip */
proxy->dev.type_data = proxy;
dev_add_child(master->dev, &proxy->dev);
--
1.7.9.5
_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH] drivers/spi/spi.c: when allocating a struct device_d specify id as -1
2012-05-14 8:38 [PATCH] drivers/spi/spi.c: when allocating a struct device_d specify id as -1 Jan Luebbe
@ 2012-05-14 9:05 ` Sascha Hauer
2012-05-14 10:43 ` [PATCH v2] drivers/spi/spi.c: use DEVICE_ID_DYNAMIC when allocating a struct device_d Jan Luebbe
0 siblings, 1 reply; 4+ messages in thread
From: Sascha Hauer @ 2012-05-14 9:05 UTC (permalink / raw)
To: Jan Luebbe; +Cc: barebox
On Mon, May 14, 2012 at 10:38:39AM +0200, Jan Luebbe wrote:
> This causes allocation of a free id and avoids conflicts if multiple
> identical SPI devices are attached.
>
> Signed-off-by: Jan Luebbe <jlu@pengutronix.de>
> ---
> drivers/spi/spi.c | 1 +
> 1 file changed, 1 insertion(+)
>
> diff --git a/drivers/spi/spi.c b/drivers/spi/spi.c
> index 7a8aed4..b63d02f 100644
> --- a/drivers/spi/spi.c
> +++ b/drivers/spi/spi.c
> @@ -78,6 +78,7 @@ struct spi_device *spi_new_device(struct spi_master *master,
> proxy->bits_per_word = chip->bits_per_word ? chip->bits_per_word : 8;
> proxy->dev.platform_data = chip->platform_data;
> strcpy(proxy->dev.name, chip->name);
> + proxy->dev.id = -1; /* allocate a free id for this chip */
Please use DEVICE_ID_DYNAMIC instead.
Sascha
--
Pengutronix e.K. | |
Industrial Linux Solutions | http://www.pengutronix.de/ |
Peiner Str. 6-8, 31137 Hildesheim, Germany | Phone: +49-5121-206917-0 |
Amtsgericht Hildesheim, HRA 2686 | Fax: +49-5121-206917-5555 |
_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox
^ permalink raw reply [flat|nested] 4+ messages in thread
* [PATCH v2] drivers/spi/spi.c: use DEVICE_ID_DYNAMIC when allocating a struct device_d
2012-05-14 9:05 ` Sascha Hauer
@ 2012-05-14 10:43 ` Jan Luebbe
2012-05-14 17:47 ` Sascha Hauer
0 siblings, 1 reply; 4+ messages in thread
From: Jan Luebbe @ 2012-05-14 10:43 UTC (permalink / raw)
To: barebox
This causes allocation of a free id and avoids conflicts if multiple
identical SPI devices are attached.
Signed-off-by: Jan Luebbe <jlu@pengutronix.de>
---
drivers/spi/spi.c | 2 ++
1 file changed, 2 insertions(+)
diff --git a/drivers/spi/spi.c b/drivers/spi/spi.c
index 7a8aed4..a7fe10c 100644
--- a/drivers/spi/spi.c
+++ b/drivers/spi/spi.c
@@ -78,6 +78,8 @@ struct spi_device *spi_new_device(struct spi_master *master,
proxy->bits_per_word = chip->bits_per_word ? chip->bits_per_word : 8;
proxy->dev.platform_data = chip->platform_data;
strcpy(proxy->dev.name, chip->name);
+ /* allocate a free id for this chip */
+ proxy->dev.id = DEVICE_ID_DYNAMIC;
proxy->dev.type_data = proxy;
dev_add_child(master->dev, &proxy->dev);
--
1.7.9.5
_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH v2] drivers/spi/spi.c: use DEVICE_ID_DYNAMIC when allocating a struct device_d
2012-05-14 10:43 ` [PATCH v2] drivers/spi/spi.c: use DEVICE_ID_DYNAMIC when allocating a struct device_d Jan Luebbe
@ 2012-05-14 17:47 ` Sascha Hauer
0 siblings, 0 replies; 4+ messages in thread
From: Sascha Hauer @ 2012-05-14 17:47 UTC (permalink / raw)
To: Jan Luebbe; +Cc: barebox
On Mon, May 14, 2012 at 12:43:31PM +0200, Jan Luebbe wrote:
> This causes allocation of a free id and avoids conflicts if multiple
> identical SPI devices are attached.
>
> Signed-off-by: Jan Luebbe <jlu@pengutronix.de>
Applied, thanks
Sascha
> ---
> drivers/spi/spi.c | 2 ++
> 1 file changed, 2 insertions(+)
>
> diff --git a/drivers/spi/spi.c b/drivers/spi/spi.c
> index 7a8aed4..a7fe10c 100644
> --- a/drivers/spi/spi.c
> +++ b/drivers/spi/spi.c
> @@ -78,6 +78,8 @@ struct spi_device *spi_new_device(struct spi_master *master,
> proxy->bits_per_word = chip->bits_per_word ? chip->bits_per_word : 8;
> proxy->dev.platform_data = chip->platform_data;
> strcpy(proxy->dev.name, chip->name);
> + /* allocate a free id for this chip */
> + proxy->dev.id = DEVICE_ID_DYNAMIC;
> proxy->dev.type_data = proxy;
> dev_add_child(master->dev, &proxy->dev);
>
> --
> 1.7.9.5
>
>
> _______________________________________________
> barebox mailing list
> barebox@lists.infradead.org
> http://lists.infradead.org/mailman/listinfo/barebox
>
--
Pengutronix e.K. | |
Industrial Linux Solutions | http://www.pengutronix.de/ |
Peiner Str. 6-8, 31137 Hildesheim, Germany | Phone: +49-5121-206917-0 |
Amtsgericht Hildesheim, HRA 2686 | Fax: +49-5121-206917-5555 |
_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2012-05-14 17:47 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2012-05-14 8:38 [PATCH] drivers/spi/spi.c: when allocating a struct device_d specify id as -1 Jan Luebbe
2012-05-14 9:05 ` Sascha Hauer
2012-05-14 10:43 ` [PATCH v2] drivers/spi/spi.c: use DEVICE_ID_DYNAMIC when allocating a struct device_d Jan Luebbe
2012-05-14 17:47 ` Sascha Hauer
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox