aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/base/core.c
diff options
context:
space:
mode:
authorGreg Kroah-Hartman <gregkh@linuxfoundation.org>2019-07-30 13:26:39 +0200
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>2019-07-30 13:26:39 +0200
commitf87da58b797aa591f2e288c7012faf3ab1e54c55 (patch)
treec1c991fe1350515a7b5ca01818f66f677cc0e14e /drivers/base/core.c
parentdriver core: Fix creation of device links with PM-runtime flags (diff)
parentplatform: Add platform_find_device_by_driver() helper (diff)
downloadlinux-dev-f87da58b797aa591f2e288c7012faf3ab1e54c55.tar.xz
linux-dev-f87da58b797aa591f2e288c7012faf3ab1e54c55.zip
Merge branch 'generic_lookup_helpers' into driver-core-next
This was on a separate branch so that others can pull it in. Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Diffstat (limited to 'drivers/base/core.c')
-rw-r--r--drivers/base/core.c39
1 files changed, 31 insertions, 8 deletions
diff --git a/drivers/base/core.c b/drivers/base/core.c
index 08eecab2497b..90f2dd4661f5 100644
--- a/drivers/base/core.c
+++ b/drivers/base/core.c
@@ -2891,13 +2891,6 @@ struct device *device_create_with_groups(struct class *class,
}
EXPORT_SYMBOL_GPL(device_create_with_groups);
-static int __match_devt(struct device *dev, const void *data)
-{
- const dev_t *devt = data;
-
- return dev->devt == *devt;
-}
-
/**
* device_destroy - removes a device that was created with device_create()
* @class: pointer to the struct class that this device was registered with
@@ -2910,7 +2903,7 @@ void device_destroy(struct class *class, dev_t devt)
{
struct device *dev;
- dev = class_find_device(class, NULL, &devt, __match_devt);
+ dev = class_find_device_by_devt(class, devt);
if (dev) {
put_device(dev);
device_unregister(dev);
@@ -3381,8 +3374,38 @@ 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;
}
EXPORT_SYMBOL_GPL(device_match_of_node);
+
+int device_match_fwnode(struct device *dev, const void *fwnode)
+{
+ return dev_fwnode(dev) == fwnode;
+}
+EXPORT_SYMBOL_GPL(device_match_fwnode);
+
+int device_match_devt(struct device *dev, const void *pdevt)
+{
+ return dev->devt == *(dev_t *)pdevt;
+}
+EXPORT_SYMBOL_GPL(device_match_devt);
+
+int device_match_acpi_dev(struct device *dev, const void *adev)
+{
+ return ACPI_COMPANION(dev) == adev;
+}
+EXPORT_SYMBOL(device_match_acpi_dev);
+
+int device_match_any(struct device *dev, const void *unused)
+{
+ return 1;
+}
+EXPORT_SYMBOL_GPL(device_match_any);