net/nfc/digital_core.c
Source file repositories/reference/linux-study-clean/net/nfc/digital_core.c
File Facts
- System
- Linux kernel
- Corpus path
net/nfc/digital_core.c- Extension
.c- Size
- 20585 bytes
- Lines
- 867
- Domain
- Networking Core
- Bucket
- Sockets, Protocols, Packet Path, And Network Policy
- Inferred role
- Networking Core: exported/initcall integration point
- Status
- integration implementation candidate
Why This File Exists
Networking stack implementation surface: socket APIs, protocol dispatch, packet flow, routing, filtering, and network namespaces.
- Networking stack implementation surface: socket APIs, protocol dispatch, packet flow, routing, filtering, and network namespaces.
- 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/module.hdigital.h
Detected Declarations
struct digital_cmdfunction digital_skb_add_crcfunction digital_skb_check_crcfunction digital_switch_rffunction digital_abort_cmdfunction digital_wq_cmd_completefunction digital_send_cmd_completefunction digital_wq_cmdfunction digital_send_cmdfunction digital_in_configure_hwfunction digital_tg_configure_hwfunction digital_tg_listen_mdaafunction digital_tg_listen_mdfunction digital_target_foundfunction digital_poll_next_techfunction digital_wq_pollfunction digital_add_poll_techfunction technologiesfunction digital_stop_pollfunction digital_dev_upfunction digital_dev_downfunction digital_dep_link_upfunction digital_dep_link_downfunction digital_activate_targetfunction digital_deactivate_targetfunction digital_tg_sendfunction digital_in_send_completefunction digital_in_sendfunction nfc_digital_free_devicefunction nfc_digital_register_devicefunction nfc_digital_unregister_devicefunction list_for_each_entry_safeexport nfc_digital_allocate_deviceexport nfc_digital_free_deviceexport nfc_digital_register_deviceexport nfc_digital_unregister_device
Annotated Snippet
struct digital_cmd {
struct list_head queue;
u8 type;
u8 pending;
u16 timeout;
struct sk_buff *req;
struct sk_buff *resp;
struct digital_tg_mdaa_params *mdaa_params;
nfc_digital_cmd_complete_t cmd_cb;
void *cb_context;
};
struct sk_buff *digital_skb_alloc(struct nfc_digital_dev *ddev,
unsigned int len)
{
struct sk_buff *skb;
skb = alloc_skb(len + ddev->tx_headroom + ddev->tx_tailroom,
GFP_KERNEL);
if (skb)
skb_reserve(skb, ddev->tx_headroom);
return skb;
}
void digital_skb_add_crc(struct sk_buff *skb, crc_func_t crc_func, u16 init,
u8 bitwise_inv, u8 msb_first)
{
u16 crc;
crc = crc_func(init, skb->data, skb->len);
if (bitwise_inv)
crc = ~crc;
if (msb_first)
crc = __fswab16(crc);
skb_put_u8(skb, crc & 0xFF);
skb_put_u8(skb, (crc >> 8) & 0xFF);
}
int digital_skb_check_crc(struct sk_buff *skb, crc_func_t crc_func,
u16 crc_init, u8 bitwise_inv, u8 msb_first)
{
int rc;
u16 crc;
if (skb->len <= 2)
return -EIO;
crc = crc_func(crc_init, skb->data, skb->len - 2);
if (bitwise_inv)
crc = ~crc;
if (msb_first)
crc = __swab16(crc);
rc = (skb->data[skb->len - 2] - (crc & 0xFF)) +
(skb->data[skb->len - 1] - ((crc >> 8) & 0xFF));
if (rc)
return -EIO;
skb_trim(skb, skb->len - 2);
return 0;
}
static inline void digital_switch_rf(struct nfc_digital_dev *ddev, bool on)
{
ddev->ops->switch_rf(ddev, on);
}
static inline void digital_abort_cmd(struct nfc_digital_dev *ddev)
{
ddev->ops->abort_cmd(ddev);
}
static void digital_wq_cmd_complete(struct work_struct *work)
{
struct digital_cmd *cmd;
struct nfc_digital_dev *ddev = container_of(work,
struct nfc_digital_dev,
cmd_complete_work);
Annotation
- Immediate include surface: `linux/module.h`, `digital.h`.
- Detected declarations: `struct digital_cmd`, `function digital_skb_add_crc`, `function digital_skb_check_crc`, `function digital_switch_rf`, `function digital_abort_cmd`, `function digital_wq_cmd_complete`, `function digital_send_cmd_complete`, `function digital_wq_cmd`, `function digital_send_cmd`, `function digital_in_configure_hw`.
- Atlas domain: Networking Core / Sockets, Protocols, Packet Path, And Network Policy.
- 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.