mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* [PATCH 0/7] power: supply: constify ocv and resistance tables
@ 2024-10-05 10:04 Thomas Weißschuh
  2024-10-05 10:04 ` [PATCH 1/7] power: supply: core: constify power_supply_battery_info::resist_table Thomas Weißschuh
                   ` (8 more replies)
  0 siblings, 9 replies; 12+ messages in thread
From: Thomas Weißschuh @ 2024-10-05 10:04 UTC (permalink / raw)
  To: Sebastian Reichel, Linus Walleij, Orson Zhai, Baolin Wang, Chunyan Zhang
  Cc: linux-pm, linux-kernel, Thomas Weißschuh

These tables are nevery modified. Reflect this in the API and constify
the table definitions.

Signed-off-by: Thomas Weißschuh <linux@weissschuh.net>
---
Thomas Weißschuh (7):
      power: supply: core: constify power_supply_battery_info::resist_table
      power: supply: ab8500: constify resistance table
      power: supply: samsung-sdi-battery: constify resistance table
      power: supply: sc27xx: use const reference to ocv table
      power: supply: core: constify power_supply_battery_info::ocv_table
      power: supply: ab8500: constify ocv table
      power: supply: samsung-sdi-battery: constify ocv table

 drivers/power/supply/ab8500_bmdata.c       |  4 ++--
 drivers/power/supply/power_supply_core.c   | 12 ++++++------
 drivers/power/supply/samsung-sdi-battery.c | 10 +++++-----
 drivers/power/supply/sc27xx_fuel_gauge.c   |  2 +-
 include/linux/power_supply.h               | 10 +++++-----
 5 files changed, 19 insertions(+), 19 deletions(-)
---
base-commit: 27cc6fdf720183dce1dbd293483ec5a9cb6b595e
change-id: 20240922-power-supply-battery-const-3722df7d16e4

Best regards,
-- 
Thomas Weißschuh <linux@weissschuh.net>


^ permalink raw reply	[flat|nested] 12+ messages in thread

* [PATCH 1/7] power: supply: core: constify power_supply_battery_info::resist_table
  2024-10-05 10:04 [PATCH 0/7] power: supply: constify ocv and resistance tables Thomas Weißschuh
@ 2024-10-05 10:04 ` Thomas Weißschuh
  2024-10-09 16:05   ` Linus Walleij
  2024-10-05 10:04 ` [PATCH 2/7] power: supply: ab8500: constify resistance table Thomas Weißschuh
                   ` (7 subsequent siblings)
  8 siblings, 1 reply; 12+ messages in thread
From: Thomas Weißschuh @ 2024-10-05 10:04 UTC (permalink / raw)
  To: Sebastian Reichel, Linus Walleij, Orson Zhai, Baolin Wang, Chunyan Zhang
  Cc: linux-pm, linux-kernel, Thomas Weißschuh

The power supply core never modifies the resist table.
Reflect this in the API, so drivers can mark their static tables as
const.

Signed-off-by: Thomas Weißschuh <linux@weissschuh.net>
---
 drivers/power/supply/power_supply_core.c | 4 ++--
 include/linux/power_supply.h             | 4 ++--
 2 files changed, 4 insertions(+), 4 deletions(-)

diff --git a/drivers/power/supply/power_supply_core.c b/drivers/power/supply/power_supply_core.c
index 49534458a9f7d3f6d7c01bd91fa1bb6ed23bc7ad..a01703fa83c0d90ec630782e67aa3c2c406d51dd 100644
--- a/drivers/power/supply/power_supply_core.c
+++ b/drivers/power/supply/power_supply_core.c
@@ -798,7 +798,7 @@ int power_supply_get_battery_info(struct power_supply *psy,
 		goto out_ret_pointer;
 
 	info->resist_table_size = len / (2 * sizeof(__be32));
-	resist_table = info->resist_table = devm_kcalloc(&psy->dev,
+	info->resist_table = resist_table = devm_kcalloc(&psy->dev,
 							 info->resist_table_size,
 							 sizeof(*resist_table),
 							 GFP_KERNEL);
@@ -982,7 +982,7 @@ EXPORT_SYMBOL_GPL(power_supply_battery_info_get_prop);
  *
  * Return: the battery internal resistance percent
  */
-int power_supply_temp2resist_simple(struct power_supply_resistance_temp_table *table,
+int power_supply_temp2resist_simple(const struct power_supply_resistance_temp_table *table,
 				    int table_len, int temp)
 {
 	int i, high, low;
diff --git a/include/linux/power_supply.h b/include/linux/power_supply.h
index 910d407ebe6323aaf4b31f0081f2cdd4be43a9fa..9253411c105f27177181f9b0a84285a7b24bc954 100644
--- a/include/linux/power_supply.h
+++ b/include/linux/power_supply.h
@@ -752,7 +752,7 @@ struct power_supply_battery_info {
 	int temp_max;
 	struct power_supply_battery_ocv_table *ocv_table[POWER_SUPPLY_OCV_TEMP_MAX];
 	int ocv_table_size[POWER_SUPPLY_OCV_TEMP_MAX];
-	struct power_supply_resistance_temp_table *resist_table;
+	const struct power_supply_resistance_temp_table *resist_table;
 	int resist_table_size;
 	const struct power_supply_vbat_ri_table *vbat2ri_discharging;
 	int vbat2ri_discharging_size;
@@ -805,7 +805,7 @@ power_supply_find_ocv2cap_table(struct power_supply_battery_info *info,
 extern int power_supply_batinfo_ocv2cap(struct power_supply_battery_info *info,
 					int ocv, int temp);
 extern int
-power_supply_temp2resist_simple(struct power_supply_resistance_temp_table *table,
+power_supply_temp2resist_simple(const 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);

-- 
2.46.2


^ permalink raw reply	[flat|nested] 12+ messages in thread

* [PATCH 2/7] power: supply: ab8500: constify resistance table
  2024-10-05 10:04 [PATCH 0/7] power: supply: constify ocv and resistance tables Thomas Weißschuh
  2024-10-05 10:04 ` [PATCH 1/7] power: supply: core: constify power_supply_battery_info::resist_table Thomas Weißschuh
@ 2024-10-05 10:04 ` Thomas Weißschuh
  2024-10-05 10:04 ` [PATCH 3/7] power: supply: samsung-sdi-battery: " Thomas Weißschuh
                   ` (6 subsequent siblings)
  8 siblings, 0 replies; 12+ messages in thread
From: Thomas Weißschuh @ 2024-10-05 10:04 UTC (permalink / raw)
  To: Sebastian Reichel, Linus Walleij, Orson Zhai, Baolin Wang, Chunyan Zhang
  Cc: linux-pm, linux-kernel, Thomas Weißschuh

The power supply core now allows this constification.
Prevent accidental or malicious modification of the data.

Signed-off-by: Thomas Weißschuh <linux@weissschuh.net>
---
 drivers/power/supply/ab8500_bmdata.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/power/supply/ab8500_bmdata.c b/drivers/power/supply/ab8500_bmdata.c
index 3e6ea22372b2dca319779ae067ea578f03f21674..2fcfbbef050383eaef461ec2e8191e9b269305ff 100644
--- a/drivers/power/supply/ab8500_bmdata.c
+++ b/drivers/power/supply/ab8500_bmdata.c
@@ -48,7 +48,7 @@ static struct power_supply_battery_ocv_table ocv_cap_tbl[] = {
  * temperature values to work. Factory resistance is 300 mOhm and the
  * resistance values to the right are percentages of 300 mOhm.
  */
-static struct power_supply_resistance_temp_table temp_to_batres_tbl_thermistor[] = {
+static const struct power_supply_resistance_temp_table temp_to_batres_tbl_thermistor[] = {
 	{ .temp = 40, .resistance = 40 /* 120 mOhm */ },
 	{ .temp = 30, .resistance = 45 /* 135 mOhm */ },
 	{ .temp = 20, .resistance = 55 /* 165 mOhm */ },

-- 
2.46.2


^ permalink raw reply	[flat|nested] 12+ messages in thread

* [PATCH 3/7] power: supply: samsung-sdi-battery: constify resistance table
  2024-10-05 10:04 [PATCH 0/7] power: supply: constify ocv and resistance tables Thomas Weißschuh
  2024-10-05 10:04 ` [PATCH 1/7] power: supply: core: constify power_supply_battery_info::resist_table Thomas Weißschuh
  2024-10-05 10:04 ` [PATCH 2/7] power: supply: ab8500: constify resistance table Thomas Weißschuh
@ 2024-10-05 10:04 ` Thomas Weißschuh
  2024-10-05 10:04 ` [PATCH 4/7] power: supply: sc27xx: use const reference to ocv table Thomas Weißschuh
                   ` (5 subsequent siblings)
  8 siblings, 0 replies; 12+ messages in thread
From: Thomas Weißschuh @ 2024-10-05 10:04 UTC (permalink / raw)
  To: Sebastian Reichel, Linus Walleij, Orson Zhai, Baolin Wang, Chunyan Zhang
  Cc: linux-pm, linux-kernel, Thomas Weißschuh

The power supply core now allows this constification.
Prevent accidental or malicious modification of the data.

Signed-off-by: Thomas Weißschuh <linux@weissschuh.net>
---
 drivers/power/supply/samsung-sdi-battery.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/power/supply/samsung-sdi-battery.c b/drivers/power/supply/samsung-sdi-battery.c
index b63fd2758c2f13f35d9e2ae5e8ebf25d92f847dc..263592d625837e3851ccb30b4cf1272139ee923d 100644
--- a/drivers/power/supply/samsung-sdi-battery.c
+++ b/drivers/power/supply/samsung-sdi-battery.c
@@ -431,7 +431,7 @@ static const struct power_supply_vbat_ri_table samsung_vbat2res_charging_eb58515
  * temperature compensation tables so we just state 100% for every temperature.
  * If you have the datasheets, please provide these tables.
  */
-static struct power_supply_resistance_temp_table samsung_temp2res[] = {
+static const struct power_supply_resistance_temp_table samsung_temp2res[] = {
 	{ .temp = 50, .resistance = 100 },
 	{ .temp = 40, .resistance = 100 },
 	{ .temp = 30, .resistance = 100 },

-- 
2.46.2


^ permalink raw reply	[flat|nested] 12+ messages in thread

* [PATCH 4/7] power: supply: sc27xx: use const reference to ocv table
  2024-10-05 10:04 [PATCH 0/7] power: supply: constify ocv and resistance tables Thomas Weißschuh
                   ` (2 preceding siblings ...)
  2024-10-05 10:04 ` [PATCH 3/7] power: supply: samsung-sdi-battery: " Thomas Weißschuh
@ 2024-10-05 10:04 ` Thomas Weißschuh
  2024-10-10  9:24   ` Baolin Wang
  2024-10-05 10:04 ` [PATCH 5/7] power: supply: core: constify power_supply_battery_info::ocv_table Thomas Weißschuh
                   ` (4 subsequent siblings)
  8 siblings, 1 reply; 12+ messages in thread
From: Thomas Weißschuh @ 2024-10-05 10:04 UTC (permalink / raw)
  To: Sebastian Reichel, Linus Walleij, Orson Zhai, Baolin Wang, Chunyan Zhang
  Cc: linux-pm, linux-kernel, Thomas Weißschuh

The table is not modified, so constify the reference.
This enables a constification in the power supply core.

Signed-off-by: Thomas Weißschuh <linux@weissschuh.net>
---
 drivers/power/supply/sc27xx_fuel_gauge.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/power/supply/sc27xx_fuel_gauge.c b/drivers/power/supply/sc27xx_fuel_gauge.c
index bd23c4d9fed43482e972ccc086311e7bfcec2d54..426d423b935b581a7673be076ae71b8899f17e2e 100644
--- a/drivers/power/supply/sc27xx_fuel_gauge.c
+++ b/drivers/power/supply/sc27xx_fuel_gauge.c
@@ -992,7 +992,7 @@ static int sc27xx_fgu_calibration(struct sc27xx_fgu_data *data)
 static int sc27xx_fgu_hw_init(struct sc27xx_fgu_data *data)
 {
 	struct power_supply_battery_info *info;
-	struct power_supply_battery_ocv_table *table;
+	const struct power_supply_battery_ocv_table *table;
 	int ret, delta_clbcnt, alarm_adc;
 
 	ret = power_supply_get_battery_info(data->battery, &info);

-- 
2.46.2


^ permalink raw reply	[flat|nested] 12+ messages in thread

* [PATCH 5/7] power: supply: core: constify power_supply_battery_info::ocv_table
  2024-10-05 10:04 [PATCH 0/7] power: supply: constify ocv and resistance tables Thomas Weißschuh
                   ` (3 preceding siblings ...)
  2024-10-05 10:04 ` [PATCH 4/7] power: supply: sc27xx: use const reference to ocv table Thomas Weißschuh
@ 2024-10-05 10:04 ` Thomas Weißschuh
  2024-10-05 10:04 ` [PATCH 6/7] power: supply: ab8500: constify ocv table Thomas Weißschuh
                   ` (3 subsequent siblings)
  8 siblings, 0 replies; 12+ messages in thread
From: Thomas Weißschuh @ 2024-10-05 10:04 UTC (permalink / raw)
  To: Sebastian Reichel, Linus Walleij, Orson Zhai, Baolin Wang, Chunyan Zhang
  Cc: linux-pm, linux-kernel, Thomas Weißschuh

The power supply core never modifies the ocv table.
Reflect this in the API, so drivers can mark their static tables as
const.

Signed-off-by: Thomas Weißschuh <linux@weissschuh.net>
---
 drivers/power/supply/power_supply_core.c | 8 ++++----
 include/linux/power_supply.h             | 6 +++---
 2 files changed, 7 insertions(+), 7 deletions(-)

diff --git a/drivers/power/supply/power_supply_core.c b/drivers/power/supply/power_supply_core.c
index a01703fa83c0d90ec630782e67aa3c2c406d51dd..5aefba2ddcda12a9f24d096fa361aa8e4ce1a681 100644
--- a/drivers/power/supply/power_supply_core.c
+++ b/drivers/power/supply/power_supply_core.c
@@ -777,7 +777,7 @@ int power_supply_get_battery_info(struct power_supply *psy,
 		tab_len = size / (2 * sizeof(__be32));
 		info->ocv_table_size[index] = tab_len;
 
-		table = info->ocv_table[index] =
+		info->ocv_table[index] = table =
 			devm_kcalloc(&psy->dev, tab_len, sizeof(*table), GFP_KERNEL);
 		if (!info->ocv_table[index]) {
 			power_supply_put_battery_info(psy, info);
@@ -1093,7 +1093,7 @@ EXPORT_SYMBOL_GPL(power_supply_get_maintenance_charging_setting);
  *
  * Return: the battery capacity.
  */
-int power_supply_ocv2cap_simple(struct power_supply_battery_ocv_table *table,
+int power_supply_ocv2cap_simple(const struct power_supply_battery_ocv_table *table,
 				int table_len, int ocv)
 {
 	int i, high, low;
@@ -1118,7 +1118,7 @@ int power_supply_ocv2cap_simple(struct power_supply_battery_ocv_table *table,
 }
 EXPORT_SYMBOL_GPL(power_supply_ocv2cap_simple);
 
-struct power_supply_battery_ocv_table *
+const struct power_supply_battery_ocv_table *
 power_supply_find_ocv2cap_table(struct power_supply_battery_info *info,
 				int temp, int *table_len)
 {
@@ -1149,7 +1149,7 @@ EXPORT_SYMBOL_GPL(power_supply_find_ocv2cap_table);
 int power_supply_batinfo_ocv2cap(struct power_supply_battery_info *info,
 				 int ocv, int temp)
 {
-	struct power_supply_battery_ocv_table *table;
+	const struct power_supply_battery_ocv_table *table;
 	int table_len;
 
 	table = power_supply_find_ocv2cap_table(info, temp, &table_len);
diff --git a/include/linux/power_supply.h b/include/linux/power_supply.h
index 9253411c105f27177181f9b0a84285a7b24bc954..4e29ec39c18f26f3e15343e198f74e8a96613e92 100644
--- a/include/linux/power_supply.h
+++ b/include/linux/power_supply.h
@@ -750,7 +750,7 @@ struct power_supply_battery_info {
 	int temp_alert_max;
 	int temp_min;
 	int temp_max;
-	struct power_supply_battery_ocv_table *ocv_table[POWER_SUPPLY_OCV_TEMP_MAX];
+	const struct power_supply_battery_ocv_table *ocv_table[POWER_SUPPLY_OCV_TEMP_MAX];
 	int ocv_table_size[POWER_SUPPLY_OCV_TEMP_MAX];
 	const struct power_supply_resistance_temp_table *resist_table;
 	int resist_table_size;
@@ -797,9 +797,9 @@ extern bool power_supply_battery_info_has_prop(struct power_supply_battery_info
 extern int power_supply_battery_info_get_prop(struct power_supply_battery_info *info,
 					      enum power_supply_property psp,
 					      union power_supply_propval *val);
-extern int power_supply_ocv2cap_simple(struct power_supply_battery_ocv_table *table,
+extern int power_supply_ocv2cap_simple(const struct power_supply_battery_ocv_table *table,
 				       int table_len, int ocv);
-extern struct power_supply_battery_ocv_table *
+extern const struct power_supply_battery_ocv_table *
 power_supply_find_ocv2cap_table(struct power_supply_battery_info *info,
 				int temp, int *table_len);
 extern int power_supply_batinfo_ocv2cap(struct power_supply_battery_info *info,

-- 
2.46.2


^ permalink raw reply	[flat|nested] 12+ messages in thread

* [PATCH 6/7] power: supply: ab8500: constify ocv table
  2024-10-05 10:04 [PATCH 0/7] power: supply: constify ocv and resistance tables Thomas Weißschuh
                   ` (4 preceding siblings ...)
  2024-10-05 10:04 ` [PATCH 5/7] power: supply: core: constify power_supply_battery_info::ocv_table Thomas Weißschuh
@ 2024-10-05 10:04 ` Thomas Weißschuh
  2024-10-05 10:04 ` [PATCH 7/7] power: supply: samsung-sdi-battery: " Thomas Weißschuh
                   ` (2 subsequent siblings)
  8 siblings, 0 replies; 12+ messages in thread
From: Thomas Weißschuh @ 2024-10-05 10:04 UTC (permalink / raw)
  To: Sebastian Reichel, Linus Walleij, Orson Zhai, Baolin Wang, Chunyan Zhang
  Cc: linux-pm, linux-kernel, Thomas Weißschuh

The power supply core now allows this constification.
Prevent accidental or malicious modification of the data.

Signed-off-by: Thomas Weißschuh <linux@weissschuh.net>
---
 drivers/power/supply/ab8500_bmdata.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/power/supply/ab8500_bmdata.c b/drivers/power/supply/ab8500_bmdata.c
index 2fcfbbef050383eaef461ec2e8191e9b269305ff..19ed528528048547a97cddbf18f3f5aaf771d646 100644
--- a/drivers/power/supply/ab8500_bmdata.c
+++ b/drivers/power/supply/ab8500_bmdata.c
@@ -16,7 +16,7 @@
 /* Default: temperature hysteresis */
 #define AB8500_TEMP_HYSTERESIS	3
 
-static struct power_supply_battery_ocv_table ocv_cap_tbl[] = {
+static const struct power_supply_battery_ocv_table ocv_cap_tbl[] = {
 	{ .ocv = 4186000, .capacity = 100},
 	{ .ocv = 4163000, .capacity = 99},
 	{ .ocv = 4114000, .capacity = 95},

-- 
2.46.2


^ permalink raw reply	[flat|nested] 12+ messages in thread

* [PATCH 7/7] power: supply: samsung-sdi-battery: constify ocv table
  2024-10-05 10:04 [PATCH 0/7] power: supply: constify ocv and resistance tables Thomas Weißschuh
                   ` (5 preceding siblings ...)
  2024-10-05 10:04 ` [PATCH 6/7] power: supply: ab8500: constify ocv table Thomas Weißschuh
@ 2024-10-05 10:04 ` Thomas Weißschuh
  2024-10-09 16:06 ` [PATCH 0/7] power: supply: constify ocv and resistance tables Linus Walleij
  2024-10-15 21:01 ` Sebastian Reichel
  8 siblings, 0 replies; 12+ messages in thread
From: Thomas Weißschuh @ 2024-10-05 10:04 UTC (permalink / raw)
  To: Sebastian Reichel, Linus Walleij, Orson Zhai, Baolin Wang, Chunyan Zhang
  Cc: linux-pm, linux-kernel, Thomas Weißschuh

The power supply core now allows this constification.
Prevent accidental or malicious modification of the data.

Signed-off-by: Thomas Weißschuh <linux@weissschuh.net>
---
 drivers/power/supply/samsung-sdi-battery.c | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/drivers/power/supply/samsung-sdi-battery.c b/drivers/power/supply/samsung-sdi-battery.c
index 263592d625837e3851ccb30b4cf1272139ee923d..33565002ee27053b27a2b16cc588976faab4fce5 100644
--- a/drivers/power/supply/samsung-sdi-battery.c
+++ b/drivers/power/supply/samsung-sdi-battery.c
@@ -447,7 +447,7 @@ static const struct power_supply_resistance_temp_table samsung_temp2res[] = {
  * These must be sorted by falling OCV value.
  */
 
-static struct power_supply_battery_ocv_table samsung_ocv_cap_eb485159lu[] = {
+static const struct power_supply_battery_ocv_table samsung_ocv_cap_eb485159lu[] = {
 	{ .ocv = 4330000, .capacity = 100},
 	{ .ocv = 4320000, .capacity = 99},
 	{ .ocv = 4283000, .capacity = 95},
@@ -499,7 +499,7 @@ static struct power_supply_battery_ocv_table samsung_ocv_cap_eb485159lu[] = {
 };
 
 /* Same capacity table is used by eb-l1m7flu, eb425161la, eb425161lu */
-static struct power_supply_battery_ocv_table samsung_ocv_cap_1500mah[] = {
+static const struct power_supply_battery_ocv_table samsung_ocv_cap_1500mah[] = {
 	{ .ocv = 4328000, .capacity = 100},
 	{ .ocv = 4299000, .capacity = 99},
 	{ .ocv = 4281000, .capacity = 98},
@@ -540,7 +540,7 @@ static struct power_supply_battery_ocv_table samsung_ocv_cap_1500mah[] = {
 	{ .ocv = 3300000, .capacity = 0},
 };
 
-static struct power_supply_battery_ocv_table samsung_ocv_cap_eb535151vu[] = {
+static const struct power_supply_battery_ocv_table samsung_ocv_cap_eb535151vu[] = {
 	{ .ocv = 4178000, .capacity = 100},
 	{ .ocv = 4148000, .capacity = 99},
 	{ .ocv = 4105000, .capacity = 95},
@@ -572,7 +572,7 @@ static struct power_supply_battery_ocv_table samsung_ocv_cap_eb535151vu[] = {
 	{ .ocv = 3300000, .capacity = 0},
 };
 
-static struct power_supply_battery_ocv_table samsung_ocv_cap_eb585157lu[] = {
+static const struct power_supply_battery_ocv_table samsung_ocv_cap_eb585157lu[] = {
 	{ .ocv = 4320000, .capacity = 100},
 	{ .ocv = 4296000, .capacity = 99},
 	{ .ocv = 4283000, .capacity = 98},

-- 
2.46.2


^ permalink raw reply	[flat|nested] 12+ messages in thread

* Re: [PATCH 1/7] power: supply: core: constify power_supply_battery_info::resist_table
  2024-10-05 10:04 ` [PATCH 1/7] power: supply: core: constify power_supply_battery_info::resist_table Thomas Weißschuh
@ 2024-10-09 16:05   ` Linus Walleij
  0 siblings, 0 replies; 12+ messages in thread
From: Linus Walleij @ 2024-10-09 16:05 UTC (permalink / raw)
  To: Thomas Weißschuh
  Cc: Sebastian Reichel, Orson Zhai, Baolin Wang, Chunyan Zhang,
	linux-pm, linux-kernel

On Sat, Oct 5, 2024 at 12:04 PM Thomas Weißschuh <linux@weissschuh.net> wrote:

> The power supply core never modifies the resist table.
> Reflect this in the API, so drivers can mark their static tables as
> const.
>
> Signed-off-by: Thomas Weißschuh <linux@weissschuh.net>

The series:
Reviewed-by: Linus Walleij <linus.walleij@linaro.org>

Yours,
Linus Walleij

^ permalink raw reply	[flat|nested] 12+ messages in thread

* Re: [PATCH 0/7] power: supply: constify ocv and resistance tables
  2024-10-05 10:04 [PATCH 0/7] power: supply: constify ocv and resistance tables Thomas Weißschuh
                   ` (6 preceding siblings ...)
  2024-10-05 10:04 ` [PATCH 7/7] power: supply: samsung-sdi-battery: " Thomas Weißschuh
@ 2024-10-09 16:06 ` Linus Walleij
  2024-10-15 21:01 ` Sebastian Reichel
  8 siblings, 0 replies; 12+ messages in thread
From: Linus Walleij @ 2024-10-09 16:06 UTC (permalink / raw)
  To: Thomas Weißschuh
  Cc: Sebastian Reichel, Orson Zhai, Baolin Wang, Chunyan Zhang,
	linux-pm, linux-kernel

On Sat, Oct 5, 2024 at 12:04 PM Thomas Weißschuh <linux@weissschuh.net> wrote:

> These tables are nevery modified. Reflect this in the API and constify
> the table definitions.
>
> Signed-off-by: Thomas Weißschuh <linux@weissschuh.net>

Reviewed-by: Linus Walleij <linus.walleij@linaro.org>

Yours,
Linus Walleij

^ permalink raw reply	[flat|nested] 12+ messages in thread

* Re: [PATCH 4/7] power: supply: sc27xx: use const reference to ocv table
  2024-10-05 10:04 ` [PATCH 4/7] power: supply: sc27xx: use const reference to ocv table Thomas Weißschuh
@ 2024-10-10  9:24   ` Baolin Wang
  0 siblings, 0 replies; 12+ messages in thread
From: Baolin Wang @ 2024-10-10  9:24 UTC (permalink / raw)
  To: Thomas Weißschuh, Sebastian Reichel, Linus Walleij,
	Orson Zhai, Chunyan Zhang
  Cc: linux-pm, linux-kernel



On 2024/10/5 18:04, Thomas Weißschuh wrote:
> The table is not modified, so constify the reference.
> This enables a constification in the power supply core.
> 
> Signed-off-by: Thomas Weißschuh <linux@weissschuh.net>

Thanks.
Reviewed-by: Baolin Wang <baolin.wang@linux.alibaba.com>

> ---
>   drivers/power/supply/sc27xx_fuel_gauge.c | 2 +-
>   1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/drivers/power/supply/sc27xx_fuel_gauge.c b/drivers/power/supply/sc27xx_fuel_gauge.c
> index bd23c4d9fed43482e972ccc086311e7bfcec2d54..426d423b935b581a7673be076ae71b8899f17e2e 100644
> --- a/drivers/power/supply/sc27xx_fuel_gauge.c
> +++ b/drivers/power/supply/sc27xx_fuel_gauge.c
> @@ -992,7 +992,7 @@ static int sc27xx_fgu_calibration(struct sc27xx_fgu_data *data)
>   static int sc27xx_fgu_hw_init(struct sc27xx_fgu_data *data)
>   {
>   	struct power_supply_battery_info *info;
> -	struct power_supply_battery_ocv_table *table;
> +	const struct power_supply_battery_ocv_table *table;
>   	int ret, delta_clbcnt, alarm_adc;
>   
>   	ret = power_supply_get_battery_info(data->battery, &info);
> 

^ permalink raw reply	[flat|nested] 12+ messages in thread

* Re: [PATCH 0/7] power: supply: constify ocv and resistance tables
  2024-10-05 10:04 [PATCH 0/7] power: supply: constify ocv and resistance tables Thomas Weißschuh
                   ` (7 preceding siblings ...)
  2024-10-09 16:06 ` [PATCH 0/7] power: supply: constify ocv and resistance tables Linus Walleij
@ 2024-10-15 21:01 ` Sebastian Reichel
  8 siblings, 0 replies; 12+ messages in thread
From: Sebastian Reichel @ 2024-10-15 21:01 UTC (permalink / raw)
  To: Sebastian Reichel, Linus Walleij, Orson Zhai, Baolin Wang,
	Chunyan Zhang, Thomas Weißschuh
  Cc: linux-pm, linux-kernel


On Sat, 05 Oct 2024 12:04:16 +0200, Thomas Weißschuh wrote:
> These tables are nevery modified. Reflect this in the API and constify
> the table definitions.
> 
> 

Applied, thanks!

[1/7] power: supply: core: constify power_supply_battery_info::resist_table
      commit: 58797abed49d6b78c7af99b03b037f20c7ffb203
[2/7] power: supply: ab8500: constify resistance table
      commit: 40d00fa5a8be87812a7acb6524eb3d8fd3ea42b9
[3/7] power: supply: samsung-sdi-battery: constify resistance table
      commit: 27fde3aa4f924793966c8aa5b10506c41ce933e1
[4/7] power: supply: sc27xx: use const reference to ocv table
      commit: 840683c341907b37173e270798607a83462118f1
[5/7] power: supply: core: constify power_supply_battery_info::ocv_table
      commit: ce20d5b9e37099a035ab34d4d3f59e1744756385
[6/7] power: supply: ab8500: constify ocv table
      commit: b7b6bf444529c2ead9416e79d8dd8a2cb832cd24
[7/7] power: supply: samsung-sdi-battery: constify ocv table
      commit: b5289ba57a27a212acad14b81ec6597ce140e01d

Best regards,
-- 
Sebastian Reichel <sebastian.reichel@collabora.com>


^ permalink raw reply	[flat|nested] 12+ messages in thread

end of thread, other threads:[~2024-10-15 21:01 UTC | newest]

Thread overview: 12+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2024-10-05 10:04 [PATCH 0/7] power: supply: constify ocv and resistance tables Thomas Weißschuh
2024-10-05 10:04 ` [PATCH 1/7] power: supply: core: constify power_supply_battery_info::resist_table Thomas Weißschuh
2024-10-09 16:05   ` Linus Walleij
2024-10-05 10:04 ` [PATCH 2/7] power: supply: ab8500: constify resistance table Thomas Weißschuh
2024-10-05 10:04 ` [PATCH 3/7] power: supply: samsung-sdi-battery: " Thomas Weißschuh
2024-10-05 10:04 ` [PATCH 4/7] power: supply: sc27xx: use const reference to ocv table Thomas Weißschuh
2024-10-10  9:24   ` Baolin Wang
2024-10-05 10:04 ` [PATCH 5/7] power: supply: core: constify power_supply_battery_info::ocv_table Thomas Weißschuh
2024-10-05 10:04 ` [PATCH 6/7] power: supply: ab8500: constify ocv table Thomas Weißschuh
2024-10-05 10:04 ` [PATCH 7/7] power: supply: samsung-sdi-battery: " Thomas Weißschuh
2024-10-09 16:06 ` [PATCH 0/7] power: supply: constify ocv and resistance tables Linus Walleij
2024-10-15 21:01 ` Sebastian Reichel

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

Powered by JetHome