power: supply: samsung-sdi-battery: Constify struct power_supply_maintenance_charge_table
authorChristophe JAILLET <christophe.jaillet@wanadoo.fr>
Sun, 23 Jun 2024 08:04:45 +0000 (10:04 +0200)
committerSebastian Reichel <sebastian.reichel@collabora.com>
Wed, 26 Jun 2024 15:32:00 +0000 (17:32 +0200)
commit0b209ec85b2b73c38a09ba71dc05fbe4aee7be67
treeafb649c6ef5032b8106ff65d7ca02fc05bb77143
parent5d55721d6e24c8e99cc86ee1fcb90d776ef47964
power: supply: samsung-sdi-battery: Constify struct power_supply_maintenance_charge_table

'struct power_supply_maintenance_charge_table' is not modified in this
driver.

Constifying this structure moves some data to a read-only section, so
increase overall security.

In order to do it, some code also needs to be adjusted to this new const
qualifier.

On a x86_64, with allmodconfig:
Before:
======
$ size drivers/power/supply/samsung-sdi-battery.o
   text    data     bss     dec     hex filename
   4055    4584       0    8639    21bf drivers/power/supply/samsung-sdi-battery.o

After:
=====
$ size drivers/power/supply/samsung-sdi-battery.o
   text    data     bss     dec     hex filename
   4087    4552       0    8639    21bf drivers/power/supply/samsung-sdi-battery.o

Signed-off-by: Christophe JAILLET <christophe.jaillet@wanadoo.fr>
Link: https://lore.kernel.org/r/6caafd0ac2556a40405273b1a4badc508ea8e9b0.1719125040.git.christophe.jaillet@wanadoo.fr
Signed-off-by: Sebastian Reichel <sebastian.reichel@collabora.com>
drivers/power/supply/ab8500_chargalg.c
drivers/power/supply/power_supply_core.c
drivers/power/supply/samsung-sdi-battery.c
include/linux/power_supply.h