staging: rtl8188eu: rename HalSetBrateCfg() - style
[linux/fpc-iii.git] / drivers / s390 / crypto / ap_queue.c
blob66f7334bcb03214307fb4f3fecebf91dbb3ba341
1 // SPDX-License-Identifier: GPL-2.0
2 /*
3 * Copyright IBM Corp. 2016
4 * Author(s): Martin Schwidefsky <schwidefsky@de.ibm.com>
6 * Adjunct processor bus, queue related code.
7 */
9 #define KMSG_COMPONENT "ap"
10 #define pr_fmt(fmt) KMSG_COMPONENT ": " fmt
12 #include <linux/init.h>
13 #include <linux/slab.h>
14 #include <asm/facility.h>
16 #include "ap_bus.h"
18 /**
19 * ap_queue_enable_interruption(): Enable interruption on an AP queue.
20 * @qid: The AP queue number
21 * @ind: the notification indicator byte
23 * Enables interruption on AP queue via ap_aqic(). Based on the return
24 * value it waits a while and tests the AP queue if interrupts
25 * have been switched on using ap_test_queue().
27 static int ap_queue_enable_interruption(struct ap_queue *aq, void *ind)
29 struct ap_queue_status status;
30 struct ap_qirq_ctrl qirqctrl = { 0 };
32 qirqctrl.ir = 1;
33 qirqctrl.isc = AP_ISC;
34 status = ap_aqic(aq->qid, qirqctrl, ind);
35 switch (status.response_code) {
36 case AP_RESPONSE_NORMAL:
37 case AP_RESPONSE_OTHERWISE_CHANGED:
38 return 0;
39 case AP_RESPONSE_Q_NOT_AVAIL:
40 case AP_RESPONSE_DECONFIGURED:
41 case AP_RESPONSE_CHECKSTOPPED:
42 case AP_RESPONSE_INVALID_ADDRESS:
43 pr_err("Registering adapter interrupts for AP device %02x.%04x failed\n",
44 AP_QID_CARD(aq->qid),
45 AP_QID_QUEUE(aq->qid));
46 return -EOPNOTSUPP;
47 case AP_RESPONSE_RESET_IN_PROGRESS:
48 case AP_RESPONSE_BUSY:
49 default:
50 return -EBUSY;
54 /**
55 * __ap_send(): Send message to adjunct processor queue.
56 * @qid: The AP queue number
57 * @psmid: The program supplied message identifier
58 * @msg: The message text
59 * @length: The message length
60 * @special: Special Bit
62 * Returns AP queue status structure.
63 * Condition code 1 on NQAP can't happen because the L bit is 1.
64 * Condition code 2 on NQAP also means the send is incomplete,
65 * because a segment boundary was reached. The NQAP is repeated.
67 static inline struct ap_queue_status
68 __ap_send(ap_qid_t qid, unsigned long long psmid, void *msg, size_t length,
69 unsigned int special)
71 if (special == 1)
72 qid |= 0x400000UL;
73 return ap_nqap(qid, psmid, msg, length);
76 int ap_send(ap_qid_t qid, unsigned long long psmid, void *msg, size_t length)
78 struct ap_queue_status status;
80 status = __ap_send(qid, psmid, msg, length, 0);
81 switch (status.response_code) {
82 case AP_RESPONSE_NORMAL:
83 return 0;
84 case AP_RESPONSE_Q_FULL:
85 case AP_RESPONSE_RESET_IN_PROGRESS:
86 return -EBUSY;
87 case AP_RESPONSE_REQ_FAC_NOT_INST:
88 return -EINVAL;
89 default: /* Device is gone. */
90 return -ENODEV;
93 EXPORT_SYMBOL(ap_send);
95 int ap_recv(ap_qid_t qid, unsigned long long *psmid, void *msg, size_t length)
97 struct ap_queue_status status;
99 if (msg == NULL)
100 return -EINVAL;
101 status = ap_dqap(qid, psmid, msg, length);
102 switch (status.response_code) {
103 case AP_RESPONSE_NORMAL:
104 return 0;
105 case AP_RESPONSE_NO_PENDING_REPLY:
106 if (status.queue_empty)
107 return -ENOENT;
108 return -EBUSY;
109 case AP_RESPONSE_RESET_IN_PROGRESS:
110 return -EBUSY;
111 default:
112 return -ENODEV;
115 EXPORT_SYMBOL(ap_recv);
117 /* State machine definitions and helpers */
119 static enum ap_wait ap_sm_nop(struct ap_queue *aq)
121 return AP_WAIT_NONE;
125 * ap_sm_recv(): Receive pending reply messages from an AP queue but do
126 * not change the state of the device.
127 * @aq: pointer to the AP queue
129 * Returns AP_WAIT_NONE, AP_WAIT_AGAIN, or AP_WAIT_INTERRUPT
131 static struct ap_queue_status ap_sm_recv(struct ap_queue *aq)
133 struct ap_queue_status status;
134 struct ap_message *ap_msg;
136 status = ap_dqap(aq->qid, &aq->reply->psmid,
137 aq->reply->message, aq->reply->length);
138 switch (status.response_code) {
139 case AP_RESPONSE_NORMAL:
140 aq->queue_count--;
141 if (aq->queue_count > 0)
142 mod_timer(&aq->timeout,
143 jiffies + aq->request_timeout);
144 list_for_each_entry(ap_msg, &aq->pendingq, list) {
145 if (ap_msg->psmid != aq->reply->psmid)
146 continue;
147 list_del_init(&ap_msg->list);
148 aq->pendingq_count--;
149 ap_msg->receive(aq, ap_msg, aq->reply);
150 break;
152 case AP_RESPONSE_NO_PENDING_REPLY:
153 if (!status.queue_empty || aq->queue_count <= 0)
154 break;
155 /* The card shouldn't forget requests but who knows. */
156 aq->queue_count = 0;
157 list_splice_init(&aq->pendingq, &aq->requestq);
158 aq->requestq_count += aq->pendingq_count;
159 aq->pendingq_count = 0;
160 break;
161 default:
162 break;
164 return status;
168 * ap_sm_read(): Receive pending reply messages from an AP queue.
169 * @aq: pointer to the AP queue
171 * Returns AP_WAIT_NONE, AP_WAIT_AGAIN, or AP_WAIT_INTERRUPT
173 static enum ap_wait ap_sm_read(struct ap_queue *aq)
175 struct ap_queue_status status;
177 if (!aq->reply)
178 return AP_WAIT_NONE;
179 status = ap_sm_recv(aq);
180 switch (status.response_code) {
181 case AP_RESPONSE_NORMAL:
182 if (aq->queue_count > 0) {
183 aq->state = AP_STATE_WORKING;
184 return AP_WAIT_AGAIN;
186 aq->state = AP_STATE_IDLE;
187 return AP_WAIT_NONE;
188 case AP_RESPONSE_NO_PENDING_REPLY:
189 if (aq->queue_count > 0)
190 return AP_WAIT_INTERRUPT;
191 aq->state = AP_STATE_IDLE;
192 return AP_WAIT_NONE;
193 default:
194 aq->state = AP_STATE_BORKED;
195 return AP_WAIT_NONE;
200 * ap_sm_suspend_read(): Receive pending reply messages from an AP queue
201 * without changing the device state in between. In suspend mode we don't
202 * allow sending new requests, therefore just fetch pending replies.
203 * @aq: pointer to the AP queue
205 * Returns AP_WAIT_NONE or AP_WAIT_AGAIN
207 static enum ap_wait ap_sm_suspend_read(struct ap_queue *aq)
209 struct ap_queue_status status;
211 if (!aq->reply)
212 return AP_WAIT_NONE;
213 status = ap_sm_recv(aq);
214 switch (status.response_code) {
215 case AP_RESPONSE_NORMAL:
216 if (aq->queue_count > 0)
217 return AP_WAIT_AGAIN;
218 /* fall through */
219 default:
220 return AP_WAIT_NONE;
225 * ap_sm_write(): Send messages from the request queue to an AP queue.
226 * @aq: pointer to the AP queue
228 * Returns AP_WAIT_NONE, AP_WAIT_AGAIN, or AP_WAIT_INTERRUPT
230 static enum ap_wait ap_sm_write(struct ap_queue *aq)
232 struct ap_queue_status status;
233 struct ap_message *ap_msg;
235 if (aq->requestq_count <= 0)
236 return AP_WAIT_NONE;
237 /* Start the next request on the queue. */
238 ap_msg = list_entry(aq->requestq.next, struct ap_message, list);
239 status = __ap_send(aq->qid, ap_msg->psmid,
240 ap_msg->message, ap_msg->length, ap_msg->special);
241 switch (status.response_code) {
242 case AP_RESPONSE_NORMAL:
243 aq->queue_count++;
244 if (aq->queue_count == 1)
245 mod_timer(&aq->timeout, jiffies + aq->request_timeout);
246 list_move_tail(&ap_msg->list, &aq->pendingq);
247 aq->requestq_count--;
248 aq->pendingq_count++;
249 if (aq->queue_count < aq->card->queue_depth) {
250 aq->state = AP_STATE_WORKING;
251 return AP_WAIT_AGAIN;
253 /* fall through */
254 case AP_RESPONSE_Q_FULL:
255 aq->state = AP_STATE_QUEUE_FULL;
256 return AP_WAIT_INTERRUPT;
257 case AP_RESPONSE_RESET_IN_PROGRESS:
258 aq->state = AP_STATE_RESET_WAIT;
259 return AP_WAIT_TIMEOUT;
260 case AP_RESPONSE_MESSAGE_TOO_BIG:
261 case AP_RESPONSE_REQ_FAC_NOT_INST:
262 list_del_init(&ap_msg->list);
263 aq->requestq_count--;
264 ap_msg->rc = -EINVAL;
265 ap_msg->receive(aq, ap_msg, NULL);
266 return AP_WAIT_AGAIN;
267 default:
268 aq->state = AP_STATE_BORKED;
269 return AP_WAIT_NONE;
274 * ap_sm_read_write(): Send and receive messages to/from an AP queue.
275 * @aq: pointer to the AP queue
277 * Returns AP_WAIT_NONE, AP_WAIT_AGAIN, or AP_WAIT_INTERRUPT
279 static enum ap_wait ap_sm_read_write(struct ap_queue *aq)
281 return min(ap_sm_read(aq), ap_sm_write(aq));
285 * ap_sm_reset(): Reset an AP queue.
286 * @qid: The AP queue number
288 * Submit the Reset command to an AP queue.
290 static enum ap_wait ap_sm_reset(struct ap_queue *aq)
292 struct ap_queue_status status;
294 status = ap_rapq(aq->qid);
295 switch (status.response_code) {
296 case AP_RESPONSE_NORMAL:
297 case AP_RESPONSE_RESET_IN_PROGRESS:
298 aq->state = AP_STATE_RESET_WAIT;
299 aq->interrupt = AP_INTR_DISABLED;
300 return AP_WAIT_TIMEOUT;
301 case AP_RESPONSE_BUSY:
302 return AP_WAIT_TIMEOUT;
303 case AP_RESPONSE_Q_NOT_AVAIL:
304 case AP_RESPONSE_DECONFIGURED:
305 case AP_RESPONSE_CHECKSTOPPED:
306 default:
307 aq->state = AP_STATE_BORKED;
308 return AP_WAIT_NONE;
313 * ap_sm_reset_wait(): Test queue for completion of the reset operation
314 * @aq: pointer to the AP queue
316 * Returns AP_POLL_IMMEDIATELY, AP_POLL_AFTER_TIMEROUT or 0.
318 static enum ap_wait ap_sm_reset_wait(struct ap_queue *aq)
320 struct ap_queue_status status;
321 void *lsi_ptr;
323 if (aq->queue_count > 0 && aq->reply)
324 /* Try to read a completed message and get the status */
325 status = ap_sm_recv(aq);
326 else
327 /* Get the status with TAPQ */
328 status = ap_tapq(aq->qid, NULL);
330 switch (status.response_code) {
331 case AP_RESPONSE_NORMAL:
332 lsi_ptr = ap_airq_ptr();
333 if (lsi_ptr && ap_queue_enable_interruption(aq, lsi_ptr) == 0)
334 aq->state = AP_STATE_SETIRQ_WAIT;
335 else
336 aq->state = (aq->queue_count > 0) ?
337 AP_STATE_WORKING : AP_STATE_IDLE;
338 return AP_WAIT_AGAIN;
339 case AP_RESPONSE_BUSY:
340 case AP_RESPONSE_RESET_IN_PROGRESS:
341 return AP_WAIT_TIMEOUT;
342 case AP_RESPONSE_Q_NOT_AVAIL:
343 case AP_RESPONSE_DECONFIGURED:
344 case AP_RESPONSE_CHECKSTOPPED:
345 default:
346 aq->state = AP_STATE_BORKED;
347 return AP_WAIT_NONE;
352 * ap_sm_setirq_wait(): Test queue for completion of the irq enablement
353 * @aq: pointer to the AP queue
355 * Returns AP_POLL_IMMEDIATELY, AP_POLL_AFTER_TIMEROUT or 0.
357 static enum ap_wait ap_sm_setirq_wait(struct ap_queue *aq)
359 struct ap_queue_status status;
361 if (aq->queue_count > 0 && aq->reply)
362 /* Try to read a completed message and get the status */
363 status = ap_sm_recv(aq);
364 else
365 /* Get the status with TAPQ */
366 status = ap_tapq(aq->qid, NULL);
368 if (status.irq_enabled == 1) {
369 /* Irqs are now enabled */
370 aq->interrupt = AP_INTR_ENABLED;
371 aq->state = (aq->queue_count > 0) ?
372 AP_STATE_WORKING : AP_STATE_IDLE;
375 switch (status.response_code) {
376 case AP_RESPONSE_NORMAL:
377 if (aq->queue_count > 0)
378 return AP_WAIT_AGAIN;
379 /* fallthrough */
380 case AP_RESPONSE_NO_PENDING_REPLY:
381 return AP_WAIT_TIMEOUT;
382 default:
383 aq->state = AP_STATE_BORKED;
384 return AP_WAIT_NONE;
389 * AP state machine jump table
391 static ap_func_t *ap_jumptable[NR_AP_STATES][NR_AP_EVENTS] = {
392 [AP_STATE_RESET_START] = {
393 [AP_EVENT_POLL] = ap_sm_reset,
394 [AP_EVENT_TIMEOUT] = ap_sm_nop,
396 [AP_STATE_RESET_WAIT] = {
397 [AP_EVENT_POLL] = ap_sm_reset_wait,
398 [AP_EVENT_TIMEOUT] = ap_sm_nop,
400 [AP_STATE_SETIRQ_WAIT] = {
401 [AP_EVENT_POLL] = ap_sm_setirq_wait,
402 [AP_EVENT_TIMEOUT] = ap_sm_nop,
404 [AP_STATE_IDLE] = {
405 [AP_EVENT_POLL] = ap_sm_write,
406 [AP_EVENT_TIMEOUT] = ap_sm_nop,
408 [AP_STATE_WORKING] = {
409 [AP_EVENT_POLL] = ap_sm_read_write,
410 [AP_EVENT_TIMEOUT] = ap_sm_reset,
412 [AP_STATE_QUEUE_FULL] = {
413 [AP_EVENT_POLL] = ap_sm_read,
414 [AP_EVENT_TIMEOUT] = ap_sm_reset,
416 [AP_STATE_SUSPEND_WAIT] = {
417 [AP_EVENT_POLL] = ap_sm_suspend_read,
418 [AP_EVENT_TIMEOUT] = ap_sm_nop,
420 [AP_STATE_BORKED] = {
421 [AP_EVENT_POLL] = ap_sm_nop,
422 [AP_EVENT_TIMEOUT] = ap_sm_nop,
426 enum ap_wait ap_sm_event(struct ap_queue *aq, enum ap_event event)
428 return ap_jumptable[aq->state][event](aq);
431 enum ap_wait ap_sm_event_loop(struct ap_queue *aq, enum ap_event event)
433 enum ap_wait wait;
435 while ((wait = ap_sm_event(aq, event)) == AP_WAIT_AGAIN)
437 return wait;
441 * Power management for queue devices
443 void ap_queue_suspend(struct ap_device *ap_dev)
445 struct ap_queue *aq = to_ap_queue(&ap_dev->device);
447 /* Poll on the device until all requests are finished. */
448 spin_lock_bh(&aq->lock);
449 aq->state = AP_STATE_SUSPEND_WAIT;
450 while (ap_sm_event(aq, AP_EVENT_POLL) != AP_WAIT_NONE)
452 aq->state = AP_STATE_BORKED;
453 spin_unlock_bh(&aq->lock);
455 EXPORT_SYMBOL(ap_queue_suspend);
457 void ap_queue_resume(struct ap_device *ap_dev)
460 EXPORT_SYMBOL(ap_queue_resume);
463 * AP queue related attributes.
465 static ssize_t request_count_show(struct device *dev,
466 struct device_attribute *attr,
467 char *buf)
469 struct ap_queue *aq = to_ap_queue(dev);
470 unsigned int req_cnt;
472 spin_lock_bh(&aq->lock);
473 req_cnt = aq->total_request_count;
474 spin_unlock_bh(&aq->lock);
475 return snprintf(buf, PAGE_SIZE, "%d\n", req_cnt);
478 static ssize_t request_count_store(struct device *dev,
479 struct device_attribute *attr,
480 const char *buf, size_t count)
482 struct ap_queue *aq = to_ap_queue(dev);
484 spin_lock_bh(&aq->lock);
485 aq->total_request_count = 0;
486 spin_unlock_bh(&aq->lock);
488 return count;
491 static DEVICE_ATTR_RW(request_count);
493 static ssize_t requestq_count_show(struct device *dev,
494 struct device_attribute *attr, char *buf)
496 struct ap_queue *aq = to_ap_queue(dev);
497 unsigned int reqq_cnt = 0;
499 spin_lock_bh(&aq->lock);
500 reqq_cnt = aq->requestq_count;
501 spin_unlock_bh(&aq->lock);
502 return snprintf(buf, PAGE_SIZE, "%d\n", reqq_cnt);
505 static DEVICE_ATTR_RO(requestq_count);
507 static ssize_t pendingq_count_show(struct device *dev,
508 struct device_attribute *attr, char *buf)
510 struct ap_queue *aq = to_ap_queue(dev);
511 unsigned int penq_cnt = 0;
513 spin_lock_bh(&aq->lock);
514 penq_cnt = aq->pendingq_count;
515 spin_unlock_bh(&aq->lock);
516 return snprintf(buf, PAGE_SIZE, "%d\n", penq_cnt);
519 static DEVICE_ATTR_RO(pendingq_count);
521 static ssize_t reset_show(struct device *dev,
522 struct device_attribute *attr, char *buf)
524 struct ap_queue *aq = to_ap_queue(dev);
525 int rc = 0;
527 spin_lock_bh(&aq->lock);
528 switch (aq->state) {
529 case AP_STATE_RESET_START:
530 case AP_STATE_RESET_WAIT:
531 rc = snprintf(buf, PAGE_SIZE, "Reset in progress.\n");
532 break;
533 case AP_STATE_WORKING:
534 case AP_STATE_QUEUE_FULL:
535 rc = snprintf(buf, PAGE_SIZE, "Reset Timer armed.\n");
536 break;
537 default:
538 rc = snprintf(buf, PAGE_SIZE, "No Reset Timer set.\n");
540 spin_unlock_bh(&aq->lock);
541 return rc;
544 static DEVICE_ATTR_RO(reset);
546 static ssize_t interrupt_show(struct device *dev,
547 struct device_attribute *attr, char *buf)
549 struct ap_queue *aq = to_ap_queue(dev);
550 int rc = 0;
552 spin_lock_bh(&aq->lock);
553 if (aq->state == AP_STATE_SETIRQ_WAIT)
554 rc = snprintf(buf, PAGE_SIZE, "Enable Interrupt pending.\n");
555 else if (aq->interrupt == AP_INTR_ENABLED)
556 rc = snprintf(buf, PAGE_SIZE, "Interrupts enabled.\n");
557 else
558 rc = snprintf(buf, PAGE_SIZE, "Interrupts disabled.\n");
559 spin_unlock_bh(&aq->lock);
560 return rc;
563 static DEVICE_ATTR_RO(interrupt);
565 static struct attribute *ap_queue_dev_attrs[] = {
566 &dev_attr_request_count.attr,
567 &dev_attr_requestq_count.attr,
568 &dev_attr_pendingq_count.attr,
569 &dev_attr_reset.attr,
570 &dev_attr_interrupt.attr,
571 NULL
574 static struct attribute_group ap_queue_dev_attr_group = {
575 .attrs = ap_queue_dev_attrs
578 static const struct attribute_group *ap_queue_dev_attr_groups[] = {
579 &ap_queue_dev_attr_group,
580 NULL
583 static struct device_type ap_queue_type = {
584 .name = "ap_queue",
585 .groups = ap_queue_dev_attr_groups,
588 static void ap_queue_device_release(struct device *dev)
590 struct ap_queue *aq = to_ap_queue(dev);
592 if (!list_empty(&aq->list)) {
593 spin_lock_bh(&ap_list_lock);
594 list_del_init(&aq->list);
595 spin_unlock_bh(&ap_list_lock);
597 kfree(aq);
600 struct ap_queue *ap_queue_create(ap_qid_t qid, int device_type)
602 struct ap_queue *aq;
604 aq = kzalloc(sizeof(*aq), GFP_KERNEL);
605 if (!aq)
606 return NULL;
607 aq->ap_dev.device.release = ap_queue_device_release;
608 aq->ap_dev.device.type = &ap_queue_type;
609 aq->ap_dev.device_type = device_type;
610 aq->qid = qid;
611 aq->state = AP_STATE_RESET_START;
612 aq->interrupt = AP_INTR_DISABLED;
613 spin_lock_init(&aq->lock);
614 INIT_LIST_HEAD(&aq->list);
615 INIT_LIST_HEAD(&aq->pendingq);
616 INIT_LIST_HEAD(&aq->requestq);
617 timer_setup(&aq->timeout, ap_request_timeout, 0);
619 return aq;
622 void ap_queue_init_reply(struct ap_queue *aq, struct ap_message *reply)
624 aq->reply = reply;
626 spin_lock_bh(&aq->lock);
627 ap_wait(ap_sm_event(aq, AP_EVENT_POLL));
628 spin_unlock_bh(&aq->lock);
630 EXPORT_SYMBOL(ap_queue_init_reply);
633 * ap_queue_message(): Queue a request to an AP device.
634 * @aq: The AP device to queue the message to
635 * @ap_msg: The message that is to be added
637 void ap_queue_message(struct ap_queue *aq, struct ap_message *ap_msg)
639 /* For asynchronous message handling a valid receive-callback
640 * is required.
642 BUG_ON(!ap_msg->receive);
644 spin_lock_bh(&aq->lock);
645 /* Queue the message. */
646 list_add_tail(&ap_msg->list, &aq->requestq);
647 aq->requestq_count++;
648 aq->total_request_count++;
649 atomic_inc(&aq->card->total_request_count);
650 /* Send/receive as many request from the queue as possible. */
651 ap_wait(ap_sm_event_loop(aq, AP_EVENT_POLL));
652 spin_unlock_bh(&aq->lock);
654 EXPORT_SYMBOL(ap_queue_message);
657 * ap_cancel_message(): Cancel a crypto request.
658 * @aq: The AP device that has the message queued
659 * @ap_msg: The message that is to be removed
661 * Cancel a crypto request. This is done by removing the request
662 * from the device pending or request queue. Note that the
663 * request stays on the AP queue. When it finishes the message
664 * reply will be discarded because the psmid can't be found.
666 void ap_cancel_message(struct ap_queue *aq, struct ap_message *ap_msg)
668 struct ap_message *tmp;
670 spin_lock_bh(&aq->lock);
671 if (!list_empty(&ap_msg->list)) {
672 list_for_each_entry(tmp, &aq->pendingq, list)
673 if (tmp->psmid == ap_msg->psmid) {
674 aq->pendingq_count--;
675 goto found;
677 aq->requestq_count--;
678 found:
679 list_del_init(&ap_msg->list);
681 spin_unlock_bh(&aq->lock);
683 EXPORT_SYMBOL(ap_cancel_message);
686 * __ap_flush_queue(): Flush requests.
687 * @aq: Pointer to the AP queue
689 * Flush all requests from the request/pending queue of an AP device.
691 static void __ap_flush_queue(struct ap_queue *aq)
693 struct ap_message *ap_msg, *next;
695 list_for_each_entry_safe(ap_msg, next, &aq->pendingq, list) {
696 list_del_init(&ap_msg->list);
697 aq->pendingq_count--;
698 ap_msg->rc = -EAGAIN;
699 ap_msg->receive(aq, ap_msg, NULL);
701 list_for_each_entry_safe(ap_msg, next, &aq->requestq, list) {
702 list_del_init(&ap_msg->list);
703 aq->requestq_count--;
704 ap_msg->rc = -EAGAIN;
705 ap_msg->receive(aq, ap_msg, NULL);
709 void ap_flush_queue(struct ap_queue *aq)
711 spin_lock_bh(&aq->lock);
712 __ap_flush_queue(aq);
713 spin_unlock_bh(&aq->lock);
715 EXPORT_SYMBOL(ap_flush_queue);
717 void ap_queue_remove(struct ap_queue *aq)
719 ap_flush_queue(aq);
720 del_timer_sync(&aq->timeout);
722 EXPORT_SYMBOL(ap_queue_remove);