1
0
mirror of https://git.FreeBSD.org/src.git synced 2026-06-02 11:24:32 +00:00

LinuxKPI: 802.11 suspend/resume: fix the is_pci_dev check

Shortly before I committed the works from a year ago, jhb added a
function ("is_pci_device") so that the check against the devclass
does not have to be coded in every driver.  Use this instead in main
(and stable/15 in case the works get MFCed).

At the same time this fixes the check (the old one was wrong) as we
attach to the LinuxKPI 802.11 driver, e.g., iwlwifi and thus we need
to check the parent of the parent and not just the parent to be
of the devclass "pci" in the identify bus function.  The was the
first error.  The second was (and this is why it worked) that we
checked for == instead of != and so the wrong check became true again.

Discussed with:	jhb
Fixes:		11d69a4558 ("LinuxKPI: 802.11: add support for s/r")
MFC after:	3 days
X-MFC after:	ffcf5e3566 ("pci: Add is_pci_device helper function")
Sponsored by:	The FreeBSD Foundation
This commit is contained in:
Bjoern A. Zeeb
2026-05-30 21:33:51 +00:00
parent 49b413c4b0
commit d07460f194
@@ -13,6 +13,7 @@
#include <sys/module.h>
#include <linux/pci.h>
#include <dev/pci/pcivar.h>
#include "linux_80211.h"
#include <net80211/ieee80211_var.h>
@@ -139,7 +140,7 @@ lkpi_80211_pm_identify(driver_t *driver, device_t parent)
return;
/* Make sure this is PCI for now. */
if (device_get_devclass(parent) == devclass_find("pci"))
if (!is_pci_device(parent))
return;
if (BUS_ADD_CHILD(parent, 0, driver->name, DEVICE_UNIT_ANY) == NULL)