[RFC PATCH 21/57] drivers: Add generic match helper by ACPI_COMPANION device
From: Suzuki K Poulose
Date: Mon Jun 03 2019 - 11:57:49 EST
Add a generic helper to match a device by the acpi device.
Cc: Greg Kroah-Hartman <gregkh@xxxxxxxxxxxxxxxxxxx>
Cc: "Rafael J. Wysocki" <rafael@xxxxxxxxxx>
Signed-off-by: Suzuki K Poulose <suzuki.poulose@xxxxxxx>
---
drivers/base/core.c | 6 ++++++
include/linux/device.h | 1 +
2 files changed, 7 insertions(+)
diff --git a/drivers/base/core.c b/drivers/base/core.c
index 9df812f..db19185 100644
--- a/drivers/base/core.c
+++ b/drivers/base/core.c
@@ -3335,6 +3335,12 @@ int device_match_of_node(struct device *dev, void *np)
}
EXPORT_SYMBOL_GPL(device_match_of_node);
+int device_match_acpi_dev(struct device *dev, void *adev)
+{
+ return ACPI_COMPANION(dev) == adev;
+}
+EXPORT_SYMBOL(device_match_acpi_dev);
+
int device_match_fwnode(struct device *dev, void *fwnode)
{
return dev_fwnode(dev) == fwnode;
diff --git a/include/linux/device.h b/include/linux/device.h
index 83c0745..6ad1a27 100644
--- a/include/linux/device.h
+++ b/include/linux/device.h
@@ -164,6 +164,7 @@ struct device *subsys_dev_iter_next(struct subsys_dev_iter *iter);
void subsys_dev_iter_exit(struct subsys_dev_iter *iter);
int device_match_of_node(struct device *dev, void *np);
+int device_match_acpi_dev(struct device *dev, void *adev);
int device_match_fwnode(struct device *dev, void *fwnode);
int device_match_devt(struct device *dev, void *pdevt);
--
2.7.4