Lines Matching refs:rq
95 struct uss720_async_request *rq = container_of(kref, struct uss720_async_request, ref_count); in destroy_async() local
96 struct parport_uss720_private *priv = rq->priv; in destroy_async()
99 if (likely(rq->urb)) in destroy_async()
100 usb_free_urb(rq->urb); in destroy_async()
101 kfree(rq->dr); in destroy_async()
103 list_del_init(&rq->asynclist); in destroy_async()
105 kfree(rq); in destroy_async()
113 struct uss720_async_request *rq; in async_complete() local
118 rq = urb->context; in async_complete()
119 priv = rq->priv; in async_complete()
124 } else if (rq->dr->bRequest == 3) { in async_complete()
125 memcpy(priv->reg, rq->reg, sizeof(priv->reg)); in async_complete()
131 if (rq->reg[2] & rq->reg[1] & 0x10 && pp) in async_complete()
134 complete(&rq->compl); in async_complete()
135 kref_put(&rq->ref_count, destroy_async); in async_complete()
143 struct uss720_async_request *rq; in submit_async_request() local
152 rq = kzalloc(sizeof(struct uss720_async_request), mem_flags); in submit_async_request()
153 if (!rq) in submit_async_request()
155 kref_init(&rq->ref_count); in submit_async_request()
156 INIT_LIST_HEAD(&rq->asynclist); in submit_async_request()
157 init_completion(&rq->compl); in submit_async_request()
159 rq->priv = priv; in submit_async_request()
160 rq->urb = usb_alloc_urb(0, mem_flags); in submit_async_request()
161 if (!rq->urb) { in submit_async_request()
162 kref_put(&rq->ref_count, destroy_async); in submit_async_request()
165 rq->dr = kmalloc(sizeof(*rq->dr), mem_flags); in submit_async_request()
166 if (!rq->dr) { in submit_async_request()
167 kref_put(&rq->ref_count, destroy_async); in submit_async_request()
170 rq->dr->bRequestType = requesttype; in submit_async_request()
171 rq->dr->bRequest = request; in submit_async_request()
172 rq->dr->wValue = cpu_to_le16(value); in submit_async_request()
173 rq->dr->wIndex = cpu_to_le16(index); in submit_async_request()
174 rq->dr->wLength = cpu_to_le16((request == 3) ? sizeof(rq->reg) : 0); in submit_async_request()
175 …usb_fill_control_urb(rq->urb, usbdev, (requesttype & 0x80) ? usb_rcvctrlpipe(usbdev, 0) : usb_sndc… in submit_async_request()
176 (unsigned char *)rq->dr, in submit_async_request()
177 (request == 3) ? rq->reg : NULL, (request == 3) ? sizeof(rq->reg) : 0, async_complete, rq); in submit_async_request()
180 list_add_tail(&rq->asynclist, &priv->asynclist); in submit_async_request()
182 kref_get(&rq->ref_count); in submit_async_request()
183 ret = usb_submit_urb(rq->urb, mem_flags); in submit_async_request()
185 return rq; in submit_async_request()
186 destroy_async(&rq->ref_count); in submit_async_request()
193 struct uss720_async_request *rq; in kill_all_async_requests_priv() local
198 list_for_each_entry(rq, &priv->asynclist, asynclist) { in kill_all_async_requests_priv()
199 usb_unlink_urb(rq->urb); in kill_all_async_requests_priv()
211 struct uss720_async_request *rq; in get_1284_register() local
220 rq = submit_async_request(priv, 3, 0xc0, ((unsigned int)reg) << 8, 0, mem_flags); in get_1284_register()
221 if (!rq) { in get_1284_register()
227 kref_put(&rq->ref_count, destroy_async); in get_1284_register()
230 if (wait_for_completion_timeout(&rq->compl, HZ)) { in get_1284_register()
231 ret = rq->urb->status; in get_1284_register()
236 kref_put(&rq->ref_count, destroy_async); in get_1284_register()
247 struct uss720_async_request *rq; in set_1284_register() local
252 rq = submit_async_request(priv, 4, 0x40, (((unsigned int)reg) << 8) | val, 0, mem_flags); in set_1284_register()
253 if (!rq) { in set_1284_register()
258 kref_put(&rq->ref_count, destroy_async); in set_1284_register()