aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/base/core.c
diff options
context:
space:
mode:
authorSuzuki K Poulose <[email protected]>2019-07-23 22:18:32 +0000
committerGreg Kroah-Hartman <[email protected]>2019-07-30 11:07:41 +0000
commit6cda08a20dbde45b021091230c8a359fa08c5103 (patch)
tree6017a1b2e4a83b7fd330d404691e33da0df2726a /drivers/base/core.c
parentLinus 5.3-rc1 (diff)
downloadkernel-6cda08a20dbde45b021091230c8a359fa08c5103.tar.gz
kernel-6cda08a20dbde45b021091230c8a359fa08c5103.zip
drivers: Introduce device lookup variants by name
Add a helper to match the device name for device lookup. Also reuse this generic exported helper for the existing bus_find_device_by_name(). and add similar variants for driver/class. Cc: Alessandro Zummo <[email protected]> Cc: Alexander Aring <[email protected]> Cc: Alexander Shishkin <[email protected]> Cc: Arnd Bergmann <[email protected]> Cc: Dan Murphy <[email protected]> Cc: Harald Freudenberger <[email protected]> Cc: Heiko Carstens <[email protected]> Cc: Jacek Anaszewski <[email protected]> Cc: Lee Jones <[email protected]> Cc: [email protected] Cc: [email protected] Cc: [email protected] Cc: [email protected] Cc: Maxime Coquelin <[email protected]> Cc: Pavel Machek <[email protected]> Cc: Peter Oberparleiter <[email protected]> Cc: "Rafael J. Wysocki" <[email protected]> Cc: Stefan Schmidt <[email protected]> Cc: Greg Kroah-Hartman <[email protected]> Cc: "Rafael J. Wysocki" <[email protected]> Signed-off-by: Suzuki K Poulose <[email protected]> Reviewed-by: Heikki Krogerus <[email protected]> Acked-by: Alexandre Belloni <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Greg Kroah-Hartman <[email protected]>
Diffstat (limited to 'drivers/base/core.c')
-rw-r--r--drivers/base/core.c6
1 files changed, 6 insertions, 0 deletions
diff --git a/drivers/base/core.c b/drivers/base/core.c
index da84a73f2ba6..fb83647d685a 100644
--- a/drivers/base/core.c
+++ b/drivers/base/core.c
@@ -3357,6 +3357,12 @@ void device_set_of_node_from_dev(struct device *dev, const struct device *dev2)
}
EXPORT_SYMBOL_GPL(device_set_of_node_from_dev);
+int device_match_name(struct device *dev, const void *name)
+{
+ return sysfs_streq(dev_name(dev), name);
+}
+EXPORT_SYMBOL_GPL(device_match_name);
+
int device_match_of_node(struct device *dev, const void *np)
{
return dev->of_node == np;