* [PATCH] regulator: lp872x: Kill _rdev_to_offset() function
@ 2012-12-08 1:56 Axel Lin
2012-12-10 2:30 ` Kim, Milo
2012-12-10 3:23 ` Mark Brown
0 siblings, 2 replies; 3+ messages in thread
From: Axel Lin @ 2012-12-08 1:56 UTC (permalink / raw)
To: Mark Brown; +Cc: Milo(Woogyom) Kim, Liam Girdwood, linux-kernel
There is only one user calling _rdev_to_offset() function.
Remove _rdev_to_offset() makes the code simpler.
Signed-off-by: Axel Lin <axel.lin@ingics.com>
---
drivers/regulator/lp872x.c | 36 +++++++-----------------------------
1 file changed, 7 insertions(+), 29 deletions(-)
diff --git a/drivers/regulator/lp872x.c b/drivers/regulator/lp872x.c
index 9289ead..8e3c7ae 100644
--- a/drivers/regulator/lp872x.c
+++ b/drivers/regulator/lp872x.c
@@ -181,20 +181,6 @@ static inline int lp872x_update_bits(struct lp872x *lp, u8 addr,
return regmap_update_bits(lp->regmap, addr, mask, data);
}
-static int _rdev_to_offset(struct regulator_dev *rdev)
-{
- enum lp872x_regulator_id id = rdev_get_id(rdev);
-
- switch (id) {
- case LP8720_ID_LDO1 ... LP8720_ID_BUCK:
- return id;
- case LP8725_ID_LDO1 ... LP8725_ID_BUCK2:
- return id - LP8725_ID_BASE;
- default:
- return -EINVAL;
- }
-}
-
static int lp872x_get_timestep_usec(struct lp872x *lp)
{
enum lp872x_id chip = lp->chipid;
@@ -234,28 +220,20 @@ static int lp872x_get_timestep_usec(struct lp872x *lp)
static int lp872x_regulator_enable_time(struct regulator_dev *rdev)
{
struct lp872x *lp = rdev_get_drvdata(rdev);
- enum lp872x_regulator_id regulator = rdev_get_id(rdev);
+ enum lp872x_regulator_id rid = rdev_get_id(rdev);
int time_step_us = lp872x_get_timestep_usec(lp);
- int ret, offset;
+ int ret;
u8 addr, val;
if (time_step_us < 0)
return -EINVAL;
- switch (regulator) {
- case LP8720_ID_LDO1 ... LP8720_ID_LDO5:
- case LP8725_ID_LDO1 ... LP8725_ID_LILO2:
- offset = _rdev_to_offset(rdev);
- if (offset < 0)
- return -EINVAL;
-
- addr = LP872X_LDO1_VOUT + offset;
- break;
- case LP8720_ID_BUCK:
- addr = LP8720_BUCK_VOUT1;
+ switch (rid) {
+ case LP8720_ID_LDO1 ... LP8720_ID_BUCK:
+ addr = LP872X_LDO1_VOUT + rid;
break;
- case LP8725_ID_BUCK1:
- addr = LP8725_BUCK1_VOUT1;
+ case LP8725_ID_LDO1 ... LP8725_ID_BUCK1:
+ addr = LP872X_LDO1_VOUT + rid - LP8725_ID_BASE;
break;
case LP8725_ID_BUCK2:
addr = LP8725_BUCK2_VOUT1;
--
1.7.9.5
^ permalink raw reply related [flat|nested] 3+ messages in thread
* RE: [PATCH] regulator: lp872x: Kill _rdev_to_offset() function
2012-12-08 1:56 [PATCH] regulator: lp872x: Kill _rdev_to_offset() function Axel Lin
@ 2012-12-10 2:30 ` Kim, Milo
2012-12-10 3:23 ` Mark Brown
1 sibling, 0 replies; 3+ messages in thread
From: Kim, Milo @ 2012-12-10 2:30 UTC (permalink / raw)
To: Axel Lin; +Cc: Girdwood, Liam, linux-kernel@vger.kernel.org, Mark Brown
[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #1: Type: text/plain; charset="utf-8", Size: 400 bytes --]
> There is only one user calling _rdev_to_offset() function.
> Remove _rdev_to_offset() makes the code simpler.
>
> Signed-off-by: Axel Lin <axel.lin@ingics.com>
It looks good to me, thanks!
Acked-by: Milo(Woogyom) Kim <milo.kim@ti.com>
ÿôèº{.nÇ+·®+%Ëÿ±éݶ\x17¥wÿº{.nÇ+·¥{±þG«éÿ{ayº\x1dÊÚë,j\a¢f£¢·hïêÿêçz_è®\x03(éÝ¢j"ú\x1a¶^[m§ÿÿ¾\a«þG«éÿ¢¸?¨èÚ&£ø§~á¶iOæ¬z·vØ^\x14\x04\x1a¶^[m§ÿÿÃ\fÿ¶ìÿ¢¸?I¥
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH] regulator: lp872x: Kill _rdev_to_offset() function
2012-12-08 1:56 [PATCH] regulator: lp872x: Kill _rdev_to_offset() function Axel Lin
2012-12-10 2:30 ` Kim, Milo
@ 2012-12-10 3:23 ` Mark Brown
1 sibling, 0 replies; 3+ messages in thread
From: Mark Brown @ 2012-12-10 3:23 UTC (permalink / raw)
To: Axel Lin; +Cc: Milo(Woogyom) Kim, Liam Girdwood, linux-kernel
On Sat, Dec 08, 2012 at 09:56:48AM +0800, Axel Lin wrote:
> There is only one user calling _rdev_to_offset() function.
> Remove _rdev_to_offset() makes the code simpler.
Applied, thanks.
Milo, you should probably add a MAINTAINERS entry for this one too.
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2012-12-10 3:23 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2012-12-08 1:56 [PATCH] regulator: lp872x: Kill _rdev_to_offset() function Axel Lin
2012-12-10 2:30 ` Kim, Milo
2012-12-10 3:23 ` Mark Brown
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).