]> git.ipfire.org Git - thirdparty/kernel/linux.git/commitdiff
wifi: iwlwifi: tests: check listed PCI IDs have configs
authorJohannes Berg <johannes.berg@intel.com>
Mon, 15 Sep 2025 08:34:28 +0000 (11:34 +0300)
committerMiri Korenblit <miriam.rachel.korenblit@intel.com>
Tue, 28 Oct 2025 14:05:18 +0000 (16:05 +0200)
Add a test that checks, for the old pre-CNVI devices, that
PCI IDs listed in the PCI IDs table will also match in the
config table. Newer ones we test against our database of
devices, but the current database doesn't go back that far,
so at least this checks against the PCI IDs the driver has.

Signed-off-by: Johannes Berg <johannes.berg@intel.com>
Signed-off-by: Miri Korenblit <miriam.rachel.korenblit@intel.com>
Link: https://patch.msgid.link/20250915113137.eb728b270d46.Ie5754f4201b807eb0d55feb339a728fc0b42e8bf@changeid
drivers/net/wireless/intel/iwlwifi/cfg/bz.c
drivers/net/wireless/intel/iwlwifi/tests/devinfo.c

index 3e6206e739f65bf9a65cf7ff206b2ac9a5765e7f..18c9244ee8efd31601c7e6584a0eef11a8def2ac 100644 (file)
@@ -90,6 +90,7 @@ const struct iwl_mac_cfg iwl_bz_mac_cfg = {
        .low_latency_xtal = true,
        .ltr_delay = IWL_CFG_TRANS_LTR_DELAY_2500US,
 };
+EXPORT_SYMBOL_IF_IWLWIFI_KUNIT(iwl_bz_mac_cfg);
 
 const struct iwl_mac_cfg iwl_gl_mac_cfg = {
        .device_family = IWL_DEVICE_FAMILY_BZ,
index c31bbd4e7a4ae9f36853962051dd7ad40879d11a..3054bc0a9c67965b688c00a73e2cca34ff706112 100644 (file)
@@ -265,6 +265,32 @@ static void devinfo_api_range(struct kunit *test)
        }
 }
 
+static void devinfo_pci_ids_config(struct kunit *test)
+{
+       for (int i = 0; iwl_hw_card_ids[i].vendor; i++) {
+               const struct pci_device_id *s = &iwl_hw_card_ids[i];
+               const struct iwl_dev_info *di;
+
+               if (s->device == PCI_ANY_ID || s->subdevice == PCI_ANY_ID)
+                       continue;
+
+               /*
+                * The check below only works for old (pre-CNVI) devices. Most
+                * new have subdevice==ANY, so are already skipped, but for some
+                * Bz platform(s) we list all the RF PCI IDs. Skip those too.
+                */
+               if (s->driver_data == (kernel_ulong_t)&iwl_bz_mac_cfg)
+                       continue;
+
+               di = iwl_pci_find_dev_info(s->device, s->subdevice,
+                                          0, 0, 0, 0, true);
+
+               KUNIT_EXPECT_PTR_NE_MSG(test, di, NULL,
+                                       "PCI ID %04x:%04x not found\n",
+                                       s->device, s->subdevice);
+       }
+}
+
 static struct kunit_case devinfo_test_cases[] = {
        KUNIT_CASE(devinfo_table_order),
        KUNIT_CASE(devinfo_discrete_match),
@@ -276,6 +302,7 @@ static struct kunit_case devinfo_test_cases[] = {
        KUNIT_CASE(devinfo_pci_ids),
        KUNIT_CASE(devinfo_no_mac_cfg_dups),
        KUNIT_CASE(devinfo_api_range),
+       KUNIT_CASE(devinfo_pci_ids_config),
        {}
 };