[PATCH v1 06/12] driver core: expose device_is_ancestor() API

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Exposes device_is_ancestor() API which can be used
for check the device is the target device's ancestor or not.

Signed-off-by: Tianfei Zhang <tianfei.zhang@xxxxxxxxx>
Reviewed-by: Ilpo Järvinen <ilpo.jarvinen@xxxxxxxxxxxxxxx>
Reviewed-by: Andy Shevchenko <andriy.shevchenko@xxxxxxxxxxxxxxx>
---
 drivers/base/core.c    | 3 ++-
 include/linux/device.h | 1 +
 2 files changed, 3 insertions(+), 1 deletion(-)

diff --git a/drivers/base/core.c b/drivers/base/core.c
index a3e14143ec0c..597192b38198 100644
--- a/drivers/base/core.c
+++ b/drivers/base/core.c
@@ -262,7 +262,7 @@ static void device_link_remove_from_lists(struct device_link *link)
 }
 #endif /* !CONFIG_SRCU */
 
-static bool device_is_ancestor(struct device *dev, struct device *target)
+bool device_is_ancestor(struct device *dev, struct device *target)
 {
 	while (target->parent) {
 		target = target->parent;
@@ -271,6 +271,7 @@ static bool device_is_ancestor(struct device *dev, struct device *target)
 	}
 	return false;
 }
+EXPORT_SYMBOL_GPL(device_is_ancestor);
 
 /**
  * device_is_dependent - Check if one device depends on another one
diff --git a/include/linux/device.h b/include/linux/device.h
index 44e3acae7b36..35e35982d9a5 100644
--- a/include/linux/device.h
+++ b/include/linux/device.h
@@ -909,6 +909,7 @@ int device_move(struct device *dev, struct device *new_parent,
 int device_change_owner(struct device *dev, kuid_t kuid, kgid_t kgid);
 const char *device_get_devnode(struct device *dev, umode_t *mode, kuid_t *uid,
 			       kgid_t *gid, const char **tmp);
+bool device_is_ancestor(struct device *dev, struct device *target);
 int device_is_dependent(struct device *dev, void *target);
 
 static inline bool device_supports_offline(struct device *dev)
-- 
2.38.1




[Index of Archives]     [LM Sensors]     [Linux Sound]     [ALSA Users]     [ALSA Devel]     [Linux Audio Users]     [Linux Media]     [Kernel]     [Gimp]     [Yosemite News]     [Linux Media]

  Powered by Linux