public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH] driver core: add devices to deferred probe list when unbinding consumers
@ 2017-03-08 11:50 Lucas Stach
  2017-03-16  8:28 ` Greg Kroah-Hartman
  0 siblings, 1 reply; 3+ messages in thread
From: Lucas Stach @ 2017-03-08 11:50 UTC (permalink / raw)
  To: Greg Kroah-Hartman; +Cc: linux-kernel, kernel, patchwork-lst

When a device is unbound due to the provider of one of the resources going
away, add it to the deferred probe list. This way the consumer device
driver gets a chance to rebind itself if the provider is rebound later on.

Signed-off-by: Lucas Stach <l.stach@pengutronix.de>
---
 drivers/base/base.h | 1 +
 drivers/base/core.c | 2 ++
 drivers/base/dd.c   | 2 +-
 3 files changed, 4 insertions(+), 1 deletion(-)

diff --git a/drivers/base/base.h b/drivers/base/base.h
index e19b1008e5fb..c37d42450886 100644
--- a/drivers/base/base.h
+++ b/drivers/base/base.h
@@ -113,6 +113,7 @@ extern void device_release_driver_internal(struct device *dev,
 
 extern void driver_detach(struct device_driver *drv);
 extern int driver_probe_device(struct device_driver *drv, struct device *dev);
+extern void driver_deferred_probe_add(struct device *dev);
 extern void driver_deferred_probe_del(struct device *dev);
 static inline int driver_match_device(struct device_driver *drv,
 				      struct device *dev)
diff --git a/drivers/base/core.c b/drivers/base/core.c
index 8c25e68e67d7..860e1cf195b9 100644
--- a/drivers/base/core.c
+++ b/drivers/base/core.c
@@ -572,6 +572,8 @@ void device_links_unbind_consumers(struct device *dev)
 
 			device_release_driver_internal(consumer, NULL,
 						       consumer->parent);
+			driver_deferred_probe_add(consumer);
+
 			put_device(consumer);
 			goto start;
 		}
diff --git a/drivers/base/dd.c b/drivers/base/dd.c
index a1fbf55c4d3a..a0217d76a0f2 100644
--- a/drivers/base/dd.c
+++ b/drivers/base/dd.c
@@ -115,7 +115,7 @@ static void deferred_probe_work_func(struct work_struct *work)
 }
 static DECLARE_WORK(deferred_probe_work, deferred_probe_work_func);
 
-static void driver_deferred_probe_add(struct device *dev)
+void driver_deferred_probe_add(struct device *dev)
 {
 	mutex_lock(&deferred_probe_mutex);
 	if (list_empty(&dev->p->deferred_probe)) {
-- 
2.11.0

^ permalink raw reply related	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2017-03-16  9:26 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2017-03-08 11:50 [PATCH] driver core: add devices to deferred probe list when unbinding consumers Lucas Stach
2017-03-16  8:28 ` Greg Kroah-Hartman
2017-03-16  9:26   ` Lucas Stach

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox