Commit 0fe6f787 authored by Yong Wu's avatar Yong Wu Committed by Greg Kroah-Hartman

driver core: Remove the link if there is no driver with AUTO flag

DL_FLAG_AUTOREMOVE_CONSUMER/SUPPLIER means "Remove the link
automatically on consumer/supplier driver unbind", that means we should
remove whole the device_link when there is no this driver no matter what
the ref_count of the link is.

CC: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Signed-off-by: default avatarYong Wu <yong.wu@mediatek.com>
Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
parent 8a4b3269
...@@ -512,7 +512,7 @@ static void __device_links_no_driver(struct device *dev) ...@@ -512,7 +512,7 @@ static void __device_links_no_driver(struct device *dev)
continue; continue;
if (link->flags & DL_FLAG_AUTOREMOVE_CONSUMER) if (link->flags & DL_FLAG_AUTOREMOVE_CONSUMER)
kref_put(&link->kref, __device_link_del); __device_link_del(&link->kref);
else if (link->status != DL_STATE_SUPPLIER_UNBIND) else if (link->status != DL_STATE_SUPPLIER_UNBIND)
WRITE_ONCE(link->status, DL_STATE_AVAILABLE); WRITE_ONCE(link->status, DL_STATE_AVAILABLE);
} }
...@@ -557,7 +557,7 @@ void device_links_driver_cleanup(struct device *dev) ...@@ -557,7 +557,7 @@ void device_links_driver_cleanup(struct device *dev)
*/ */
if (link->status == DL_STATE_SUPPLIER_UNBIND && if (link->status == DL_STATE_SUPPLIER_UNBIND &&
link->flags & DL_FLAG_AUTOREMOVE_SUPPLIER) link->flags & DL_FLAG_AUTOREMOVE_SUPPLIER)
kref_put(&link->kref, __device_link_del); __device_link_del(&link->kref);
WRITE_ONCE(link->status, DL_STATE_DORMANT); WRITE_ONCE(link->status, DL_STATE_DORMANT);
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment