> > Then, how about the following patch submitted by Wei Yongjun?
> > http://www.spinics.net/lists/arm-kernel/msg286576.html
>
> spi_master_get() should be moved.

OK, I see now that that is the issue.

> probe:
>       spi_alloc_master                -> Init reference count to 1    => 1
>       devm_spi_register_master        -> Not increment reference count => 1
>         (It seems device_add() does not hold a reference)

Indeed.  It acquires a reference, but it releases it at the end.

> remove:
>       spi_master_get                  -> increment reference count => 2
>       devm_spi_unregister             -> decrement reference count => 1
>
> So after remove, the reference count still 1.
>
> If devm_spi_register_master() hold a reference, we will need
> a extra spi_master_put() in remove to let master be freed.

OK, I think that everything is OK with just getting rid of the get and the
put in the remove function.  Thanks for the explanations.

julia
--
To unsubscribe from this list: send the line "unsubscribe linux-spi" in
the body of a message to [email protected]
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Reply via email to