[<prev] [next>] [day] [month] [year] [list]
Message-Id: <1560534863-15115-17-git-send-email-suzuki.poulose@arm.com>
Date: Fri, 14 Jun 2019 18:54:11 +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 16/28] drivers: Introduce class_find_device_by_acpi_dev() helper
Add a wrapper to class_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 2effcc2..b1b8c90 100644
--- a/include/linux/device.h
+++ b/include/linux/device.h
@@ -534,6 +534,27 @@ static inline struct device *class_find_device_by_devt(struct class *class,
return class_find_device(class, NULL, &devt, device_match_devt);
}
+#ifdef CONFIG_ACPI
+struct acpi_device;
+/**
+ * class_find_device_by_acpi_dev : device iterator for locating a particular
+ * device matching the ACPI_COMPANION device.
+ * @class: class type
+ * @adev: ACPI_COMPANION device to match.
+ */
+static inline struct device *
+class_find_device_by_acpi_dev(struct class *class, const struct acpi_device *adev)
+{
+ return class_find_device(class, NULL, adev, device_match_acpi_dev);
+}
+#else
+static inline struct device *
+class_find_device_by_acpi_dev(struct class *class, const void *adev)
+{
+ return NULL;
+}
+#endif
+
struct class_attribute {
struct attribute attr;
ssize_t (*show)(struct class *class, struct class_attribute *attr,
--
2.7.4
Powered by blists - more mailing lists