Re: [PATCH] driver core: Make sure device detached from driver before deleting it

From: Greg Kroah-Hartman
Date: Wed Oct 18 2017 - 03:33:44 EST


On Wed, Oct 18, 2017 at 03:06:54PM +0800, jeffy wrote:
> Hi Greg,
>
> Thanks for your reply.
>
> On 10/18/2017 02:19 PM, Greg Kroah-Hartman wrote:
> > On Wed, Oct 18, 2017 at 01:49:26PM +0800, Jeffy Chen wrote:
> > > >There are cases we call device_del() without detaching it from the
> > > >driver(e.g. spi core del children devices).
> > Why would you do that? Shouldn't that be fixed instead of this odd
> > work-around for a broken bus?
> >
> i was thinking since the device_unregister() is called everywhere, maybe
> there are some other drivers missing that too?
>
> and the driver calls device_add(), then the core attaches the device to the
> driver automatically, maybe it would make sense to let the core automatic
> detach it somehow...
>
> but i know nothing about driver core, maybe i should fix it in spi core,
> i'll send new patch for that :)

The SPI core should have some internal housekeeping to do there as well,
right? Is this the only bus that gets this "wrong"?

thanks,

greg k-h