drivers/net/wireless/intel/iwlwifi/tests/devinfo.c
Source file repositories/reference/linux-study-clean/drivers/net/wireless/intel/iwlwifi/tests/devinfo.c
File Facts
- System
- Linux kernel
- Corpus path
drivers/net/wireless/intel/iwlwifi/tests/devinfo.c- Extension
.c- Size
- 8703 bytes
- Lines
- 317
- Domain
- Driver Families
- Bucket
- drivers/net
- Inferred role
- Driver Families: implementation source
- Status
- source implementation candidate
Why This File Exists
Repeatable hardware-adapter layer. Deep compatibility for every driver is out of scope; this atlas records patterns, probe lifecycles, bus glue, IRQ/DMA usage, and links back to core abstractions.
- Repeatable hardware-adapter layer. Deep compatibility for every driver is out of scope; this atlas records patterns, probe lifecycles, bus glue, IRQ/DMA usage, and links back to core abstractions.
- Allocates kernel memory; connect allocation flags and lifetime to context constraints.
- Defines or uses C structs; map object ownership, embedded links, reference counts, and lock ownership.
Dependency Surface
kunit/test.hlinux/pci.hiwl-drv.hiwl-config.h
Detected Declarations
function iwl_pci_print_dev_infofunction devinfo_table_orderfunction devinfo_discrete_matchfunction devinfo_namesfunction devinfo_no_cfg_dupsfunction devinfo_no_name_dupsfunction devinfo_check_subdev_matchfunction devinfo_check_killer_subdevfunction devinfo_pci_idsfunction devinfo_no_mac_cfg_dupsfunction devinfo_api_rangefunction devinfo_pci_ids_config
Annotated Snippet
if (!ret) {
iwl_pci_print_dev_info("No entry found for: ", di);
KUNIT_FAIL(test,
"No entry found for entry at index %d\n", idx);
} else if (ret != di) {
iwl_pci_print_dev_info("searched: ", di);
iwl_pci_print_dev_info("found: ", ret);
KUNIT_FAIL(test,
"unusable entry at index %d (found index %d instead)\n",
idx, (int)(ret - iwl_dev_info_table));
}
}
}
static void devinfo_discrete_match(struct kunit *test)
{
/*
* Validate that any entries with discrete/integrated match have
* the same config with the value inverted (if they match at all.)
*/
for (int idx = 0; idx < iwl_dev_info_table_size; idx++) {
const struct iwl_dev_info *di = &iwl_dev_info_table[idx];
const struct iwl_dev_info *ret;
if (!di->match_discrete)
continue;
ret = iwl_pci_find_dev_info(di->device, di->subdevice,
di->rf_type, di->cdb,
di->rf_id, di->bw_limit,
!di->discrete);
if (!ret)
continue;
KUNIT_EXPECT_PTR_EQ(test, di->cfg, ret->cfg);
/* and check the name is different, that'd be the point of it */
KUNIT_EXPECT_NE(test, strcmp(di->name, ret->name), 0);
}
}
static void devinfo_names(struct kunit *test)
{
int idx;
for (idx = 0; idx < iwl_dev_info_table_size; idx++) {
const struct iwl_dev_info *di = &iwl_dev_info_table[idx];
KUNIT_ASSERT_TRUE(test, di->name);
}
}
static void devinfo_no_cfg_dups(struct kunit *test)
{
for (int i = 0; i < iwl_dev_info_table_size; i++) {
const struct iwl_rf_cfg *cfg_i = iwl_dev_info_table[i].cfg;
for (int j = 0; j < i; j++) {
const struct iwl_rf_cfg *cfg_j = iwl_dev_info_table[j].cfg;
if (cfg_i == cfg_j)
continue;
KUNIT_EXPECT_NE_MSG(test, memcmp(cfg_i, cfg_j,
sizeof(*cfg_i)), 0,
"identical configs: %ps and %ps\n",
cfg_i, cfg_j);
}
}
}
static void devinfo_no_name_dups(struct kunit *test)
{
for (int i = 0; i < iwl_dev_info_table_size; i++) {
for (int j = 0; j < i; j++) {
if (iwl_dev_info_table[i].name == iwl_dev_info_table[j].name)
continue;
KUNIT_EXPECT_NE_MSG(test,
strcmp(iwl_dev_info_table[i].name,
iwl_dev_info_table[j].name),
0,
"name dup: %ps/%ps",
iwl_dev_info_table[i].name,
iwl_dev_info_table[j].name);
}
}
}
static void devinfo_check_subdev_match(struct kunit *test)
{
Annotation
- Immediate include surface: `kunit/test.h`, `linux/pci.h`, `iwl-drv.h`, `iwl-config.h`.
- Detected declarations: `function iwl_pci_print_dev_info`, `function devinfo_table_order`, `function devinfo_discrete_match`, `function devinfo_names`, `function devinfo_no_cfg_dups`, `function devinfo_no_name_dups`, `function devinfo_check_subdev_match`, `function devinfo_check_killer_subdev`, `function devinfo_pci_ids`, `function devinfo_no_mac_cfg_dups`.
- Atlas domain: Driver Families / drivers/net.
- Implementation status: source implementation candidate.
Implementation Notes
- This generated page is the file-by-file coverage layer; curated subsystem chapters should link here when they synthesize a multi-file control flow.
- Core OS pages should be promoted from atlas-only to deep-reviewed when they explain data structures, invariants, locking, lifecycle, and C implementation snippets.
- Driver-family pages are intentionally pattern-oriented unless they are part of the selected PCIe/NVMe representative device path.