drivers/nfc/st21nfca/dep.c

Source file repositories/reference/linux-study-clean/drivers/nfc/st21nfca/dep.c

File Facts

System
Linux kernel
Corpus path
drivers/nfc/st21nfca/dep.c
Extension
.c
Size
16004 bytes
Lines
658
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.

Dependency Surface

Detected Declarations

Annotated Snippet

struct st21nfca_atr_req {
	u8 length;
	u8 cmd0;
	u8 cmd1;
	u8 nfcid3[NFC_NFCID3_MAXSIZE];
	u8 did;
	u8 bsi;
	u8 bri;
	u8 ppi;
	u8 gbi[];
} __packed;

struct st21nfca_atr_res {
	u8 length;
	u8 cmd0;
	u8 cmd1;
	u8 nfcid3[NFC_NFCID3_MAXSIZE];
	u8 did;
	u8 bsi;
	u8 bri;
	u8 to;
	u8 ppi;
	u8 gbi[];
} __packed;

struct st21nfca_psl_req {
	u8 length;
	u8 cmd0;
	u8 cmd1;
	u8 did;
	u8 brs;
	u8 fsl;
} __packed;

struct st21nfca_psl_res {
	u8 length;
	u8 cmd0;
	u8 cmd1;
	u8 did;
} __packed;

struct st21nfca_dep_req_res {
	u8 length;
	u8 cmd0;
	u8 cmd1;
	u8 pfb;
	u8 did;
	u8 nad;
} __packed;

static void st21nfca_tx_work(struct work_struct *work)
{
	struct st21nfca_hci_info *info = container_of(work,
						struct st21nfca_hci_info,
						dep_info.tx_work);

	struct nfc_dev *dev;
	struct sk_buff *skb;

	dev = info->hdev->ndev;
	skb = info->dep_info.tx_pending;

	device_lock(&dev->dev);

	nfc_hci_send_cmd_async(info->hdev, ST21NFCA_RF_READER_F_GATE,
			ST21NFCA_WR_XCHG_DATA, skb->data, skb->len,
			info->async_cb, info);
	device_unlock(&dev->dev);
	kfree_skb(skb);
}

static void st21nfca_im_send_pdu(struct st21nfca_hci_info *info,
						struct sk_buff *skb)
{
	info->dep_info.tx_pending = skb;
	schedule_work(&info->dep_info.tx_work);
}

static int st21nfca_tm_send_atr_res(struct nfc_hci_dev *hdev,
				    struct st21nfca_atr_req *atr_req)
{
	struct st21nfca_atr_res *atr_res;
	struct sk_buff *skb;
	size_t gb_len;
	int r;
	struct st21nfca_hci_info *info = nfc_hci_get_clientdata(hdev);

	gb_len = atr_req->length - sizeof(struct st21nfca_atr_req);
	skb = alloc_skb(atr_req->length + 1, GFP_KERNEL);
	if (!skb)

Annotation

Implementation Notes