static int microread_dep_link_up(struct nfc_hci_dev *hdev, struct nfc_target *target, u8 comm_mode, u8 *gb, size_t gb_len) { struct sk_buff *rgb_skb = NULL; int r; r = nfc_hci_get_param(hdev, target->hci_reader_gate, MICROREAD_PAR_P2P_INITIATOR_GT, &rgb_skb); if (r < 0) return r; if (rgb_skb->len == 0 || rgb_skb->len > NFC_GB_MAXSIZE) { r = -EPROTO; goto exit; } r = nfc_set_remote_general_bytes(hdev->ndev, rgb_skb->data, rgb_skb->len); if (r == 0) r = nfc_dep_link_is_up(hdev->ndev, target->idx, comm_mode, NFC_RF_INITIATOR); exit: kfree_skb(rgb_skb); return r; }
static int pn544_hci_dep_link_up(struct nfc_hci_dev *hdev, struct nfc_target *target, u8 comm_mode, u8 *gb, size_t gb_len) { struct sk_buff *rgb_skb = NULL; int r; r = nfc_hci_get_param(hdev, target->hci_reader_gate, PN544_DEP_ATR_RES, &rgb_skb); if (r < 0) return r; if (rgb_skb->len == 0 || rgb_skb->len > NFC_GB_MAXSIZE) { r = -EPROTO; goto exit; } print_hex_dump(KERN_DEBUG, "remote gb: ", DUMP_PREFIX_OFFSET, 16, 1, rgb_skb->data, rgb_skb->len, true); r = nfc_set_remote_general_bytes(hdev->ndev, rgb_skb->data, rgb_skb->len); if (r == 0) r = nfc_dep_link_is_up(hdev->ndev, target->idx, comm_mode, NFC_RF_INITIATOR); exit: kfree_skb(rgb_skb); return r; }
static int nfcsim_dep_link_up(struct nfc_dev *nfc_dev, struct nfc_target *target, u8 comm_mode, u8 *gb, size_t gb_len) { int rc; struct nfcsim *dev = nfc_get_drvdata(nfc_dev); struct nfcsim *peer = dev->peer_dev; u8 *remote_gb; size_t remote_gb_len; DEV_DBG(dev, "target_idx: %d, comm_mode: %d\n", target->idx, comm_mode); mutex_lock(&peer->lock); nfc_tm_activated(peer->nfc_dev, NFC_PROTO_NFC_DEP_MASK, NFC_COMM_ACTIVE, gb, gb_len); remote_gb = nfc_get_local_general_bytes(peer->nfc_dev, &remote_gb_len); if (!remote_gb) { DEV_ERR(peer, "Can't get remote general bytes\n"); mutex_unlock(&peer->lock); return -EINVAL; } mutex_unlock(&peer->lock); mutex_lock(&dev->lock); rc = nfc_set_remote_general_bytes(nfc_dev, remote_gb, remote_gb_len); if (rc) { DEV_ERR(dev, "Can't set remote general bytes\n"); mutex_unlock(&dev->lock); return rc; } rc = nfc_dep_link_is_up(nfc_dev, target->idx, NFC_COMM_ACTIVE, NFC_RF_INITIATOR); mutex_unlock(&dev->lock); return rc; }
static int nci_dep_link_up(struct nfc_dev *nfc_dev, struct nfc_target *target, __u8 comm_mode, __u8 *gb, size_t gb_len) { struct nci_dev *ndev = nfc_get_drvdata(nfc_dev); int rc; pr_debug("target_idx %d, comm_mode %d\n", target->idx, comm_mode); rc = nci_activate_target(nfc_dev, target, NFC_PROTO_NFC_DEP); if (rc) return rc; rc = nfc_set_remote_general_bytes(nfc_dev, ndev->remote_gb, ndev->remote_gb_len); if (!rc) rc = nfc_dep_link_is_up(nfc_dev, target->idx, NFC_COMM_PASSIVE, NFC_RF_INITIATOR); return rc; }