Lines Matching full:vdev

34 	struct virtual_nci_dev *vdev = nci_get_drvdata(ndev);  in virtual_nci_open()  local
36 vdev->running = true; in virtual_nci_open()
42 struct virtual_nci_dev *vdev = nci_get_drvdata(ndev); in virtual_nci_close() local
44 mutex_lock(&vdev->mtx); in virtual_nci_close()
45 kfree_skb(vdev->send_buff); in virtual_nci_close()
46 vdev->send_buff = NULL; in virtual_nci_close()
47 vdev->running = false; in virtual_nci_close()
48 mutex_unlock(&vdev->mtx); in virtual_nci_close()
55 struct virtual_nci_dev *vdev = nci_get_drvdata(ndev); in virtual_nci_send() local
57 mutex_lock(&vdev->mtx); in virtual_nci_send()
58 if (vdev->send_buff || !vdev->running) { in virtual_nci_send()
59 mutex_unlock(&vdev->mtx); in virtual_nci_send()
63 vdev->send_buff = skb_copy(skb, GFP_KERNEL); in virtual_nci_send()
64 if (!vdev->send_buff) { in virtual_nci_send()
65 mutex_unlock(&vdev->mtx); in virtual_nci_send()
69 mutex_unlock(&vdev->mtx); in virtual_nci_send()
70 wake_up_interruptible(&vdev->wq); in virtual_nci_send()
85 struct virtual_nci_dev *vdev = file->private_data; in virtual_ncidev_read() local
88 mutex_lock(&vdev->mtx); in virtual_ncidev_read()
89 while (!vdev->send_buff) { in virtual_ncidev_read()
90 mutex_unlock(&vdev->mtx); in virtual_ncidev_read()
91 if (wait_event_interruptible(vdev->wq, vdev->send_buff)) in virtual_ncidev_read()
93 mutex_lock(&vdev->mtx); in virtual_ncidev_read()
96 actual_len = min_t(size_t, count, vdev->send_buff->len); in virtual_ncidev_read()
98 if (copy_to_user(buf, vdev->send_buff->data, actual_len)) { in virtual_ncidev_read()
99 mutex_unlock(&vdev->mtx); in virtual_ncidev_read()
103 skb_pull(vdev->send_buff, actual_len); in virtual_ncidev_read()
104 if (vdev->send_buff->len == 0) { in virtual_ncidev_read()
105 consume_skb(vdev->send_buff); in virtual_ncidev_read()
106 vdev->send_buff = NULL; in virtual_ncidev_read()
108 mutex_unlock(&vdev->mtx); in virtual_ncidev_read()
117 struct virtual_nci_dev *vdev = file->private_data; in virtual_ncidev_write() local
133 nci_recv_frame(vdev->ndev, skb); in virtual_ncidev_write()
140 struct virtual_nci_dev *vdev; in virtual_ncidev_open() local
142 vdev = kzalloc(sizeof(*vdev), GFP_KERNEL); in virtual_ncidev_open()
143 if (!vdev) in virtual_ncidev_open()
145 vdev->ndev = nci_allocate_device(&virtual_nci_ops, in virtual_ncidev_open()
147 if (!vdev->ndev) { in virtual_ncidev_open()
148 kfree(vdev); in virtual_ncidev_open()
152 mutex_init(&vdev->mtx); in virtual_ncidev_open()
153 init_waitqueue_head(&vdev->wq); in virtual_ncidev_open()
154 file->private_data = vdev; in virtual_ncidev_open()
155 nci_set_drvdata(vdev->ndev, vdev); in virtual_ncidev_open()
157 ret = nci_register_device(vdev->ndev); in virtual_ncidev_open()
159 nci_free_device(vdev->ndev); in virtual_ncidev_open()
160 mutex_destroy(&vdev->mtx); in virtual_ncidev_open()
161 kfree(vdev); in virtual_ncidev_open()
170 struct virtual_nci_dev *vdev = file->private_data; in virtual_ncidev_close() local
172 nci_unregister_device(vdev->ndev); in virtual_ncidev_close()
173 nci_free_device(vdev->ndev); in virtual_ncidev_close()
174 mutex_destroy(&vdev->mtx); in virtual_ncidev_close()
175 kfree(vdev); in virtual_ncidev_close()
183 struct virtual_nci_dev *vdev = file->private_data; in virtual_ncidev_ioctl() local
184 const struct nfc_dev *nfc_dev = vdev->ndev->nfc_dev; in virtual_ncidev_ioctl()