[v2,25/28] drivers: Introduce driver_find_device_by_devt() helper
diff mbox series

Message ID 1560534863-15115-26-git-send-email-suzuki.poulose@arm.com
State New
Headers show
Series
  • [v2,01/28] staging: most-core: Use bus_find_device_by_name
Related show

Commit Message

Suzuki K Poulose June 14, 2019, 5:54 p.m. UTC
Add a wrapper to driver_find_device() to search for a device
by the device type, reusing the generic match function.

Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Cc: "Rafael J. Wysocki" <rafael@kernel.org>
Signed-off-by: Suzuki K Poulose <suzuki.poulose@arm.com>
---
 include/linux/device.h | 12 ++++++++++++
 1 file changed, 12 insertions(+)

Patch
diff mbox series

diff --git a/include/linux/device.h b/include/linux/device.h
index 2cf49f7..f7f6a43 100644
--- a/include/linux/device.h
+++ b/include/linux/device.h
@@ -463,6 +463,18 @@  driver_find_device_by_fwnode(struct device_driver *drv,
 	return driver_find_device(drv, NULL, fwnode, device_match_fwnode);
 }
 
+/**
+ * driver_find_device_by_devt- device iterator for locating a particular device
+ * by devt.
+ * @driver: the driver we're iterating
+ * @devt: devt pointer to match.
+ */
+static inline struct device *driver_find_device_by_devt(struct device_driver *drv,
+							dev_t devt)
+{
+	return driver_find_device(drv, NULL, &devt, device_match_devt);
+}
+
 void driver_deferred_probe_add(struct device *dev);
 int driver_deferred_probe_check_state(struct device *dev);