[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <5821a8bb-8751-70e8-970f-eb2bf2b077fb@linaro.org>
Date: Mon, 6 Feb 2023 08:00:46 -0600
From: Alex Elder <elder@...aro.org>
To: Srinivas Kandagatla <srinivas.kandagatla@...aro.org>,
Elliot Berman <quic_eberman@...cinc.com>,
Bjorn Andersson <quic_bjorande@...cinc.com>,
Murali Nalajala <quic_mnalajal@...cinc.com>,
Jonathan Corbet <corbet@....net>,
Jassi Brar <jassisinghbrar@...il.com>
Cc: Trilok Soni <quic_tsoni@...cinc.com>,
Srivatsa Vaddagiri <quic_svaddagi@...cinc.com>,
Carl van Schaik <quic_cvanscha@...cinc.com>,
Prakruthi Deepak Heragu <quic_pheragu@...cinc.com>,
Dmitry Baryshkov <dmitry.baryshkov@...aro.org>,
Arnd Bergmann <arnd@...db.de>,
Greg Kroah-Hartman <gregkh@...uxfoundation.org>,
Rob Herring <robh+dt@...nel.org>,
Krzysztof Kozlowski <krzysztof.kozlowski+dt@...aro.org>,
Bagas Sanjaya <bagasdotme@...il.com>,
Catalin Marinas <catalin.marinas@....com>,
Will Deacon <will@...nel.org>, Marc Zyngier <maz@...nel.org>,
Sudeep Holla <sudeep.holla@....com>,
linux-arm-msm@...r.kernel.org, devicetree@...r.kernel.org,
linux-kernel@...r.kernel.org, linux-doc@...r.kernel.org,
linux-arm-kernel@...ts.infradead.org
Subject: Re: [PATCH v9 08/27] mailbox: Add Gunyah message queue mailbox
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;
>> +}
Powered by blists - more mailing lists