lkml.org 
[lkml]   [2021]   [May]   [5]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: [PATCH v1] spi: Don't have controller clean up spi device before driver unbind
On Tue, May 04, 2021 at 08:14:16PM -0700, Saravana Kannan wrote:
> @@ -415,6 +421,7 @@ static int spi_remove(struct device *dev)
> ERR_PTR(ret));
> }
>
> + spi_cleanup(to_spi_device(dev));
> dev_pm_domain_detach(dev, true);
>
> return 0;

Unfortunately this doesn't look right: spi_remove() is run on
driver unbind of the spi_device. With the above change,
->setup is called on spi_device addition and ->cleanup is called
on unbind, which is obviously assymetric. What can happen
here is that a slave-specific controller_state is allocated on
spi_device addition, then on unbind that controller_state is freed
and on a subsequent rebind it won't be recreated because ->setup
isn't run on spi_device ->probe.

As I've written yesterday, calling spi_cleanup() in
spi_unregister_device() should be fine if you move it to the end
of the function, but before the final put_device(). For that,
you need to open code the calls to device_del() and put_device()
that happen in device_unregister() so far.

Thanks,

Lukas

\
 
 \ /
  Last update: 2021-05-05 07:49    [W:0.101 / U:0.356 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site