mirror of
https://github.com/Fishwaldo/Star64_linux.git
synced 2025-07-22 23:04:43 +00:00
drivers: Add generic helper to match any device
Add a generic helper to match any/all devices. Using this introduce new wrappers {bus/driver/class}_find_next_device(). Cc: Elie Morisse <syniurge@gmail.com> Cc: "James E.J. Bottomley" <jejb@linux.ibm.com> Cc: "Martin K. Petersen" <martin.petersen@oracle.com> Cc: Nehal Shah <nehal-bakulchandra.shah@amd.com> Cc: "Rafael J. Wysocki" <rafael.j.wysocki@intel.com> Cc: Shyam Sundar S K <shyam-sundar.s-k@amd.com> Signed-off-by: Suzuki K Poulose <suzuki.poulose@arm.com> Acked-by: Bjorn Helgaas <bhelgaas@google.com> # PCI Link: https://lore.kernel.org/r/20190723221838.12024-7-suzuki.poulose@arm.com Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
This commit is contained in:
parent
00500147cb
commit
6bf85ba9e5
6 changed files with 28 additions and 27 deletions
|
@ -169,6 +169,7 @@ int device_match_of_node(struct device *dev, const void *np);
|
|||
int device_match_fwnode(struct device *dev, const void *fwnode);
|
||||
int device_match_devt(struct device *dev, const void *pdevt);
|
||||
int device_match_acpi_dev(struct device *dev, const void *adev);
|
||||
int device_match_any(struct device *dev, const void *unused);
|
||||
|
||||
int bus_for_each_dev(struct bus_type *bus, struct device *start, void *data,
|
||||
int (*fn)(struct device *dev, void *data));
|
||||
|
@ -225,6 +226,16 @@ static inline struct device *bus_find_device_by_devt(struct bus_type *bus,
|
|||
return bus_find_device(bus, NULL, &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 *cur)
|
||||
{
|
||||
return bus_find_device(bus, cur, NULL, device_match_any);
|
||||
}
|
||||
|
||||
#ifdef CONFIG_ACPI
|
||||
struct acpi_device;
|
||||
|
||||
|
@ -465,6 +476,12 @@ static inline struct device *driver_find_device_by_devt(struct device_driver *dr
|
|||
return driver_find_device(drv, NULL, &devt, device_match_devt);
|
||||
}
|
||||
|
||||
static inline struct device *driver_find_next_device(struct device_driver *drv,
|
||||
struct device *start)
|
||||
{
|
||||
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
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue