[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <e4c7ed9321df9d5772b9ab381f98ded879dbcd3c.1611048785.git.mchehab+huawei@kernel.org>
Date: Tue, 19 Jan 2021 11:14:12 +0100
From: Mauro Carvalho Chehab <mchehab+huawei@...nel.org>
To: Mark Brown <broonie@...nel.org>, Lee Jones <lee.jones@...aro.org>
Cc: Mauro Carvalho Chehab <mchehab+huawei@...nel.org>,
Greg Kroah-Hartman <gregkh@...uxfoundation.org>,
Mayulong <mayulong1@...wei.com>, devel@...verdev.osuosl.org,
linux-kernel@...r.kernel.org
Subject: [PATCH v3 07/18] staging: hikey9xx: hi6421v600-regulator: get rid of an static data
Move it to be inside the private data struct.
Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@...nel.org>
---
drivers/staging/hikey9xx/hi6421v600-regulator.c | 10 ++++++----
1 file changed, 6 insertions(+), 4 deletions(-)
diff --git a/drivers/staging/hikey9xx/hi6421v600-regulator.c b/drivers/staging/hikey9xx/hi6421v600-regulator.c
index 5469089a3daf..e96aab17a499 100644
--- a/drivers/staging/hikey9xx/hi6421v600-regulator.c
+++ b/drivers/staging/hikey9xx/hi6421v600-regulator.c
@@ -28,9 +28,10 @@ struct hi6421_spmi_reg_info {
struct hi6421_spmi_pmic *pmic;
u8 eco_mode_mask;
u32 eco_uA;
-};
-static DEFINE_MUTEX(enable_mutex);
+ /* Serialize regulator enable logic */
+ struct mutex enable_mutex;
+};
static const unsigned int ldo3_voltages[] = {
1500000, 1550000, 1600000, 1650000,
@@ -118,7 +119,7 @@ static int hi6421_spmi_regulator_enable(struct regulator_dev *rdev)
struct hi6421_spmi_pmic *pmic = sreg->pmic;
/* cannot enable more than one regulator at one time */
- mutex_lock(&enable_mutex);
+ mutex_lock(&sreg->enable_mutex);
usleep_range(HISI_REGS_ENA_PROTECT_TIME,
HISI_REGS_ENA_PROTECT_TIME + 1000);
@@ -127,7 +128,7 @@ static int hi6421_spmi_regulator_enable(struct regulator_dev *rdev)
rdev->desc->enable_mask,
rdev->desc->enable_mask);
- mutex_unlock(&enable_mutex);
+ mutex_unlock(&sreg->enable_mutex);
return 0;
}
@@ -312,6 +313,7 @@ static int hi6421_spmi_regulator_probe(struct platform_device *pdev)
return -ENOMEM;
sreg->pmic = pmic;
+ mutex_init(&sreg->enable_mutex);
for (i = 0; i < ARRAY_SIZE(regulator_info); i++) {
/* assign per-regulator data */
--
2.29.2
Powered by blists - more mailing lists