Lines Matching +full:wait +full:- +full:state

1 // SPDX-License-Identifier: GPL-2.0-only
3 * Function Control Protocol (IEC 61883-1) helper functions
10 #include <linux/firewire-constants.h>
16 #include <linux/wait.h>
20 #include "amdtp-stream.h"
45 return -EINVAL;
49 return -ENOMEM;
59 buf[5] = 0x07 & sfc; /* FDF-hi. AM824, frequency */
60 buf[6] = 0xff; /* FDF-mid. AM824, SYT hi (not used)*/
61 buf[7] = 0xff; /* FDF-low. AM824, SYT lo (not used) */
63 /* do transaction and check buf[1-5] are the same against command */
69 err = -EIO;
71 err = -ENOSYS;
73 err = -EINVAL;
94 return -ENOMEM;
104 buf[5] = 0xff; /* FDF-hi. AM824, frequency */
105 buf[6] = 0xff; /* FDF-mid. AM824, SYT hi (not used) */
106 buf[7] = 0xff; /* FDF-low. AM824, SYT lo (not used) */
108 /* do transaction and check buf[1-4] are the same against command */
114 err = -EIO;
116 err = -ENOSYS;
118 err = -EINVAL;
120 err = -EAGAIN;
127 err = -EAGAIN; /* also in transition */
148 return -EINVAL;
152 return -ENOMEM;
164 err = -EIO;
166 err = -ENOSYS;
168 err = -EINVAL;
170 err = -EAGAIN;
202 enum fcp_state state;
203 wait_queue_head_t wait;
208 * fcp_avc_transaction - send an AV/C command and wait for its response
210 * @command: a buffer containing the command frame; must be DMA-able
241 t.state = STATE_PENDING;
242 init_waitqueue_head(&t.wait);
258 wait_event_timeout(t.wait, t.state != STATE_PENDING,
261 if (t.state == STATE_DEFERRED) {
269 t.state = STATE_PENDING;
271 } else if (t.state == STATE_COMPLETE) {
274 } else if (t.state == STATE_BUS_RESET) {
277 dev_err(&t.unit->device, "FCP command timed out\n");
278 ret = -EIO;
292 * fcp_bus_reset - inform the target handler about a bus reset
305 if (t->unit == unit &&
306 (t->state == STATE_PENDING ||
307 t->state == STATE_DEFERRED)) {
308 t->state = STATE_BUS_RESET;
309 wake_up(&t->wait);
323 p2 = transaction->response_buffer;
324 mask = transaction->response_match_bytes;
332 if (--length == 0)
349 struct fw_device *device = fw_parent_device(t->unit);
350 if (device->card != card ||
351 device->generation != generation)
354 if (device->node_id != source)
357 if (t->state == STATE_PENDING &&
359 if (t->deferrable && *(const u8 *)data == 0x0f) {
360 t->state = STATE_DEFERRED;
362 t->state = STATE_COMPLETE;
363 t->response_size = min_t(unsigned int, length,
364 t->response_size);
365 memcpy(t->response_buffer, data,
366 t->response_size);
368 wake_up(&t->wait);