drivers/nfc/st21nfca/se.c
Source file repositories/reference/linux-study-clean/drivers/nfc/st21nfca/se.c
File Facts
- System
- Linux kernel
- Corpus path
drivers/nfc/st21nfca/se.c- Extension
.c- Size
- 12456 bytes
- Lines
- 448
- Domain
- Driver Families
- Bucket
- drivers/nfc
- 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.
- 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
net/nfc/hci.hst21nfca.h
Detected Declarations
function Copyrightfunction st21nfca_se_get_atrfunction st21nfca_hci_control_sefunction st21nfca_hci_discover_sefunction st21nfca_hci_enable_sefunction st21nfca_hci_disable_sefunction st21nfca_hci_se_iofunction st21nfca_se_wt_workfunction st21nfca_se_wt_timeoutfunction st21nfca_se_activation_timeoutfunction st21nfca_connectivity_event_receivedfunction st21nfca_apdu_reader_event_receivedfunction st21nfca_se_initfunction st21nfca_se_deinitexport st21nfca_hci_discover_seexport st21nfca_hci_enable_seexport st21nfca_hci_disable_seexport st21nfca_hci_se_ioexport st21nfca_connectivity_event_receivedexport st21nfca_apdu_reader_event_receivedexport st21nfca_se_initexport st21nfca_se_deinit
Annotated Snippet
if (ST21NFCA_ATR_TB_PRESENT(td)) {
i++;
return info->se_info.atr[i] >> 4;
}
}
return ST21NFCA_ATR_DEFAULT_BWI;
}
static void st21nfca_se_get_atr(struct nfc_hci_dev *hdev)
{
int r;
struct sk_buff *skb;
struct st21nfca_hci_info *info = nfc_hci_get_clientdata(hdev);
r = nfc_hci_get_param(hdev, ST21NFCA_APDU_READER_GATE,
ST21NFCA_PARAM_ATR, &skb);
if (r < 0)
return;
if (skb->len <= ST21NFCA_ESE_MAX_LENGTH) {
memcpy(info->se_info.atr, skb->data, skb->len);
info->se_info.wt_timeout =
ST21NFCA_BWI_TO_TIMEOUT(st21nfca_se_get_bwi(hdev));
}
kfree_skb(skb);
}
static int st21nfca_hci_control_se(struct nfc_hci_dev *hdev, u32 se_idx,
u8 state)
{
struct st21nfca_hci_info *info = nfc_hci_get_clientdata(hdev);
int r, i;
struct sk_buff *sk_host_list;
u8 se_event, host_id;
switch (se_idx) {
case NFC_HCI_UICC_HOST_ID:
se_event = (state == ST21NFCA_SE_MODE_ON ?
ST21NFCA_EVT_UICC_ACTIVATE :
ST21NFCA_EVT_UICC_DEACTIVATE);
info->se_info.count_pipes = 0;
info->se_info.expected_pipes = ST21NFCA_SE_COUNT_PIPE_UICC;
break;
case ST21NFCA_ESE_HOST_ID:
se_event = (state == ST21NFCA_SE_MODE_ON ?
ST21NFCA_EVT_SE_ACTIVATE :
ST21NFCA_EVT_SE_DEACTIVATE);
info->se_info.count_pipes = 0;
info->se_info.expected_pipes = ST21NFCA_SE_COUNT_PIPE_EMBEDDED;
break;
default:
return -EINVAL;
}
/*
* Wait for an EVT_HOT_PLUG in order to
* retrieve a relevant host list.
*/
reinit_completion(&info->se_info.req_completion);
r = nfc_hci_send_event(hdev, ST21NFCA_DEVICE_MGNT_GATE, se_event,
NULL, 0);
if (r < 0)
return r;
mod_timer(&info->se_info.se_active_timer, jiffies +
msecs_to_jiffies(ST21NFCA_SE_TO_HOT_PLUG));
info->se_info.se_active = true;
/* Ignore return value and check in any case the host_list */
wait_for_completion_interruptible(&info->se_info.req_completion);
r = nfc_hci_get_param(hdev, NFC_HCI_ADMIN_GATE,
NFC_HCI_ADMIN_HOST_LIST,
&sk_host_list);
if (r < 0)
return r;
for (i = 0; i < sk_host_list->len &&
sk_host_list->data[i] != se_idx; i++)
;
host_id = sk_host_list->data[i];
kfree_skb(sk_host_list);
if (state == ST21NFCA_SE_MODE_ON && host_id == se_idx)
return se_idx;
else if (state == ST21NFCA_SE_MODE_OFF && host_id != se_idx)
return se_idx;
Annotation
- Immediate include surface: `net/nfc/hci.h`, `st21nfca.h`.
- Detected declarations: `function Copyright`, `function st21nfca_se_get_atr`, `function st21nfca_hci_control_se`, `function st21nfca_hci_discover_se`, `function st21nfca_hci_enable_se`, `function st21nfca_hci_disable_se`, `function st21nfca_hci_se_io`, `function st21nfca_se_wt_work`, `function st21nfca_se_wt_timeout`, `function st21nfca_se_activation_timeout`.
- Atlas domain: Driver Families / drivers/nfc.
- Implementation status: integration 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.