lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <1366126380.14735.4.camel@phoenix>
Date:	Tue, 16 Apr 2013 23:33:00 +0800
From:	Axel Lin <axel.lin@...ics.com>
To:	Mark Brown <broonie@...nsource.wolfsonmicro.com>
Cc:	Bengt Jonsson <bengt.g.jonsson@...ricsson.com>,
	Lee Jones <lee.jones@...aro.org>,
	Yvan FILLION <yvan.fillion@...ricsson.com>,
	Liam Girdwood <lgirdwood@...il.com>,
	linux-kernel@...r.kernel.org
Subject: [PATCH v2 2/2] regulator: ab8500-ext: Remove enable() and disable()
 functions

Both enable() and disable() functions have only one caller, thus remove them.

Signed-off-by: Axel Lin <axel.lin@...ics.com>
---
 drivers/regulator/ab8500-ext.c |   64 +++++++++++++++-------------------------
 1 file changed, 23 insertions(+), 41 deletions(-)

diff --git a/drivers/regulator/ab8500-ext.c b/drivers/regulator/ab8500-ext.c
index 03faf9c..b4d4547 100644
--- a/drivers/regulator/ab8500-ext.c
+++ b/drivers/regulator/ab8500-ext.c
@@ -54,32 +54,44 @@ struct ab8500_ext_regulator_info {
 	u8 update_val_hw;
 };
 
-static int enable(struct ab8500_ext_regulator_info *info, u8 *regval)
+static int ab8500_ext_regulator_enable(struct regulator_dev *rdev)
 {
 	int ret;
+	struct ab8500_ext_regulator_info *info = rdev_get_drvdata(rdev);
+	u8 regval;
 
-	*regval = info->update_val;
+	if (info == NULL) {
+		dev_err(rdev_get_dev(rdev), "regulator info null pointer\n");
+		return -EINVAL;
+	}
 
 	/*
 	 * To satisfy both HW high power request and SW request, the regulator
 	 * must be on in high power.
 	 */
 	if (info->cfg && info->cfg->hwreq)
-		*regval = info->update_val_hp;
+		regval = info->update_val_hp;
+	else
+		regval = info->update_val;
 
 	ret = abx500_mask_and_set_register_interruptible(info->dev,
 		info->update_bank, info->update_reg,
-		info->update_mask, *regval);
+		info->update_mask, regval);
 	if (ret < 0) {
 		dev_err(rdev_get_dev(info->rdev),
 			"couldn't set enable bits for regulator\n");
 		return ret;
 	}
 
-	return ret;
+	dev_dbg(rdev_get_dev(rdev),
+		"%s-enable (bank, reg, mask, value): 0x%02x, 0x%02x, 0x%02x, 0x%02x\n",
+		info->desc.name, info->update_bank, info->update_reg,
+		info->update_mask, regval);
+
+	return 0;
 }
 
-static int ab8500_ext_regulator_enable(struct regulator_dev *rdev)
+static int ab8500_ext_regulator_disable(struct regulator_dev *rdev)
 {
 	int ret;
 	struct ab8500_ext_regulator_info *info = rdev_get_drvdata(rdev);
@@ -90,59 +102,29 @@ static int ab8500_ext_regulator_enable(struct regulator_dev *rdev)
 		return -EINVAL;
 	}
 
-	ret = enable(info, &regval);
-
-	dev_dbg(rdev_get_dev(rdev), "%s-enable (bank, reg, mask, value):"
-		" 0x%02x, 0x%02x, 0x%02x, 0x%02x\n",
-		info->desc.name, info->update_bank, info->update_reg,
-		info->update_mask, regval);
-
-	return ret;
-}
-
-static int disable(struct ab8500_ext_regulator_info *info, u8 *regval)
-{
-	int ret;
-
-	*regval = 0x0;
-
 	/*
 	 * Set the regulator in HW request mode if configured
 	 */
 	if (info->cfg && info->cfg->hwreq)
-		*regval = info->update_val_hw;
+		regval = info->update_val_hw;
+	else
+		regval = 0;
 
 	ret = abx500_mask_and_set_register_interruptible(info->dev,
 		info->update_bank, info->update_reg,
-		info->update_mask, *regval);
+		info->update_mask, regval);
 	if (ret < 0) {
 		dev_err(rdev_get_dev(info->rdev),
 			"couldn't set disable bits for regulator\n");
 		return ret;
 	}
 
-	return ret;
-}
-
-static int ab8500_ext_regulator_disable(struct regulator_dev *rdev)
-{
-	int ret;
-	struct ab8500_ext_regulator_info *info = rdev_get_drvdata(rdev);
-	u8 regval;
-
-	if (info == NULL) {
-		dev_err(rdev_get_dev(rdev), "regulator info null pointer\n");
-		return -EINVAL;
-	}
-
-	ret = disable(info, &regval);
-
 	dev_dbg(rdev_get_dev(rdev), "%s-disable (bank, reg, mask, value):"
 		" 0x%02x, 0x%02x, 0x%02x, 0x%02x\n",
 		info->desc.name, info->update_bank, info->update_reg,
 		info->update_mask, regval);
 
-	return ret;
+	return 0;
 }
 
 static int ab8500_ext_regulator_is_enabled(struct regulator_dev *rdev)
-- 
1.7.10.4



--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ