* [PATCH] driver core: Move device_links_purge() after bus_remove_device()
@ 2017-10-18 11:28 Jeffy Chen
2017-10-18 23:36 ` Rafael J. Wysocki
0 siblings, 1 reply; 3+ messages in thread
From: Jeffy Chen @ 2017-10-18 11:28 UTC (permalink / raw)
To: linux-kernel
Cc: seanpaul, briannorris, heiko, gregkh, dmitry.torokhov, rjw,
dianders, tfiga, broonie, thierry.reding, Jeffy Chen
Currently we are unbinding device link consumers when detaching the
supplier. So we need to make sure the detaching happens before purging
the supplier's device links.
Move device_links_purge() after bus_remove_device() in device_del()
for that.
Signed-off-by: Jeffy Chen <jeffy.chen@rock-chips.com>
---
drivers/base/core.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/drivers/base/core.c b/drivers/base/core.c
index 12ebd055724c..2e683cdf4a08 100644
--- a/drivers/base/core.c
+++ b/drivers/base/core.c
@@ -1958,7 +1958,6 @@ void device_del(struct device *dev)
blocking_notifier_call_chain(&dev->bus->p->bus_notifier,
BUS_NOTIFY_DEL_DEVICE, dev);
- device_links_purge(dev);
dpm_sysfs_remove(dev);
if (parent)
klist_del(&dev->p->knode_parent);
@@ -1986,6 +1985,7 @@ void device_del(struct device *dev)
device_pm_remove(dev);
driver_deferred_probe_del(dev);
device_remove_properties(dev);
+ device_links_purge(dev);
/* Notify the platform of the removal, in case they
* need to do anything...
--
2.11.0
^ permalink raw reply related [flat|nested] 3+ messages in thread
* Re: [PATCH] driver core: Move device_links_purge() after bus_remove_device()
2017-10-18 11:28 [PATCH] driver core: Move device_links_purge() after bus_remove_device() Jeffy Chen
@ 2017-10-18 23:36 ` Rafael J. Wysocki
2017-10-19 1:11 ` jeffy
0 siblings, 1 reply; 3+ messages in thread
From: Rafael J. Wysocki @ 2017-10-18 23:36 UTC (permalink / raw)
To: Jeffy Chen
Cc: linux-kernel, seanpaul, briannorris, heiko, gregkh,
dmitry.torokhov, dianders, tfiga, broonie, thierry.reding
On Wednesday, October 18, 2017 1:28:38 PM CEST Jeffy Chen wrote:
> Currently we are unbinding device link consumers when detaching the
> supplier. So we need to make sure the detaching happens before purging
> the supplier's device links.
>
> Move device_links_purge() after bus_remove_device() in device_del()
> for that.
>
> Signed-off-by: Jeffy Chen <jeffy.chen@rock-chips.com>
Yes, we can do that, but the changelog is somewhat hard to understand IMO.
Why don't you write something like the following:
"The current ordering of code in device_del() triggers a WARN_ON()
in device_links_purge(), because of an unexpected link status.
The device_links_unbind_consumers() call in device_release_driver()
has to take place before device_links_purge() for the status of all
links to be correct, so move the device_links_purge() call in
device_del() after the invocation of bus_remove_device() which calls
device_release_driver()."
> ---
>
> drivers/base/core.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/drivers/base/core.c b/drivers/base/core.c
> index 12ebd055724c..2e683cdf4a08 100644
> --- a/drivers/base/core.c
> +++ b/drivers/base/core.c
> @@ -1958,7 +1958,6 @@ void device_del(struct device *dev)
> blocking_notifier_call_chain(&dev->bus->p->bus_notifier,
> BUS_NOTIFY_DEL_DEVICE, dev);
>
> - device_links_purge(dev);
> dpm_sysfs_remove(dev);
> if (parent)
> klist_del(&dev->p->knode_parent);
> @@ -1986,6 +1985,7 @@ void device_del(struct device *dev)
> device_pm_remove(dev);
> driver_deferred_probe_del(dev);
> device_remove_properties(dev);
> + device_links_purge(dev);
>
> /* Notify the platform of the removal, in case they
> * need to do anything...
>
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH] driver core: Move device_links_purge() after bus_remove_device()
2017-10-18 23:36 ` Rafael J. Wysocki
@ 2017-10-19 1:11 ` jeffy
0 siblings, 0 replies; 3+ messages in thread
From: jeffy @ 2017-10-19 1:11 UTC (permalink / raw)
To: Rafael J. Wysocki
Cc: linux-kernel, seanpaul, briannorris, heiko, gregkh,
dmitry.torokhov, dianders, tfiga, broonie, thierry.reding
Hi Rafael,
On 10/19/2017 07:36 AM, Rafael J. Wysocki wrote:
> Why don't you write something like the following:
>
> "The current ordering of code in device_del() triggers a WARN_ON()
> in device_links_purge(), because of an unexpected link status.
>
> The device_links_unbind_consumers() call in device_release_driver()
> has to take place before device_links_purge() for the status of all
> links to be correct, so move the device_links_purge() call in
> device_del() after the invocation of bus_remove_device() which calls
> device_release_driver()."
that looks much better, i'll use it and your signed-off, thanks :)
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2017-10-19 1:11 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2017-10-18 11:28 [PATCH] driver core: Move device_links_purge() after bus_remove_device() Jeffy Chen
2017-10-18 23:36 ` Rafael J. Wysocki
2017-10-19 1:11 ` jeffy
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.