Find a specific instance of an device by its compatible string
#include <drvr/hwinfo.h> unsigned hwi_find_compatible( const char *compatible, int unit, unsigned hwi_off );
The hwi_find_compatible() function lets you find a specific instance of an item, based on its compatible string. If the unit instance of compatible has been added to the hwinfo section of the system page after hwi_off, then hwi_find_compatible() returns its offset.
If hwi_off is HWI_NULL_OFF, indicating no parent specified, the function searches from the beginning.
If unit is -1, indicating that you aren't searching for a specific instance, the first occurrence of compatible is returned. Setting unit to -1 is most useful when you're searching for all devices with a matching compatible.
The hwinfo section offset or HWI_NULL_OFF if the bus or device instance doesn't exist.
Safety: | |
---|---|
Cancellation point | No |
Interrupt handler | No |
Signal handler | No |
Thread | Yes |