diff mbox series

[RFC,21/57] drivers: Add generic match helper by ACPI_COMPANION device

Message ID 1559577023-558-22-git-send-email-suzuki.poulose@arm.com
State New
Headers show
Series [RFC,01/57] drivers: s390/cio: Use driver_for_each_device | expand

Commit Message

Suzuki K Poulose June 3, 2019, 3:49 p.m. UTC
Add a generic helper to match a device by the acpi device.

Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Cc: "Rafael J. Wysocki" <rafael@kernel.org>
Signed-off-by: Suzuki K Poulose <suzuki.poulose@arm.com>

---
 drivers/base/core.c    | 6 ++++++
 include/linux/device.h | 1 +
 2 files changed, 7 insertions(+)

-- 
2.7.4
diff mbox series

Patch

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);