drivers/net/wireless/intel/iwlegacy/common.c
Source file repositories/reference/linux-study-clean/drivers/net/wireless/intel/iwlegacy/common.c
File Facts
- System
- Linux kernel
- Corpus path
drivers/net/wireless/intel/iwlegacy/common.c- Extension
.c- Size
- 145662 bytes
- Lines
- 5546
- Domain
- Driver Families
- Bucket
- drivers/net
- Inferred role
- Driver Families: exported/initcall integration point
- Status
- integration 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.
- Exports symbols or registers init work; inspect boot/module ordering and who consumes the exported contract.
- Uses kernel synchronization; read lock ordering, sleepability, and interrupt context assumptions before translating.
- Touches IRQ or DMA behavior; this matters for the representative real-device path.
- 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
linux/kernel.hlinux/module.hlinux/etherdevice.hlinux/sched.hlinux/slab.hlinux/types.hlinux/lockdep.hlinux/pci.hlinux/dma-mapping.hlinux/delay.hlinux/skbuff.hnet/mac80211.hcommon.h
Detected Declarations
function Copyrightfunction il_set_bitfunction il_clear_bitfunction _il_grab_nic_accessfunction il_poll_bitfunction il_rd_prphfunction il_wr_prphfunction il_read_targ_memfunction il_write_targ_memfunction il_get_cmd_stringfunction il_generic_cmd_callbackfunction il_send_cmd_asyncfunction il_send_cmd_syncfunction il_send_cmdfunction il_send_cmd_pdufunction il_send_cmd_pdu_asyncfunction il_blink_compensationfunction il_led_cmdfunction il_led_brightness_setfunction il_led_blink_setfunction il_leds_initfunction il_leds_exitfunction il_eeprom_verify_signaturefunction il_eeprom_query_addrfunction il_eeprom_query16function il_eeprom_initfunction il_eeprom_freefunction il_init_band_referencefunction il_mod_ht40_chan_infofunction il_init_channel_mapfunction il_free_channel_mapfunction il_get_channel_infofunction cpu_to_le32function il_set_powerfunction il_power_set_modefunction il_power_update_modefunction il_power_initializefunction il_send_scan_abortfunction il_complete_scanfunction il_force_scan_endfunction il_do_scan_abortfunction il_scan_cancelfunction il_scan_cancel_timeoutfunction il_hdl_scanfunction il_hdl_scan_startfunction il_hdl_scan_resultsfunction il_hdl_scan_completefunction il_setup_rx_scan_handlers
Annotated Snippet
if (test_bit(S_HCMD_ACTIVE, &il->status)) {
IL_ERR("Error sending %s: time out after %dms.\n",
il_get_cmd_string(cmd->id),
jiffies_to_msecs(HOST_COMPLETE_TIMEOUT));
clear_bit(S_HCMD_ACTIVE, &il->status);
D_INFO("Clearing HCMD_ACTIVE for command %s\n",
il_get_cmd_string(cmd->id));
ret = -ETIMEDOUT;
goto cancel;
}
}
if (test_bit(S_RFKILL, &il->status)) {
IL_ERR("Command %s aborted: RF KILL Switch\n",
il_get_cmd_string(cmd->id));
ret = -ECANCELED;
goto fail;
}
if (test_bit(S_FW_ERROR, &il->status)) {
IL_ERR("Command %s failed: FW Error\n",
il_get_cmd_string(cmd->id));
ret = -EIO;
goto fail;
}
if ((cmd->flags & CMD_WANT_SKB) && !cmd->reply_page) {
IL_ERR("Error: Response NULL in '%s'\n",
il_get_cmd_string(cmd->id));
ret = -EIO;
goto cancel;
}
ret = 0;
goto out;
cancel:
if (cmd->flags & CMD_WANT_SKB) {
/*
* Cancel the CMD_WANT_SKB flag for the cmd in the
* TX cmd queue. Otherwise in case the cmd comes
* in later, it will possibly set an invalid
* address (cmd->meta.source).
*/
il->txq[il->cmd_queue].meta[cmd_idx].flags &= ~CMD_WANT_SKB;
}
fail:
if (cmd->reply_page) {
il_free_pages(il, cmd->reply_page);
cmd->reply_page = 0;
}
out:
return ret;
}
EXPORT_SYMBOL(il_send_cmd_sync);
int
il_send_cmd(struct il_priv *il, struct il_host_cmd *cmd)
{
if (cmd->flags & CMD_ASYNC)
return il_send_cmd_async(il, cmd);
return il_send_cmd_sync(il, cmd);
}
EXPORT_SYMBOL(il_send_cmd);
int
il_send_cmd_pdu(struct il_priv *il, u8 id, u16 len, const void *data)
{
struct il_host_cmd cmd = {
.id = id,
.len = len,
.data = data,
};
return il_send_cmd_sync(il, &cmd);
}
EXPORT_SYMBOL(il_send_cmd_pdu);
int
il_send_cmd_pdu_async(struct il_priv *il, u8 id, u16 len, const void *data,
void (*callback) (struct il_priv *il,
struct il_device_cmd *cmd,
struct il_rx_pkt *pkt))
{
struct il_host_cmd cmd = {
.id = id,
.len = len,
.data = data,
};
Annotation
- Immediate include surface: `linux/kernel.h`, `linux/module.h`, `linux/etherdevice.h`, `linux/sched.h`, `linux/slab.h`, `linux/types.h`, `linux/lockdep.h`, `linux/pci.h`.
- Detected declarations: `function Copyright`, `function il_set_bit`, `function il_clear_bit`, `function _il_grab_nic_access`, `function il_poll_bit`, `function il_rd_prph`, `function il_wr_prph`, `function il_read_targ_mem`, `function il_write_targ_mem`, `function il_get_cmd_string`.
- Atlas domain: Driver Families / drivers/net.
- Implementation status: integration implementation candidate.
- Synchronization appears in or near this file; preserve lock ordering, sleepability, and interrupt-context constraints.
- IRQ or DMA behavior appears here, which is relevant to the selected PCIe/NVMe device path.
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.