コード例 #1
0
ファイル: microread.c プロジェクト: neominds/wrfx227819
static void microread_im_transceive_cb(void *context, struct sk_buff *skb,
				       int err)
{
	struct microread_info *info = context;

	switch (info->async_cb_type) {
	case MICROREAD_CB_TYPE_READER_ALL:
		if (err == 0) {
			if (skb->len == 0) {
				err = -EPROTO;
				kfree_skb(skb);
				info->async_cb(info->async_cb_context, NULL,
					       -EPROTO);
				return;
			}

			if (skb->data[skb->len - 1] != 0) {
				err = nfc_hci_result_to_errno(
						       skb->data[skb->len - 1]);
				kfree_skb(skb);
				info->async_cb(info->async_cb_context, NULL,
					       err);
				return;
			}

			skb_trim(skb, skb->len - 1);	/* RF Error ind. */
		}
		info->async_cb(info->async_cb_context, skb, err);
		break;
	default:
		if (err == 0)
			kfree_skb(skb);
		break;
	}
}
コード例 #2
0
ファイル: command.c プロジェクト: AllenWeb/linux
static void nfc_hci_execute_cb(struct nfc_hci_dev *hdev, u8 result,
			       struct sk_buff *skb, void *cb_data)
{
	struct hcp_exec_waiter *hcp_ew = (struct hcp_exec_waiter *)cb_data;

	pr_debug("HCI Cmd completed with HCI result=%d\n", result);

	hcp_ew->exec_result = nfc_hci_result_to_errno(result);
	if (hcp_ew->exec_result == 0)
		hcp_ew->result_skb = skb;
	else
		kfree_skb(skb);
	hcp_ew->exec_complete = true;

	wake_up(hcp_ew->wq);
}