[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <7040427b-f580-ec33-8afa-35dcf5735abb@gmail.com>
Date: Sat, 29 Sep 2018 14:50:35 +0200
From: Matthias Brugger <matthias.bgg@...il.com>
To: Houlong Wei <houlong.wei@...iatek.com>,
Jassi Brar <jassisinghbrar@...il.com>,
Rob Herring <robh+dt@...nel.org>
Cc: Daniel Kurtz <djkurtz@...omium.org>,
Sascha Hauer <s.hauer@...gutronix.de>,
devicetree@...r.kernel.org, linux-kernel@...r.kernel.org,
linux-arm-kernel@...ts.infradead.org,
linux-mediatek@...ts.infradead.org, srv_heupstream@...iatek.com,
Sascha Hauer <kernel@...gutronix.de>,
Philipp Zabel <p.zabel@...gutronix.de>,
Nicolas Boichat <drinkcat@...omium.org>,
CK HU <ck.hu@...iatek.com>,
Bibby Hsieh <bibby.hsieh@...iatek.com>,
YT Shen <yt.shen@...iatek.com>,
Daoyuan Huang <daoyuan.huang@...iatek.com>,
Jiaguang Zhang <jiaguang.zhang@...iatek.com>,
Dennis-YC Hsieh <dennis-yc.hsieh@...iatek.com>,
Monica Wang <monica.wang@...iatek.com>,
HS Liao <hs.liao@...iatek.com>, ginny.chen@...iatek.com,
enzhu.wang@...iatek.com
Subject: Re: [PATCH v25 2/2] soc: mediatek: Add Mediatek CMDQ helper
On 29/09/2018 11:21, Houlong Wei wrote:
[...]
> +static int cmdq_pkt_append_command(struct cmdq_pkt *pkt, enum cmdq_code code,
> + u32 arg_a, u32 arg_b)
> +{
> + u64 *cmd_ptr;
> +
> + if (unlikely(pkt->cmd_buf_size + CMDQ_INST_SIZE > pkt->buf_size)) {
> + pkt->cmd_buf_size += CMDQ_INST_SIZE;
Can you plesae provide some example code of a driver that will use this API, I
still don't understand why you need to update the cmd_buf_size here.
> + WARN_ON(1);
can we add some debug information:
WARN_ON(1, "%s: buffer size too small for the amount of commands", __func__);
Would it make sense to use WARN_ONCE()?
> + return -ENOMEM;
> + }
> + cmd_ptr = pkt->va_base + pkt->cmd_buf_size;
> + (*cmd_ptr) = (u64)((code << CMDQ_OP_CODE_SHIFT) | arg_a) << 32 | arg_b;
> + pkt->cmd_buf_size += CMDQ_INST_SIZE;
> +
> + return 0;
> +}
Thanks,
Matthias
Powered by blists - more mailing lists