From patchwork Sat Oct 5 10:04:17 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Thomas_Wei=C3=9Fschuh?= X-Patchwork-Id: 833312 Received: from todd.t-8ch.de (todd.t-8ch.de [159.69.126.157]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 6A901231CA7; Sat, 5 Oct 2024 10:04:46 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=159.69.126.157 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1728122689; cv=none; b=qWs/R67zBVRbAe0DSyc2x/mh1kzS/RQIswiiwaGsUQpY1XhWZczu4PICvSmmetAFIY8LgMgNYSxEOT8feBzHZJ7VQ3O8iRIsTp4EoNblAyUB1GufyB1wf+uKju6b+gF9oTmG8HC6CJICUOI2t0zpYSatIn9ps1iKSMA7bxdFau0= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1728122689; c=relaxed/simple; bh=4qTTd8cHY8k//IB2AglhRt3irpRoC0iA10R9Vbg+F/4=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=exbJ8j+ZJNgbj3zn7JtlyJMBixtt8iSVvZWrg9KI0hzc78UgIrlRrHzldscmV1AmWzH9vy+79eO3aTWjlLKWmqbeRMHbh5ZcoFuFGbQuNNq5Aad86OrilF8z+/ulfw/+26rHdhHoWbe3g1rCnJGVAtdlGng2Z8jCr1FQLZb2eCk= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=weissschuh.net; spf=pass smtp.mailfrom=weissschuh.net; dkim=pass (1024-bit key) header.d=weissschuh.net header.i=@weissschuh.net header.b=VN7QjWKX; arc=none smtp.client-ip=159.69.126.157 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=weissschuh.net Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=weissschuh.net Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=weissschuh.net header.i=@weissschuh.net header.b="VN7QjWKX" DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=weissschuh.net; s=mail; t=1728122684; bh=4qTTd8cHY8k//IB2AglhRt3irpRoC0iA10R9Vbg+F/4=; h=From:Date:Subject:References:In-Reply-To:To:Cc:From; b=VN7QjWKXFo6jglN3i1vC7Ju5aPAgAG201MP5fTmnz8VIAOc/25zmbsBB8H/sFdK0r oxxvMY6I0KG9L4Fb4xTaZb/9uRueVxxMZFrMLRc9GP3Z7v41GF+ZMCQZiq9SDmPMxy VYfcOsC6QxuljbArpqLf/Pv8WqM9cjENHoEi5n5c= From: =?utf-8?q?Thomas_Wei=C3=9Fschuh?= Date: Sat, 05 Oct 2024 12:04:17 +0200 Subject: [PATCH 1/7] power: supply: core: constify power_supply_battery_info::resist_table Precedence: bulk X-Mailing-List: linux-pm@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Message-Id: <20241005-power-supply-battery-const-v1-1-c1f721927048@weissschuh.net> References: <20241005-power-supply-battery-const-v1-0-c1f721927048@weissschuh.net> In-Reply-To: <20241005-power-supply-battery-const-v1-0-c1f721927048@weissschuh.net> To: Sebastian Reichel , Linus Walleij , Orson Zhai , Baolin Wang , Chunyan Zhang Cc: linux-pm@vger.kernel.org, linux-kernel@vger.kernel.org, =?utf-8?q?Thomas?= =?utf-8?q?_Wei=C3=9Fschuh?= X-Mailer: b4 0.14.2 X-Developer-Signature: v=1; a=ed25519-sha256; t=1728122683; l=2652; i=linux@weissschuh.net; s=20221212; h=from:subject:message-id; bh=4qTTd8cHY8k//IB2AglhRt3irpRoC0iA10R9Vbg+F/4=; b=tK9N8tIuwWtttiO3whPdsgexMcPtCHKhcx+7OvB8PdFIWnJbarRuXMd6DMZYNPv0/HcfS/JRX 4NBROc0m8mACyCeeLhUhg7X6w4qZth+qoC3q3ezhbeHNzv+Od+1JyUh X-Developer-Key: i=linux@weissschuh.net; a=ed25519; pk=KcycQgFPX2wGR5azS7RhpBqedglOZVgRPfdFSPB1LNw= 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 Reviewed-by: Linus Walleij --- 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); From patchwork Sat Oct 5 10:04:18 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Thomas_Wei=C3=9Fschuh?= X-Patchwork-Id: 833176 Received: from todd.t-8ch.de (todd.t-8ch.de [159.69.126.157]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id B2445136337; Sat, 5 Oct 2024 10:04:46 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=159.69.126.157 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1728122689; cv=none; b=RT7zPRX0SonWp4XXb3yrJslYYU7nF3zeCONOCXhjwOVcS4ew+3/ioBHt8ZEyTZp5zRNdJ+1rYmkQSi8QxyooaLPTgjAe3V/GMv8V2YNhbQZAr5Dy4G0wogdu2U9fljg4qjQKaOQTdBQbrTjgy4/DtvCB/yjfBaSfu0RzPQ2UvS8= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1728122689; c=relaxed/simple; bh=+l2pGuOAnlI1p5kUoYdQR6K905nYeVw99+tbMlmF4S0=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=ApEcIcmrt5qcTo7krjJh25i6YsqrDWzI+x67l6ZuVKf0D8tbN+47BLIcl8ZIG9FNw7W7eOLsoTWBYVj4zE31GjvQAKnIVaAqOIk6Btr9dtGVsGK4pq2sfL+aS5b4nfTlkkGd1ZutdrqdjD1vpeRbMesHG/vIQ9LJQNEinIYzfY4= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=weissschuh.net; spf=pass smtp.mailfrom=weissschuh.net; dkim=pass (1024-bit key) header.d=weissschuh.net header.i=@weissschuh.net header.b=MbENSiQz; arc=none smtp.client-ip=159.69.126.157 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=weissschuh.net Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=weissschuh.net Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=weissschuh.net header.i=@weissschuh.net header.b="MbENSiQz" DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=weissschuh.net; s=mail; t=1728122684; bh=+l2pGuOAnlI1p5kUoYdQR6K905nYeVw99+tbMlmF4S0=; h=From:Date:Subject:References:In-Reply-To:To:Cc:From; b=MbENSiQzNmRJBB5dFqpYyW0CUm5DoUJICB/7xn9ihkixHYf9wzd475tSXDwDLTkSU G0Wqvimtzu9gBMA51PtCzq29PJ70oWjtQtphKVXIIJBeEn/EUxbBJgXc6Uy8o8zxOR whrLZNP6INwXLxO7S7ANZKwiQEWr0wTpS4tOgOZ0= From: =?utf-8?q?Thomas_Wei=C3=9Fschuh?= Date: Sat, 05 Oct 2024 12:04:18 +0200 Subject: [PATCH 2/7] power: supply: ab8500: constify resistance table Precedence: bulk X-Mailing-List: linux-pm@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Message-Id: <20241005-power-supply-battery-const-v1-2-c1f721927048@weissschuh.net> References: <20241005-power-supply-battery-const-v1-0-c1f721927048@weissschuh.net> In-Reply-To: <20241005-power-supply-battery-const-v1-0-c1f721927048@weissschuh.net> To: Sebastian Reichel , Linus Walleij , Orson Zhai , Baolin Wang , Chunyan Zhang Cc: linux-pm@vger.kernel.org, linux-kernel@vger.kernel.org, =?utf-8?q?Thomas?= =?utf-8?q?_Wei=C3=9Fschuh?= X-Mailer: b4 0.14.2 X-Developer-Signature: v=1; a=ed25519-sha256; t=1728122683; l=1125; i=linux@weissschuh.net; s=20221212; h=from:subject:message-id; bh=+l2pGuOAnlI1p5kUoYdQR6K905nYeVw99+tbMlmF4S0=; b=R8Pla5NqT6Y23irNX/MFV7AxWBIQUfi3KOdQSyGqD2FBVHOFE1lN6auREKfih0sd82apgRjd9 eREXhH4c65DDCHt9knioh/uvfK/Zh4FNJ2c8kI6azp6cbFEHKtb7syQ X-Developer-Key: i=linux@weissschuh.net; a=ed25519; pk=KcycQgFPX2wGR5azS7RhpBqedglOZVgRPfdFSPB1LNw= The power supply core now allows this constification. Prevent accidental or malicious modification of the data. Signed-off-by: Thomas Weißschuh --- 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 */ }, From patchwork Sat Oct 5 10:04:19 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Thomas_Wei=C3=9Fschuh?= X-Patchwork-Id: 833313 Received: from todd.t-8ch.de (todd.t-8ch.de [159.69.126.157]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id ECCC8136349; Sat, 5 Oct 2024 10:04:46 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=159.69.126.157 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1728122689; cv=none; b=O5U6nVgvnZxpL7OY5NQOsNiIkJOl4ZdSMzxb3nUgsLM64YksDv8+O5g+xMRTQFLTuWoZEWTKG6+04Ps8pM3n/eqANp13vq2iDbfOlPZD0IfJSWAY8JPTeKTjmJ2nycHnUGD6R/IrubF7GAF7bvzhrDi19IEuKE7GnP+LJbIEXko= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1728122689; c=relaxed/simple; bh=AwYwiT2DeM2wVq1UwoseCa2sO84nhlWpq31txXWMSQE=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=E00BoG4gSZpFepXGxdvJVQ0vhmvD3c6BGDPkYv+rrocqSQzkXuLsfihQ3hPyQsUuR2rlXkLFXWIBzGGpyzuAVRIl/8m5gJ78id7agUh7LvvN1eFRNc9NbXmapvwcGDATNEGQ9d4VQIiO9+r5WeWb3Lx/v80S8+UisXdjH+NyrLU= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=weissschuh.net; spf=pass smtp.mailfrom=weissschuh.net; dkim=pass (1024-bit key) header.d=weissschuh.net header.i=@weissschuh.net header.b=TaJF7eIB; arc=none smtp.client-ip=159.69.126.157 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=weissschuh.net Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=weissschuh.net Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=weissschuh.net header.i=@weissschuh.net header.b="TaJF7eIB" DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=weissschuh.net; s=mail; t=1728122684; bh=AwYwiT2DeM2wVq1UwoseCa2sO84nhlWpq31txXWMSQE=; h=From:Date:Subject:References:In-Reply-To:To:Cc:From; b=TaJF7eIB0+nzM2l5m6N4sVRy8C7mdn/Otg/147qaEivoRYvXabb81daAcfZC9kqE2 tr5z3taDitdzrQHSHDGJE/EqdozU4fUZ6SqRcYfh6tbMdZ0TwQUMGiZbZhm8AtJPUM Bg/oAC9INA4Lcxef1/1ataOoOKPayORp3V2lbtcE= From: =?utf-8?q?Thomas_Wei=C3=9Fschuh?= Date: Sat, 05 Oct 2024 12:04:19 +0200 Subject: [PATCH 3/7] power: supply: samsung-sdi-battery: constify resistance table Precedence: bulk X-Mailing-List: linux-pm@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Message-Id: <20241005-power-supply-battery-const-v1-3-c1f721927048@weissschuh.net> References: <20241005-power-supply-battery-const-v1-0-c1f721927048@weissschuh.net> In-Reply-To: <20241005-power-supply-battery-const-v1-0-c1f721927048@weissschuh.net> To: Sebastian Reichel , Linus Walleij , Orson Zhai , Baolin Wang , Chunyan Zhang Cc: linux-pm@vger.kernel.org, linux-kernel@vger.kernel.org, =?utf-8?q?Thomas?= =?utf-8?q?_Wei=C3=9Fschuh?= X-Mailer: b4 0.14.2 X-Developer-Signature: v=1; a=ed25519-sha256; t=1728122683; l=1114; i=linux@weissschuh.net; s=20221212; h=from:subject:message-id; bh=AwYwiT2DeM2wVq1UwoseCa2sO84nhlWpq31txXWMSQE=; b=qmXj7XvxaS6SK4/Sp2D3XOW7fmip94fNft/oIVu1Db0RHo82w4sTF95qCTAHgGy1Kq9Ko3Erz 1VoEUftrA6qBCGRRt9sk2sZsiHLon4dGrm//jU6H6NZG+aMpW53X1XR X-Developer-Key: i=linux@weissschuh.net; a=ed25519; pk=KcycQgFPX2wGR5azS7RhpBqedglOZVgRPfdFSPB1LNw= The power supply core now allows this constification. Prevent accidental or malicious modification of the data. Signed-off-by: Thomas Weißschuh --- 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 }, From patchwork Sat Oct 5 10:04:20 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Thomas_Wei=C3=9Fschuh?= X-Patchwork-Id: 833311 Received: from todd.t-8ch.de (todd.t-8ch.de [159.69.126.157]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id D5C53149013; Sat, 5 Oct 2024 10:04:49 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=159.69.126.157 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1728122691; cv=none; b=RaSXUc6rCqDkgtySEakpRlUyuNcBjisK88/MXaA+2eDJzWfhX+Kte6Q8GPwqZAKGqLhMkmDo7O6mQX3o8TkfAH5Wm3LJut90oD/g8glXc8bs3D20qXHUZSiJ/uZWmo6mo0IJOzWLjLaR1iOQm48sPTFtSmaLp8rz24Vx7Zj5wdo= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1728122691; c=relaxed/simple; bh=1aycd4QjgM3twjcHPu5RfSlFvnFJGjYZ0UUPaZfkKpU=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=Wy0PSUghnfhTm47mh5ekZ8f4FK/yLPNtWYHPGES6xhTC2rydNmYyacvy1fj07ovbx5SOs9Tfr+4sSsw6rhpKf6t3lvubZRRbw4++a+MQj1IU924yvCZ0C38BvQ+HZ+fTi4OX2PoEIXY7/bEqnweO049ZYteIWPQCkvGXK3U/7PM= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=weissschuh.net; spf=pass smtp.mailfrom=weissschuh.net; dkim=pass (1024-bit key) header.d=weissschuh.net header.i=@weissschuh.net header.b=S69peaYp; arc=none smtp.client-ip=159.69.126.157 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=weissschuh.net Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=weissschuh.net Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=weissschuh.net header.i=@weissschuh.net header.b="S69peaYp" DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=weissschuh.net; s=mail; t=1728122684; bh=1aycd4QjgM3twjcHPu5RfSlFvnFJGjYZ0UUPaZfkKpU=; h=From:Date:Subject:References:In-Reply-To:To:Cc:From; b=S69peaYpHJAnEEIJgo43r3BppS9kiqF0RM1obBfUEifVUlnk7+hZBfmpMyO40FEpv eGINlTHZkCQvm+8jG92/L1sly+ttFjtQgdyA4VcOH8y0xzSdjrtzL9g04n+/uNq/Z+ JdHtlaLr5Kf/YPvnWcQyOIWeqQdj/T58XYWGe12A= From: =?utf-8?q?Thomas_Wei=C3=9Fschuh?= Date: Sat, 05 Oct 2024 12:04:20 +0200 Subject: [PATCH 4/7] power: supply: sc27xx: use const reference to ocv table Precedence: bulk X-Mailing-List: linux-pm@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Message-Id: <20241005-power-supply-battery-const-v1-4-c1f721927048@weissschuh.net> References: <20241005-power-supply-battery-const-v1-0-c1f721927048@weissschuh.net> In-Reply-To: <20241005-power-supply-battery-const-v1-0-c1f721927048@weissschuh.net> To: Sebastian Reichel , Linus Walleij , Orson Zhai , Baolin Wang , Chunyan Zhang Cc: linux-pm@vger.kernel.org, linux-kernel@vger.kernel.org, =?utf-8?q?Thomas?= =?utf-8?q?_Wei=C3=9Fschuh?= X-Mailer: b4 0.14.2 X-Developer-Signature: v=1; a=ed25519-sha256; t=1728122683; l=982; i=linux@weissschuh.net; s=20221212; h=from:subject:message-id; bh=1aycd4QjgM3twjcHPu5RfSlFvnFJGjYZ0UUPaZfkKpU=; b=8ID4HvF5nYm05f3Bl8tRwMYItx+s/IjINSd8wSzfMesTYQbsOFGFa55u+r9VkMxLl070BTNIH uxqF0wLHY9mDUqckKN8I81F5HcfuEENZnrNBJDkWDBEjlZb/nxO3sar X-Developer-Key: i=linux@weissschuh.net; a=ed25519; pk=KcycQgFPX2wGR5azS7RhpBqedglOZVgRPfdFSPB1LNw= The table is not modified, so constify the reference. This enables a constification in the power supply core. Signed-off-by: Thomas Weißschuh Reviewed-by: Baolin Wang --- 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); From patchwork Sat Oct 5 10:04:21 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Thomas_Wei=C3=9Fschuh?= X-Patchwork-Id: 833175 Received: from todd.t-8ch.de (todd.t-8ch.de [159.69.126.157]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id ECD161369BC; Sat, 5 Oct 2024 10:04:46 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=159.69.126.157 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1728122690; cv=none; b=rWBPgK4Isu1yOtxDb0u9zV1pnFIQ2Oh5KjxRCVgvCzZwgM41uJctcxSJ1n5NxlgqWAAI5I4sY/FITxtn9BgwzgiL48tiIPXBi+dsFhPsYEd32Z++ZQ0s8v2ow7NE6yiTFS2iPuclZkmqgyvHLFR3DbGjZ8erLec+EvRwTV8bNps= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1728122690; c=relaxed/simple; bh=vnWYEzhPiz5A5M5J8q/Fl3cT74nVDkwiVz6Uf8mnxDk=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=hiOvlTqrDjEFhf/5DkXPR09p2M1OCFB8/BJmMhDzW1jOyU6lM+Qg5d4xz3MJ/V57MuPfBap/FAazhRGCEufn/4MJbYOejbVJii+AUfUm0UqNtSa8oxErnSnSq9AzmmMemsomhq5I4bMDN8AkISAvCn/1VQLVk+a8Zsix89u0qOo= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=weissschuh.net; spf=pass smtp.mailfrom=weissschuh.net; dkim=pass (1024-bit key) header.d=weissschuh.net header.i=@weissschuh.net header.b=OwaAcMQf; arc=none smtp.client-ip=159.69.126.157 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=weissschuh.net Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=weissschuh.net Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=weissschuh.net header.i=@weissschuh.net header.b="OwaAcMQf" DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=weissschuh.net; s=mail; t=1728122684; bh=vnWYEzhPiz5A5M5J8q/Fl3cT74nVDkwiVz6Uf8mnxDk=; h=From:Date:Subject:References:In-Reply-To:To:Cc:From; b=OwaAcMQfqzTsGFw1+nfHdyHe7S+/qH/mDV/1/UjFYFxDlA4kP91+z+3jPhS+lFuZk LO8j2APotgwrGSoQQXkTVljybvC9l1mxtCGdsNyADwe6iDHBa3011rSXv60RMo89xr 6fJ3RG4J4wR4PEBJBrqlWdvJPxxJ9jNtK3an1fys= From: =?utf-8?q?Thomas_Wei=C3=9Fschuh?= Date: Sat, 05 Oct 2024 12:04:21 +0200 Subject: [PATCH 5/7] power: supply: core: constify power_supply_battery_info::ocv_table Precedence: bulk X-Mailing-List: linux-pm@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Message-Id: <20241005-power-supply-battery-const-v1-5-c1f721927048@weissschuh.net> References: <20241005-power-supply-battery-const-v1-0-c1f721927048@weissschuh.net> In-Reply-To: <20241005-power-supply-battery-const-v1-0-c1f721927048@weissschuh.net> To: Sebastian Reichel , Linus Walleij , Orson Zhai , Baolin Wang , Chunyan Zhang Cc: linux-pm@vger.kernel.org, linux-kernel@vger.kernel.org, =?utf-8?q?Thomas?= =?utf-8?q?_Wei=C3=9Fschuh?= X-Mailer: b4 0.14.2 X-Developer-Signature: v=1; a=ed25519-sha256; t=1728122683; l=3599; i=linux@weissschuh.net; s=20221212; h=from:subject:message-id; bh=vnWYEzhPiz5A5M5J8q/Fl3cT74nVDkwiVz6Uf8mnxDk=; b=fNUGfthWMCXploCkKZ9eALkkhKRYRvUbIQAh97b9aWHPKvGzOkYV+TzQnIVUXuXXFl5nUFu1q TfbPz9gAdr2CmXT4aF2lXgZBdl/rpQbb2LrupRjOK1inzTfOjN/hs9K X-Developer-Key: i=linux@weissschuh.net; a=ed25519; pk=KcycQgFPX2wGR5azS7RhpBqedglOZVgRPfdFSPB1LNw= 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 --- 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, From patchwork Sat Oct 5 10:04:22 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Thomas_Wei=C3=9Fschuh?= X-Patchwork-Id: 833310 Received: from todd.t-8ch.de (todd.t-8ch.de [159.69.126.157]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 2FEF914C5B5; Sat, 5 Oct 2024 10:04:50 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=159.69.126.157 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1728122692; cv=none; b=WoEPMl+5Ap/y/D2caIIyO0XkHOEQfX6W3ya3tZATui7j3A5Iu8V6vp0vsG/aol6b82q9Py4Ilr5WUi+4mrnlFmbEnG9xd97/OGufEuzJuoahE3Mup6BMO9BHDI7RmKlK79/hVGYFvTcmmgnF2BrNY4XhwrpNB3bPotx9CBtqnm8= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1728122692; c=relaxed/simple; bh=G7hFn53Hx/armmZCWo8cg+1e0J/zbMPD5IhuGApPuV4=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=bOu/ObGqBBaLCf3YENBBYhA2+p2qUJssX+Vbp9b7h7tTIJA+dYgkY6DOzFWPCQeKDRtBqghXE6f2BjzrvNrCCUQaY49fHYwR2rIZnAK5VZmbmM++3gBSPx+VQuVPx5sNIhL7pIdRwrmKYJ9xOIps+C9o7hETIxZJ7YybfaquiM4= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=weissschuh.net; spf=pass smtp.mailfrom=weissschuh.net; dkim=pass (1024-bit key) header.d=weissschuh.net header.i=@weissschuh.net header.b=OTfMmLXu; arc=none smtp.client-ip=159.69.126.157 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=weissschuh.net Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=weissschuh.net Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=weissschuh.net header.i=@weissschuh.net header.b="OTfMmLXu" DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=weissschuh.net; s=mail; t=1728122684; bh=G7hFn53Hx/armmZCWo8cg+1e0J/zbMPD5IhuGApPuV4=; h=From:Date:Subject:References:In-Reply-To:To:Cc:From; b=OTfMmLXuJtpBcquKC7KAfgSS3aCISaPH9eNFwhJdhwZv9963BBv7H7HkHctm4maBt 0GT7uYTwolZt3c03B6Plr1cLaHcqHODHQ3s7OigaSedCP8Be4oYFEp7IBKBG/5ftYe gESZMJoNDgTPn76ddsggTEzdgguMNkM7IZ1D1dyA= From: =?utf-8?q?Thomas_Wei=C3=9Fschuh?= Date: Sat, 05 Oct 2024 12:04:22 +0200 Subject: [PATCH 6/7] power: supply: ab8500: constify ocv table Precedence: bulk X-Mailing-List: linux-pm@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Message-Id: <20241005-power-supply-battery-const-v1-6-c1f721927048@weissschuh.net> References: <20241005-power-supply-battery-const-v1-0-c1f721927048@weissschuh.net> In-Reply-To: <20241005-power-supply-battery-const-v1-0-c1f721927048@weissschuh.net> To: Sebastian Reichel , Linus Walleij , Orson Zhai , Baolin Wang , Chunyan Zhang Cc: linux-pm@vger.kernel.org, linux-kernel@vger.kernel.org, =?utf-8?q?Thomas?= =?utf-8?q?_Wei=C3=9Fschuh?= X-Mailer: b4 0.14.2 X-Developer-Signature: v=1; a=ed25519-sha256; t=1728122683; l=912; i=linux@weissschuh.net; s=20221212; h=from:subject:message-id; bh=G7hFn53Hx/armmZCWo8cg+1e0J/zbMPD5IhuGApPuV4=; b=0NizM4/ou17qrDgIW2R6hywiNqZWjrLMRyiJqMrqhhsBwrsGGjKCWxRr22taXIvwHFBuulhi+ oETkVsI8b0IAuP1r8skOlb0pZly3vIuJfpdua/3597aP1N7puRYmBSt X-Developer-Key: i=linux@weissschuh.net; a=ed25519; pk=KcycQgFPX2wGR5azS7RhpBqedglOZVgRPfdFSPB1LNw= The power supply core now allows this constification. Prevent accidental or malicious modification of the data. Signed-off-by: Thomas Weißschuh --- 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}, From patchwork Sat Oct 5 10:04:23 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Thomas_Wei=C3=9Fschuh?= X-Patchwork-Id: 833174 Received: from todd.t-8ch.de (todd.t-8ch.de [159.69.126.157]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 1B45D149C7A; Sat, 5 Oct 2024 10:04:49 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=159.69.126.157 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1728122691; cv=none; b=LJRWvh0JS3JMhz4pnq9mY+ZnqcQDClDMOmkf8CoHjAjyU4EXW5ZcmcZyMEEsF4W9MPk97T4vtrgvgRFO5vOsYVHtkUO3QSPkvPeDjfyff+htLCgIsRd9I1mvsIH/yYYl0Q3ZrkL2LrIGciVd/FXgsjDtDDkRV1w1jCvOfHWTekw= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1728122691; c=relaxed/simple; bh=fG25pPqPUSkyr8a2zQoffk/BcWOXq6/l1QyvlkGHiqg=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=otcq5UGA8H/pMlldubN4nJPzyX4fLlz/aUVdWjQnba3VzJcbqSjCflwVm/gl0ohQz7wnBt7fVnSuZDpK4b0F1OZhBk3JCFRdDxqf19P43ItBHnya8PB6O3sBiqzFW38XlQzAtkKKy3x6RWcWeO+9cDFod8sh9teXKTqEwmjnSXY= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=weissschuh.net; spf=pass smtp.mailfrom=weissschuh.net; dkim=pass (1024-bit key) header.d=weissschuh.net header.i=@weissschuh.net header.b=D7YyuQY1; arc=none smtp.client-ip=159.69.126.157 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=weissschuh.net Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=weissschuh.net Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=weissschuh.net header.i=@weissschuh.net header.b="D7YyuQY1" DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=weissschuh.net; s=mail; t=1728122684; bh=fG25pPqPUSkyr8a2zQoffk/BcWOXq6/l1QyvlkGHiqg=; h=From:Date:Subject:References:In-Reply-To:To:Cc:From; b=D7YyuQY16aeP14n4/0NbURg9QUmFLm2nAmea4TqI8AkrXQaRldR+V/RC6csVWvAxB OZIcDVHv6tLJTu4dy/7FA0pcZW3wK/6UPMY6ufMUazZjSd8sENRuplmOVsMkoe+Gl0 lXmdbi/LVmXaMIvQKT12AmRaTDrQe2ewhRSj41ro= From: =?utf-8?q?Thomas_Wei=C3=9Fschuh?= Date: Sat, 05 Oct 2024 12:04:23 +0200 Subject: [PATCH 7/7] power: supply: samsung-sdi-battery: constify ocv table Precedence: bulk X-Mailing-List: linux-pm@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Message-Id: <20241005-power-supply-battery-const-v1-7-c1f721927048@weissschuh.net> References: <20241005-power-supply-battery-const-v1-0-c1f721927048@weissschuh.net> In-Reply-To: <20241005-power-supply-battery-const-v1-0-c1f721927048@weissschuh.net> To: Sebastian Reichel , Linus Walleij , Orson Zhai , Baolin Wang , Chunyan Zhang Cc: linux-pm@vger.kernel.org, linux-kernel@vger.kernel.org, =?utf-8?q?Thomas?= =?utf-8?q?_Wei=C3=9Fschuh?= X-Mailer: b4 0.14.2 X-Developer-Signature: v=1; a=ed25519-sha256; t=1728122683; l=2342; i=linux@weissschuh.net; s=20221212; h=from:subject:message-id; bh=fG25pPqPUSkyr8a2zQoffk/BcWOXq6/l1QyvlkGHiqg=; b=R5veXLGLavA7E332CjyjZI7xjw+FpI71xLof/yJX0E3W7oftC0ZRylnnwMjgFAx3YPeOhb3tA SywIafUrmjACjws0wtjOgWo5XSy3icQBiX7+Ay9ETu2pFr6zLgtAQ1T X-Developer-Key: i=linux@weissschuh.net; a=ed25519; pk=KcycQgFPX2wGR5azS7RhpBqedglOZVgRPfdFSPB1LNw= The power supply core now allows this constification. Prevent accidental or malicious modification of the data. Signed-off-by: Thomas Weißschuh --- 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},