Messages in this thread | | | Date | Wed, 18 Oct 2017 19:11:04 +0800 | From | jeffy <> | Subject | Re: [PATCH] driver core: Make sure device detached from driver before deleting it |
| |
Hi Rafael,
Thanks for your reply.
On 10/18/2017 06:04 PM, Rafael J. Wysocki wrote: > But device_del() calls bus_remove_device() which in turn calls > device_release_driver(), so this looks like an ordering issue to me. > uh, right, didn't notice that, it indeed to be a ordering issue...
it turns out in device_del() we are calling device_links_purge() before bus_remove_device()...
> What*exactly* is not working? Or rather, what symptoms do you see? > my board has these devices: spi master device->spi child device->spi based pwm->pwm_bl
and i add a device link to the pwm and pwm_bl, and got a warning about the pwm not unbound:
static void device_links_purge(struct device *dev) { ... list_for_each_entry_safe_reverse(link, ln, &dev->links.consumers, s_node) { WARN_ON(link->status != DL_STATE_DORMANT && link->status != DL_STATE_NONE); <-- warning here! __device_link_del(link); }
and i was confused by: static void mac80211_hwsim_del_radio(struct mac80211_hwsim_data *data, const char *hwname, struct genl_info *info) { ... device_release_driver(data->dev); device_unregister(data->dev);
and adding that device_release_driver hide that issue(oops...)
so we should move device_links_purge() after bus_remove_device() in device_del() right? maybe after device_remove_properties(), and that did solve the issue :)
> Thanks, > Rafael
| |