Lines Matching refs:msg

33 void virtsnd_ctl_msg_ref(struct virtio_snd_msg *msg)  in virtsnd_ctl_msg_ref()  argument
35 refcount_inc(&msg->ref_count); in virtsnd_ctl_msg_ref()
46 void virtsnd_ctl_msg_unref(struct virtio_snd_msg *msg) in virtsnd_ctl_msg_unref() argument
48 if (refcount_dec_and_test(&msg->ref_count)) in virtsnd_ctl_msg_unref()
49 kfree(msg); in virtsnd_ctl_msg_unref()
58 void *virtsnd_ctl_msg_request(struct virtio_snd_msg *msg) in virtsnd_ctl_msg_request() argument
60 return sg_virt(&msg->sg_request); in virtsnd_ctl_msg_request()
69 void *virtsnd_ctl_msg_response(struct virtio_snd_msg *msg) in virtsnd_ctl_msg_response() argument
71 return sg_virt(&msg->sg_response); in virtsnd_ctl_msg_response()
88 struct virtio_snd_msg *msg; in virtsnd_ctl_msg_alloc() local
93 msg = kzalloc(sizeof(*msg) + request_size + response_size, gfp); in virtsnd_ctl_msg_alloc()
94 if (!msg) in virtsnd_ctl_msg_alloc()
97 sg_init_one(&msg->sg_request, (u8 *)msg + sizeof(*msg), request_size); in virtsnd_ctl_msg_alloc()
98 sg_init_one(&msg->sg_response, (u8 *)msg + sizeof(*msg) + request_size, in virtsnd_ctl_msg_alloc()
101 INIT_LIST_HEAD(&msg->list); in virtsnd_ctl_msg_alloc()
102 init_completion(&msg->notify); in virtsnd_ctl_msg_alloc()
104 refcount_set(&msg->ref_count, 1); in virtsnd_ctl_msg_alloc()
106 return msg; in virtsnd_ctl_msg_alloc()
121 int virtsnd_ctl_msg_send(struct virtio_snd *snd, struct virtio_snd_msg *msg, in virtsnd_ctl_msg_send() argument
128 struct virtio_snd_hdr *request = virtsnd_ctl_msg_request(msg); in virtsnd_ctl_msg_send()
129 struct virtio_snd_hdr *response = virtsnd_ctl_msg_response(msg); in virtsnd_ctl_msg_send()
136 virtsnd_ctl_msg_ref(msg); in virtsnd_ctl_msg_send()
141 psgs[nouts++] = &msg->sg_request; in virtsnd_ctl_msg_send()
145 psgs[nouts + nins++] = &msg->sg_response; in virtsnd_ctl_msg_send()
150 rc = virtqueue_add_sgs(queue->vqueue, psgs, nouts, nins, msg, in virtsnd_ctl_msg_send()
155 list_add_tail(&msg->list, &snd->ctl_msgs); in virtsnd_ctl_msg_send()
167 virtsnd_ctl_msg_unref(msg); in virtsnd_ctl_msg_send()
178 rc = wait_for_completion_interruptible_timeout(&msg->notify, js); in virtsnd_ctl_msg_send()
206 virtsnd_ctl_msg_unref(msg); in virtsnd_ctl_msg_send()
218 void virtsnd_ctl_msg_complete(struct virtio_snd_msg *msg) in virtsnd_ctl_msg_complete() argument
220 list_del(&msg->list); in virtsnd_ctl_msg_complete()
221 complete(&msg->notify); in virtsnd_ctl_msg_complete()
223 virtsnd_ctl_msg_unref(msg); in virtsnd_ctl_msg_complete()
238 struct virtio_snd_msg *msg = in virtsnd_ctl_msg_cancel_all() local
242 virtsnd_ctl_msg_complete(msg); in virtsnd_ctl_msg_cancel_all()
261 struct virtio_snd_msg *msg; in virtsnd_ctl_query_info() local
265 msg = virtsnd_ctl_msg_alloc(sizeof(*query), in virtsnd_ctl_query_info()
267 if (!msg) in virtsnd_ctl_query_info()
270 query = virtsnd_ctl_msg_request(msg); in virtsnd_ctl_query_info()
278 return virtsnd_ctl_msg_send(snd, msg, NULL, &sg, false); in virtsnd_ctl_query_info()
294 struct virtio_snd_msg *msg; in virtsnd_ctl_notify_cb() local
300 while ((msg = virtqueue_get_buf(vqueue, &length))) in virtsnd_ctl_notify_cb()
301 virtsnd_ctl_msg_complete(msg); in virtsnd_ctl_notify_cb()