summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorYong Wu <yong.wu@mediatek.com>2019-01-01 07:51:05 +0300
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>2019-01-22 16:25:26 +0300
commit0fe6f7874d467456da6f6a221dd92499a3ab1780 (patch)
tree7e45a7113487214b2f63efcf39db81ded7d10e54
parent8a4b32691120b8fd6b029f5ad37d742a97ec82c1 (diff)
downloadlinux-0fe6f7874d467456da6f6a221dd92499a3ab1780.tar.xz
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: Yong Wu <yong.wu@mediatek.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
-rw-r--r--drivers/base/core.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/drivers/base/core.c b/drivers/base/core.c
index 4e57e1632f87..26f8cd6dd0b3 100644
--- a/drivers/base/core.c
+++ b/drivers/base/core.c
@@ -512,7 +512,7 @@ static void __device_links_no_driver(struct device *dev)
continue;
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)
WRITE_ONCE(link->status, DL_STATE_AVAILABLE);
}
@@ -557,7 +557,7 @@ void device_links_driver_cleanup(struct device *dev)
*/
if (link->status == DL_STATE_SUPPLIER_UNBIND &&
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);
}