9
0
Fork 0

drivers/spi/spi.c: use DEVICE_ID_DYNAMIC when allocating a struct device_d

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>
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
This commit is contained in:
Jan Luebbe 2012-05-14 12:43:31 +02:00 committed by Sascha Hauer
parent 932f54688f
commit 7b5817e58d
1 changed files with 2 additions and 0 deletions

View File

@ -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);