Lines Matching +full:x +full:- +full:rc

1 // SPDX-License-Identifier: GPL-2.0
27 return aq->card->hwinfo.ep11 || aq->card->hwinfo.accel; in ap_q_supported_in_se()
32 return aq->card->hwinfo.ep11 || aq->card->hwinfo.accel; in ap_q_supports_bind()
37 return aq->card->hwinfo.ep11; in ap_q_supports_assoc()
61 status = ap_aqic(aq->qid, qirqctrl, virt_to_phys(ind)); in ap_queue_enable_irq()
63 return -EPERM; in ap_queue_enable_irq()
72 pr_err("Registering adapter interrupts for AP device %02x.%04x failed\n", in ap_queue_enable_irq()
73 AP_QID_CARD(aq->qid), in ap_queue_enable_irq()
74 AP_QID_QUEUE(aq->qid)); in ap_queue_enable_irq()
75 return -EOPNOTSUPP; in ap_queue_enable_irq()
79 return -EBUSY; in ap_queue_enable_irq()
132 * and the receiver of the msg is informed with a msg rc code in ap_sm_recv()
136 status = ap_dqap(aq->qid, &aq->reply->psmid, in ap_sm_recv()
137 aq->reply->msg, aq->reply->bufsize, in ap_sm_recv()
138 &aq->reply->len, &reslen, &resgr0); in ap_sm_recv()
145 aq->reply->msg, aq->reply->len, false); in ap_sm_recv()
146 aq->queue_count = max_t(int, 0, aq->queue_count - 1); in ap_sm_recv()
147 if (!status.queue_empty && !aq->queue_count) in ap_sm_recv()
148 aq->queue_count++; in ap_sm_recv()
149 if (aq->queue_count > 0) in ap_sm_recv()
150 mod_timer(&aq->timeout, in ap_sm_recv()
151 jiffies + aq->request_timeout); in ap_sm_recv()
152 list_for_each_entry(ap_msg, &aq->pendingq, list) { in ap_sm_recv()
153 if (ap_msg->psmid != aq->reply->psmid) in ap_sm_recv()
155 list_del_init(&ap_msg->list); in ap_sm_recv()
156 aq->pendingq_count--; in ap_sm_recv()
158 ap_msg->rc = -EMSGSIZE; in ap_sm_recv()
159 ap_msg->receive(aq, ap_msg, NULL); in ap_sm_recv()
161 ap_msg->receive(aq, ap_msg, aq->reply); in ap_sm_recv()
167 AP_DBF_WARN("%s unassociated reply psmid=0x%016lx on 0x%02x.%04x\n", in ap_sm_recv()
168 __func__, aq->reply->psmid, in ap_sm_recv()
169 AP_QID_CARD(aq->qid), AP_QID_QUEUE(aq->qid)); in ap_sm_recv()
173 if (!status.queue_empty || aq->queue_count <= 0) in ap_sm_recv()
176 aq->queue_count = 0; in ap_sm_recv()
177 list_splice_init(&aq->pendingq, &aq->requestq); in ap_sm_recv()
178 aq->requestq_count += aq->pendingq_count; in ap_sm_recv()
179 pr_debug("queue 0x%02x.%04x rescheduled %d reqs (new req %d)\n", in ap_sm_recv()
180 AP_QID_CARD(aq->qid), AP_QID_QUEUE(aq->qid), in ap_sm_recv()
181 aq->pendingq_count, aq->requestq_count); in ap_sm_recv()
182 aq->pendingq_count = 0; in ap_sm_recv()
200 if (!aq->reply) in ap_sm_read()
207 if (aq->queue_count > 0) { in ap_sm_read()
208 aq->sm_state = AP_SM_STATE_WORKING; in ap_sm_read()
211 aq->sm_state = AP_SM_STATE_IDLE; in ap_sm_read()
214 if (aq->queue_count > 0) in ap_sm_read()
217 aq->sm_state = AP_SM_STATE_IDLE; in ap_sm_read()
220 aq->dev_state = AP_DEV_STATE_ERROR; in ap_sm_read()
221 aq->last_err_rc = status.response_code; in ap_sm_read()
222 AP_DBF_WARN("%s RC 0x%02x on 0x%02x.%04x -> AP_DEV_STATE_ERROR\n", in ap_sm_read()
224 AP_QID_CARD(aq->qid), AP_QID_QUEUE(aq->qid)); in ap_sm_read()
232 aq->sm_state = AP_SM_STATE_SETIRQ_WAIT; in ap_sm_read()
249 ap_qid_t qid = aq->qid; in ap_sm_write()
251 if (aq->requestq_count <= 0) in ap_sm_write()
255 ap_msg = list_entry(aq->requestq.next, struct ap_message, list); in ap_sm_write()
257 ap_msg->msg, ap_msg->len, false); in ap_sm_write()
258 status = __ap_send(qid, ap_msg->psmid, in ap_sm_write()
259 ap_msg->msg, ap_msg->len, in ap_sm_write()
260 ap_msg->flags & AP_MSG_FLAG_SPECIAL); in ap_sm_write()
265 aq->queue_count = max_t(int, 1, aq->queue_count + 1); in ap_sm_write()
266 if (aq->queue_count == 1) in ap_sm_write()
267 mod_timer(&aq->timeout, jiffies + aq->request_timeout); in ap_sm_write()
268 list_move_tail(&ap_msg->list, &aq->pendingq); in ap_sm_write()
269 aq->requestq_count--; in ap_sm_write()
270 aq->pendingq_count++; in ap_sm_write()
271 if (aq->queue_count < aq->card->hwinfo.qd) { in ap_sm_write()
272 aq->sm_state = AP_SM_STATE_WORKING; in ap_sm_write()
277 aq->sm_state = AP_SM_STATE_QUEUE_FULL; in ap_sm_write()
281 aq->sm_state = AP_SM_STATE_RESET_WAIT; in ap_sm_write()
288 list_del_init(&ap_msg->list); in ap_sm_write()
289 aq->requestq_count--; in ap_sm_write()
290 ap_msg->rc = -EINVAL; in ap_sm_write()
291 ap_msg->receive(aq, ap_msg, NULL); in ap_sm_write()
294 aq->dev_state = AP_DEV_STATE_ERROR; in ap_sm_write()
295 aq->last_err_rc = status.response_code; in ap_sm_write()
296 AP_DBF_WARN("%s RC 0x%02x on 0x%02x.%04x -> AP_DEV_STATE_ERROR\n", in ap_sm_write()
298 AP_QID_CARD(aq->qid), AP_QID_QUEUE(aq->qid)); in ap_sm_write()
324 status = ap_rapq(aq->qid, aq->rapq_fbit); in ap_sm_reset()
330 aq->sm_state = AP_SM_STATE_RESET_WAIT; in ap_sm_reset()
331 aq->rapq_fbit = 0; in ap_sm_reset()
334 aq->dev_state = AP_DEV_STATE_ERROR; in ap_sm_reset()
335 aq->last_err_rc = status.response_code; in ap_sm_reset()
336 AP_DBF_WARN("%s RC 0x%02x on 0x%02x.%04x -> AP_DEV_STATE_ERROR\n", in ap_sm_reset()
338 AP_QID_CARD(aq->qid), AP_QID_QUEUE(aq->qid)); in ap_sm_reset()
356 status = ap_test_queue(aq->qid, 1, &hwinfo); in ap_sm_reset_wait()
360 aq->se_bstate = hwinfo.bs; in ap_sm_reset_wait()
363 aq->sm_state = AP_SM_STATE_SETIRQ_WAIT; in ap_sm_reset_wait()
365 aq->sm_state = (aq->queue_count > 0) ? in ap_sm_reset_wait()
375 aq->dev_state = AP_DEV_STATE_ERROR; in ap_sm_reset_wait()
376 aq->last_err_rc = status.response_code; in ap_sm_reset_wait()
377 AP_DBF_WARN("%s RC 0x%02x on 0x%02x.%04x -> AP_DEV_STATE_ERROR\n", in ap_sm_reset_wait()
379 AP_QID_CARD(aq->qid), AP_QID_QUEUE(aq->qid)); in ap_sm_reset_wait()
394 if (aq->queue_count > 0 && aq->reply) in ap_sm_setirq_wait()
399 status = ap_tapq(aq->qid, NULL); in ap_sm_setirq_wait()
403 aq->sm_state = (aq->queue_count > 0) ? in ap_sm_setirq_wait()
409 if (aq->queue_count > 0) in ap_sm_setirq_wait()
415 aq->dev_state = AP_DEV_STATE_ERROR; in ap_sm_setirq_wait()
416 aq->last_err_rc = status.response_code; in ap_sm_setirq_wait()
417 AP_DBF_WARN("%s RC 0x%02x on 0x%02x.%04x -> AP_DEV_STATE_ERROR\n", in ap_sm_setirq_wait()
419 AP_QID_CARD(aq->qid), AP_QID_QUEUE(aq->qid)); in ap_sm_setirq_wait()
434 status = ap_test_queue(aq->qid, 1, &hwinfo); in ap_sm_assoc_wait()
437 aq->dev_state = AP_DEV_STATE_ERROR; in ap_sm_assoc_wait()
438 aq->last_err_rc = status.response_code; in ap_sm_assoc_wait()
439 AP_DBF_WARN("%s asynch RC 0x%02x on 0x%02x.%04x -> AP_DEV_STATE_ERROR\n", in ap_sm_assoc_wait()
441 AP_QID_CARD(aq->qid), AP_QID_QUEUE(aq->qid)); in ap_sm_assoc_wait()
445 aq->dev_state = AP_DEV_STATE_ERROR; in ap_sm_assoc_wait()
446 aq->last_err_rc = status.response_code; in ap_sm_assoc_wait()
447 AP_DBF_WARN("%s RC 0x%02x on 0x%02x.%04x -> AP_DEV_STATE_ERROR\n", in ap_sm_assoc_wait()
449 AP_QID_CARD(aq->qid), AP_QID_QUEUE(aq->qid)); in ap_sm_assoc_wait()
454 aq->se_bstate = hwinfo.bs; in ap_sm_assoc_wait()
460 aq->sm_state = AP_SM_STATE_IDLE; in ap_sm_assoc_wait()
461 pr_debug("queue 0x%02x.%04x associated with %u\n", in ap_sm_assoc_wait()
462 AP_QID_CARD(aq->qid), in ap_sm_assoc_wait()
463 AP_QID_QUEUE(aq->qid), aq->assoc_idx); in ap_sm_assoc_wait()
470 aq->assoc_idx = ASSOC_IDX_INVALID; in ap_sm_assoc_wait()
471 aq->dev_state = AP_DEV_STATE_ERROR; in ap_sm_assoc_wait()
472 aq->last_err_rc = status.response_code; in ap_sm_assoc_wait()
473 AP_DBF_WARN("%s bs 0x%02x on 0x%02x.%04x -> AP_DEV_STATE_ERROR\n", in ap_sm_assoc_wait()
475 AP_QID_CARD(aq->qid), AP_QID_QUEUE(aq->qid)); in ap_sm_assoc_wait()
516 if (aq->config && !aq->chkstop && in ap_sm_event()
517 aq->dev_state > AP_DEV_STATE_UNINITIATED) in ap_sm_event()
518 return ap_jumptable[aq->sm_state][event](aq); in ap_sm_event()
543 spin_lock_bh(&aq->lock); in request_count_show()
544 if (aq->dev_state > AP_DEV_STATE_UNINITIATED) { in request_count_show()
545 req_cnt = aq->total_request_count; in request_count_show()
548 spin_unlock_bh(&aq->lock); in request_count_show()
553 return sysfs_emit(buf, "-\n"); in request_count_show()
562 spin_lock_bh(&aq->lock); in request_count_store()
563 aq->total_request_count = 0; in request_count_store()
564 spin_unlock_bh(&aq->lock); in request_count_store()
577 spin_lock_bh(&aq->lock); in requestq_count_show()
578 if (aq->dev_state > AP_DEV_STATE_UNINITIATED) in requestq_count_show()
579 reqq_cnt = aq->requestq_count; in requestq_count_show()
580 spin_unlock_bh(&aq->lock); in requestq_count_show()
592 spin_lock_bh(&aq->lock); in pendingq_count_show()
593 if (aq->dev_state > AP_DEV_STATE_UNINITIATED) in pendingq_count_show()
594 penq_cnt = aq->pendingq_count; in pendingq_count_show()
595 spin_unlock_bh(&aq->lock); in pendingq_count_show()
605 int rc = 0; in reset_show() local
607 spin_lock_bh(&aq->lock); in reset_show()
608 switch (aq->sm_state) { in reset_show()
611 rc = sysfs_emit(buf, "Reset in progress.\n"); in reset_show()
615 rc = sysfs_emit(buf, "Reset Timer armed.\n"); in reset_show()
618 rc = sysfs_emit(buf, "No Reset Timer set.\n"); in reset_show()
620 spin_unlock_bh(&aq->lock); in reset_show()
621 return rc; in reset_show()
630 spin_lock_bh(&aq->lock); in reset_store()
632 aq->sm_state = AP_SM_STATE_RESET_START; in reset_store()
634 spin_unlock_bh(&aq->lock); in reset_store()
636 AP_DBF_INFO("%s reset queue=%02x.%04x triggered by user\n", in reset_store()
637 __func__, AP_QID_CARD(aq->qid), AP_QID_QUEUE(aq->qid)); in reset_store()
649 int rc = 0; in interrupt_show() local
651 spin_lock_bh(&aq->lock); in interrupt_show()
652 if (aq->sm_state == AP_SM_STATE_SETIRQ_WAIT) { in interrupt_show()
653 rc = sysfs_emit(buf, "Enable Interrupt pending.\n"); in interrupt_show()
655 status = ap_tapq(aq->qid, NULL); in interrupt_show()
657 rc = sysfs_emit(buf, "Interrupts enabled.\n"); in interrupt_show()
659 rc = sysfs_emit(buf, "Interrupts disabled.\n"); in interrupt_show()
661 spin_unlock_bh(&aq->lock); in interrupt_show()
663 return rc; in interrupt_show()
672 int rc; in config_show() local
674 spin_lock_bh(&aq->lock); in config_show()
675 rc = sysfs_emit(buf, "%d\n", aq->config ? 1 : 0); in config_show()
676 spin_unlock_bh(&aq->lock); in config_show()
677 return rc; in config_show()
686 int rc; in chkstop_show() local
688 spin_lock_bh(&aq->lock); in chkstop_show()
689 rc = sysfs_emit(buf, "%d\n", aq->chkstop ? 1 : 0); in chkstop_show()
690 spin_unlock_bh(&aq->lock); in chkstop_show()
691 return rc; in chkstop_show()
703 status = ap_test_queue(aq->qid, 1, &hwinfo); in ap_functions_show()
705 pr_debug("RC 0x%02x on tapq(0x%02x.%04x)\n", in ap_functions_show()
707 AP_QID_CARD(aq->qid), AP_QID_QUEUE(aq->qid)); in ap_functions_show()
708 return -EIO; in ap_functions_show()
711 return sysfs_emit(buf, "0x%08X\n", hwinfo.fac); in ap_functions_show()
721 int rc = 0; in states_show() local
723 spin_lock_bh(&aq->lock); in states_show()
725 switch (aq->dev_state) { in states_show()
727 rc = sysfs_emit(buf, "UNINITIATED\n"); in states_show()
730 rc = sysfs_emit(buf, "OPERATING"); in states_show()
733 rc = sysfs_emit(buf, "SHUTDOWN"); in states_show()
736 rc = sysfs_emit(buf, "ERROR"); in states_show()
739 rc = sysfs_emit(buf, "UNKNOWN"); in states_show()
742 if (aq->dev_state) { in states_show()
743 switch (aq->sm_state) { in states_show()
745 rc += sysfs_emit_at(buf, rc, " [RESET_START]\n"); in states_show()
748 rc += sysfs_emit_at(buf, rc, " [RESET_WAIT]\n"); in states_show()
751 rc += sysfs_emit_at(buf, rc, " [SETIRQ_WAIT]\n"); in states_show()
754 rc += sysfs_emit_at(buf, rc, " [IDLE]\n"); in states_show()
757 rc += sysfs_emit_at(buf, rc, " [WORKING]\n"); in states_show()
760 rc += sysfs_emit_at(buf, rc, " [FULL]\n"); in states_show()
763 rc += sysfs_emit_at(buf, rc, " [ASSOC_WAIT]\n"); in states_show()
766 rc += sysfs_emit_at(buf, rc, " [UNKNOWN]\n"); in states_show()
769 spin_unlock_bh(&aq->lock); in states_show()
771 return rc; in states_show()
779 int rc; in last_err_rc_show() local
781 spin_lock_bh(&aq->lock); in last_err_rc_show()
782 rc = aq->last_err_rc; in last_err_rc_show()
783 spin_unlock_bh(&aq->lock); in last_err_rc_show()
785 switch (rc) { in last_err_rc_show()
813 return sysfs_emit(buf, "response code %d\n", rc); in last_err_rc_show()
857 return sysfs_emit(buf, "-\n"); in se_bind_show()
859 status = ap_test_queue(aq->qid, 1, &hwinfo); in se_bind_show()
861 pr_debug("RC 0x%02x on tapq(0x%02x.%04x)\n", in se_bind_show()
863 AP_QID_CARD(aq->qid), AP_QID_QUEUE(aq->qid)); in se_bind_show()
864 return -EIO; in se_bind_show()
868 spin_lock_bh(&aq->lock); in se_bind_show()
869 aq->se_bstate = hwinfo.bs; in se_bind_show()
870 spin_unlock_bh(&aq->lock); in se_bind_show()
889 int rc; in se_bind_store() local
892 return -EINVAL; in se_bind_store()
895 rc = kstrtobool(buf, &value); in se_bind_store()
896 if (rc) in se_bind_store()
897 return rc; in se_bind_store()
901 spin_lock_bh(&aq->lock); in se_bind_store()
903 aq->rapq_fbit = 1; in se_bind_store()
905 rc = count; in se_bind_store()
910 status = ap_test_queue(aq->qid, 1, &hwinfo); in se_bind_store()
912 AP_DBF_WARN("%s RC 0x%02x on tapq(0x%02x.%04x)\n", in se_bind_store()
914 AP_QID_CARD(aq->qid), AP_QID_QUEUE(aq->qid)); in se_bind_store()
915 return -EIO; in se_bind_store()
919 spin_lock_bh(&aq->lock); in se_bind_store()
920 aq->se_bstate = hwinfo.bs; in se_bind_store()
922 AP_DBF_WARN("%s bind attempt with bs %d on queue 0x%02x.%04x\n", in se_bind_store()
924 AP_QID_CARD(aq->qid), AP_QID_QUEUE(aq->qid)); in se_bind_store()
925 rc = -EINVAL; in se_bind_store()
930 if (aq->sm_state < AP_SM_STATE_IDLE) { in se_bind_store()
931 rc = -EBUSY; in se_bind_store()
936 status = ap_bapq(aq->qid); in se_bind_store()
938 AP_DBF_WARN("%s RC 0x%02x on bapq(0x%02x.%04x)\n", in se_bind_store()
940 AP_QID_CARD(aq->qid), AP_QID_QUEUE(aq->qid)); in se_bind_store()
941 rc = -EIO; in se_bind_store()
944 aq->assoc_idx = ASSOC_IDX_INVALID; in se_bind_store()
947 status = ap_test_queue(aq->qid, 1, &hwinfo); in se_bind_store()
949 AP_DBF_WARN("%s RC 0x%02x on tapq(0x%02x.%04x)\n", in se_bind_store()
951 AP_QID_CARD(aq->qid), AP_QID_QUEUE(aq->qid)); in se_bind_store()
952 rc = -EIO; in se_bind_store()
955 aq->se_bstate = hwinfo.bs; in se_bind_store()
958 AP_DBF_WARN("%s BAPQ success, but bs shows %d on queue 0x%02x.%04x\n", in se_bind_store()
960 AP_QID_CARD(aq->qid), AP_QID_QUEUE(aq->qid)); in se_bind_store()
961 rc = -EIO; in se_bind_store()
966 AP_DBF_INFO("%s bapq(0x%02x.%04x) success\n", __func__, in se_bind_store()
967 AP_QID_CARD(aq->qid), AP_QID_QUEUE(aq->qid)); in se_bind_store()
968 rc = count; in se_bind_store()
971 spin_unlock_bh(&aq->lock); in se_bind_store()
972 return rc; in se_bind_store()
985 return sysfs_emit(buf, "-\n"); in se_associate_show()
987 status = ap_test_queue(aq->qid, 1, &hwinfo); in se_associate_show()
989 pr_debug("RC 0x%02x on tapq(0x%02x.%04x)\n", in se_associate_show()
991 AP_QID_CARD(aq->qid), AP_QID_QUEUE(aq->qid)); in se_associate_show()
992 return -EIO; in se_associate_show()
996 spin_lock_bh(&aq->lock); in se_associate_show()
997 aq->se_bstate = hwinfo.bs; in se_associate_show()
998 spin_unlock_bh(&aq->lock); in se_associate_show()
1002 if (aq->assoc_idx == ASSOC_IDX_INVALID) { in se_associate_show()
1004 return -EIO; in se_associate_show()
1006 return sysfs_emit(buf, "associated %u\n", aq->assoc_idx); in se_associate_show()
1008 if (aq->assoc_idx != ASSOC_IDX_INVALID) in se_associate_show()
1024 int rc; in se_associate_store() local
1027 return -EINVAL; in se_associate_store()
1030 rc = kstrtouint(buf, 0, &value); in se_associate_store()
1031 if (rc) in se_associate_store()
1032 return rc; in se_associate_store()
1034 return -EINVAL; in se_associate_store()
1037 status = ap_test_queue(aq->qid, 1, &hwinfo); in se_associate_store()
1039 AP_DBF_WARN("%s RC 0x%02x on tapq(0x%02x.%04x)\n", in se_associate_store()
1041 AP_QID_CARD(aq->qid), AP_QID_QUEUE(aq->qid)); in se_associate_store()
1042 return -EIO; in se_associate_store()
1044 spin_lock_bh(&aq->lock); in se_associate_store()
1045 aq->se_bstate = hwinfo.bs; in se_associate_store()
1047 AP_DBF_WARN("%s association attempt with bs %d on queue 0x%02x.%04x\n", in se_associate_store()
1049 AP_QID_CARD(aq->qid), AP_QID_QUEUE(aq->qid)); in se_associate_store()
1050 rc = -EINVAL; in se_associate_store()
1055 if (aq->sm_state != AP_SM_STATE_IDLE) { in se_associate_store()
1056 rc = -EBUSY; in se_associate_store()
1061 status = ap_aapq(aq->qid, value); in se_associate_store()
1065 aq->sm_state = AP_SM_STATE_ASSOC_WAIT; in se_associate_store()
1066 aq->assoc_idx = value; in se_associate_store()
1070 AP_DBF_WARN("%s RC 0x%02x on aapq(0x%02x.%04x)\n", in se_associate_store()
1072 AP_QID_CARD(aq->qid), AP_QID_QUEUE(aq->qid)); in se_associate_store()
1073 rc = -EIO; in se_associate_store()
1077 rc = count; in se_associate_store()
1080 spin_unlock_bh(&aq->lock); in se_associate_store()
1081 return rc; in se_associate_store()
1106 hash_del(&aq->hnode); in ap_queue_device_release()
1119 aq->card = ac; in ap_queue_create()
1120 aq->ap_dev.device.release = ap_queue_device_release; in ap_queue_create()
1121 aq->ap_dev.device.type = &ap_queue_type; in ap_queue_create()
1122 aq->ap_dev.device_type = ac->ap_dev.device_type; in ap_queue_create()
1125 aq->ap_dev.device.groups = ap_queue_dev_sb_attr_groups; in ap_queue_create()
1126 aq->qid = qid; in ap_queue_create()
1127 spin_lock_init(&aq->lock); in ap_queue_create()
1128 INIT_LIST_HEAD(&aq->pendingq); in ap_queue_create()
1129 INIT_LIST_HEAD(&aq->requestq); in ap_queue_create()
1130 timer_setup(&aq->timeout, ap_request_timeout, 0); in ap_queue_create()
1137 aq->reply = reply; in ap_queue_init_reply()
1139 spin_lock_bh(&aq->lock); in ap_queue_init_reply()
1141 spin_unlock_bh(&aq->lock); in ap_queue_init_reply()
1152 int rc = 0; in ap_queue_message() local
1154 /* msg needs to have a valid receive-callback */ in ap_queue_message()
1155 BUG_ON(!ap_msg->receive); in ap_queue_message()
1157 spin_lock_bh(&aq->lock); in ap_queue_message()
1160 if (aq->dev_state == AP_DEV_STATE_OPERATING) { in ap_queue_message()
1161 list_add_tail(&ap_msg->list, &aq->requestq); in ap_queue_message()
1162 aq->requestq_count++; in ap_queue_message()
1163 aq->total_request_count++; in ap_queue_message()
1164 atomic64_inc(&aq->card->total_request_count); in ap_queue_message()
1166 rc = -ENODEV; in ap_queue_message()
1172 spin_unlock_bh(&aq->lock); in ap_queue_message()
1174 return rc; in ap_queue_message()
1183 * ap_queue_message(). The perspective is very short-term as the
1188 bool rc = true; in ap_queue_usable() local
1190 spin_lock_bh(&aq->lock); in ap_queue_usable()
1193 if (!aq->config || aq->chkstop) { in ap_queue_usable()
1194 rc = false; in ap_queue_usable()
1199 if (aq->dev_state != AP_DEV_STATE_OPERATING) { in ap_queue_usable()
1200 rc = false; in ap_queue_usable()
1207 rc = false; in ap_queue_usable()
1211 !(aq->se_bstate == AP_BS_Q_USABLE || in ap_queue_usable()
1212 aq->se_bstate == AP_BS_Q_USABLE_NO_SECURE_KEY)) in ap_queue_usable()
1213 rc = false; in ap_queue_usable()
1217 spin_unlock_bh(&aq->lock); in ap_queue_usable()
1218 return rc; in ap_queue_usable()
1236 spin_lock_bh(&aq->lock); in ap_cancel_message()
1237 if (!list_empty(&ap_msg->list)) { in ap_cancel_message()
1238 list_for_each_entry(tmp, &aq->pendingq, list) in ap_cancel_message()
1239 if (tmp->psmid == ap_msg->psmid) { in ap_cancel_message()
1240 aq->pendingq_count--; in ap_cancel_message()
1243 aq->requestq_count--; in ap_cancel_message()
1245 list_del_init(&ap_msg->list); in ap_cancel_message()
1247 spin_unlock_bh(&aq->lock); in ap_cancel_message()
1261 list_for_each_entry_safe(ap_msg, next, &aq->pendingq, list) { in __ap_flush_queue()
1262 list_del_init(&ap_msg->list); in __ap_flush_queue()
1263 aq->pendingq_count--; in __ap_flush_queue()
1264 ap_msg->rc = -EAGAIN; in __ap_flush_queue()
1265 ap_msg->receive(aq, ap_msg, NULL); in __ap_flush_queue()
1267 list_for_each_entry_safe(ap_msg, next, &aq->requestq, list) { in __ap_flush_queue()
1268 list_del_init(&ap_msg->list); in __ap_flush_queue()
1269 aq->requestq_count--; in __ap_flush_queue()
1270 ap_msg->rc = -EAGAIN; in __ap_flush_queue()
1271 ap_msg->receive(aq, ap_msg, NULL); in __ap_flush_queue()
1273 aq->queue_count = 0; in __ap_flush_queue()
1278 spin_lock_bh(&aq->lock); in ap_flush_queue()
1280 spin_unlock_bh(&aq->lock); in ap_flush_queue()
1286 spin_lock_bh(&aq->lock); in ap_queue_prepare_remove()
1290 aq->dev_state = AP_DEV_STATE_SHUTDOWN; in ap_queue_prepare_remove()
1291 spin_unlock_bh(&aq->lock); in ap_queue_prepare_remove()
1292 timer_delete_sync(&aq->timeout); in ap_queue_prepare_remove()
1303 spin_lock_bh(&aq->lock); in ap_queue_remove()
1304 ap_zapq(aq->qid, 0); in ap_queue_remove()
1305 aq->dev_state = AP_DEV_STATE_UNINITIATED; in ap_queue_remove()
1306 spin_unlock_bh(&aq->lock); in ap_queue_remove()
1311 aq->dev_state = AP_DEV_STATE_OPERATING; in _ap_queue_init_state()
1312 aq->sm_state = AP_SM_STATE_RESET_START; in _ap_queue_init_state()
1313 aq->last_err_rc = 0; in _ap_queue_init_state()
1314 aq->assoc_idx = ASSOC_IDX_INVALID; in _ap_queue_init_state()
1320 spin_lock_bh(&aq->lock); in ap_queue_init_state()
1322 spin_unlock_bh(&aq->lock); in ap_queue_init_state()