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:

committed by
Greg Kroah-Hartman

parent
00500147cb
commit
6bf85ba9e5
@@ -64,11 +64,6 @@ static struct resource *get_pci_domain_busn_res(int domain_nr)
|
||||
return &r->res;
|
||||
}
|
||||
|
||||
static int find_anything(struct device *dev, const void *data)
|
||||
{
|
||||
return 1;
|
||||
}
|
||||
|
||||
/*
|
||||
* Some device drivers need know if PCI is initiated.
|
||||
* Basically, we think PCI is not initiated when there
|
||||
@@ -79,7 +74,7 @@ int no_pci_devices(void)
|
||||
struct device *dev;
|
||||
int no_devices;
|
||||
|
||||
dev = bus_find_device(&pci_bus_type, NULL, NULL, find_anything);
|
||||
dev = bus_find_next_device(&pci_bus_type, NULL);
|
||||
no_devices = (dev == NULL);
|
||||
put_device(dev);
|
||||
return no_devices;
|
||||
|
Reference in New Issue
Block a user