mirror of
https://github.com/BobTheBlinker/android_kernel_motorola_sm6375.git
synced 2026-10-29 11:11:45 -04:00
driver core: Add device_link_remove function
Device_link_remove uses the same arguments than device_link_add. The Goal is to avoid storing the link pointer. Signed-off-by: pascal paillet <[email protected]> Acked-by: Greg Kroah-Hartman <[email protected]> Signed-off-by: Mark Brown <[email protected]>
This commit is contained in:
parent
0380cf7dba
commit
d8842211b6
2 changed files with 31 additions and 0 deletions
|
|
@ -365,6 +365,36 @@ void device_link_del(struct device_link *link)
|
|||
}
|
||||
EXPORT_SYMBOL_GPL(device_link_del);
|
||||
|
||||
/**
|
||||
* device_link_remove - remove a link between two devices.
|
||||
* @consumer: Consumer end of the link.
|
||||
* @supplier: Supplier end of the link.
|
||||
*
|
||||
* The caller must ensure proper synchronization of this function with runtime
|
||||
* PM.
|
||||
*/
|
||||
void device_link_remove(void *consumer, struct device *supplier)
|
||||
{
|
||||
struct device_link *link;
|
||||
|
||||
if (WARN_ON(consumer == supplier))
|
||||
return;
|
||||
|
||||
device_links_write_lock();
|
||||
device_pm_lock();
|
||||
|
||||
list_for_each_entry(link, &supplier->links.consumers, s_node) {
|
||||
if (link->consumer == consumer) {
|
||||
kref_put(&link->kref, __device_link_del);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
device_pm_unlock();
|
||||
device_links_write_unlock();
|
||||
}
|
||||
EXPORT_SYMBOL_GPL(device_link_remove);
|
||||
|
||||
static void device_links_missing_supplier(struct device *dev)
|
||||
{
|
||||
struct device_link *link;
|
||||
|
|
|
|||
Loading…
Reference in a new issue