Thread (76 messages) 76 messages, 6 authors, 2023-03-16

Re: [PATCH v9 08/27] mailbox: Add Gunyah message queue mailbox

From: Alex Elder <hidden>
Date: 2023-02-06 14:02:22
Also in: linux-arm-msm, linux-devicetree, linux-doc, lkml

On 2/2/23 3:59 AM, Srinivas Kandagatla wrote:
quoted
+static irqreturn_t gh_msgq_rx_irq_handler(int irq, void *data)
+{
+    struct gh_msgq *msgq = data;
+    struct gh_msgq_rx_data rx_data;
+    unsigned long gh_err;
+    bool ready = true;
+
+    while (ready) {
+        gh_err = gh_hypercall_msgq_recv(msgq->rx_ghrsc->capid,
+                (uintptr_t)&rx_data.data, sizeof(rx_data.data),
you should proabably use  GH_MSGQ_MAX_MSG_SIZE instead of calling sizeof 
for every loop.
I disagree with this comment.

I think sizeof(object) conveys more meaning that CONSTANT_SIZE,
and both values are known at compile time (so there is no cost
of "calling sizeof" a lot.

					-Alex
quoted
+                &rx_data.length, &ready);
+        if (gh_err == GH_ERROR_OK) {
+            mbox_chan_received_data(gh_msgq_chan(msgq), &rx_data);
+        } else if (gh_err == GH_ERROR_MSGQUEUE_EMPTY) {
+            break;
+        } else {
+            pr_warn("Failed to receive data from msgq for %s: %zd\n",
+                msgq->mbox.dev ? dev_name(msgq->mbox.dev) : "", gh_err);
+            break;
+        }
+    }
+
+    return IRQ_HANDLED;
+} 

_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help