drivers/net/wireless/marvell/libertas/cmd.c
Source file repositories/reference/linux-study-clean/drivers/net/wireless/marvell/libertas/cmd.c
File Facts
- System
- Linux kernel
- Corpus path
drivers/net/wireless/marvell/libertas/cmd.c- Extension
.c- Size
- 37963 bytes
- Lines
- 1472
- 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.
- 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/hardirq.hlinux/kfifo.hlinux/sched.hlinux/slab.hlinux/if_arp.hlinux/export.hdecl.hcfg.hcmd.h
Detected Declarations
function lbs_cmd_copybackfunction lbs_cmd_async_callbackfunction is_command_allowed_in_psfunction lbs_update_hw_specfunction lbs_ret_host_sleep_cfgfunction lbs_host_sleep_cfgfunction lbs_set_ps_modefunction lbs_cmd_802_11_sleep_paramsfunction lbs_wait_for_ds_awakefunction lbs_set_deep_sleepfunction lbs_ret_host_sleep_activatefunction lbs_set_host_sleepfunction lbs_set_snmp_mibfunction lbs_get_tx_powerfunction lbs_set_monitor_modefunction lbs_get_channelfunction lbs_update_channelfunction lbs_set_channelfunction lbs_get_rssifunction lbs_set_11d_domain_infofunction lbs_get_regfunction lbs_set_regfunction lbs_queue_cmdfunction lbs_submit_commandfunction __lbs_cleanup_and_insert_cmdfunction lbs_cleanup_and_insert_cmdfunction __lbs_complete_commandfunction lbs_complete_commandfunction lbs_set_radiofunction lbs_set_mac_controlfunction lbs_set_mac_control_syncfunction lbs_allocate_cmd_bufferfunction lbs_free_cmd_bufferfunction lbs_execute_next_commandfunction lbs_send_confirmsleepfunction lbs_ps_confirm_sleepfunction lbs_cmd_asyncfunction __lbs_cmdexport lbs_cmd_copybackexport lbs_host_sleep_cfgexport __lbs_cmd
Annotated Snippet
if (priv->psstate == PS_STATE_FULL_POWER) {
priv->is_host_sleep_activated = 0;
wake_up_interruptible(&priv->host_sleep_q);
}
} else {
priv->is_host_sleep_configured = 1;
}
return 0;
}
int lbs_host_sleep_cfg(struct lbs_private *priv, uint32_t criteria,
struct wol_config *p_wol_config)
{
struct cmd_ds_host_sleep cmd_config;
int ret;
/*
* Certain firmware versions do not support EHS_REMOVE_WAKEUP command
* and the card will return a failure. Since we need to be
* able to reset the mask, in those cases we set a 0 mask instead.
*/
if (criteria == EHS_REMOVE_WAKEUP && !priv->ehs_remove_supported)
criteria = 0;
cmd_config.hdr.size = cpu_to_le16(sizeof(cmd_config));
cmd_config.criteria = cpu_to_le32(criteria);
cmd_config.gpio = priv->wol_gpio;
cmd_config.gap = priv->wol_gap;
if (p_wol_config != NULL)
memcpy((uint8_t *)&cmd_config.wol_conf, (uint8_t *)p_wol_config,
sizeof(struct wol_config));
else
cmd_config.wol_conf.action = CMD_ACT_ACTION_NONE;
ret = __lbs_cmd(priv, CMD_802_11_HOST_SLEEP_CFG, &cmd_config.hdr,
le16_to_cpu(cmd_config.hdr.size),
lbs_ret_host_sleep_cfg, 0);
if (!ret) {
if (p_wol_config)
memcpy((uint8_t *) p_wol_config,
(uint8_t *)&cmd_config.wol_conf,
sizeof(struct wol_config));
} else {
netdev_info(priv->dev, "HOST_SLEEP_CFG failed %d\n", ret);
}
return ret;
}
EXPORT_SYMBOL_GPL(lbs_host_sleep_cfg);
/**
* lbs_set_ps_mode - Sets the Power Save mode
*
* @priv: A pointer to &struct lbs_private structure
* @cmd_action: The Power Save operation (PS_MODE_ACTION_ENTER_PS or
* PS_MODE_ACTION_EXIT_PS)
* @block: Whether to block on a response or not
*
* returns: 0 on success, error on failure
*/
int lbs_set_ps_mode(struct lbs_private *priv, u16 cmd_action, bool block)
{
struct cmd_ds_802_11_ps_mode cmd;
int ret = 0;
memset(&cmd, 0, sizeof(cmd));
cmd.hdr.size = cpu_to_le16(sizeof(cmd));
cmd.action = cpu_to_le16(cmd_action);
if (cmd_action == PS_MODE_ACTION_ENTER_PS) {
lbs_deb_cmd("PS_MODE: action ENTER_PS\n");
cmd.multipledtim = cpu_to_le16(1); /* Default DTIM multiple */
} else if (cmd_action == PS_MODE_ACTION_EXIT_PS) {
lbs_deb_cmd("PS_MODE: action EXIT_PS\n");
} else {
/* We don't handle CONFIRM_SLEEP here because it needs to
* be fastpathed to the firmware.
*/
lbs_deb_cmd("PS_MODE: unknown action 0x%X\n", cmd_action);
ret = -EOPNOTSUPP;
goto out;
}
if (block)
ret = lbs_cmd_with_response(priv, CMD_802_11_PS_MODE, &cmd);
else
lbs_cmd_async(priv, CMD_802_11_PS_MODE, &cmd.hdr, sizeof (cmd));
Annotation
- Immediate include surface: `linux/hardirq.h`, `linux/kfifo.h`, `linux/sched.h`, `linux/slab.h`, `linux/if_arp.h`, `linux/export.h`, `decl.h`, `cfg.h`.
- Detected declarations: `function lbs_cmd_copyback`, `function lbs_cmd_async_callback`, `function is_command_allowed_in_ps`, `function lbs_update_hw_spec`, `function lbs_ret_host_sleep_cfg`, `function lbs_host_sleep_cfg`, `function lbs_set_ps_mode`, `function lbs_cmd_802_11_sleep_params`, `function lbs_wait_for_ds_awake`, `function lbs_set_deep_sleep`.
- 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.
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.