lkml.org 
[lkml]   [2017]   [Oct]   [18]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
    /
    From
    SubjectRe: [PATCH] driver core: Make sure device detached from driver before deleting it
    Date
    On Wednesday, October 18, 2017 7:49:26 AM CEST Jeffy Chen wrote:
    > There are cases we call device_del() without detaching it from the
    > driver(e.g. spi core del children devices).

    But device_del() itself detaches the device from its driver.

    > Signed-off-by: Jeffy Chen <jeffy.chen@rock-chips.com>
    > ---
    >
    > drivers/base/core.c | 2 ++
    > 1 file changed, 2 insertions(+)
    >
    > diff --git a/drivers/base/core.c b/drivers/base/core.c
    > index 12ebd055724c..717efc3020af 100644
    > --- a/drivers/base/core.c
    > +++ b/drivers/base/core.c
    > @@ -1951,6 +1951,8 @@ void device_del(struct device *dev)
    > struct kobject *glue_dir = NULL;
    > struct class_interface *class_intf;
    >
    > + device_release_driver(dev);
    > +
    > /* Notify clients of device removal. This call must come
    > * before dpm_sysfs_remove().
    > */
    >

    But device_del() calls bus_remove_device() which in turn calls
    device_release_driver(), so this looks like an ordering issue to me.

    What *exactly* is not working? Or rather, what symptoms do you see?

    Thanks,
    Rafael

    \
     
     \ /
      Last update: 2017-10-22 17:12    [W:4.190 / U:0.008 seconds]
    ©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site