drivers/nfc/st21nfca/vendor_cmds.c
Source file repositories/reference/linux-study-clean/drivers/nfc/st21nfca/vendor_cmds.c
File Facts
- System
- Linux kernel
- Corpus path
drivers/nfc/st21nfca/vendor_cmds.c- Extension
.c- Size
- 8210 bytes
- Lines
- 365
- 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.
- Defines or uses C structs; map object ownership, embedded links, reference counts, and lock ownership.
Dependency Surface
net/genetlink.hlinux/module.hlinux/nfc.hnet/nfc/hci.hnet/nfc/llc.hst21nfca.h
Detected Declarations
struct get_param_datafunction st21nfca_factory_modefunction st21nfca_hci_clear_all_pipesfunction st21nfca_hci_dm_put_datafunction st21nfca_hci_dm_update_aidfunction st21nfca_hci_dm_get_infofunction st21nfca_hci_dm_get_datafunction st21nfca_hci_dm_loadfunction st21nfca_hci_dm_resetfunction st21nfca_hci_get_paramfunction st21nfca_hci_dm_field_generatorfunction st21nfca_hci_loopback_event_receivedfunction st21nfca_hci_loopbackfunction st21nfca_vendor_cmds_initexport st21nfca_hci_loopback_event_receivedexport st21nfca_vendor_cmds_init
Annotated Snippet
struct get_param_data {
u8 gate;
u8 data;
} __packed;
static int st21nfca_factory_mode(struct nfc_dev *dev, void *data,
size_t data_len)
{
struct nfc_hci_dev *hdev = nfc_get_drvdata(dev);
if (data_len != 1)
return -EINVAL;
pr_debug("factory mode: %x\n", ((u8 *)data)[0]);
switch (((u8 *)data)[0]) {
case ST21NFCA_FACTORY_MODE_ON:
test_and_set_bit(ST21NFCA_FACTORY_MODE, &hdev->quirks);
break;
case ST21NFCA_FACTORY_MODE_OFF:
clear_bit(ST21NFCA_FACTORY_MODE, &hdev->quirks);
break;
default:
return -EINVAL;
}
return 0;
}
static int st21nfca_hci_clear_all_pipes(struct nfc_dev *dev, void *data,
size_t data_len)
{
struct nfc_hci_dev *hdev = nfc_get_drvdata(dev);
return nfc_hci_disconnect_all_gates(hdev);
}
static int st21nfca_hci_dm_put_data(struct nfc_dev *dev, void *data,
size_t data_len)
{
struct nfc_hci_dev *hdev = nfc_get_drvdata(dev);
return nfc_hci_send_cmd(hdev, ST21NFCA_DEVICE_MGNT_GATE,
ST21NFCA_HCI_DM_PUTDATA, data,
data_len, NULL);
}
static int st21nfca_hci_dm_update_aid(struct nfc_dev *dev, void *data,
size_t data_len)
{
struct nfc_hci_dev *hdev = nfc_get_drvdata(dev);
return nfc_hci_send_cmd(hdev, ST21NFCA_DEVICE_MGNT_GATE,
ST21NFCA_HCI_DM_UPDATE_AID, data, data_len, NULL);
}
static int st21nfca_hci_dm_get_info(struct nfc_dev *dev, void *data,
size_t data_len)
{
int r;
struct sk_buff *msg, *skb;
struct nfc_hci_dev *hdev = nfc_get_drvdata(dev);
r = nfc_hci_send_cmd(hdev,
ST21NFCA_DEVICE_MGNT_GATE,
ST21NFCA_HCI_DM_GETINFO,
data, data_len, &skb);
if (r)
goto exit;
msg = nfc_vendor_cmd_alloc_reply_skb(dev, ST21NFCA_VENDOR_OUI,
HCI_DM_GET_INFO, skb->len);
if (!msg) {
r = -ENOMEM;
goto free_skb;
}
if (nla_put(msg, NFC_ATTR_VENDOR_DATA, skb->len, skb->data)) {
kfree_skb(msg);
r = -ENOBUFS;
goto free_skb;
}
r = nfc_vendor_cmd_reply(msg);
free_skb:
kfree_skb(skb);
exit:
return r;
}
Annotation
- Immediate include surface: `net/genetlink.h`, `linux/module.h`, `linux/nfc.h`, `net/nfc/hci.h`, `net/nfc/llc.h`, `st21nfca.h`.
- Detected declarations: `struct get_param_data`, `function st21nfca_factory_mode`, `function st21nfca_hci_clear_all_pipes`, `function st21nfca_hci_dm_put_data`, `function st21nfca_hci_dm_update_aid`, `function st21nfca_hci_dm_get_info`, `function st21nfca_hci_dm_get_data`, `function st21nfca_hci_dm_load`, `function st21nfca_hci_dm_reset`, `function st21nfca_hci_get_param`.
- 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.