From patchwork Mon Sep 9 13:51:13 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Krzysztof Kozlowski X-Patchwork-Id: 826669 Received: from mail-ej1-f44.google.com (mail-ej1-f44.google.com [209.85.218.44]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id B58021BA26E for ; Mon, 9 Sep 2024 13:51:42 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.218.44 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1725889904; cv=none; b=fRmkTOG926ou0eX9d2XL2T+198RH2p7EfXp3L8170rbN5lTrkHLtxYbnt/SVB1ast4FbbYEohpK1bZWHBx3k5wOoBfCw8wnQsJl+fyZIoXqiLaz3mixNbSyWVBhdn+SaYXx+7JWQgcBVuvrl74e+oRTnmpYtxcNK2I92gZfWWpo= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1725889904; c=relaxed/simple; bh=7T+l2SN6pqbE6hOx06iBBg4xZdBmuecLOUZCOIFvMyE=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=Qw/0C7wS0Ft+YTWnwj30JYrvJMJZMlTQTIUInwhdsq/FVmD+jLBAkd56YKohxbJc6Pa10FZ7XX6I3caQP+NbD6R89bX6EzgHpCK/BJpGaYAxCp+YugDRV6c1d+Lu0+ePCqyFEh0GC81iuUciBwpRNIYFbgqYjttZ5yXZRPtB7l4= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linaro.org; spf=pass smtp.mailfrom=linaro.org; dkim=pass (2048-bit key) header.d=linaro.org header.i=@linaro.org header.b=iJCHW6F0; arc=none smtp.client-ip=209.85.218.44 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linaro.org Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=linaro.org Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=linaro.org header.i=@linaro.org header.b="iJCHW6F0" Received: by mail-ej1-f44.google.com with SMTP id a640c23a62f3a-a8713b00219so23252266b.0 for ; Mon, 09 Sep 2024 06:51:42 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1725889901; x=1726494701; darn=vger.kernel.org; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :mime-version:subject:date:from:from:to:cc:subject:date:message-id :reply-to; bh=gWUZynZie/tnte+8abYpr8R+Igo3OliRTpchdOYI/bM=; b=iJCHW6F0h7vHODRF+6Sbg3dN+AmB1f5OxQ9T44Bl/q348IQdN73/cS0Axb78l82vOk U5ZouR7Q2t8c6UzbCKumkQnprA9aWaC4KRVVfNlzmI2lZ0lKaPQC8qifWl5Bu1i6OP2e x3YENUIA2ba1noh3roiO/xmfo4XuK9YHcaqeb+45HeQtCMmSquEiqf//8gCdKcTY1V7B QkoAxZHY1GNH1dH++W/RmhYRiERaYjoWin5UEzDGE8x4nH9SLkk80cNhMklyN1Fr3Yhm 73Y9WjvDFjLUsTMVBemyjp28WDPIpAU+K48SS/evii87Z1HDX1IIhLQicz295w0VZh4F ppow== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1725889901; x=1726494701; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :mime-version:subject:date:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=gWUZynZie/tnte+8abYpr8R+Igo3OliRTpchdOYI/bM=; b=XIJT64/iyk1v+96lZcnzoEyxBhoBP+JUrIecMUIqgo7gOz5hEdmpWN/JReRmzk0MzV jiJv4fRieA5g/WarWr3X9CqYe6Nn3amikldnROAEbLT57r1/3RF5wPTuO64dyv0bKMmo x1KVqQTMkBMeO4elhj2Ulf4obhm5ytn2VQ1skywW2V8LoW3GDaP9JygxQ5SPRaQU5rdm zDMV+Lk5xrgonSOfRP0ooN7mqX0urai2/MZGt/JT9mLWVZ362paZAe9ExWtLZUpzsCq/ 14w+M7f/HeaE2KSF+Mc3z74KjQnyJCqweSL+EUarii7sFIF4WXncfUR29POlPk+6/2OA viEg== X-Forwarded-Encrypted: i=1; AJvYcCXLuZTgBapypOE9n69ti9m7T20vpxDV5jItOqbPYQtOcMTvTHM247QDCl3111SAaEc4kRveYKz0LWWBW/kD@vger.kernel.org X-Gm-Message-State: AOJu0YycwxESI6o5VSALMhOcLnutVZfn42NLAYs14kOMtMnuSW750teA tauK5kIqZ6ZI0jLL+O5fT6g+zq53dJyRy6rN2tU+OM+5kTfPQdS9AmJDGJ0T4xk= X-Google-Smtp-Source: AGHT+IGolL3X79jf6IP489nGtxAGUdA8yh3dZboS2pdNZz9QxZiprwgkdAl5gVT7/E37l/eQxx6GtA== X-Received: by 2002:a17:907:da3:b0:a83:70d0:7a1e with SMTP id a640c23a62f3a-a8a888e61a0mr406825166b.9.1725889900964; Mon, 09 Sep 2024 06:51:40 -0700 (PDT) Received: from [127.0.1.1] ([178.197.222.82]) by smtp.gmail.com with ESMTPSA id a640c23a62f3a-a8d25cf3ad6sm345344566b.148.2024.09.09.06.51.39 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 09 Sep 2024 06:51:40 -0700 (PDT) From: Krzysztof Kozlowski Date: Mon, 09 Sep 2024 15:51:13 +0200 Subject: [PATCH 02/17] regulator: da9055: Constify static data Precedence: bulk X-Mailing-List: linux-arm-msm@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Message-Id: <20240909-regulator-const-v1-2-8934704a5787@linaro.org> References: <20240909-regulator-const-v1-0-8934704a5787@linaro.org> In-Reply-To: <20240909-regulator-const-v1-0-8934704a5787@linaro.org> To: Support Opensource , Liam Girdwood , Mark Brown , Matthias Brugger , AngeloGioacchino Del Regno , Bartosz Golaszewski 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 X-Mailer: b4 0.14.1 X-Developer-Signature: v=1; a=openpgp-sha256; l=5542; i=krzysztof.kozlowski@linaro.org; h=from:subject:message-id; bh=7T+l2SN6pqbE6hOx06iBBg4xZdBmuecLOUZCOIFvMyE=; b=owEBbQKS/ZANAwAKAcE3ZuaGi4PXAcsmYgBm3v1a58opF52+48fMopZc5Ie9MgwbFtabVspDx XEDU3SMO8GJAjMEAAEKAB0WIQTd0mIoPREbIztuuKjBN2bmhouD1wUCZt79WgAKCRDBN2bmhouD 10RTD/0R3aEMOqjsaXdiCVQWplC8EpgbLj8ZanFKI2VfbsehBl68HKT/D98YBx6czQKoVB2yrlW PYvASCaQUm5YWQWux7cw+yXpnbq7LVSD6eNjRVw/q6tmWdrstD+Qn7t4HN1ktZzo4oBK7rlvLMc x3mtMz9FRaTzTH5Nazadk42WBjKw7mxTr7QMxR442nCi5/HyqlGDYagpIJNG+XYLQbo1iVKmoDG 6Zu3wrt2pSFqWk18Hy3ShRYELnzjdFhiSB1RnGaByDwQxBdg+u445qBb0su71+1+Bmpl9rk/jkv 8hTlPMk4mSpkaGLWV2CNJ7MhjGvhJTL7pqhlkp43GHePiUHF+W6FVUjupqQueyG7j9xL7FNAv5I ZnioNWLnhS0coGeh1Bgp9zHoRR7yCcHX60En5L5lup9oBDNW6vF6HWQacApjh8sf8cz/QCGzE7x 9wfWe3KsjQaYpjDKD37c1cjI6nF4TMPL9LyQptdgS0aIV+OxuW29I3DaXtVANuU4FZtuM8iY1V1 Y8pmzsl+sjIGQoE9cOvo30Y6+9j/nBeVgPRRvzpfxAEnPQPCNBZJb43aa8IRZF95de7aeqSeppV rL2WZ13ht2jGqi8aKSJYLtaWv7WdHrP8TDes+0K/pPUhR8b7Rve8G/CRjwFQGxWWB1WKgA8ERYB BHYCyhf+ywSoirw== X-Developer-Key: i=krzysztof.kozlowski@linaro.org; a=openpgp; fpr=9BD07E0E0C51F8D59677B7541B93437D3B41629B Driver does not modify static data with regulators description (struct da9055_regulator_info), so make it const for code safety. Signed-off-by: Krzysztof Kozlowski --- drivers/regulator/da9055-regulator.c | 28 ++++++++++++++-------------- 1 file changed, 14 insertions(+), 14 deletions(-) diff --git a/drivers/regulator/da9055-regulator.c b/drivers/regulator/da9055-regulator.c index 352547c375bd..a0d3414aa79e 100644 --- a/drivers/regulator/da9055-regulator.c +++ b/drivers/regulator/da9055-regulator.c @@ -73,7 +73,7 @@ struct da9055_regulator_info { struct da9055_regulator { struct da9055 *da9055; - struct da9055_regulator_info *info; + const struct da9055_regulator_info *info; struct regulator_dev *rdev; enum gpio_select reg_rselect; }; @@ -81,7 +81,7 @@ struct da9055_regulator { static unsigned int da9055_buck_get_mode(struct regulator_dev *rdev) { struct da9055_regulator *regulator = rdev_get_drvdata(rdev); - struct da9055_regulator_info *info = regulator->info; + const struct da9055_regulator_info *info = regulator->info; int ret, mode = 0; ret = da9055_reg_read(regulator->da9055, info->mode.reg); @@ -107,7 +107,7 @@ static int da9055_buck_set_mode(struct regulator_dev *rdev, unsigned int mode) { struct da9055_regulator *regulator = rdev_get_drvdata(rdev); - struct da9055_regulator_info *info = regulator->info; + const struct da9055_regulator_info *info = regulator->info; int val = 0; switch (mode) { @@ -129,7 +129,7 @@ static int da9055_buck_set_mode(struct regulator_dev *rdev, static unsigned int da9055_ldo_get_mode(struct regulator_dev *rdev) { struct da9055_regulator *regulator = rdev_get_drvdata(rdev); - struct da9055_regulator_info *info = regulator->info; + const struct da9055_regulator_info *info = regulator->info; int ret; ret = da9055_reg_read(regulator->da9055, info->volt.reg_b); @@ -145,7 +145,7 @@ static unsigned int da9055_ldo_get_mode(struct regulator_dev *rdev) static int da9055_ldo_set_mode(struct regulator_dev *rdev, unsigned int mode) { struct da9055_regulator *regulator = rdev_get_drvdata(rdev); - struct da9055_regulator_info *info = regulator->info; + const struct da9055_regulator_info *info = regulator->info; struct da9055_volt_reg volt = info->volt; int val = 0; @@ -167,7 +167,7 @@ static int da9055_ldo_set_mode(struct regulator_dev *rdev, unsigned int mode) static int da9055_regulator_get_voltage_sel(struct regulator_dev *rdev) { struct da9055_regulator *regulator = rdev_get_drvdata(rdev); - struct da9055_regulator_info *info = regulator->info; + const struct da9055_regulator_info *info = regulator->info; struct da9055_volt_reg volt = info->volt; int ret, sel; @@ -199,7 +199,7 @@ static int da9055_regulator_set_voltage_sel(struct regulator_dev *rdev, unsigned int selector) { struct da9055_regulator *regulator = rdev_get_drvdata(rdev); - struct da9055_regulator_info *info = regulator->info; + const struct da9055_regulator_info *info = regulator->info; int ret; /* @@ -242,7 +242,7 @@ static int da9055_regulator_set_suspend_voltage(struct regulator_dev *rdev, int uV) { struct da9055_regulator *regulator = rdev_get_drvdata(rdev); - struct da9055_regulator_info *info = regulator->info; + const struct da9055_regulator_info *info = regulator->info; int ret; /* Select register set B for suspend voltage ramping. */ @@ -264,7 +264,7 @@ static int da9055_regulator_set_suspend_voltage(struct regulator_dev *rdev, static int da9055_suspend_enable(struct regulator_dev *rdev) { struct da9055_regulator *regulator = rdev_get_drvdata(rdev); - struct da9055_regulator_info *info = regulator->info; + const struct da9055_regulator_info *info = regulator->info; /* Select register set B for voltage ramping. */ if (regulator->reg_rselect == NO_GPIO) @@ -277,7 +277,7 @@ static int da9055_suspend_enable(struct regulator_dev *rdev) static int da9055_suspend_disable(struct regulator_dev *rdev) { struct da9055_regulator *regulator = rdev_get_drvdata(rdev); - struct da9055_regulator_info *info = regulator->info; + const struct da9055_regulator_info *info = regulator->info; /* Diselect register set B. */ if (regulator->reg_rselect == NO_GPIO) @@ -396,7 +396,7 @@ static const struct regulator_ops da9055_ldo_ops = { },\ } -static struct da9055_regulator_info da9055_regulator_info[] = { +static const struct da9055_regulator_info da9055_regulator_info[] = { DA9055_BUCK(BUCK1, 25, 725, 2075, 6, 9, 0xc, 2), DA9055_BUCK(BUCK2, 25, 925, 2500, 6, 0, 3, 0), DA9055_LDO(LDO1, 50, 900, 3300, 6, 2), @@ -417,7 +417,7 @@ static int da9055_gpio_init(struct device *dev, struct regulator_config *config, struct da9055_pdata *pdata, int id) { - struct da9055_regulator_info *info = regulator->info; + const struct da9055_regulator_info *info = regulator->info; struct gpio_desc *ren; struct gpio_desc *ena; struct gpio_desc *rsel; @@ -491,9 +491,9 @@ static irqreturn_t da9055_ldo5_6_oc_irq(int irq, void *data) return IRQ_HANDLED; } -static inline struct da9055_regulator_info *find_regulator_info(int id) +static inline const struct da9055_regulator_info *find_regulator_info(int id) { - struct da9055_regulator_info *info; + const struct da9055_regulator_info *info; int i; for (i = 0; i < ARRAY_SIZE(da9055_regulator_info); i++) { From patchwork Mon Sep 9 13:51:15 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Krzysztof Kozlowski X-Patchwork-Id: 826668 Received: from mail-ej1-f43.google.com (mail-ej1-f43.google.com [209.85.218.43]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id BCBD41BA897 for ; Mon, 9 Sep 2024 13:51:45 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.218.43 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1725889908; cv=none; b=Md0BdpEsF/wQUrHxW2qUjSew6vfwsBL+7hjSlQ07HK5pHfy5FfpujR+qJw4xbdBwnhfOe8ElAPQ4AYH5M39dYOxMWYUq+SYDvFay8e6a7sjZLopt0KArzkLHbC2pbd+g3tfvzRK7vqN7+wv++gF0i5ZQJEdzBzywArqzDl+wFc4= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1725889908; c=relaxed/simple; bh=NpUoubZdNxPAP0/VQA+CguJJu4K+4PwUlJgiCI3BfEs=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=H0NXwtW1OnspJ4UquqNfLPad8NFWA5RJHMgpCTk4jkgxS8yYjVCAuUstsU0Zyxx/hMh43A2S4txx5jiIRe3uvrz3p2Og3NG+iI+D2EF2CV/3KmxV8JLSeu9k591IdyqNrCrbouAfSNrITQIapka0YiKh1aU8DaIKbUcE55oaPPk= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linaro.org; spf=pass smtp.mailfrom=linaro.org; dkim=pass (2048-bit key) header.d=linaro.org header.i=@linaro.org header.b=cyoDWfk1; arc=none smtp.client-ip=209.85.218.43 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linaro.org Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=linaro.org Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=linaro.org header.i=@linaro.org header.b="cyoDWfk1" Received: by mail-ej1-f43.google.com with SMTP id a640c23a62f3a-a866902708fso26993366b.2 for ; Mon, 09 Sep 2024 06:51:45 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1725889904; x=1726494704; darn=vger.kernel.org; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :mime-version:subject:date:from:from:to:cc:subject:date:message-id :reply-to; bh=J5ubU/nIvmhUK+978Fu438bn7v+wIGW6OXK49tq6QXU=; b=cyoDWfk1hwq23ev/0KNkf72vlqXks7zcE5fbWrbyQltFACZO79Rc64bR/T73D2iO2v EyUEqCALE8KnEA6ZuNKdlZcoBWvxSpoGAxc3cDYvxFQKqZCLQBgJBYFZYsMXUNtD7b0J 0DEdYpDFYX1oikoAxZx+DbmjLiRqpy9h7BnayCHiIftdr0J9NAgyWvXTNa2uznthVYZA SW7Ecc/I4nCqI6IJmT5hfMTxTsqdTizLvGT+bGmBms6XzbJQpzrK+CoyqDL4fM7JSi6E HpFN8BqQMh3JwnjpjT73SiSZzH5iyl6QoXL+pYpjrsnQSGDBOaWs9HWTcdCG7yiiy0os 1P1w== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1725889904; x=1726494704; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :mime-version:subject:date:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=J5ubU/nIvmhUK+978Fu438bn7v+wIGW6OXK49tq6QXU=; b=kmg2rqEIAzM7VD8KmHd45q4PJay15W0h+VeMTq4+onWYpy5kLkRQKGwF9nOm0wETfw KdH4fWuwGXfXrNh69VBGKt2CYw7V1dKDe/LT9W7mJmIxNDsRrfc3WlA89Jxug2/x9qAY wfVf7eST7vE2oFapYLsKZ1AL4SgCcw4O5lvoj9OKX9JTIkLNtWcXTaCUfPuqz1WRTCwD TeanncigYIwfTkLruUCa0+UpZd9GUaRfBYB1DzmTAqZ8tP0TTdpRQUmqUknj1wY+O3aN cy+nvBNSm6jTeOJMDDDHHzM8/uEw04pM5vUjDfiVjWQEBYHX/zuunQEtUB/U+Yi7mllC sz7g== X-Forwarded-Encrypted: i=1; AJvYcCWzryAnSrKzormwuTlmBTMcmgtYCqLKjpNgV90WxFOSy5ztOyBrHQaKlSdyZPE/iRCVyj2rJEl3Wv4HaQwU@vger.kernel.org X-Gm-Message-State: AOJu0YzGwGi+3omfBa3jDAIazbjj/C9X0Wb36Sx4DIJJkZq+ev+EbUhx OfpZXLKExyIs+Ji6t+CL0VTdABSQ84O2uxyCHkIilF535RnB8I/uqgFwUy1VtKY= X-Google-Smtp-Source: AGHT+IEugSgsSV0xgb1AxjeRmN9gIBXYvzLHz3hHfeWqWgETWGq55T1TciET1HOvhecAnGFDnoDFNQ== X-Received: by 2002:a17:906:c151:b0:a86:a694:aaff with SMTP id a640c23a62f3a-a8a885c3502mr329789266b.1.1725889903950; Mon, 09 Sep 2024 06:51:43 -0700 (PDT) Received: from [127.0.1.1] ([178.197.222.82]) by smtp.gmail.com with ESMTPSA id a640c23a62f3a-a8d25cf3ad6sm345344566b.148.2024.09.09.06.51.42 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 09 Sep 2024 06:51:43 -0700 (PDT) From: Krzysztof Kozlowski Date: Mon, 09 Sep 2024 15:51:15 +0200 Subject: [PATCH 04/17] regulator: da9121: Constify static data Precedence: bulk X-Mailing-List: linux-arm-msm@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Message-Id: <20240909-regulator-const-v1-4-8934704a5787@linaro.org> References: <20240909-regulator-const-v1-0-8934704a5787@linaro.org> In-Reply-To: <20240909-regulator-const-v1-0-8934704a5787@linaro.org> To: Support Opensource , Liam Girdwood , Mark Brown , Matthias Brugger , AngeloGioacchino Del Regno , Bartosz Golaszewski 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 X-Mailer: b4 0.14.1 X-Developer-Signature: v=1; a=openpgp-sha256; l=3601; i=krzysztof.kozlowski@linaro.org; h=from:subject:message-id; bh=NpUoubZdNxPAP0/VQA+CguJJu4K+4PwUlJgiCI3BfEs=; b=owEBbQKS/ZANAwAKAcE3ZuaGi4PXAcsmYgBm3v1bGMGjRSX40m+jFUd3qXmQIrwJMipZzv7er WSu6zsXuOmJAjMEAAEKAB0WIQTd0mIoPREbIztuuKjBN2bmhouD1wUCZt79WwAKCRDBN2bmhouD 18ryD/wIt2dvPBpg6GfCuXTwI8ZHq/Xhw0UUKgiDvi6l0M1lAqmPdNe0fQPYFdpV7zloCImte9+ P1Rpg8oK5fB2xYfpH2YGpbqr1Uhp45D3NIXMWFiwAa7P73jVOxmn+pZE6+S75b0NBihnwBDjqv3 NL+/U8t1DkPGHOMx/S5pQEuto+kc7rPd1Cfw99rlH0l/lzWxFCcWQlABzlx1P4BLiiA0ao2ODqu b/ALGdnj/u5blpYURBGbHBgJ/eHqljdezVIzg9T1mrzgl5rOOrQIhrUWD4ipvwr5NEo/W0y4nsN luFsScVmEoJCcxj9Zm2tdwmc8QNWI7cZjM7r6NM6X/0vujLWQfb+C8O/RrZXkdMsRey99nU+XTZ siCy5IFha4lpKRaEUrjQ36PxSn2j6+NhxLSi98Ap2WmDA/tL4vEu+5aU8/Vik/zUhQVzQ56Y4kG JsRIM+M9H+zlrQqGWCgPeN+1Tr6T8r9aAmrQ6sqclP7XEYOZBglrDetgxW/lPldfEDwGHdDizXE cs6pOl6y6qIifPvAtZ0g2YecHTpN6UlRVS1nPSXvnVuF0kvICRhgHpvK3wfYnEHvv/fSEzP7qzF 2B8SBCizdJt1YFjLGsqVYGocM+c7PHZL+/nyoTU3nG99OO4KBmwJqaadqY8XKMT6J6IbL7aaDNx 6L2A2Di5T3Pdssg== X-Developer-Key: i=krzysztof.kozlowski@linaro.org; a=openpgp; fpr=9BD07E0E0C51F8D59677B7541B93437D3B41629B Driver does not modify static data with regulator description (struct da9121_range), so make it const for code safety. Signed-off-by: Krzysztof Kozlowski --- 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; From patchwork Mon Sep 9 13:51:17 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Krzysztof Kozlowski X-Patchwork-Id: 826667 Received: from mail-wr1-f41.google.com (mail-wr1-f41.google.com [209.85.221.41]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id A72C91BAEDB for ; Mon, 9 Sep 2024 13:51:48 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.221.41 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1725889910; cv=none; b=HI3pg7SObRG/mosKkWaJpTDaHMZKvtvk8wR0sXZc71iIMhYxaszeZO6LpbrW2+aJiMBuMggKIQnpJrKSXTG/4hwbuMFY0Ewz7ePPeypbsgbiSk/MkI/XrMu5GYgdnij83kUtq6/4zttRpMsfgCSxcPKDJ9Tk/qM9U4vYQ0ql8vo= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1725889910; c=relaxed/simple; bh=j2zwQ1BCa3xviw33TQ1yU9leknMd45i2193Hd7keRfQ=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=cavrBa+EDUrNv6k6XRC1qNI4gTE+g60DWfgPOPkvnyIeeKHQ8RMQKpl5hjVRP8FW4I5ycHd551YFd0QXEnRWCl4oSuioRulra/LcCX0Yh4EkqRd0KKIdqvaVJXpeU9/L68vw7o9xY6HS6eOyvTitI6XLe+n61nQJCahos00jCi4= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linaro.org; spf=pass smtp.mailfrom=linaro.org; dkim=pass (2048-bit key) header.d=linaro.org header.i=@linaro.org header.b=hFWi8444; arc=none smtp.client-ip=209.85.221.41 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linaro.org Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=linaro.org Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=linaro.org header.i=@linaro.org header.b="hFWi8444" Received: by mail-wr1-f41.google.com with SMTP id ffacd0b85a97d-374c2df8a07so103042f8f.0 for ; Mon, 09 Sep 2024 06:51:48 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1725889907; x=1726494707; darn=vger.kernel.org; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :mime-version:subject:date:from:from:to:cc:subject:date:message-id :reply-to; bh=FzRjkUKpUqQXpsK4/eDUhuJEBuZIqvcSWctdz6VolTM=; b=hFWi8444h/YAQ5XB1Mel9v3J1UfXDekUDqw9fOMYHbrzuL/ziK2W4OQf66KXvJpr22 HKjVoQG17Pj1Qm1HslCuKTe9F6zMk/OlFCV4Bjh5GdcGEI04//IoMqBimf6prrEcAnmB FCPt6sGMTkGNHN1j0bhmZTE7S+y0ITIb+2L2QGC94FwmfcRGIj6sbnu8aJN8PObHWqoO BaPCcTQSILX54hoNp5DQ3x9Mf55dv9ObuRXD+RX2dYPIWZQYmAlg/kir+8m5oH0bu4Nr FY4OGHW//JuYIHsEHR16Hi1LUh9fCojd7YaligQhkmrhNI913QtulooS7WmLaZiTQ38c NX/Q== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1725889907; x=1726494707; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :mime-version:subject:date:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=FzRjkUKpUqQXpsK4/eDUhuJEBuZIqvcSWctdz6VolTM=; b=d5VEGmNTCASiqHDzxlnf06o6DpxVuU2BujcwpkMuvLmGeQIxX9yZ/+R7ERDdTW95Nx uL1ZFNIUIgI1zzEXa7Xpbf8P470m6rMWWZ0VCsXvD9+J+rjVGfx1GkV9CMBgGXK0dSc2 y/qA+Wv5EgfEEtD0JAFlyE5e+awRr8jSiz2Z8NQSCnpgbQh2H+heAIFd4hE8/RyqnUEy 7oVV7voYoIhy5SQxh0oXKT3qaroEN1Ef4pGn3u8efb/geITBsiS0qFVPKa+fRRYDvjYO 1qPARO+GmuM3puejTPA+LFByMichnCx/R4rWkLuw9eNonaLwodwYRzMfk+P6Yb5ovqRt RSlg== X-Forwarded-Encrypted: i=1; AJvYcCUD00Lvs24fxn74cPp+6F3KQccghWTtSJxLyGksZFBslWuaqXYD/f2vzOvMiA/fbOa8XCIKXinYIIA1s5s0@vger.kernel.org X-Gm-Message-State: AOJu0Yx2/ABJoC7EQ6iKDJsx01fS4CYCBOvScTwf/sNG89mFLX8zgjju 2m3LcdFg1C4S5onkAjM2P2CMeCk7f5ZK13aECFIR8wF9c4+m6Fh7qKv0smjgDWk= X-Google-Smtp-Source: AGHT+IG784y6TviUcaC0Sy4/IOqmsR+O7VMUlzzzng9cVnZEltHKULUPHrwBEN/dEMaMq7ZQr9+LCw== X-Received: by 2002:a5d:6484:0:b0:374:cd3e:7d7a with SMTP id ffacd0b85a97d-378895c38c4mr3364134f8f.2.1725889906747; Mon, 09 Sep 2024 06:51:46 -0700 (PDT) Received: from [127.0.1.1] ([178.197.222.82]) by smtp.gmail.com with ESMTPSA id a640c23a62f3a-a8d25cf3ad6sm345344566b.148.2024.09.09.06.51.45 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 09 Sep 2024 06:51:46 -0700 (PDT) From: Krzysztof Kozlowski Date: Mon, 09 Sep 2024 15:51:17 +0200 Subject: [PATCH 06/17] regulator: hi6421: Constify static data Precedence: bulk X-Mailing-List: linux-arm-msm@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Message-Id: <20240909-regulator-const-v1-6-8934704a5787@linaro.org> References: <20240909-regulator-const-v1-0-8934704a5787@linaro.org> In-Reply-To: <20240909-regulator-const-v1-0-8934704a5787@linaro.org> To: Support Opensource , Liam Girdwood , Mark Brown , Matthias Brugger , AngeloGioacchino Del Regno , Bartosz Golaszewski 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 X-Mailer: b4 0.14.1 X-Developer-Signature: v=1; a=openpgp-sha256; l=3081; i=krzysztof.kozlowski@linaro.org; h=from:subject:message-id; bh=j2zwQ1BCa3xviw33TQ1yU9leknMd45i2193Hd7keRfQ=; b=owEBbQKS/ZANAwAKAcE3ZuaGi4PXAcsmYgBm3v1dar5m8pWkgX0YQ41g0FmZeSQHS5Ldzu5oS VY/Jxr8BWyJAjMEAAEKAB0WIQTd0mIoPREbIztuuKjBN2bmhouD1wUCZt79XQAKCRDBN2bmhouD 196TD/9RCl439qn314C+1T07HG8J93zopFOVXqjRy5Chbs5rO9u7m7CWkTeYHrZRX11Lsv/pD8I 92sYpTkK7vooauJ0uvcp3EMdJb5DiMrjs6ZmG+mXxH6XVliP1laV5MM0KiyDQeQoxAPO9tqmen3 yL4kC7BbpHsME4uSggz2G7SUJ/oHzaJ70GDRgB/BYnqnNvqJbP0KMsLHyhg3AxgRRw2mNawPdHe kwMomDZN92uAzVczA1Ynpj7p74RF9KBVIZvAlIl1efcitCaJUMOj3gEYTwRfA0jWDBKMAiCYdyE 1JNU01he7Duw2eMYTuSdroWOk81VkunYCpFrGvuSxFvttiFIAuwhPZhVks4dAfOtRlLbqdZ1qsE emRlIThRFUeb+glNUU7QLIG6JXpXtd6lGIEGK1SktsF7A3zQgo1M6ukdkioa5k7PxK8kZk+FszD /PSqRFLSiLqTZVz66TJNUcNs+hSOo3gzi6GBco5mW02vsquNRXrREUBVUseeCvWtI8v9lPwwIIN zbD3lqgTWX025GXQhLUk9I56pMObo+qAux80yYS2enK5o5hc9EJjf7SC8kMWhO6BmmMDYyoViuw wMWN4XPk2B1WZtQb3TGYlMlGotK1q6KnFPgSzICh+WNwhXYyOorLxMRRaJl/YA2eTuoxfKpiIt9 xHhe5ucd9x/ZU6Q== X-Developer-Key: i=krzysztof.kozlowski@linaro.org; a=openpgp; fpr=9BD07E0E0C51F8D59677B7541B93437D3B41629B Driver does not modify static data with regulator description (struct hi6421_regulator_info), so make it const for code safety. Signed-off-by: Krzysztof Kozlowski --- drivers/regulator/hi6421-regulator.c | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/drivers/regulator/hi6421-regulator.c b/drivers/regulator/hi6421-regulator.c index 82e9e364d4d4..69d24728d6a4 100644 --- a/drivers/regulator/hi6421-regulator.c +++ b/drivers/regulator/hi6421-regulator.c @@ -303,7 +303,7 @@ static const struct regulator_ops hi6421_buck345_ops; } /* HI6421 regulator information */ -static struct hi6421_regulator_info +static const struct hi6421_regulator_info hi6421_regulator_info[HI6421_NUM_REGULATORS] = { HI6421_LDO(LDO0, hi6421_vout0, ldo_0_voltages, 0x20, 0x07, 0x20, 0x10, 10000, 0x20, 8000), @@ -384,7 +384,7 @@ static int hi6421_regulator_enable(struct regulator_dev *rdev) static unsigned int hi6421_regulator_ldo_get_mode(struct regulator_dev *rdev) { - struct hi6421_regulator_info *info; + const struct hi6421_regulator_info *info; unsigned int reg_val; info = container_of(rdev->desc, struct hi6421_regulator_info, desc); @@ -397,7 +397,7 @@ static unsigned int hi6421_regulator_ldo_get_mode(struct regulator_dev *rdev) static unsigned int hi6421_regulator_buck_get_mode(struct regulator_dev *rdev) { - struct hi6421_regulator_info *info; + const struct hi6421_regulator_info *info; unsigned int reg_val; info = container_of(rdev->desc, struct hi6421_regulator_info, desc); @@ -411,7 +411,7 @@ static unsigned int hi6421_regulator_buck_get_mode(struct regulator_dev *rdev) static int hi6421_regulator_ldo_set_mode(struct regulator_dev *rdev, unsigned int mode) { - struct hi6421_regulator_info *info; + const struct hi6421_regulator_info *info; unsigned int new_mode; info = container_of(rdev->desc, struct hi6421_regulator_info, desc); @@ -436,7 +436,7 @@ static int hi6421_regulator_ldo_set_mode(struct regulator_dev *rdev, static int hi6421_regulator_buck_set_mode(struct regulator_dev *rdev, unsigned int mode) { - struct hi6421_regulator_info *info; + const struct hi6421_regulator_info *info; unsigned int new_mode; info = container_of(rdev->desc, struct hi6421_regulator_info, desc); @@ -462,7 +462,7 @@ static unsigned int hi6421_regulator_ldo_get_optimum_mode(struct regulator_dev *rdev, int input_uV, int output_uV, int load_uA) { - struct hi6421_regulator_info *info; + const struct hi6421_regulator_info *info; info = container_of(rdev->desc, struct hi6421_regulator_info, desc); @@ -539,7 +539,7 @@ static int hi6421_regulator_probe(struct platform_device *pdev) { struct hi6421_pmic *pmic = dev_get_drvdata(pdev->dev.parent); struct hi6421_regulator_pdata *pdata; - struct hi6421_regulator_info *info; + const struct hi6421_regulator_info *info; struct regulator_config config = { }; struct regulator_dev *rdev; int i; From patchwork Mon Sep 9 13:51:20 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Krzysztof Kozlowski X-Patchwork-Id: 826666 Received: from mail-ej1-f50.google.com (mail-ej1-f50.google.com [209.85.218.50]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id F16191BB6A5 for ; Mon, 9 Sep 2024 13:51:52 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.218.50 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1725889914; cv=none; b=KOXbDpntTQC2KkHjORDtEXniP+Q+Vg6w056ZKN9D9NKCN9z+5xs0rw4hKM85rXUqPebOQil9grcrZ4+A4LHv/1UAnTqez3N7WSdLhxU3Z4QHnw1LmL+5Nj+HN3RB+virYIgEbE9FB9pzNQaXpVQy61vKDf8fEsxvDiA9zgi/suc= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1725889914; c=relaxed/simple; bh=rxHbd8ZN2Gnll5CmN6olaVIKBgECJTgaQrtvW4I7hxI=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=CmdWQ4VdtehxRGQiKQoEJ9HZAl3jmFfSNL4i4cGfu8XTsPa432tjO4naJMM6+i3ehHSVgkjsM7mpqic77O8fd0y5ad/T896Do3UyYXVwBF1GE+AFf0RNtHqfOPaNC85SVEqX/wMk8C/I3AtqRnM9tCkWVZudZlRBGO+09KC70YQ= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linaro.org; spf=pass smtp.mailfrom=linaro.org; dkim=pass (2048-bit key) header.d=linaro.org header.i=@linaro.org header.b=ERrNHWWu; arc=none smtp.client-ip=209.85.218.50 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linaro.org Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=linaro.org Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=linaro.org header.i=@linaro.org header.b="ERrNHWWu" Received: by mail-ej1-f50.google.com with SMTP id a640c23a62f3a-a8d1a00e0d0so8614666b.3 for ; Mon, 09 Sep 2024 06:51:52 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1725889911; x=1726494711; darn=vger.kernel.org; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :mime-version:subject:date:from:from:to:cc:subject:date:message-id :reply-to; bh=e4nMk71Ror4dDuFejQdNMVkNcSGmGkDbOfs0S0Gk4o4=; b=ERrNHWWueLsdsvtS7r7ye4oD1Ovlq1L0rsPrl0lhIT8tG1vLMdWtC8cITRo0joMD2Q 03lx+VTi1MGh2rK1LzMUpGJTpo8gClL6UpwkC9f8OPdqTimvBZcBzJ8ku7N+gBmHsfYo 54znMtOzzxMrHrh3qZDFXBG9Qqfcb+ReVIeKLZXRyxdx+DjbF9yh1XTuDKx53+Hnav0K N98LPXgHA9/OC9QDtp45mKMiMMtqpYo9pVEFdy8/yrmvfFIE5xCO7l75VPH1BmtXDyPg XT/6PP4VBD8nEtUtmO4l6HG2pHT5XOLlm/kKmhVjaVls+v58QZkvijmD3WM/c7xp8okX WnlQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1725889911; x=1726494711; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :mime-version:subject:date:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=e4nMk71Ror4dDuFejQdNMVkNcSGmGkDbOfs0S0Gk4o4=; b=cijlbTodjNF3b3SF/pbplBmCp2aJztVB0ipP9poGs2jUK24tp3OPnBOV09+sTR6snT wKhrUocXWfCmxP0mKv5GSuIATNYjwCFNaPTZUvJSyA2UJrlaWHJVJ9rhED62u1ebqr/R gAJniW73CefVZQOcUO3gGGgKolp5ITe1B+7LeofxLmWOfWwRAc3zXWC9ytfuEWwZrwiH 5d6kjlyXZnhMWFiNm/se97RYAneMbAroQxkrXH9GDvFabPv6xTv6SjsRIOgDEJUDHFiS p8zyWGXfPV5Hk+3Z8I0cRBALe66uzoeDsmfUgRVYB1EP49L4vNVyKpfb3LaD2u8kaabq kE1g== X-Forwarded-Encrypted: i=1; AJvYcCX1ueV34Q+EfWaDNTS5ZwK8WFxBQjH0BKayPjptDoFh8nMQMVE92YJhC0r54vtTRt66oqr6PP+iKK+NFDTF@vger.kernel.org X-Gm-Message-State: AOJu0Yxf9fiOyuM61fHdSVXXYvvoPqMR64IQqFq0S0xOZe7a7T8P3ebP KaZxaKvIoPM4BdeshzpLVcKW3TFnvRRLgb/ndGBgGD/WBUNsKA6ljYj10TVY1+A= X-Google-Smtp-Source: AGHT+IF2PjCN56jaALnPx3R93ZXhQvgFBd1aE1EAodWyw/lW7I8GsseYFB7PzSZqIjBvJb78EvrSWg== X-Received: by 2002:a17:907:3da7:b0:a8a:81ec:f731 with SMTP id a640c23a62f3a-a8a885c3265mr378374066b.2.1725889911134; Mon, 09 Sep 2024 06:51:51 -0700 (PDT) Received: from [127.0.1.1] ([178.197.222.82]) by smtp.gmail.com with ESMTPSA id a640c23a62f3a-a8d25cf3ad6sm345344566b.148.2024.09.09.06.51.49 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 09 Sep 2024 06:51:50 -0700 (PDT) From: Krzysztof Kozlowski Date: Mon, 09 Sep 2024 15:51:20 +0200 Subject: [PATCH 09/17] regulator: max77826: Drop unused 'rdesc' in 'struct max77826_regulator_info' Precedence: bulk X-Mailing-List: linux-arm-msm@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Message-Id: <20240909-regulator-const-v1-9-8934704a5787@linaro.org> References: <20240909-regulator-const-v1-0-8934704a5787@linaro.org> In-Reply-To: <20240909-regulator-const-v1-0-8934704a5787@linaro.org> To: Support Opensource , Liam Girdwood , Mark Brown , Matthias Brugger , AngeloGioacchino Del Regno , Bartosz Golaszewski 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 X-Mailer: b4 0.14.1 X-Developer-Signature: v=1; a=openpgp-sha256; l=991; i=krzysztof.kozlowski@linaro.org; h=from:subject:message-id; bh=rxHbd8ZN2Gnll5CmN6olaVIKBgECJTgaQrtvW4I7hxI=; b=owEBbQKS/ZANAwAKAcE3ZuaGi4PXAcsmYgBm3v1gk6LT/h4VMebCtZMbJoCRkBZvx8KAMANRf n9s9srNC/uJAjMEAAEKAB0WIQTd0mIoPREbIztuuKjBN2bmhouD1wUCZt79YAAKCRDBN2bmhouD 161kD/9Lp6g4Ua2xpAlNHKFc2J5G5EkSOmL9wRmeRWCqsIzq5Ao0p02ZQ/8kTCNSxibJ8bPQuIK m64QJ0LFlP7nWIYw91ctKvfqnOy9UrHRju3r8U7TXRUYNFab/vQ3BrceR6gpzcLhFXvfTX5En9+ JRGMtRd5J5AiGl5VBp5TIig09DqDdVkFCEpKDBn9zj49laVzNo+V3xue8dnGynTAxW9z2buAKmw gMI3QvQEEk3fqKFNxGFJExDUoC6NHK5qBENhj4+JjHPbYN+gS0KSxwYT3EfTxhE6ufKfpoQzaOX 2bvZ9kMCCaaayjeO4s/J0YlxHCdjAnFy0iTRQ3Q+lWkWbCoYT8KKOU54FAEfvqVZl1M1lCQ6OeG lg/enr2QZKSc3XG6+Qld8the0DM7gOehFJyT02OTsv7Q4Mk93qun+f38yHQOuxZxJCcBmIZCRDr 1udf/OsmXR9Gl0qG/QEslImmSd2+1Kw1McycPnPgPWMGc9hhQtxycEKTzCqDDS/+Pq8rgBZ23em Ck/jxoX3WTakTQHwWJBUqXjZzFeBhpEWY+yGphtd7kJMlyHZoHCbUfloX27j8SAas98RNlyQxpM Tt5GlM0LkHrEzEyWqRpdSva0G/5/lYGNTKtPDYZWm+xvCXgM4jEa5Zx8VCwN0F7GpxQwPiL9omy hTqm9UKegqYPonQ== X-Developer-Key: i=krzysztof.kozlowski@linaro.org; a=openpgp; fpr=9BD07E0E0C51F8D59677B7541B93437D3B41629B The max77826_regulator_info.rdesc is assigned once and never used again. Signed-off-by: Krzysztof Kozlowski --- drivers/regulator/max77826-regulator.c | 2 -- 1 file changed, 2 deletions(-) diff --git a/drivers/regulator/max77826-regulator.c b/drivers/regulator/max77826-regulator.c index 5590cdf615b7..4b656a694108 100644 --- a/drivers/regulator/max77826-regulator.c +++ b/drivers/regulator/max77826-regulator.c @@ -153,7 +153,6 @@ enum max77826_regulators { struct max77826_regulator_info { struct regmap *regmap; - struct regulator_desc *rdesc; }; static const struct regmap_config max77826_regmap_config = { @@ -246,7 +245,6 @@ static int max77826_i2c_probe(struct i2c_client *client) if (!info) return -ENOMEM; - info->rdesc = max77826_regulators_desc; regmap = devm_regmap_init_i2c(client, &max77826_regmap_config); if (IS_ERR(regmap)) { dev_err(dev, "Failed to allocate regmap!\n"); From patchwork Mon Sep 9 13:51:22 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Krzysztof Kozlowski X-Patchwork-Id: 826665 Received: from mail-wm1-f41.google.com (mail-wm1-f41.google.com [209.85.128.41]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id B31031BC9E2 for ; Mon, 9 Sep 2024 13:51:55 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.128.41 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1725889917; cv=none; b=d62BJ4mkk85XUiLadAEvheRlC1UCGltESRHfZei6AekyDOPXJ2BJ1vPtPz/X/IERuO52DENHPfvBWvwHC6sUhRRN5WFy362v3SB+zVzMkxg5cCbc/pwJPqV+Rm7AUsDmFpyBxrBkWdgnnB/W37uL2Tcq9oZ5TsletuCTDsE/sUQ= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1725889917; c=relaxed/simple; bh=zfZGJPZ+7n/u+R7h1aiFdsdkEzudbMyrWwt0mCMNVy8=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=BW/PSg3vtm6v124woVRheF8iM69lLgXBLndtElRd5uw342IT+CLp9fnWqcYuYwX9F3YcbERwtkK6G9a0uHtKM3b5doh8YpjEq8IqmuBENzwMMw8L+UAJkt7sng36NXhjiU5XcR4RHRdbskbLHnWEttFwTvofGut3+dVGaMF3t1A= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linaro.org; spf=pass smtp.mailfrom=linaro.org; dkim=pass (2048-bit key) header.d=linaro.org header.i=@linaro.org header.b=HnsuNF9u; arc=none smtp.client-ip=209.85.128.41 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linaro.org Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=linaro.org Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=linaro.org header.i=@linaro.org header.b="HnsuNF9u" Received: by mail-wm1-f41.google.com with SMTP id 5b1f17b1804b1-42cb1866c00so2645695e9.0 for ; Mon, 09 Sep 2024 06:51:55 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1725889914; x=1726494714; darn=vger.kernel.org; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :mime-version:subject:date:from:from:to:cc:subject:date:message-id :reply-to; bh=2Ca+bwI9Pu7F3YUoAaUsqSsRV8VpFvNoCThNciak41Q=; b=HnsuNF9uTiZz2KD36y4vGRhG/UVM2phfhdiPAuKuD65LaqZkhdxaZSA9R+8agSAhoJ EHSCt45YtgBi5Pc3N3qtjJkixOtVo6DdwQZp1qRL3iGXRg/XzR4PIgqaMXVojPSSnK8V OL8rz7NSaEvl8zlExlCwG5J04JHKFaF3QOhsi5nMp2l8QAB2Jc1Q+i7gdg3Pj0hj8TvS Z/1PWM0EwqXoThYVNfjDBMDfQhvAzymMoKZLS7PMeIN3XbL+SBkMXoygI/4PXiQwEu6H hBXO+V6MB5vqoHdP9em3KOO9wviRLN1SToi6Di2WMo1PNuAlDHG+41nipJ2PXmGXTJEE KTew== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1725889914; x=1726494714; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :mime-version:subject:date:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=2Ca+bwI9Pu7F3YUoAaUsqSsRV8VpFvNoCThNciak41Q=; b=YJ6h0Way49emY3KK9hUyC17XYODtEbY3Ip3ayyE2T7EnAJe74QlhebbxKs9QodV6lj 1NfOLivWR0krjgTjaldyLm1LCG5f6I1tA3fa9eugtwvtWwpLvZVnja4DuH1m7P9syQE0 i/+2dTc/iIBQV96hUk1Bpq1e1X785S20vMAokM3M6gRBVpVwMVs91k1b8cO+JqfDMZFo 7v2dH4AwYkwJ3e0GuWT7C7rXBEcCnYkkDK52rDg7WQiB+L4zgQaNqIODLnccyBymZD2C 9LpOJyjvU6cBqdaUTww/SXqBw0nO4bj2A2w/gBTo1qbENO5XmsZT05/S2jdsihELRg1f JnsA== X-Forwarded-Encrypted: i=1; AJvYcCVSEJL5qjfziX5jjbkx0HEL2jFt8XlxoMbJ/XF2Ij7o3JuxONlxsEkr7ooI4jsPt41q1jzx6TWkYbx6W4aE@vger.kernel.org X-Gm-Message-State: AOJu0YyhYHp1HTrP0SstNy9dX2AR5z6eShej3egR5FzCdfNzN4qlVarA xQ7n01QwtREvVmPIMiuXBSzpfshKMs1r4XH05odQRVIEa04Wmn31/wLSiAhALQc= X-Google-Smtp-Source: AGHT+IHwSOk/fpUD97Xcan+P+CIOyJe34rmyJqYvmDhNziRzvW/wcrZnoC+6JMIT/uTXpLghlRozEQ== X-Received: by 2002:a05:6000:18a5:b0:378:955f:d242 with SMTP id ffacd0b85a97d-378955fd30emr2248356f8f.12.1725889913898; Mon, 09 Sep 2024 06:51:53 -0700 (PDT) Received: from [127.0.1.1] ([178.197.222.82]) by smtp.gmail.com with ESMTPSA id a640c23a62f3a-a8d25cf3ad6sm345344566b.148.2024.09.09.06.51.52 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 09 Sep 2024 06:51:53 -0700 (PDT) From: Krzysztof Kozlowski Date: Mon, 09 Sep 2024 15:51:22 +0200 Subject: [PATCH 11/17] regulator: mtk-dvfsrc: Constify static data Precedence: bulk X-Mailing-List: linux-arm-msm@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Message-Id: <20240909-regulator-const-v1-11-8934704a5787@linaro.org> References: <20240909-regulator-const-v1-0-8934704a5787@linaro.org> In-Reply-To: <20240909-regulator-const-v1-0-8934704a5787@linaro.org> To: Support Opensource , Liam Girdwood , Mark Brown , Matthias Brugger , AngeloGioacchino Del Regno , Bartosz Golaszewski 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 X-Mailer: b4 0.14.1 X-Developer-Signature: v=1; a=openpgp-sha256; l=2139; i=krzysztof.kozlowski@linaro.org; h=from:subject:message-id; bh=zfZGJPZ+7n/u+R7h1aiFdsdkEzudbMyrWwt0mCMNVy8=; b=owEBbQKS/ZANAwAKAcE3ZuaGi4PXAcsmYgBm3v1iyrWzON70Cq7VuXn8aYsCpNlvo+gCyF8zr /RcPqSw97WJAjMEAAEKAB0WIQTd0mIoPREbIztuuKjBN2bmhouD1wUCZt79YgAKCRDBN2bmhouD 1yTND/9Kx2lZ3eCZZI46T755Vu5pa+AVNHwPIjhtgawTn9QLWZU4dx/nKarepxpIrJmJoAiNmef l9zUCIQ7tTRLh08J5eaODQJjDqqHS9iKGibJ1szkjME/jAk8tK2AuujylmN7rFF6OnjGZRy1hIX +MEkXzQnCsG3sWC79oLxmePYDAS9w79DyLnc+Y2VG416EUBy0sWemV843d/iP/ImkgfSQ8Z+rF0 NqNl+VSGgnBY0WeVjDR5J/LugNaoWcKIOo9oL0JPMMyqLCIbAyXKnZNOKH1RgJohboAaKvvRWcj pvqFAWqbP+cDOVyuibuNXPW57C0G9xz0AdR5CEvDaxMCzVsog/Mp3P+IPNH0DsLfNaLxMcub5pO 7uG43TuDc8R7IV6+0Kwgq6NsaOT+kBsDFBWodE0Kh2TzOv2uZ2COlbSO4fhWQ4xD+D4oOwxNtVa tkUbOckx0oRsGIXgLDv4DqJxJrzypzsLm12PnHbgKcTSps9z5zMpn193f6UCX6fJO9G6V5/GbFg sqWqNLxaDkdNgDua3Pl4lXKyL+90l4ssXiY9uwL788ThSvGGxE4eazeXMUmZ54lNbDvsDYJVzVj ozpmtPHcblf+kCN45ItBbo+Di94pYfYELDshUwux8NWiV61d+WNWYfAV21pMl+w6F26s8fo25Qh ymgij+ek/OQx8QQ== X-Developer-Key: i=krzysztof.kozlowski@linaro.org; a=openpgp; fpr=9BD07E0E0C51F8D59677B7541B93437D3B41629B Driver does not modify static data with regulator description (struct regulator_desc), so make it const for code safety. Signed-off-by: Krzysztof Kozlowski --- Have in mind that to compile this code, you need pending (off-tree) patches, which I applied. --- drivers/regulator/mtk-dvfsrc-regulator.c | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/drivers/regulator/mtk-dvfsrc-regulator.c b/drivers/regulator/mtk-dvfsrc-regulator.c index 9bf4163221f1..f5662c569464 100644 --- a/drivers/regulator/mtk-dvfsrc-regulator.c +++ b/drivers/regulator/mtk-dvfsrc-regulator.c @@ -19,7 +19,7 @@ enum dvfsrc_regulator_id { }; struct dvfsrc_regulator_pdata { - struct regulator_desc *descs; + const struct regulator_desc *descs; u32 size; }; @@ -107,7 +107,7 @@ static const unsigned int mt6873_voltages[] = { 725000, }; -static struct regulator_desc mt6873_regulators[] = { +static const struct regulator_desc mt6873_regulators[] = { MTK_DVFSRC_VREG("dvfsrc-vcore", VCORE, mt6873_voltages), MTK_DVFSRC_VREG("dvfsrc-vscp", VSCP, mt6873_voltages), }; @@ -122,7 +122,7 @@ static const unsigned int mt8183_voltages[] = { 800000, }; -static struct regulator_desc mt8183_regulators[] = { +static const struct regulator_desc mt8183_regulators[] = { MTK_DVFSRC_VREG("dvfsrc-vcore", VCORE, mt8183_voltages), }; @@ -138,7 +138,7 @@ static const unsigned int mt8195_voltages[] = { 750000, }; -static struct regulator_desc mt8195_regulators[] = { +static const struct regulator_desc mt8195_regulators[] = { MTK_DVFSRC_VREG("dvfsrc-vcore", VCORE, mt8195_voltages), MTK_DVFSRC_VREG("dvfsrc-vscp", VSCP, mt8195_voltages), }; @@ -159,7 +159,7 @@ static int dvfsrc_vcore_regulator_probe(struct platform_device *pdev) return -EINVAL; for (i = 0; i < pdata->size; i++) { - struct regulator_desc *vrdesc = &pdata->descs[i]; + const struct regulator_desc *vrdesc = &pdata->descs[i]; struct regulator_dev *rdev; rdev = devm_regulator_register(&pdev->dev, vrdesc, &config); From patchwork Mon Sep 9 13:51:24 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Krzysztof Kozlowski X-Patchwork-Id: 826664 Received: from mail-ej1-f48.google.com (mail-ej1-f48.google.com [209.85.218.48]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 819B21BC9F0 for ; Mon, 9 Sep 2024 13:51:58 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.218.48 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1725889920; cv=none; b=jslHlMl2EPbODsqdOM9jlxAqSGPjB75mov8FlePd5AgfZ0XGQz0bn5FLW8eGB2lN34g+Ln7yiTm1rxISMHWR2UKbgxiPHy6NHwe+bRkcbQpu1gkmuqNvsknQrmVGDhlx+nI8z3Y7VIBlt0ovSkQB1Y3mB8HbIgNvStKwTE6vXuA= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1725889920; c=relaxed/simple; bh=HRKyZjGM94NkFQ6StvG56VA5RTKeFKEABwUAsw2nTr0=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=mxPfJu1wDZkQJscQn9FSfMdqj2KuUGkINGGCSQVjX0UELGQxJerZcvYHZRtsvT7twmejHJvkJZsZLGrQfTVT2MANChlxJGIILYtHhhWXJZWunlf3+dQ8mP+OL+GVGDuJ5ga4FncKu22Ojv/ccZ+lxGDpHhpOa38CbgIbIYYQdMI= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linaro.org; spf=pass smtp.mailfrom=linaro.org; dkim=pass (2048-bit key) header.d=linaro.org header.i=@linaro.org header.b=QJxdMoJ3; arc=none smtp.client-ip=209.85.218.48 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linaro.org Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=linaro.org Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=linaro.org header.i=@linaro.org header.b="QJxdMoJ3" Received: by mail-ej1-f48.google.com with SMTP id a640c23a62f3a-a8713b00219so23260566b.0 for ; Mon, 09 Sep 2024 06:51:58 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1725889917; x=1726494717; darn=vger.kernel.org; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :mime-version:subject:date:from:from:to:cc:subject:date:message-id :reply-to; bh=AYJy8WgMUAn0VEuaq5aXmaoEnUqoMBjQF+74z8dXbcI=; b=QJxdMoJ3nCnO2tzHj6mQ5YmmlfSX/tSPZMS2OC39TUXix5sBO/ExUodH3qwElOAhGp SjqhFSJJTPlgI1C9ls7iqKtgPE1oPkFDkzoIwrEl2giG7wbWH3VvWUQ8DGepoq8Ir+wh i5hDMTXMNeBKZ/hSJpjAxqYEAE8EyY78SFOb3z4+B8r9cLb2zgcrLtvKqiBSCrfQmADd DdzVoEErotetD6vnoFhtDTSkNnGbRCxCEjf/RfKpQJCz6e51hOlGIz3fbuej1iYgwLcj stPsoVUa+M5ElxMK8FxkJvvSLeWje0cEdb2+5RzEQWyaKvQS3y2bJK0JpiGSLS7bBwNQ LSnA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1725889917; x=1726494717; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :mime-version:subject:date:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=AYJy8WgMUAn0VEuaq5aXmaoEnUqoMBjQF+74z8dXbcI=; b=OIvVGhBaS8p16ejtrZAJlSQqfuyiQKpYevjEDRhdvt6ZdzyzsjGM4v+Rt5vT011ygs 2XU6feM2Dmmuzz2t8d0iOYqonzIHOv7Ef5JEjBhm6VG8aPBT+nVe2mqY/F4if6I3xVeo O7R/kvIAUiv8Zyt1End5S3ReJ2iJ7HjkaUH+a2T09dH1WGBZEqL+NQXj8hJ386SEbah7 QlUY9ePUyRanulWDMTphuPtind7eKjlBgsY/Ld0n1fDcuAvN7Gpd+CfvacULor5dwErX Dzuiv3XSgLN2NYkhkx1km0lXN1T2rPbHNv+U85XnTN9HirDIKZJjCKMoXpp8ocsaYjuy TrHQ== X-Forwarded-Encrypted: i=1; AJvYcCUnPunyO5EnERvLoKpx+WOzAKxLLFQKeVH/Y6Eoo3qHHVhXRwEULOaycw+/mNhUxPHmhtpDi0Q7ckUQt+yc@vger.kernel.org X-Gm-Message-State: AOJu0YyguLw/VN9r+01FBovrGziclY0T1EjMC1CSycaN+kh9V6CY7gr3 M5XW42Kv2k4pU6JzloVPDUv8sW3tvVAETb7MnGhT/l2gbHabIP4JLr5fYaZI+/8= X-Google-Smtp-Source: AGHT+IGzfXZ15lM7AABSl1WEEBoTSjYJRhQxhU3CuhHvNSnGY43koVrWg9eO+EQ6ZFAnE+Rywyd0Lw== X-Received: by 2002:a17:907:da3:b0:a83:70d0:7a1e with SMTP id a640c23a62f3a-a8a888e61a0mr406855066b.9.1725889916851; Mon, 09 Sep 2024 06:51:56 -0700 (PDT) Received: from [127.0.1.1] ([178.197.222.82]) by smtp.gmail.com with ESMTPSA id a640c23a62f3a-a8d25cf3ad6sm345344566b.148.2024.09.09.06.51.55 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 09 Sep 2024 06:51:56 -0700 (PDT) From: Krzysztof Kozlowski Date: Mon, 09 Sep 2024 15:51:24 +0200 Subject: [PATCH 13/17] regulator: pfuze100: Constify static data Precedence: bulk X-Mailing-List: linux-arm-msm@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Message-Id: <20240909-regulator-const-v1-13-8934704a5787@linaro.org> References: <20240909-regulator-const-v1-0-8934704a5787@linaro.org> In-Reply-To: <20240909-regulator-const-v1-0-8934704a5787@linaro.org> To: Support Opensource , Liam Girdwood , Mark Brown , Matthias Brugger , AngeloGioacchino Del Regno , Bartosz Golaszewski 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 X-Mailer: b4 0.14.1 X-Developer-Signature: v=1; a=openpgp-sha256; l=2916; i=krzysztof.kozlowski@linaro.org; h=from:subject:message-id; bh=HRKyZjGM94NkFQ6StvG56VA5RTKeFKEABwUAsw2nTr0=; b=owEBbQKS/ZANAwAKAcE3ZuaGi4PXAcsmYgBm3v1j85Ng6PdTzeDBq/rz5MGVUOdHrew/KeKhR UAfJ5DrtbyJAjMEAAEKAB0WIQTd0mIoPREbIztuuKjBN2bmhouD1wUCZt79YwAKCRDBN2bmhouD 1yq9D/9tEjTOPlkRyFze0AvTYAD9mQWQGKm7MqyAuFjex4vzWptpuDisJx4iUpkQGmRhr25LLQX oXu120pBSWEDyQFmdFWxvR1i6Xjdl9p8ssy7QiCXyXw9LWTDUxT2v26LV5QzupmqthvQ0mEH6ae Kk7gQmRAnIMnVliMEojJJ2KkwvVrye1X+xfnycZobF2ebIi82li/lQ5fDcEyLsm/g89FKLP723D en12o+9U4G6pVLlxeXMDXfxXojQtJzrkujgF6AMsRsuxZs6e6bZJck4wyPC1M2lbdFN7/Y9l4Wp xAIahb3R59XqJ1OMcHNHo897iLmXClURj3Q0ENgymMYfRcVdaqyUTRDal3wXBcfMdfAEwb6d47+ miiThY7QV7kjifx3aZGRwEX6JnwRkw+BZqtTuTw90GwNDsSCEZI6DuHZWWvBPRYiPYqEBWBiTzL yrtKPWp0HEb138JnN1PW505GszshVpkyNd8ghcmPCrmrhOk9HZsVdBd5cU9CY2mv6xEwW+n6loy 51xKnNZ/RYG+mu5B8VhF623N1mZPISanAnuYhEjXfbZI28dSOs75HHcrdVbfxcbjLsbJ0uPq/rj 3p7t129yZIjYUXz4cGYDgLPis2PpWCshGD0TdTvKAqo3F/xR1Yw41HJD0E14ZzKfHxyBYo/1osg UG/PHCWPadpT4/w== X-Developer-Key: i=krzysztof.kozlowski@linaro.org; a=openpgp; fpr=9BD07E0E0C51F8D59677B7541B93437D3B41629B Driver does not modify static data with regulator description (struct pfuze_regulator), so make it const for code safety. Signed-off-by: Krzysztof Kozlowski --- drivers/regulator/pfuze100-regulator.c | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/drivers/regulator/pfuze100-regulator.c b/drivers/regulator/pfuze100-regulator.c index 7c04870442d3..7d56c22b5e40 100644 --- a/drivers/regulator/pfuze100-regulator.c +++ b/drivers/regulator/pfuze100-regulator.c @@ -76,7 +76,7 @@ struct pfuze_chip { struct device *dev; struct pfuze_regulator regulator_descs[PFUZE100_MAX_REGULATOR]; struct regulator_dev *regulators[PFUZE100_MAX_REGULATOR]; - struct pfuze_regulator *pfuze_regulators; + const struct pfuze_regulator *pfuze_regulators; }; static const int pfuze100_swbst[] = { @@ -367,7 +367,7 @@ static const struct regulator_ops pfuze3000_sw_regulator_ops = { } /* PFUZE100 */ -static struct pfuze_regulator pfuze100_regulators[] = { +static const struct pfuze_regulator pfuze100_regulators[] = { PFUZE100_SW_REG(PFUZE100, SW1AB, PFUZE100_SW1ABVOL, 300000, 1875000, 25000), PFUZE100_SW_REG(PFUZE100, SW1C, PFUZE100_SW1CVOL, 300000, 1875000, 25000), PFUZE100_SW_REG(PFUZE100, SW2, PFUZE100_SW2VOL, 400000, 1975000, 25000), @@ -386,7 +386,7 @@ static struct pfuze_regulator pfuze100_regulators[] = { PFUZE100_COIN_REG(PFUZE100, COIN, PFUZE100_COINVOL, 0x7, pfuze100_coin), }; -static struct pfuze_regulator pfuze200_regulators[] = { +static const struct pfuze_regulator pfuze200_regulators[] = { PFUZE100_SW_REG(PFUZE200, SW1AB, PFUZE100_SW1ABVOL, 300000, 1875000, 25000), PFUZE100_SW_REG(PFUZE200, SW2, PFUZE100_SW2VOL, 400000, 1975000, 25000), PFUZE100_SW_REG(PFUZE200, SW3A, PFUZE100_SW3AVOL, 400000, 1975000, 25000), @@ -403,7 +403,7 @@ static struct pfuze_regulator pfuze200_regulators[] = { PFUZE100_COIN_REG(PFUZE200, COIN, PFUZE100_COINVOL, 0x7, pfuze100_coin), }; -static struct pfuze_regulator pfuze3000_regulators[] = { +static const struct pfuze_regulator pfuze3000_regulators[] = { PFUZE3000_SW_REG(PFUZE3000, SW1A, PFUZE100_SW1ABVOL, 0x1f, pfuze3000_sw1a), PFUZE100_SW_REG(PFUZE3000, SW1B, PFUZE100_SW1CVOL, 700000, 1475000, 25000), PFUZE3000_SW_REG(PFUZE3000, SW2, PFUZE100_SW2VOL, 0x7, pfuze3000_sw2lo), @@ -419,7 +419,7 @@ static struct pfuze_regulator pfuze3000_regulators[] = { PFUZE100_VGEN_REG(PFUZE3000, VLDO4, PFUZE100_VGEN6VOL, 1800000, 3300000, 100000), }; -static struct pfuze_regulator pfuze3001_regulators[] = { +static const struct pfuze_regulator pfuze3001_regulators[] = { PFUZE3000_SW_REG(PFUZE3001, SW1, PFUZE100_SW1ABVOL, 0x1f, pfuze3000_sw1a), PFUZE3000_SW_REG(PFUZE3001, SW2, PFUZE100_SW2VOL, 0x7, pfuze3000_sw2lo), PFUZE3000_SW3_REG(PFUZE3001, SW3, PFUZE100_SW3AVOL, 900000, 1650000, 50000), From patchwork Mon Sep 9 13:51:26 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Krzysztof Kozlowski X-Patchwork-Id: 826663 Received: from mail-ed1-f45.google.com (mail-ed1-f45.google.com [209.85.208.45]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id E6B631BD51E for ; Mon, 9 Sep 2024 13:52:01 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.208.45 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1725889923; cv=none; b=UUTYeNbW1RyYLrfUxFenNgxPGgAtxtShY1AccH8B3cq+H1M5Gnb//IOpfNJOgbLlhNRryIdoweyKhBuPnTgXQAnE71OiawRpjdPYpfGfco+JK8WmUqEa54lUx/rtcOKNtx+J9tlw9Q6pQleeUU4ldwt5ix45bCIii2w8tYpN78w= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1725889923; c=relaxed/simple; bh=30I+hQDkibrC4fpctSIcG7hdlAaMTfnXmLnvdZibnpU=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=rIqEUTF6CTzKloYCtOUAan80RvYuz1tPk40s5M1hLFXdBb8ca2ucYl7aMzdffE/3eIOVx/nRD4FbvBWLxz67RgTKjlnK5SNxu0Xn43Gdei1QwGkNZUyJKV5WdXMoZ6Tyh/m53kqzYwMAJMwny1XXoF/41tQa/VF61pAK7y4cegc= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linaro.org; spf=pass smtp.mailfrom=linaro.org; dkim=pass (2048-bit key) header.d=linaro.org header.i=@linaro.org header.b=SpU23G7J; arc=none smtp.client-ip=209.85.208.45 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linaro.org Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=linaro.org Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=linaro.org header.i=@linaro.org header.b="SpU23G7J" Received: by mail-ed1-f45.google.com with SMTP id 4fb4d7f45d1cf-5c2535b081fso414819a12.2 for ; Mon, 09 Sep 2024 06:52:01 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1725889920; x=1726494720; darn=vger.kernel.org; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :mime-version:subject:date:from:from:to:cc:subject:date:message-id :reply-to; bh=5Qz5yF8W3jl1pLAFz+0oNTHhctIS0pggkjmDEQxrtgU=; b=SpU23G7JvwPVip2PWQ5P8j1Q/c4+OFN9lP5fidFKUJ8ariFjLySEXNeDSh8mmNpSsI DI+3XUMeOJMhF6SuSncLC5sHie+N4D+nRp+6GqPxivlKbCGfLr+kQAJbtfQsS1CrpPfW knk5NqKqQgErLgGGGYsg3Eg6R66fM7+CjVrl5a3n7JsYtF5HK68xAviRKNlLH1q+PJGv HHXNGQRTWd9HPFK/e1DKKqGjQMeAallamqjWo93MspWYZ4NKkmotQ1yJXIeoNcOrwDKT 74HZGezE24NpCyMdaHxgCed9vHe6gLmXRXqwdvitljWsay5xakCKXENBdI+dPDcknnCp qOyw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1725889920; x=1726494720; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :mime-version:subject:date:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=5Qz5yF8W3jl1pLAFz+0oNTHhctIS0pggkjmDEQxrtgU=; b=mF/4pDTmh71D+tVdIM5QWm8lgs1/SMVOaoIE+VLMZPYP6s2hOYEkkhR+KpGj2ef9lC q8QQIUIQ49JKtrMkaiUftU5Jz8s4iZ1loMc8p7vgeXab2n/KWLWnmy6e8ErWTUPg+NYU o2QWw2OTMOUGVb2Lz8lWS1heacbuBJ3YV6kBPNbZ+Bl2KaAABPmlv3HGEfwI1ngbj27Y BJE6526WPN0oL21z+VoXKgFkM+og7Te7jkg2d7ZDDakzlzufKlAR78ZW600Kj/nnXaYp /aAIXHeka56Ilg01OlHPhPa6GLobrFqbkbOPElG1VbWp6w+XkMJsqhJQ2VYW/8g//Y6P B3Rg== X-Forwarded-Encrypted: i=1; AJvYcCV55cgQJlljsuoTKrQ4cjp24ipv8rdnyv4bAuivTnWzO9iaPNWKGmczE+2Lau40z/eOnGVDF3oZK8VQkUnh@vger.kernel.org X-Gm-Message-State: AOJu0Yy5IMvoaBh8VfsIqf/618mm8Rt8Q7WtYAXnsC3Vhllc1okubrvv k7mT37hW/pgTQ4879vCg+OrWAzjVp28j3XSTmlWcqZnKNwQMhZPHbVt3XAtdEIE= X-Google-Smtp-Source: AGHT+IHSuAevAtPCygtpKBvr/DQWy/NsHdMyERpLS/rDXi0gGwd6VC/KF5cHqYfeuGYHkbx6t4QX+w== X-Received: by 2002:a17:907:3f9b:b0:a8d:2623:dd19 with SMTP id a640c23a62f3a-a8d2623e2b7mr190904166b.14.1725889920059; Mon, 09 Sep 2024 06:52:00 -0700 (PDT) Received: from [127.0.1.1] ([178.197.222.82]) by smtp.gmail.com with ESMTPSA id a640c23a62f3a-a8d25cf3ad6sm345344566b.148.2024.09.09.06.51.58 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 09 Sep 2024 06:51:59 -0700 (PDT) From: Krzysztof Kozlowski Date: Mon, 09 Sep 2024 15:51:26 +0200 Subject: [PATCH 15/17] regulator: hi6421v530: Drop unused 'eco_microamp' Precedence: bulk X-Mailing-List: linux-arm-msm@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Message-Id: <20240909-regulator-const-v1-15-8934704a5787@linaro.org> References: <20240909-regulator-const-v1-0-8934704a5787@linaro.org> In-Reply-To: <20240909-regulator-const-v1-0-8934704a5787@linaro.org> To: Support Opensource , Liam Girdwood , Mark Brown , Matthias Brugger , AngeloGioacchino Del Regno , Bartosz Golaszewski 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 X-Mailer: b4 0.14.1 X-Developer-Signature: v=1; a=openpgp-sha256; l=2350; i=krzysztof.kozlowski@linaro.org; h=from:subject:message-id; bh=30I+hQDkibrC4fpctSIcG7hdlAaMTfnXmLnvdZibnpU=; b=kA0DAAoBwTdm5oaLg9cByyZiAGbe/WWgVe4Femx5zZkMkuSdYYU3T+Lo1v/39prjIzLzFC2Rk okCMwQAAQoAHRYhBN3SYig9ERsjO264qME3ZuaGi4PXBQJm3v1lAAoJEME3ZuaGi4PXrZ4P/jA0 sscxqGelVqRBLU11Sgi+WZRl0920k7u9YS+qTqrF3B/ixnO5gkeFkh4TidRddSqKEWj+bKpdvWa A985jl1aSp2A42gfSWC7SYcXBpCgXKPR3E5di6RpAUS2Msj8yuwD7dJudEhah6wq+pYlfCNcI3t gdcDxs6cY8+kbdmCsRWXDs8X6PqojXuAlNlKPH9FrQolgKicOVgYfXvyQQrBFRcCrrFHgpPyhZT QMQ4Y+Vcxj5WAg057JH9m2BMVVmcUppJSaBoc1Yz1EN3ZNTm/OZY9lDFywruf24uW6wlZHz22NX RmmZIeW1AUBK7ZpSDY1/R74lzoVOH4CDNVotkjknx06o7Tme2QRHyUQdhghK73hGa4ojfkfM8sT QJ5FWuKNPfujqXIuKg8+xL2slkkJ+UJXYHL1SsIbNzNaulZXEXiO+TAJzDcChJskzf4NE/BRG9G jRPXYkMladjtkLEgp0jvX8Jg88lqSaM5XodDAyrrr/qjRcWLaFpKb4NIG8dViOlRndyg6o+pT0o kZWiKXuuzuoTtzqisFHhoSOsmDWPwmBHu2SSsFqQ0oG8eOsi3v+jwn46ji9DwGcvQu79QkLAOFq 32/amHyTfCBs9oqbF7lZOKOeBYNkW88NZysVNbLHkW52ifnuyjykX+2B4b/QR4BpGZTi4B2bPRP fQWF8 X-Developer-Key: i=krzysztof.kozlowski@linaro.org; a=openpgp; fpr=9BD07E0E0C51F8D59677B7541B93437D3B41629B The hi6421v530_regulator_info.eco_microamp is assigned once and never used again. Signed-off-by: Krzysztof Kozlowski --- drivers/regulator/hi6421v530-regulator.c | 16 ++++++---------- 1 file changed, 6 insertions(+), 10 deletions(-) diff --git a/drivers/regulator/hi6421v530-regulator.c b/drivers/regulator/hi6421v530-regulator.c index 23924ff0c7b2..a9c6c077f50d 100644 --- a/drivers/regulator/hi6421v530-regulator.c +++ b/drivers/regulator/hi6421v530-regulator.c @@ -21,12 +21,10 @@ * struct hi6421v530_regulator_info - hi6421v530 regulator information * @desc: regulator description * @mode_mask: ECO mode bitmask of LDOs; for BUCKs, this masks sleep - * @eco_microamp: eco mode load upper limit (in uA), valid for LDOs only */ struct hi6421v530_regulator_info { struct regulator_desc rdesc; u8 mode_mask; - u32 eco_microamp; }; /* HI6421v530 regulators */ @@ -68,10 +66,9 @@ static const struct regulator_ops hi6421v530_ldo_ops; * emask - enable mask * odelay - off/on delay time in uS * ecomask - eco mode mask - * ecoamp - eco mode load uppler limit in uA */ #define HI6421V530_LDO(_ID, v_table, vreg, vmask, ereg, emask, \ - odelay, ecomask, ecoamp) { \ + odelay, ecomask) { \ .rdesc = { \ .name = #_ID, \ .of_match = of_match_ptr(#_ID), \ @@ -90,22 +87,21 @@ static const struct regulator_ops hi6421v530_ldo_ops; .off_on_delay = odelay, \ }, \ .mode_mask = ecomask, \ - .eco_microamp = ecoamp, \ } /* HI6421V530 regulator information */ static struct hi6421v530_regulator_info hi6421v530_regulator_info[] = { HI6421V530_LDO(LDO3, ldo_3_voltages, 0x061, 0xf, 0x060, 0x2, - 20000, 0x6, 8000), + 20000, 0x6), HI6421V530_LDO(LDO9, ldo_9_11_voltages, 0x06b, 0x7, 0x06a, 0x2, - 40000, 0x6, 8000), + 40000, 0x6), HI6421V530_LDO(LDO11, ldo_9_11_voltages, 0x06f, 0x7, 0x06e, 0x2, - 40000, 0x6, 8000), + 40000, 0x6), HI6421V530_LDO(LDO15, ldo_15_16_voltages, 0x077, 0x7, 0x076, 0x2, - 40000, 0x6, 8000), + 40000, 0x6), HI6421V530_LDO(LDO16, ldo_15_16_voltages, 0x079, 0x7, 0x078, 0x2, - 40000, 0x6, 8000), + 40000, 0x6), }; static unsigned int hi6421v530_regulator_ldo_get_mode( From patchwork Mon Sep 9 13:51:27 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Krzysztof Kozlowski X-Patchwork-Id: 826662 Received: from mail-ej1-f51.google.com (mail-ej1-f51.google.com [209.85.218.51]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 3DB451BDA99 for ; Mon, 9 Sep 2024 13:52:03 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.218.51 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1725889925; cv=none; b=cfo1cdbCXRxr1SbkLgzRAtf3RnlMxOLWtKK8UNcAwBB9Og1JNLsceP4rGI3U747EDXIEEhhcBUYIAURrMS/NSRbSxOLry7IJJNiuYKanCH9PLG+1c8WWb5ECfJPmzp4gCqKqCq2HRqKm444/ThxOSjTdW1/yIu9vAQSpPZQeErM= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1725889925; c=relaxed/simple; bh=QfpMH8xpX7M5v1cNMdTuKAFwaOO0ijMMMrIuqJNJ7Fc=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=Wo4Bum1t/0AhVYdylLhFWs7A/488nklQwaAeBFqV68k0Yvf+fxZzbvMIHOvPL+sKDT8q4wEWHJ1TLmRHqso7HXGjnhaMziOYCp7HccmUEL8jOYI2HmxqkHP/P+6p8vjqcpcR+6aEZq5BPGwVqORryfem22UN8/lW+r0EXk1YlJM= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linaro.org; spf=pass smtp.mailfrom=linaro.org; dkim=pass (2048-bit key) header.d=linaro.org header.i=@linaro.org header.b=TTMniVFR; arc=none smtp.client-ip=209.85.218.51 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linaro.org Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=linaro.org Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=linaro.org header.i=@linaro.org header.b="TTMniVFR" Received: by mail-ej1-f51.google.com with SMTP id a640c23a62f3a-a8a92e8c840so38153366b.2 for ; Mon, 09 Sep 2024 06:52:03 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1725889921; x=1726494721; darn=vger.kernel.org; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :mime-version:subject:date:from:from:to:cc:subject:date:message-id :reply-to; bh=HEAviafQzNR7Z9t5hpM5VZEKV85C26CtMxeL00PENiQ=; b=TTMniVFRkH7FAW64HG0nVKhi7SVcFNDUXg/BNNoI1aifgw0L6hVZrZSjOeCqXl61+b ES93oSt+YKovm1dUCxenX1Ed4egEPg7QwncUpVRDh27M1HDGQBp9MeNp/ihpUahajpQV 5wiyiswV8+/mzom0u6rJe1rgK9l9Ps9X6qAtZ3CHvUPZqccX3ejAuvga+yzic24Z0mf4 EneCVg9LXZNS2wGiw3Tx6UZ5QBUwnWInbd0O7kSTHMHMmkrC3oDXM6PgwhIhjC0nQwSN QTwXu6a6+vFof0P2Yr4fn5GRDD7bMqfyeGdfJGwj4amB06T4cjRzvs2EjTT9Sa4CIX9W SJng== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1725889921; x=1726494721; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :mime-version:subject:date:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=HEAviafQzNR7Z9t5hpM5VZEKV85C26CtMxeL00PENiQ=; b=ipdwbjDEHNfJ6TvEPgUo2ZEKGopuS0ktnXe3VLzYGg4tFxo/bEqEeXvOwtytePb5uF 1R/dD7aa/iIb86IFNOl5oPCX6ofyy78dQOx+IASCE7qRPWZuA1scJpgDZgkPRflLdJFf iFcRf2Q5q57yKzrrXr6uz4OEWm/n+eRjLjGXlZcuezhPKzfNfPUzU008+Ap91J6AfbdB dgAcrb/8ggwdo4Su3WY+n3uO0lCKSGbpRNjoDkippYTdqvU6LB8ajlVZ2MGLnXkGebn8 Sw01M3rAiZe8+Tt6Vs+z62YuDhIQGg8G8FPb51flSBN0l+mPWuk6O3d9AQ+EAXnM8j8L 49mQ== X-Forwarded-Encrypted: i=1; AJvYcCVJQkcBp/J2EQL7srI3G98OyPFHFjlTLQ4CTFP8MmaMKKdXz05sROnCA8L8PCpi1HWxX5Vm17SoO3cq7LNb@vger.kernel.org X-Gm-Message-State: AOJu0YxTmZxBFaqyI6Vq23pvzChrG4mf8lOJW7lASAjpNoUNm9TGUAdp VjsRVbrF0iN6lRkWnQ5HLGsc95vXGb5YS1xVgvNfEO+lz3PoTQlkeTxx+YvHcGg= X-Google-Smtp-Source: AGHT+IGUrqfpjeRf1rMAe7mjAkRWErGkoP/w4iRCRemp+gCnfBdE5Yx7pYFApwpFKe1jn6l3HlkbcA== X-Received: by 2002:a17:907:3d8b:b0:a80:a193:a509 with SMTP id a640c23a62f3a-a8a885bdde7mr356155466b.2.1725889921408; Mon, 09 Sep 2024 06:52:01 -0700 (PDT) Received: from [127.0.1.1] ([178.197.222.82]) by smtp.gmail.com with ESMTPSA id a640c23a62f3a-a8d25cf3ad6sm345344566b.148.2024.09.09.06.52.00 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 09 Sep 2024 06:52:00 -0700 (PDT) From: Krzysztof Kozlowski Date: Mon, 09 Sep 2024 15:51:27 +0200 Subject: [PATCH 16/17] regulator: hi6421v530: Use container_of and constify static data Precedence: bulk X-Mailing-List: linux-arm-msm@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Message-Id: <20240909-regulator-const-v1-16-8934704a5787@linaro.org> References: <20240909-regulator-const-v1-0-8934704a5787@linaro.org> In-Reply-To: <20240909-regulator-const-v1-0-8934704a5787@linaro.org> To: Support Opensource , Liam Girdwood , Mark Brown , Matthias Brugger , AngeloGioacchino Del Regno , Bartosz Golaszewski 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 X-Mailer: b4 0.14.1 X-Developer-Signature: v=1; a=openpgp-sha256; l=2454; i=krzysztof.kozlowski@linaro.org; h=from:subject:message-id; bh=QfpMH8xpX7M5v1cNMdTuKAFwaOO0ijMMMrIuqJNJ7Fc=; b=owEBbQKS/ZANAwAKAcE3ZuaGi4PXAcsmYgBm3v1mbrrIu6Do6kppOFM21iGEOSQnx+wr6TRGX MTTtX77+QKJAjMEAAEKAB0WIQTd0mIoPREbIztuuKjBN2bmhouD1wUCZt79ZgAKCRDBN2bmhouD 17PsD/49SlTRgOuT9opobBE999Eo0XMLtC18q26ggdv3vW/9xY53TZacc1sfclw2LWcHUPAzpMk v2yz16QkZK0z0MiqCpwIM3z7/b4Idk/YJQxNscRM645bKHaNxlYeBVQgXRpX/rgPYKwne7RRCzS 2G8wCmaSA7KTQ4OK0I/VX1B1w1PVLAdlTp1DajYRjpFMQyCbeGMx1dw2pHFCVEZnGklOtB+JXZw F24rxvpdFzaZTvbSrR8OA3Qr0AbdGSNsvBjJxWxMKNmeXehb9q4X7PeP6NMEWyZuZahJhIwjPuK 4GjDbix7naxDG3LRLFvXQVBTd3tTtlrmarGiqUrWr48TKoOIiXQ9+3DhtiZbU0jen/scVfhLIXN JLmEHol/WBUI0ziNAnJcMtWHmUDZeQZgehGHviTxSEQvRoCRJi8cR8jVrPFXBOeWXUp5+cELP7+ e9OPitc1nA9XIsdv9Is1SNjUSSH8fQGeNLDqzfSNPLkGqGDi8HE/QlkfwsNJ27ITARLbditccpc 3OaBBhaAb6Ejc/HnYwA1EcFNkR+iwRN8RBLJqsGC7GVr9tfTtG1CZDKj8B9TfcLpEpCBvVTcmUd wa85RJKRg3BgCuNk3/bEnS44Ywg8avfJ5Q66Hu84715P6hvPDUVsjB8PJSrlaN477J5Bxa2URNo S2rXdeUiFplSo8w== X-Developer-Key: i=krzysztof.kozlowski@linaro.org; a=openpgp; fpr=9BD07E0E0C51F8D59677B7541B93437D3B41629B Switch from rdev_get_drvdata() to container_of(), so the static 'struct hi6421v530_regulator_info' holding 'struct regulator_desc' can be made const for code safety. Signed-off-by: Krzysztof Kozlowski --- [RFT]: Not tested, only built. --- drivers/regulator/hi6421v530-regulator.c | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) diff --git a/drivers/regulator/hi6421v530-regulator.c b/drivers/regulator/hi6421v530-regulator.c index a9c6c077f50d..b3ebd1624814 100644 --- a/drivers/regulator/hi6421v530-regulator.c +++ b/drivers/regulator/hi6421v530-regulator.c @@ -91,7 +91,7 @@ static const struct regulator_ops hi6421v530_ldo_ops; /* HI6421V530 regulator information */ -static struct hi6421v530_regulator_info hi6421v530_regulator_info[] = { +static const struct hi6421v530_regulator_info hi6421v530_regulator_info[] = { HI6421V530_LDO(LDO3, ldo_3_voltages, 0x061, 0xf, 0x060, 0x2, 20000, 0x6), HI6421V530_LDO(LDO9, ldo_9_11_voltages, 0x06b, 0x7, 0x06a, 0x2, @@ -107,10 +107,10 @@ static struct hi6421v530_regulator_info hi6421v530_regulator_info[] = { static unsigned int hi6421v530_regulator_ldo_get_mode( struct regulator_dev *rdev) { - struct hi6421v530_regulator_info *info; + const struct hi6421v530_regulator_info *info; unsigned int reg_val; - info = rdev_get_drvdata(rdev); + info = container_of(rdev->desc, struct hi6421v530_regulator_info, rdesc); regmap_read(rdev->regmap, rdev->desc->enable_reg, ®_val); if (reg_val & (info->mode_mask)) @@ -122,10 +122,10 @@ static unsigned int hi6421v530_regulator_ldo_get_mode( static int hi6421v530_regulator_ldo_set_mode(struct regulator_dev *rdev, unsigned int mode) { - struct hi6421v530_regulator_info *info; + const struct hi6421v530_regulator_info *info; unsigned int new_mode; - info = rdev_get_drvdata(rdev); + info = container_of(rdev->desc, struct hi6421v530_regulator_info, rdesc); switch (mode) { case REGULATOR_MODE_NORMAL: new_mode = 0; @@ -172,7 +172,6 @@ static int hi6421v530_regulator_probe(struct platform_device *pdev) for (i = 0; i < ARRAY_SIZE(hi6421v530_regulator_info); i++) { config.dev = pdev->dev.parent; config.regmap = pmic->regmap; - config.driver_data = &hi6421v530_regulator_info[i]; rdev = devm_regulator_register(&pdev->dev, &hi6421v530_regulator_info[i].rdesc,