mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Krzysztof Kozlowski <krzysztof.kozlowski@linaro.org>
To: Support Opensource <support.opensource@diasemi.com>,
	 Liam Girdwood <lgirdwood@gmail.com>,
	Mark Brown <broonie@kernel.org>,
	 Matthias Brugger <matthias.bgg@gmail.com>,
	 AngeloGioacchino Del Regno
	<angelogioacchino.delregno@collabora.com>,
	 Bartosz Golaszewski <brgl@bgdev.pl>
Cc: linux-kernel@vger.kernel.org,
	linux-arm-kernel@lists.infradead.org,
	 linux-mediatek@lists.infradead.org,
	linux-arm-msm@vger.kernel.org,
	 Krzysztof Kozlowski <krzysztof.kozlowski@linaro.org>
Subject: [PATCH 04/17] regulator: da9121: Constify static data
Date: Mon, 09 Sep 2024 15:51:15 +0200	[thread overview]
Message-ID: <20240909-regulator-const-v1-4-8934704a5787@linaro.org> (raw)
In-Reply-To: <20240909-regulator-const-v1-0-8934704a5787@linaro.org>

Driver does not modify static data with regulator description (struct
da9121_range), so make it const for code safety.

Signed-off-by: Krzysztof Kozlowski <krzysztof.kozlowski@linaro.org>
---
 drivers/regulator/da9121-regulator.c | 20 ++++++++++----------
 1 file changed, 10 insertions(+), 10 deletions(-)

diff --git a/drivers/regulator/da9121-regulator.c b/drivers/regulator/da9121-regulator.c
index 5524bd314f13..ef161eb0ca27 100644
--- a/drivers/regulator/da9121-regulator.c
+++ b/drivers/regulator/da9121-regulator.c
@@ -53,7 +53,7 @@ struct da9121_range {
 	int reg_max;
 };
 
-static struct da9121_range da9121_10A_2phase_current = {
+static const struct da9121_range da9121_10A_2phase_current = {
 	.val_min =  7000000,
 	.val_max = 20000000,
 	.val_stp =  1000000,
@@ -61,7 +61,7 @@ static struct da9121_range da9121_10A_2phase_current = {
 	.reg_max = 14,
 };
 
-static struct da9121_range da9121_6A_2phase_current = {
+static const struct da9121_range da9121_6A_2phase_current = {
 	.val_min =  7000000,
 	.val_max = 12000000,
 	.val_stp =  1000000,
@@ -69,7 +69,7 @@ static struct da9121_range da9121_6A_2phase_current = {
 	.reg_max = 6,
 };
 
-static struct da9121_range da9121_5A_1phase_current = {
+static const struct da9121_range da9121_5A_1phase_current = {
 	.val_min =  3500000,
 	.val_max = 10000000,
 	.val_stp =   500000,
@@ -77,7 +77,7 @@ static struct da9121_range da9121_5A_1phase_current = {
 	.reg_max = 14,
 };
 
-static struct da9121_range da9121_3A_1phase_current = {
+static const struct da9121_range da9121_3A_1phase_current = {
 	.val_min = 3500000,
 	.val_max = 6000000,
 	.val_stp =  500000,
@@ -85,7 +85,7 @@ static struct da9121_range da9121_3A_1phase_current = {
 	.reg_max = 6,
 };
 
-static struct da9121_range da914x_40A_4phase_current = {
+static const struct da9121_range da914x_40A_4phase_current = {
 	.val_min = 26000000,
 	.val_max = 78000000,
 	.val_stp =  4000000,
@@ -93,7 +93,7 @@ static struct da9121_range da914x_40A_4phase_current = {
 	.reg_max = 14,
 };
 
-static struct da9121_range da914x_20A_2phase_current = {
+static const struct da9121_range da914x_20A_2phase_current = {
 	.val_min = 13000000,
 	.val_max = 39000000,
 	.val_stp =  2000000,
@@ -104,7 +104,7 @@ static struct da9121_range da914x_20A_2phase_current = {
 struct da9121_variant_info {
 	int num_bucks;
 	int num_phases;
-	struct da9121_range *current_range;
+	const struct da9121_range *current_range;
 };
 
 static const struct da9121_variant_info variant_parameters[] = {
@@ -188,7 +188,7 @@ static int da9121_get_current_limit(struct regulator_dev *rdev)
 {
 	struct da9121 *chip = rdev_get_drvdata(rdev);
 	int id = rdev_get_id(rdev);
-	struct da9121_range *range =
+	const struct da9121_range *range =
 		variant_parameters[chip->variant_id].current_range;
 	unsigned int val = 0;
 	int ret = 0;
@@ -219,7 +219,7 @@ static int da9121_ceiling_selector(struct regulator_dev *rdev,
 		unsigned int *selector)
 {
 	struct da9121 *chip = rdev_get_drvdata(rdev);
-	struct da9121_range *range =
+	const struct da9121_range *range =
 		variant_parameters[chip->variant_id].current_range;
 	unsigned int level;
 	unsigned int i = 0;
@@ -259,7 +259,7 @@ static int da9121_set_current_limit(struct regulator_dev *rdev,
 {
 	struct da9121 *chip = rdev_get_drvdata(rdev);
 	int id = rdev_get_id(rdev);
-	struct da9121_range *range =
+	const struct da9121_range *range =
 		variant_parameters[chip->variant_id].current_range;
 	unsigned int sel = 0;
 	int ret = 0;

-- 
2.43.0


  parent reply	other threads:[~2024-09-09 13:51 UTC|newest]

Thread overview: 19+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-09-09 13:51 [PATCH 00/17] regulator: Few constifications of " Krzysztof Kozlowski
2024-09-09 13:51 ` [PATCH 01/17] regulator: da9052: Constify " Krzysztof Kozlowski
2024-09-09 13:51 ` [PATCH 02/17] regulator: da9055: " Krzysztof Kozlowski
2024-09-09 13:51 ` [PATCH 03/17] regulator: da9063: " Krzysztof Kozlowski
2024-09-09 13:51 ` Krzysztof Kozlowski [this message]
2024-09-09 13:51 ` [PATCH 05/17] regulator: da9211: " Krzysztof Kozlowski
2024-09-09 13:51 ` [PATCH 06/17] regulator: hi6421: " Krzysztof Kozlowski
2024-09-09 13:51 ` [PATCH 07/17] regulator: hi6421v600: " Krzysztof Kozlowski
2024-09-09 13:51 ` [PATCH 08/17] regulator: tps65023: " Krzysztof Kozlowski
2024-09-09 13:51 ` [PATCH 09/17] regulator: max77826: Drop unused 'rdesc' in 'struct max77826_regulator_info' Krzysztof Kozlowski
2024-09-09 13:51 ` [PATCH 10/17] regulator: max77826: Constify static data Krzysztof Kozlowski
2024-09-09 13:51 ` [PATCH 11/17] regulator: mtk-dvfsrc: " Krzysztof Kozlowski
2024-09-09 13:51 ` [PATCH 12/17] regulator: pcap: " Krzysztof Kozlowski
2024-09-09 13:51 ` [PATCH 13/17] regulator: pfuze100: " Krzysztof Kozlowski
2024-09-09 13:51 ` [PATCH 14/17] regulator: qcom-refgen: " Krzysztof Kozlowski
2024-09-09 13:51 ` [PATCH 15/17] regulator: hi6421v530: Drop unused 'eco_microamp' Krzysztof Kozlowski
2024-09-09 13:51 ` [PATCH 16/17] regulator: hi6421v530: Use container_of and constify static data Krzysztof Kozlowski
2024-09-09 13:51 ` [PATCH 17/17] regulator: max77650: " Krzysztof Kozlowski
2024-09-11 11:16 ` [PATCH 00/17] regulator: Few constifications of " Mark Brown

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20240909-regulator-const-v1-4-8934704a5787@linaro.org \
    --to=krzysztof.kozlowski@linaro.org \
    --cc=angelogioacchino.delregno@collabora.com \
    --cc=brgl@bgdev.pl \
    --cc=broonie@kernel.org \
    --cc=lgirdwood@gmail.com \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=linux-arm-msm@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-mediatek@lists.infradead.org \
    --cc=matthias.bgg@gmail.com \
    --cc=support.opensource@diasemi.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®