Add a helper to find the next device on the given bus from a
given device iterator position.

Cc: Greg Kroah-Hartman <[email protected]>
Cc: "Rafael J. Wysocki" <[email protected]>
Signed-off-by: Suzuki K Poulose <[email protected]>
---
 include/linux/device.h | 10 ++++++++++
 1 file changed, 10 insertions(+)

diff --git a/include/linux/device.h b/include/linux/device.h
index 7ea15e6..528efc0 100644
--- a/include/linux/device.h
+++ b/include/linux/device.h
@@ -234,6 +234,16 @@ static inline struct device 
*bus_find_device_by_devt(struct bus_type *bus,
        return bus_find_device(bus, start, &devt, device_match_devt);
 }
 
+/**
+ * bus_find_next_device - Find the next device after a given device in a
+ * given bus.
+ */
+static inline struct device *bus_find_next_device(struct bus_type *bus,
+                                                 struct device *start)
+{
+       return bus_find_device(bus, start, NULL, device_match_any);
+}
+
 struct device *subsys_find_device_by_id(struct bus_type *bus, unsigned int id,
                                        struct device *hint);
 int bus_for_each_drv(struct bus_type *bus, struct device_driver *start,
-- 
2.7.4

Reply via email to