spi: Fix device unregistration when unregistering the bus master
authorLaurent Pinchart <laurent.pinchart@ideasonboard.com>
Mon, 12 Dec 2011 00:15:06 +0000 (01:15 +0100)
committerGrant Likely <grant.likely@secretlab.ca>
Tue, 13 Dec 2011 23:45:35 +0000 (16:45 -0700)
Device are added as children of the bus master's parent device, but
spi_unregister_master() looks for devices to unregister in the bus
master's children. This results in the child devices not being
unregistered.

Fix this by registering devices as direct children of the bus master.

Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Signed-off-by: Grant Likely <grant.likely@secretlab.ca>
drivers/spi/spi.c

index 77eae99..b2ccdea 100644 (file)
@@ -319,7 +319,7 @@ struct spi_device *spi_alloc_device(struct spi_master *master)
        }
 
        spi->master = master;
-       spi->dev.parent = dev;
+       spi->dev.parent = &master->dev;
        spi->dev.bus = &spi_bus_type;
        spi->dev.release = spidev_release;
        device_initialize(&spi->dev);