drivers/nfc/st-nci/vendor_cmds.c
Source file repositories/reference/linux-study-clean/drivers/nfc/st-nci/vendor_cmds.c
File Facts
- System
- Linux kernel
- Corpus path
drivers/nfc/st-nci/vendor_cmds.c- Extension
.c- Size
- 10277 bytes
- Lines
- 463
- 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.hlinux/delay.hnet/nfc/nci_core.hst-nci.h
Detected Declarations
struct get_param_datafunction st_nci_factory_modefunction st_nci_hci_clear_all_pipesfunction st_nci_hci_dm_put_datafunction st_nci_hci_dm_update_aidfunction st_nci_hci_dm_get_infofunction st_nci_hci_dm_get_datafunction st_nci_hci_dm_fwupd_startfunction st_nci_hci_dm_fwupd_endfunction st_nci_hci_dm_direct_loadfunction st_nci_hci_dm_resetfunction st_nci_hci_get_paramfunction st_nci_hci_dm_field_generatorfunction st_nci_hci_dm_vdc_measurement_valuefunction st_nci_hci_dm_vdc_value_comparisonfunction st_nci_loopbackfunction st_nci_manufacturer_specificfunction st_nci_vendor_cmds_initexport st_nci_vendor_cmds_init
Annotated Snippet
struct get_param_data {
u8 gate;
u8 data;
} __packed;
static int st_nci_factory_mode(struct nfc_dev *dev, void *data,
size_t data_len)
{
struct nci_dev *ndev = nfc_get_drvdata(dev);
struct st_nci_info *info = nci_get_drvdata(ndev);
if (data_len != 1)
return -EINVAL;
pr_debug("factory mode: %x\n", ((u8 *)data)[0]);
switch (((u8 *)data)[0]) {
case ST_NCI_FACTORY_MODE_ON:
test_and_set_bit(ST_NCI_FACTORY_MODE, &info->flags);
break;
case ST_NCI_FACTORY_MODE_OFF:
clear_bit(ST_NCI_FACTORY_MODE, &info->flags);
break;
default:
return -EINVAL;
}
return 0;
}
static int st_nci_hci_clear_all_pipes(struct nfc_dev *dev, void *data,
size_t data_len)
{
struct nci_dev *ndev = nfc_get_drvdata(dev);
return nci_hci_clear_all_pipes(ndev);
}
static int st_nci_hci_dm_put_data(struct nfc_dev *dev, void *data,
size_t data_len)
{
struct nci_dev *ndev = nfc_get_drvdata(dev);
return nci_hci_send_cmd(ndev, ST_NCI_DEVICE_MGNT_GATE,
ST_NCI_HCI_DM_PUTDATA, data,
data_len, NULL);
}
static int st_nci_hci_dm_update_aid(struct nfc_dev *dev, void *data,
size_t data_len)
{
struct nci_dev *ndev = nfc_get_drvdata(dev);
return nci_hci_send_cmd(ndev, ST_NCI_DEVICE_MGNT_GATE,
ST_NCI_HCI_DM_UPDATE_AID, data, data_len, NULL);
}
static int st_nci_hci_dm_get_info(struct nfc_dev *dev, void *data,
size_t data_len)
{
int r;
struct sk_buff *msg, *skb;
struct nci_dev *ndev = nfc_get_drvdata(dev);
r = nci_hci_send_cmd(ndev, ST_NCI_DEVICE_MGNT_GATE, ST_NCI_HCI_DM_GETINFO,
data, data_len, &skb);
if (r)
return r;
msg = nfc_vendor_cmd_alloc_reply_skb(dev, ST_NCI_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);
return r;
}
static int st_nci_hci_dm_get_data(struct nfc_dev *dev, void *data,
Annotation
- Immediate include surface: `net/genetlink.h`, `linux/module.h`, `linux/nfc.h`, `linux/delay.h`, `net/nfc/nci_core.h`, `st-nci.h`.
- Detected declarations: `struct get_param_data`, `function st_nci_factory_mode`, `function st_nci_hci_clear_all_pipes`, `function st_nci_hci_dm_put_data`, `function st_nci_hci_dm_update_aid`, `function st_nci_hci_dm_get_info`, `function st_nci_hci_dm_get_data`, `function st_nci_hci_dm_fwupd_start`, `function st_nci_hci_dm_fwupd_end`, `function st_nci_hci_dm_direct_load`.
- 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.