mirror of
https://github.com/torvalds/linux.git
synced 2026-05-29 17:43:52 +02:00
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>
This commit is contained in:
parent
5d55721d6e
commit
0b209ec85b
|
|
@ -1225,8 +1225,8 @@ static bool ab8500_chargalg_time_to_restart(struct ab8500_chargalg *di)
|
|||
*/
|
||||
static void ab8500_chargalg_algorithm(struct ab8500_chargalg *di)
|
||||
{
|
||||
const struct power_supply_maintenance_charge_table *mt;
|
||||
struct power_supply_battery_info *bi = di->bm->bi;
|
||||
struct power_supply_maintenance_charge_table *mt;
|
||||
int charger_status;
|
||||
int ret;
|
||||
|
||||
|
|
|
|||
|
|
@ -1072,7 +1072,7 @@ int power_supply_vbat2ri(struct power_supply_battery_info *info,
|
|||
}
|
||||
EXPORT_SYMBOL_GPL(power_supply_vbat2ri);
|
||||
|
||||
struct power_supply_maintenance_charge_table *
|
||||
const struct power_supply_maintenance_charge_table *
|
||||
power_supply_get_maintenance_charging_setting(struct power_supply_battery_info *info,
|
||||
int index)
|
||||
{
|
||||
|
|
|
|||
|
|
@ -613,7 +613,7 @@ static struct power_supply_battery_ocv_table samsung_ocv_cap_eb585157lu[] = {
|
|||
{ .ocv = 3300000, .capacity = 0},
|
||||
};
|
||||
|
||||
static struct power_supply_maintenance_charge_table samsung_maint_charge_table[] = {
|
||||
static const struct power_supply_maintenance_charge_table samsung_maint_charge_table[] = {
|
||||
{
|
||||
/* Maintenance charging phase A, 60 hours */
|
||||
.charge_current_max_ua = 600000,
|
||||
|
|
|
|||
|
|
@ -736,7 +736,7 @@ struct power_supply_battery_info {
|
|||
int overvoltage_limit_uv;
|
||||
int constant_charge_current_max_ua;
|
||||
int constant_charge_voltage_max_uv;
|
||||
struct power_supply_maintenance_charge_table *maintenance_charge;
|
||||
const struct power_supply_maintenance_charge_table *maintenance_charge;
|
||||
int maintenance_charge_size;
|
||||
int alert_low_temp_charge_current_ua;
|
||||
int alert_low_temp_charge_voltage_uv;
|
||||
|
|
@ -810,7 +810,7 @@ power_supply_temp2resist_simple(struct power_supply_resistance_temp_table *table
|
|||
int table_len, int temp);
|
||||
extern int power_supply_vbat2ri(struct power_supply_battery_info *info,
|
||||
int vbat_uv, bool charging);
|
||||
extern struct power_supply_maintenance_charge_table *
|
||||
extern const struct power_supply_maintenance_charge_table *
|
||||
power_supply_get_maintenance_charging_setting(struct power_supply_battery_info *info, int index);
|
||||
extern bool power_supply_battery_bti_in_range(struct power_supply_battery_info *info,
|
||||
int resistance);
|
||||
|
|
@ -824,7 +824,7 @@ extern int power_supply_set_battery_charged(struct power_supply *psy);
|
|||
static inline bool
|
||||
power_supply_supports_maintenance_charging(struct power_supply_battery_info *info)
|
||||
{
|
||||
struct power_supply_maintenance_charge_table *mt;
|
||||
const struct power_supply_maintenance_charge_table *mt;
|
||||
|
||||
mt = power_supply_get_maintenance_charging_setting(info, 0);
|
||||
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user