[<prev] [next>] [day] [month] [year] [list]
Message-Id: <1560534863-15115-28-git-send-email-suzuki.poulose@arm.com>
Date: Fri, 14 Jun 2019 18:54:22 +0100
From: Suzuki K Poulose <suzuki.poulose@....com>
To: linux-kernel@...r.kernel.org
Cc: gregkh@...uxfoundation.org, rafael@...nel.org,
suzuki.poulose@....com
Subject: [PATCH v2 27/28] drivers: Introduce driver_find_device_by_acpi_dev() helper
Add a wrapper to driver_find_device() to search for a device
by the ACPI COMPANION device, reusing the generic match function.
Cc: Greg Kroah-Hartman <gregkh@...uxfoundation.org>
Cc: "Rafael J. Wysocki" <rafael@...nel.org>
Signed-off-by: Suzuki K Poulose <suzuki.poulose@....com>
---
include/linux/device.h | 21 +++++++++++++++++++++
1 file changed, 21 insertions(+)
diff --git a/include/linux/device.h b/include/linux/device.h
index 77f817d..a2a8ac2 100644
--- a/include/linux/device.h
+++ b/include/linux/device.h
@@ -481,6 +481,27 @@ static inline struct device *driver_find_next_device(struct device_driver *drv,
return driver_find_device(drv, start, NULL, device_match_any);
}
+#ifdef CONFIG_ACPI
+/**
+ * driver_find_device_by_acpi_dev : device iterator for locating a particular
+ * device matching the ACPI_COMPANION device.
+ * @driver: the driver we're iterating
+ * @adev: ACPI_COMPANION device to match.
+ */
+static inline struct device *
+driver_find_device_by_acpi_dev(struct device_driver *drv,
+ const struct acpi_device *adev)
+{
+ return driver_find_device(drv, NULL, adev, device_match_acpi_dev);
+}
+#else
+static inline struct device *
+driver_find_device_by_acpi_dev(struct device_driver *drv, const void *adev)
+{
+ return NULL;
+}
+#endif
+
void driver_deferred_probe_add(struct device *dev);
int driver_deferred_probe_check_state(struct device *dev);
--
2.7.4
Powered by blists - more mailing lists