Re: [PATCH] scsi: ufs: ufs-exynos: make a const array static, makes object smaller

From: Krzysztof Kozlowski
Date: Wed May 05 2021 - 15:41:44 EST


On 05/05/2021 15:01, Colin King wrote:
> From: Colin Ian King <colin.king@xxxxxxxxxxxxx>
>
> Don't populate the const array granularity_tbl on the stack but instead it
> static. Makes the object code smaller by 190 bytes:
>
> Before:
> text data bss dec hex filename
> 25563 6908 0 32471 7ed7 ./drivers/scsi/ufs/ufs-exynos.o
>
> After:
> text data bss dec hex filename
> 25213 7068 0 32281 7e19 ./drivers/scsi/ufs/ufs-exynos.o
>
> (gcc version 10.3.0)

I am not sure what's the benefit here - you moved the code from text to
data. In total you decreased the size for this compilation settings
(e.g. compiler + optimizations) but that might not be always true, right?

This has effect on the code readability - line is longer and reader
would think "why this was made static since it is simple one-time const?".


Best regards,
Krzysztof