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

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On 2/2/23 3:59 AM, Srinivas Kandagatla wrote:

+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


+                &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;
+}




[Index of Archives]     [Linux ARM Kernel]     [Linux ARM]     [Linux Omap]     [Fedora ARM]     [Linux for Sparc]     [IETF Annouce]     [Security]     [Bugtraq]     [Linux MIPS]     [ECOS]     [Asterisk Internet PBX]     [Linux API]

  Powered by Linux