Skip to content

Commit

Permalink
driver core: Remove the link if there is no driver with AUTO flag
Browse files Browse the repository at this point in the history
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>
  • Loading branch information
Yong Wu authored and Greg Kroah-Hartman committed Jan 22, 2019
1 parent 8a4b326 commit 0fe6f78
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions drivers/base/core.c
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}
Expand Down Expand Up @@ -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);
}
Expand Down

0 comments on commit 0fe6f78

Please sign in to comment.