From: Axel Lin <axel.lin@gmail.com>
To: linux-kernel@vger.kernel.org
Cc: Marek Vasut <marek.vasut@gmail.com>, Liam Girdwood <lrg@ti.com>,
Mark Brown <broonie@opensource.wolfsonmicro.com>
Subject: [PATCH RFT 2/3] regulator: isl6271a: Convert to get_voltage_sel
Date: Wed, 16 May 2012 10:10:22 +0800 [thread overview]
Message-ID: <1337134222.5940.3.camel@phoenix> (raw)
In-Reply-To: <1337134167.5940.2.camel@phoenix>
Signed-off-by: Axel Lin <axel.lin@gmail.com>
---
drivers/regulator/isl6271a-regulator.c | 17 +++++------------
1 files changed, 5 insertions(+), 12 deletions(-)
diff --git a/drivers/regulator/isl6271a-regulator.c b/drivers/regulator/isl6271a-regulator.c
index 78cdc90..00cb288 100644
--- a/drivers/regulator/isl6271a-regulator.c
+++ b/drivers/regulator/isl6271a-regulator.c
@@ -35,26 +35,19 @@ struct isl_pmic {
struct mutex mtx;
};
-static int isl6271a_get_voltage(struct regulator_dev *dev)
+static int isl6271a_get_voltage_sel(struct regulator_dev *dev)
{
struct isl_pmic *pmic = rdev_get_drvdata(dev);
- int idx, data;
+ int idx;
mutex_lock(&pmic->mtx);
idx = i2c_smbus_read_byte(pmic->client);
- if (idx < 0) {
+ if (idx < 0)
dev_err(&pmic->client->dev, "Error getting voltage\n");
- data = idx;
- goto out;
- }
-
- /* Convert the data from chip to microvolts */
- data = ISL6271A_VOLTAGE_MIN + (ISL6271A_VOLTAGE_STEP * (idx & 0xf));
-out:
mutex_unlock(&pmic->mtx);
- return data;
+ return idx;
}
static int isl6271a_set_voltage(struct regulator_dev *dev,
@@ -84,7 +77,7 @@ static int isl6271a_set_voltage(struct regulator_dev *dev,
}
static struct regulator_ops isl_core_ops = {
- .get_voltage = isl6271a_get_voltage,
+ .get_voltage_sel = isl6271a_get_voltage_sel,
.set_voltage = isl6271a_set_voltage,
.list_voltage = regulator_list_voltage_linear,
};
--
1.7.5.4
next prev parent reply other threads:[~2012-05-16 2:10 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2012-05-16 2:09 [PATCH RFT 1/3] regulator: isl6271a: Use regulator_list_voltage_linear() Axel Lin
2012-05-16 2:10 ` Axel Lin [this message]
2012-05-16 2:11 ` [PATCH RFT 3/3] regulator: isl6271a: Convert to set_voltage_sel and regulator_map_voltage_linear Axel Lin
2012-05-16 2:29 ` Marek Vasut
2012-05-16 8:47 ` [PATCH RFT 1/3] regulator: isl6271a: Use regulator_list_voltage_linear() 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=1337134222.5940.3.camel@phoenix \
--to=axel.lin@gmail.com \
--cc=broonie@opensource.wolfsonmicro.com \
--cc=linux-kernel@vger.kernel.org \
--cc=lrg@ti.com \
--cc=marek.vasut@gmail.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