Thread (4 messages) 4 messages, 2 authors, 2012-05-14

[PATCH] drivers/spi/spi.c: when allocating a struct device_d specify id as -1

From: Jan Luebbe <jlu@pengutronix.de>
Date: 2012-05-14 08:38:44
Subsystem: spi subsystem, the rest · Maintainers: Mark Brown, Linus Torvalds

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
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help