mirror of
https://github.com/BobTheBlinker/android_kernel_motorola_sm6375.git
synced 2026-10-30 19:51:31 -04:00
FROMGIT: driver core: Add fwnode_to_dev() to look up device from fwnode
It's often useful to look up a device that corresponds to a fwnode. So add an API to do that irrespective of the bus on which the device has been added to. Signed-off-by: Saravana Kannan <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Greg Kroah-Hartman <[email protected]> (cherry-picked from commit 372a67c0c5ef63f55bd1eb480d9555328d8ec0f2 https://git.kernel.org/pub/scm/linux/kernel/git/gregkh/driver-core.git driver-core-next) Bug: 141703324 Change-Id: I68c36177da083bfb04e73c1b754e740f40faf284
This commit is contained in:
parent
8e9e0abf99
commit
58acf67e41
2 changed files with 9 additions and 0 deletions
|
|
@ -2198,6 +2198,10 @@ int device_add(struct device *dev)
|
|||
BUS_NOTIFY_ADD_DEVICE, dev);
|
||||
|
||||
kobject_uevent(&dev->kobj, KOBJ_ADD);
|
||||
|
||||
if (dev->fwnode && !dev->fwnode->dev)
|
||||
dev->fwnode->dev = dev;
|
||||
|
||||
bus_probe_device(dev);
|
||||
if (parent)
|
||||
klist_add_tail(&dev->p->knode_parent,
|
||||
|
|
@ -2342,6 +2346,9 @@ void device_del(struct device *dev)
|
|||
kill_device(dev);
|
||||
device_unlock(dev);
|
||||
|
||||
if (dev->fwnode && dev->fwnode->dev == dev)
|
||||
dev->fwnode->dev = NULL;
|
||||
|
||||
/* Notify clients of device removal. This call must come
|
||||
* before dpm_sysfs_remove().
|
||||
*/
|
||||
|
|
|
|||
Loading…
Reference in a new issue