Lines Matching refs:rb
261 struct scmi_raw_buffer *rb = NULL; in scmi_raw_buffer_get() local
266 rb = list_first_entry(head, struct scmi_raw_buffer, node); in scmi_raw_buffer_get()
267 list_del_init(&rb->node); in scmi_raw_buffer_get()
271 return rb; in scmi_raw_buffer_get()
275 struct scmi_raw_buffer *rb) in scmi_raw_buffer_put() argument
280 rb->msg.len = rb->max_len; in scmi_raw_buffer_put()
283 list_add_tail(&rb->node, &q->free_bufs); in scmi_raw_buffer_put()
288 struct scmi_raw_buffer *rb) in scmi_raw_buffer_enqueue() argument
293 list_add_tail(&rb->node, &q->msg_q); in scmi_raw_buffer_enqueue()
302 struct scmi_raw_buffer *rb = NULL; in scmi_raw_buffer_dequeue_unlocked() local
305 rb = list_first_entry(&q->msg_q, struct scmi_raw_buffer, node); in scmi_raw_buffer_dequeue_unlocked()
306 list_del_init(&rb->node); in scmi_raw_buffer_dequeue_unlocked()
309 return rb; in scmi_raw_buffer_dequeue_unlocked()
315 struct scmi_raw_buffer *rb; in scmi_raw_buffer_dequeue() local
318 rb = scmi_raw_buffer_dequeue_unlocked(q); in scmi_raw_buffer_dequeue()
321 return rb; in scmi_raw_buffer_dequeue()
326 struct scmi_raw_buffer *rb; in scmi_raw_buffer_queue_flush() local
329 rb = scmi_raw_buffer_dequeue(q); in scmi_raw_buffer_queue_flush()
330 if (rb) in scmi_raw_buffer_queue_flush()
331 scmi_raw_buffer_put(q, rb); in scmi_raw_buffer_queue_flush()
332 } while (rb); in scmi_raw_buffer_queue_flush()
698 struct scmi_raw_buffer *rb; in scmi_raw_message_dequeue() local
713 rb = scmi_raw_buffer_dequeue_unlocked(q); in scmi_raw_message_dequeue()
717 return rb; in scmi_raw_message_dequeue()
741 struct scmi_raw_buffer *rb; in scmi_raw_message_receive() local
748 rb = scmi_raw_message_dequeue(q, o_nonblock); in scmi_raw_message_receive()
749 if (IS_ERR(rb)) { in scmi_raw_message_receive()
751 return PTR_ERR(rb); in scmi_raw_message_receive()
754 if (rb->msg.len <= len) { in scmi_raw_message_receive()
755 memcpy(buf, rb->msg.buf, rb->msg.len); in scmi_raw_message_receive()
756 *size = rb->msg.len; in scmi_raw_message_receive()
761 scmi_raw_buffer_put(q, rb); in scmi_raw_message_receive()
1031 struct scmi_raw_buffer *rb; in scmi_raw_queue_init() local
1039 rb = devm_kcalloc(dev, raw->tx_max_msg, sizeof(*rb), GFP_KERNEL); in scmi_raw_queue_init()
1040 if (!rb) in scmi_raw_queue_init()
1045 for (i = 0; i < raw->tx_max_msg; i++, rb++) { in scmi_raw_queue_init()
1046 rb->max_len = raw->desc->max_msg_size + sizeof(u32); in scmi_raw_queue_init()
1047 rb->msg.buf = devm_kzalloc(dev, rb->max_len, GFP_KERNEL); in scmi_raw_queue_init()
1048 if (!rb->msg.buf) in scmi_raw_queue_init()
1050 scmi_raw_buffer_put(q, rb); in scmi_raw_queue_init()
1312 struct scmi_raw_buffer *rb; in scmi_raw_message_report() local
1340 rb = scmi_raw_buffer_get(q); in scmi_raw_message_report()
1341 if (!rb) { in scmi_raw_message_report()
1367 rb = scmi_raw_buffer_dequeue_unlocked(q); in scmi_raw_message_report()
1368 if (WARN_ON(!rb)) { in scmi_raw_message_report()
1374 rb->msg.len = rb->max_len; in scmi_raw_message_report()
1382 ret = scmi_xfer_raw_collect(rb->msg.buf, &rb->msg.len, xfer); in scmi_raw_message_report()
1385 scmi_raw_buffer_put(q, rb); in scmi_raw_message_report()
1389 scmi_raw_buffer_enqueue(q, rb); in scmi_raw_message_report()