drivers/net/wireless/intel/iwlwifi/fw/dhc-utils.h
Source file repositories/reference/linux-study-clean/drivers/net/wireless/intel/iwlwifi/fw/dhc-utils.h
File Facts
- System
- Linux kernel
- Corpus path
drivers/net/wireless/intel/iwlwifi/fw/dhc-utils.h- Extension
.h- Size
- 2058 bytes
- Lines
- 76
- 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.
- Defines or uses C structs; map object ownership, embedded links, reference counts, and lock ownership.
Dependency Surface
linux/types.hfw/img.hapi/commands.hapi/dhc.h
Detected Declarations
function Copyrightfunction valid
Annotated Snippet
#ifndef __iwl_fw_dhc_utils_h__
#define __iwl_fw_dhc_utils_h__
#include <linux/types.h>
#include "fw/img.h"
#include "api/commands.h"
#include "api/dhc.h"
/**
* iwl_dhc_resp_status - return status of DHC response
* @fw: firwmware image information
* @pkt: response packet, must not be %NULL
*
* Returns: the status value of the DHC command or (u32)-1 if the
* response was too short.
*/
static inline u32 iwl_dhc_resp_status(const struct iwl_fw *fw,
struct iwl_rx_packet *pkt)
{
if (iwl_fw_lookup_notif_ver(fw, IWL_ALWAYS_LONG_GROUP,
DEBUG_HOST_COMMAND, 1) >= 2) {
struct iwl_dhc_cmd_resp *resp = (void *)pkt->data;
if (iwl_rx_packet_payload_len(pkt) < sizeof(*resp))
return (u32)-1;
return le32_to_cpu(resp->status);
} else {
struct iwl_dhc_cmd_resp_v1 *resp = (void *)pkt->data;
if (iwl_rx_packet_payload_len(pkt) < sizeof(*resp))
return (u32)-1;
return le32_to_cpu(resp->status);
}
}
/**
* iwl_dhc_resp_data - return data pointer of DHC response
* @fw: firwmware image information
* @pkt: response packet, must not be %NULL
* @len: where to store the length
*
* Returns: The data pointer, or an ERR_PTR() if the data was
* not valid (too short).
*/
static inline void *iwl_dhc_resp_data(const struct iwl_fw *fw,
struct iwl_rx_packet *pkt,
unsigned int *len)
{
if (iwl_fw_lookup_notif_ver(fw, IWL_ALWAYS_LONG_GROUP,
DEBUG_HOST_COMMAND, 1) >= 2) {
struct iwl_dhc_cmd_resp *resp = (void *)pkt->data;
if (iwl_rx_packet_payload_len(pkt) < sizeof(*resp))
return ERR_PTR(-EINVAL);
*len = iwl_rx_packet_payload_len(pkt) - sizeof(*resp);
return (void *)&resp->data;
} else {
struct iwl_dhc_cmd_resp_v1 *resp = (void *)pkt->data;
if (iwl_rx_packet_payload_len(pkt) < sizeof(*resp))
return ERR_PTR(-EINVAL);
*len = iwl_rx_packet_payload_len(pkt) - sizeof(*resp);
return (void *)&resp->data;
}
}
#endif /* __iwl_fw_dhc_utils_h__ */
Annotation
- Immediate include surface: `linux/types.h`, `fw/img.h`, `api/commands.h`, `api/dhc.h`.
- Detected declarations: `function Copyright`, `function valid`.
- 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.