mbox series

[v1,0/3] soc: mediatek: mtk-cmdq-helper: Various cleanups

Message ID 20240918100620.103536-1-angelogioacchino.delregno@collabora.com (mailing list archive)
Headers show
Series soc: mediatek: mtk-cmdq-helper: Various cleanups | expand

Message

AngeloGioacchino Del Regno Sept. 18, 2024, 10:06 a.m. UTC
This series performs various cleanups to the MediaTek CMDQ Helper lib,
reducing code duplication and enhancing human readability.

This also avoids double initialization struct cmdq_instruction as,
in some cases, it was stack-initialized to zero and then overwritten
completely anyway a bit later.
I'd expect compilers to be somehow smart about that, but still, while
at it ... why not :-)

Tested on MT8192 Asurada, MT8195 Tomato Chromebooks.

AngeloGioacchino Del Regno (3):
  soc: mediatek: mtk-cmdq: Move mask build and append to function
  soc: mediatek: mtk-cmdq: Mark very unlikely branches as such
  soc: mediatek: mtk-cmdq: Move cmdq_instruction init to declaration

 drivers/soc/mediatek/mtk-cmdq-helper.c | 241 ++++++++++++-------------
 1 file changed, 112 insertions(+), 129 deletions(-)

Comments

AngeloGioacchino Del Regno Oct. 2, 2024, 9:08 a.m. UTC | #1
On Wed, 18 Sep 2024 12:06:17 +0200, AngeloGioacchino Del Regno wrote:
> This series performs various cleanups to the MediaTek CMDQ Helper lib,
> reducing code duplication and enhancing human readability.
> 
> This also avoids double initialization struct cmdq_instruction as,
> in some cases, it was stack-initialized to zero and then overwritten
> completely anyway a bit later.
> I'd expect compilers to be somehow smart about that, but still, while
> at it ... why not :-)
> 
> [...]

Applied to v6.12-next/soc, thanks!

[1/3] soc: mediatek: mtk-cmdq: Move mask build and append to function
      https://git.kernel.org/mediatek/c/2400e830
[2/3] soc: mediatek: mtk-cmdq: Mark very unlikely branches as such
      https://git.kernel.org/mediatek/c/21ab3dae
[3/3] soc: mediatek: mtk-cmdq: Move cmdq_instruction init to declaration
      https://git.kernel.org/mediatek/c/66705b89

Cheers,
Angelo
Matthias Brugger Oct. 2, 2024, 1 p.m. UTC | #2
On 02/10/2024 11:08, AngeloGioacchino Del Regno wrote:
> On Wed, 18 Sep 2024 12:06:17 +0200, AngeloGioacchino Del Regno wrote:
>> This series performs various cleanups to the MediaTek CMDQ Helper lib,
>> reducing code duplication and enhancing human readability.
>>
>> This also avoids double initialization struct cmdq_instruction as,
>> in some cases, it was stack-initialized to zero and then overwritten
>> completely anyway a bit later.
>> I'd expect compilers to be somehow smart about that, but still, while
>> at it ... why not :-)
>>
>> [...]
> 
> Applied to v6.12-next/soc, thanks!
> 
> [1/3] soc: mediatek: mtk-cmdq: Move mask build and append to function
>        https://git.kernel.org/mediatek/c/2400e830
> [2/3] soc: mediatek: mtk-cmdq: Mark very unlikely branches as such
>        https://git.kernel.org/mediatek/c/21ab3dae
> [3/3] soc: mediatek: mtk-cmdq: Move cmdq_instruction init to declaration
>        https://git.kernel.org/mediatek/c/66705b89
> 

You probably oversaw the sparse warning email on 3/3?

As I oversaw that you already merged this.

Regards,
Matthias
AngeloGioacchino Del Regno Oct. 3, 2024, 8:08 a.m. UTC | #3
Il 02/10/24 15:00, Matthias Brugger ha scritto:
> 
> 
> On 02/10/2024 11:08, AngeloGioacchino Del Regno wrote:
>> On Wed, 18 Sep 2024 12:06:17 +0200, AngeloGioacchino Del Regno wrote:
>>> This series performs various cleanups to the MediaTek CMDQ Helper lib,
>>> reducing code duplication and enhancing human readability.
>>>
>>> This also avoids double initialization struct cmdq_instruction as,
>>> in some cases, it was stack-initialized to zero and then overwritten
>>> completely anyway a bit later.
>>> I'd expect compilers to be somehow smart about that, but still, while
>>> at it ... why not :-)
>>>
>>> [...]
>>
>> Applied to v6.12-next/soc, thanks!
>>
>> [1/3] soc: mediatek: mtk-cmdq: Move mask build and append to function
>>        https://git.kernel.org/mediatek/c/2400e830
>> [2/3] soc: mediatek: mtk-cmdq: Mark very unlikely branches as such
>>        https://git.kernel.org/mediatek/c/21ab3dae
>> [3/3] soc: mediatek: mtk-cmdq: Move cmdq_instruction init to declaration
>>        https://git.kernel.org/mediatek/c/66705b89
>>
> 
> You probably oversaw the sparse warning email on 3/3?
> 
> As I oversaw that you already merged this.
> 

Yeah, I did. There's no problem anyway, as we can always replace the commits
without noise, I haven't pushed anything to -next :-)

I plan to do that (drop patch 2/3, delete `.mask = 0` on 3/3) soon, at max
next week anyway.

Cheers,
Angelo
Matthias Brugger Oct. 7, 2024, 2:33 p.m. UTC | #4
On 03/10/2024 10:08, AngeloGioacchino Del Regno wrote:
> Il 02/10/24 15:00, Matthias Brugger ha scritto:
>>
>>
>> On 02/10/2024 11:08, AngeloGioacchino Del Regno wrote:
>>> On Wed, 18 Sep 2024 12:06:17 +0200, AngeloGioacchino Del Regno wrote:
>>>> This series performs various cleanups to the MediaTek CMDQ Helper lib,
>>>> reducing code duplication and enhancing human readability.
>>>>
>>>> This also avoids double initialization struct cmdq_instruction as,
>>>> in some cases, it was stack-initialized to zero and then overwritten
>>>> completely anyway a bit later.
>>>> I'd expect compilers to be somehow smart about that, but still, while
>>>> at it ... why not :-)
>>>>
>>>> [...]
>>>
>>> Applied to v6.12-next/soc, thanks!
>>>
>>> [1/3] soc: mediatek: mtk-cmdq: Move mask build and append to function
>>>        https://git.kernel.org/mediatek/c/2400e830
>>> [2/3] soc: mediatek: mtk-cmdq: Mark very unlikely branches as such
>>>        https://git.kernel.org/mediatek/c/21ab3dae
>>> [3/3] soc: mediatek: mtk-cmdq: Move cmdq_instruction init to declaration
>>>        https://git.kernel.org/mediatek/c/66705b89
>>>
>>
>> You probably oversaw the sparse warning email on 3/3?
>>
>> As I oversaw that you already merged this.
>>
> 
> Yeah, I did. There's no problem anyway, as we can always replace the commits
> without noise, I haven't pushed anything to -next :-)
> 
> I plan to do that (drop patch 2/3, delete `.mask = 0` on 3/3) soon, at max
> next week anyway.
> 

Perfect, before you do any locally please pull from remote as I did some 
changes, not sure if you saw my message on IRC.

Regarding -next: we don't need to keep commit history in linux-next neither, to 
even it got pushed to -next, we can drop patches in the queue with any problem.

Have a nice afternoon :)
Matthias
AngeloGioacchino Del Regno Oct. 7, 2024, 2:36 p.m. UTC | #5
Il 07/10/24 16:33, Matthias Brugger ha scritto:
> 
> 
> On 03/10/2024 10:08, AngeloGioacchino Del Regno wrote:
>> Il 02/10/24 15:00, Matthias Brugger ha scritto:
>>>
>>>
>>> On 02/10/2024 11:08, AngeloGioacchino Del Regno wrote:
>>>> On Wed, 18 Sep 2024 12:06:17 +0200, AngeloGioacchino Del Regno wrote:
>>>>> This series performs various cleanups to the MediaTek CMDQ Helper lib,
>>>>> reducing code duplication and enhancing human readability.
>>>>>
>>>>> This also avoids double initialization struct cmdq_instruction as,
>>>>> in some cases, it was stack-initialized to zero and then overwritten
>>>>> completely anyway a bit later.
>>>>> I'd expect compilers to be somehow smart about that, but still, while
>>>>> at it ... why not :-)
>>>>>
>>>>> [...]
>>>>
>>>> Applied to v6.12-next/soc, thanks!
>>>>
>>>> [1/3] soc: mediatek: mtk-cmdq: Move mask build and append to function
>>>>        https://git.kernel.org/mediatek/c/2400e830
>>>> [2/3] soc: mediatek: mtk-cmdq: Mark very unlikely branches as such
>>>>        https://git.kernel.org/mediatek/c/21ab3dae
>>>> [3/3] soc: mediatek: mtk-cmdq: Move cmdq_instruction init to declaration
>>>>        https://git.kernel.org/mediatek/c/66705b89
>>>>
>>>
>>> You probably oversaw the sparse warning email on 3/3?
>>>
>>> As I oversaw that you already merged this.
>>>
>>
>> Yeah, I did. There's no problem anyway, as we can always replace the commits
>> without noise, I haven't pushed anything to -next :-)
>>
>> I plan to do that (drop patch 2/3, delete `.mask = 0` on 3/3) soon, at max
>> next week anyway.
>>
> 
> Perfect, before you do any locally please pull from remote as I did some changes, 
> not sure if you saw my message on IRC.
> 
> Regarding -next: we don't need to keep commit history in linux-next neither, to 
> even it got pushed to -next, we can drop patches in the queue with any problem.

My day was pretty full, I didn't. Thanks for shooting the email :-D

> 
> Have a nice afternoon :)

You too!
Angelo