[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <e482ec86-c7c5-4fa3-b035-a469161b9eb1@gmail.com>
Date: Wed, 2 Oct 2024 14:52:28 +0200
From: Matthias Brugger <matthias.bgg@...il.com>
To: AngeloGioacchino Del Regno <angelogioacchino.delregno@...labora.com>,
linux-mediatek@...ts.infradead.org
Cc: linux-kernel@...r.kernel.org, linux-arm-kernel@...ts.infradead.org,
kernel@...labora.com
Subject: Re: [PATCH v1 3/3] soc: mediatek: mtk-cmdq: Move cmdq_instruction
init to declaration
On 18/09/2024 12:06, AngeloGioacchino Del Regno wrote:
> Move, where possible, the initialization of struct cmdq_instruction
> variables to their declaration to compress the code.
>
> While at it, also change an instance of open-coded mask to use the
> GENMASK() macro instead, and instances of `ret = func(); return ret;`
> to the equivalent (but shorter) `return func()`.
>
> Signed-off-by: AngeloGioacchino Del Regno <angelogioacchino.delregno@...labora.com>
> ---
> drivers/soc/mediatek/mtk-cmdq-helper.c | 200 ++++++++++++-------------
> 1 file changed, 93 insertions(+), 107 deletions(-)
>
> diff --git a/drivers/soc/mediatek/mtk-cmdq-helper.c b/drivers/soc/mediatek/mtk-cmdq-helper.c
> index 4ffd1a35df87..0b274b0fb44f 100644
> --- a/drivers/soc/mediatek/mtk-cmdq-helper.c
> +++ b/drivers/soc/mediatek/mtk-cmdq-helper.c
[...]
> @@ -474,11 +463,12 @@ int cmdq_pkt_logic_command(struct cmdq_pkt *pkt, u16 result_reg_idx,
> enum cmdq_logic_op s_op,
> struct cmdq_operand *right_operand)
> {
> - struct cmdq_instruction inst = { {0} };
> + struct cmdq_instruction inst;
>
> if (unlikely(!left_operand || !right_operand || s_op >= CMDQ_LOGIC_MAX))
> return -EINVAL;
>
> + inst.value = 0;
> inst.op = CMDQ_CODE_LOGIC;
> inst.dst_t = CMDQ_REG_TYPE;
I would add all members that are not based on left and right operand to the
definition of the struct.
Regards,
Matthias
Powered by blists - more mailing lists