[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <pxm4kekb573zz2cdjgjn5rxlr2ipneaoxlqzwkcwhctqnqm45h@pdgediy3o7tg>
Date: Mon, 19 May 2025 01:41:58 +0300
From: Dmitry Baryshkov <dmitry.baryshkov@....qualcomm.com>
To: Christophe JAILLET <christophe.jaillet@...adoo.fr>
Cc: Liam Girdwood <lgirdwood@...il.com>, Mark Brown <broonie@...nel.org>,
linux-kernel@...r.kernel.org, kernel-janitors@...r.kernel.org,
linux-arm-msm@...r.kernel.org
Subject: Re: [PATCH] regulator: qcom_spmi: Constify struct spmi_voltage_range
On Sun, May 18, 2025 at 02:16:21PM +0200, Christophe JAILLET wrote:
> 'struct spmi_voltage_range' are only modified at runtime to compile a
> field, n_voltages, that could be computed at compile time.
>
> So, simplify spmi_calculate_num_voltages() and compute n_voltages at
> compile time within the SPMI_VOLTAGE_RANGE macro.
>
> Constifying these structures moves some data to a read-only section, so
> increase overall security.
>
> On a x86_64, with allmodconfig:
> Before:
> ======
> text data bss dec hex filename
> 85437 26776 512 112725 1b855 drivers/regulator/qcom_spmi-regulator.o
>
> After:
> =====
> text data bss dec hex filename
> 86857 24760 512 112129 1b601 drivers/regulator/qcom_spmi-regulator.o
>
> Signed-off-by: Christophe JAILLET <christophe.jaillet@...adoo.fr>
> ---
> Compile tested-only.
>
> I've also checked in the .s file that n_voltages was set initialized with
> the correct value.
> ---
> drivers/regulator/qcom_spmi-regulator.c | 69 ++++++++++++-------------
> 1 file changed, 32 insertions(+), 37 deletions(-)
>
Reviewed-by: Dmitry Baryshkov <dmitry.baryshkov@....qualcomm.com>
--
With best wishes
Dmitry
Powered by blists - more mailing lists