Lines Matching refs:xfer
159 struct scmi_xfer *xfer; in scmi_xfer_get() local
176 xfer = &minfo->xfer_block[xfer_id]; in scmi_xfer_get()
177 xfer->hdr.seq = xfer_id; in scmi_xfer_get()
178 reinit_completion(&xfer->done); in scmi_xfer_get()
179 xfer->transfer_id = atomic_inc_return(&transfer_last_id); in scmi_xfer_get()
181 return xfer; in scmi_xfer_get()
193 __scmi_xfer_put(struct scmi_xfers_info *minfo, struct scmi_xfer *xfer) in __scmi_xfer_put() argument
203 clear_bit(xfer->hdr.seq, minfo->xfer_alloc_table); in __scmi_xfer_put()
209 struct scmi_xfer *xfer; in scmi_handle_notification() local
216 xfer = scmi_xfer_get(cinfo->handle, minfo); in scmi_handle_notification()
217 if (IS_ERR(xfer)) { in scmi_handle_notification()
219 PTR_ERR(xfer)); in scmi_handle_notification()
224 unpack_scmi_header(msg_hdr, &xfer->hdr); in scmi_handle_notification()
225 scmi_dump_header_dbg(dev, &xfer->hdr); in scmi_handle_notification()
227 xfer); in scmi_handle_notification()
228 scmi_notify(cinfo->handle, xfer->hdr.protocol_id, in scmi_handle_notification()
229 xfer->hdr.id, xfer->rx.buf, xfer->rx.len, ts); in scmi_handle_notification()
231 trace_scmi_rx_done(xfer->transfer_id, xfer->hdr.id, in scmi_handle_notification()
232 xfer->hdr.protocol_id, xfer->hdr.seq, in scmi_handle_notification()
235 __scmi_xfer_put(minfo, xfer); in scmi_handle_notification()
243 struct scmi_xfer *xfer; in scmi_handle_response() local
255 xfer = &minfo->xfer_block[xfer_id]; in scmi_handle_response()
262 if (unlikely(msg_type == MSG_TYPE_DELAYED_RESP && !xfer->async_done)) { in scmi_handle_response()
268 __scmi_xfer_put(minfo, xfer); in scmi_handle_response()
274 xfer->rx.len = info->desc->max_msg_size; in scmi_handle_response()
276 scmi_dump_header_dbg(dev, &xfer->hdr); in scmi_handle_response()
278 info->desc->ops->fetch_response(cinfo, xfer); in scmi_handle_response()
280 trace_scmi_rx_done(xfer->transfer_id, xfer->hdr.id, in scmi_handle_response()
281 xfer->hdr.protocol_id, xfer->hdr.seq, in scmi_handle_response()
286 complete(xfer->async_done); in scmi_handle_response()
288 complete(&xfer->done); in scmi_handle_response()
329 void scmi_xfer_put(const struct scmi_handle *handle, struct scmi_xfer *xfer) in scmi_xfer_put() argument
333 __scmi_xfer_put(&info->tx_minfo, xfer); in scmi_xfer_put()
339 struct scmi_xfer *xfer, ktime_t stop) in scmi_xfer_done_no_timeout() argument
343 return info->desc->ops->poll_done(cinfo, xfer) || in scmi_xfer_done_no_timeout()
357 int scmi_do_xfer(const struct scmi_handle *handle, struct scmi_xfer *xfer) in scmi_do_xfer() argument
365 cinfo = idr_find(&info->tx_idr, xfer->hdr.protocol_id); in scmi_do_xfer()
369 trace_scmi_xfer_begin(xfer->transfer_id, xfer->hdr.id, in scmi_do_xfer()
370 xfer->hdr.protocol_id, xfer->hdr.seq, in scmi_do_xfer()
371 xfer->hdr.poll_completion); in scmi_do_xfer()
373 ret = info->desc->ops->send_message(cinfo, xfer); in scmi_do_xfer()
379 if (xfer->hdr.poll_completion) { in scmi_do_xfer()
382 spin_until_cond(scmi_xfer_done_no_timeout(cinfo, xfer, stop)); in scmi_do_xfer()
385 info->desc->ops->fetch_response(cinfo, xfer); in scmi_do_xfer()
391 if (!wait_for_completion_timeout(&xfer->done, timeout)) { in scmi_do_xfer()
398 if (!ret && xfer->hdr.status) in scmi_do_xfer()
399 ret = scmi_to_linux_errno(xfer->hdr.status); in scmi_do_xfer()
404 trace_scmi_xfer_end(xfer->transfer_id, xfer->hdr.id, in scmi_do_xfer()
405 xfer->hdr.protocol_id, xfer->hdr.seq, ret); in scmi_do_xfer()
411 struct scmi_xfer *xfer) in scmi_reset_rx_to_maxsz() argument
415 xfer->rx.len = info->desc->max_msg_size; in scmi_reset_rx_to_maxsz()
431 struct scmi_xfer *xfer) in scmi_do_xfer_with_response() argument
436 xfer->async_done = &async_response; in scmi_do_xfer_with_response()
438 ret = scmi_do_xfer(handle, xfer); in scmi_do_xfer_with_response()
440 if (!wait_for_completion_timeout(xfer->async_done, timeout)) in scmi_do_xfer_with_response()
442 else if (xfer->hdr.status) in scmi_do_xfer_with_response()
443 ret = scmi_to_linux_errno(xfer->hdr.status); in scmi_do_xfer_with_response()
446 xfer->async_done = NULL; in scmi_do_xfer_with_response()
470 struct scmi_xfer *xfer; in scmi_xfer_get_init() local
480 xfer = scmi_xfer_get(handle, minfo); in scmi_xfer_get_init()
481 if (IS_ERR(xfer)) { in scmi_xfer_get_init()
482 ret = PTR_ERR(xfer); in scmi_xfer_get_init()
487 xfer->tx.len = tx_size; in scmi_xfer_get_init()
488 xfer->rx.len = rx_size ? : info->desc->max_msg_size; in scmi_xfer_get_init()
489 xfer->hdr.id = msg_id; in scmi_xfer_get_init()
490 xfer->hdr.protocol_id = prot_id; in scmi_xfer_get_init()
491 xfer->hdr.poll_completion = false; in scmi_xfer_get_init()
493 *p = xfer; in scmi_xfer_get_init()
617 struct scmi_xfer *xfer; in __scmi_xfer_info_init() local
640 for (i = 0, xfer = info->xfer_block; i < desc->max_msg; i++, xfer++) { in __scmi_xfer_info_init()
641 xfer->rx.buf = devm_kcalloc(dev, sizeof(u8), desc->max_msg_size, in __scmi_xfer_info_init()
643 if (!xfer->rx.buf) in __scmi_xfer_info_init()
646 xfer->tx.buf = xfer->rx.buf; in __scmi_xfer_info_init()
647 init_completion(&xfer->done); in __scmi_xfer_info_init()