pci_find_class_from help finding one or multiple device matching
a class and subclass.
If the from argument is not null we will first loop in the device list
until we find the matching device and only then start to check if the
class/subclass matches.
Details
Details
- Reviewers
jhb - Commits
- rG8517a547a052: pci: Add pci_find_class_from
Diff Detail
Diff Detail
- Lint
Lint Skipped - Unit
Tests Skipped
Event Timeline
sys/dev/pci/pci.c | ||
---|---|---|
497 | I assume this isn't a hot path, so this approach is fine vs trying to restart the iteration from the existing device. That is, you could perhaps write this as: if (from == NULL) return (pci_find_class(class, subclass); dinfo = device_get_ivars(from); for (; dinfo != NULL; info = STAILQ_NEXT(dinfo, pci_links) { if (dinfo->cfg.baseclass == class && ... But I think your current approach is fine assuming it's only used in things like attach, and it's a bit more robust against bogus input arguments. |