Skip to content
Verified Commit e9be7713 authored by Christophe JAILLET's avatar Christophe JAILLET Committed by Mark Brown
Browse files

regulator: qcom_spmi: Constify struct spmi_voltage_range



'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: default avatarChristophe JAILLET <christophe.jaillet@wanadoo.fr>
Reviewed-by: default avatarDmitry Baryshkov <dmitry.baryshkov@oss.qualcomm.com>
Link: https://patch.msgid.link/ef2a4b6df61e19470ddf6cbd1f3ca1ce88a3c1a0.1747570556.git.christophe.jaillet@wanadoo.fr


Signed-off-by: default avatarMark Brown <broonie@kernel.org>
parent 9cfdd775
Loading
Loading
Loading
Loading
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment