On Mon, Dec 12, 2011 at 01:15:06AM +0100, Laurent Pinchart wrote:
> 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.pinch...@ideasonboard.com>
> ---
>  drivers/spi/spi.c |    2 +-
>  1 files changed, 1 insertions(+), 1 deletions(-)
> 
> diff --git a/drivers/spi/spi.c b/drivers/spi/spi.c
> index 2e13a14..b423fe9 100644
> --- a/drivers/spi/spi.c
> +++ b/drivers/spi/spi.c
> @@ -318,7 +318,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);

Yes, I agree and I think this is the correct fix.  However, I'd like
to make sure it behaves correctly.  Can you test and confirm that
with this patch in place and an spi_device in use (bound to a driver)
that the kernel will either refuse to unbind the driver, or correctly
release the spi_driver from the spi_device?

Thanks,
g.


------------------------------------------------------------------------------
Cloud Computing - Latest Buzzword or a Glimpse of the Future?
This paper surveys cloud computing today: What are the benefits? 
Why are businesses embracing it? What are its payoffs and pitfalls?
http://www.accelacomm.com/jaw/sdnl/114/51425149/
_______________________________________________
spi-devel-general mailing list
spi-devel-general@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/spi-devel-general

Reply via email to