public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH 1/3] regulator: Remove a redundant device_remove_file call in create_regulator
@ 2010-11-05  7:25 Axel Lin
  2010-11-05  7:26 ` [PATCH 2/3] regulator: Ensure enough delay time for enabling regulator Axel Lin
                   ` (2 more replies)
  0 siblings, 3 replies; 6+ messages in thread
From: Axel Lin @ 2010-11-05  7:25 UTC (permalink / raw)
  To: linux-kernel; +Cc: Liam Girdwood, Mark Brown

We already have device_remove_file() in error path,
no need to call it before goto link_name_err.

Signed-off-by: Axel Lin <axel.lin@gmail.com>
---
 drivers/regulator/core.c |    1 -
 1 files changed, 0 insertions(+), 1 deletions(-)

diff --git a/drivers/regulator/core.c b/drivers/regulator/core.c
index f1d10c9..5ee67ba 100644
--- a/drivers/regulator/core.c
+++ b/drivers/regulator/core.c
@@ -1052,7 +1052,6 @@ static struct regulator *create_regulator(struct regulator_dev *rdev,
 			printk(KERN_WARNING
 			       "%s: could not add device link %s err %d\n",
 			       __func__, dev->kobj.name, err);
-			device_remove_file(dev, &regulator->dev_attr);
 			goto link_name_err;
 		}
 	}
-- 
1.7.2




^ permalink raw reply related	[flat|nested] 6+ messages in thread

* [PATCH 2/3] regulator: Ensure enough delay time for enabling regulator
  2010-11-05  7:25 [PATCH 1/3] regulator: Remove a redundant device_remove_file call in create_regulator Axel Lin
@ 2010-11-05  7:26 ` Axel Lin
  2010-11-05 13:19   ` Mark Brown
  2010-11-05  7:27 ` [PATCH 3/3] regulator: Return proper error for regulator_register() Axel Lin
  2010-11-05 13:18 ` [PATCH 1/3] regulator: Remove a redundant device_remove_file call in create_regulator Mark Brown
  2 siblings, 1 reply; 6+ messages in thread
From: Axel Lin @ 2010-11-05  7:26 UTC (permalink / raw)
  To: linux-kernel; +Cc: Liam Girdwood, Mark Brown

Integer division will truncate the result, this patch ensures we have
enough delay time for enabling regulator.

Signed-off-by: Axel Lin <axel.lin@gmail.com>
---
 drivers/regulator/core.c |    5 +++--
 1 files changed, 3 insertions(+), 2 deletions(-)

diff --git a/drivers/regulator/core.c b/drivers/regulator/core.c
index 5ee67ba..0dd9a57 100644
--- a/drivers/regulator/core.c
+++ b/drivers/regulator/core.c
@@ -1312,9 +1312,10 @@ static int _regulator_enable(struct regulator_dev *rdev)
 			if (ret < 0)
 				return ret;
 
-			if (delay >= 1000)
+			if (delay >= 1000) {
 				mdelay(delay / 1000);
-			else if (delay)
+				udelay(delay % 1000);
+			} else if (delay)
 				udelay(delay);
 
 		} else if (ret < 0) {
-- 
1.7.2




^ permalink raw reply related	[flat|nested] 6+ messages in thread

* [PATCH 3/3] regulator: Return proper error for regulator_register()
  2010-11-05  7:25 [PATCH 1/3] regulator: Remove a redundant device_remove_file call in create_regulator Axel Lin
  2010-11-05  7:26 ` [PATCH 2/3] regulator: Ensure enough delay time for enabling regulator Axel Lin
@ 2010-11-05  7:27 ` Axel Lin
  2010-11-05 13:20   ` Mark Brown
  2010-11-05 13:18 ` [PATCH 1/3] regulator: Remove a redundant device_remove_file call in create_regulator Mark Brown
  2 siblings, 1 reply; 6+ messages in thread
From: Axel Lin @ 2010-11-05  7:27 UTC (permalink / raw)
  To: linux-kernel; +Cc: Liam Girdwood, Mark Brown

Signed-off-by: Axel Lin <axel.lin@gmail.com>
---
 drivers/regulator/core.c |    2 ++
 1 files changed, 2 insertions(+), 0 deletions(-)

diff --git a/drivers/regulator/core.c b/drivers/regulator/core.c
index 0dd9a57..59a7119 100644
--- a/drivers/regulator/core.c
+++ b/drivers/regulator/core.c
@@ -2346,6 +2346,7 @@ struct regulator_dev *regulator_register(struct regulator_desc *regulator_desc,
 	if (init_data->supply_regulator && init_data->supply_regulator_dev) {
 		dev_err(dev,
 			"Supply regulator specified by both name and dev\n");
+		ret = -EINVAL;
 		goto scrub;
 	}
 
@@ -2364,6 +2365,7 @@ struct regulator_dev *regulator_register(struct regulator_desc *regulator_desc,
 		if (!found) {
 			dev_err(dev, "Failed to find supply %s\n",
 				init_data->supply_regulator);
+			ret = -ENODEV;
 			goto scrub;
 		}
 
-- 
1.7.2




^ permalink raw reply related	[flat|nested] 6+ messages in thread

* Re: [PATCH 1/3] regulator: Remove a redundant device_remove_file call in create_regulator
  2010-11-05  7:25 [PATCH 1/3] regulator: Remove a redundant device_remove_file call in create_regulator Axel Lin
  2010-11-05  7:26 ` [PATCH 2/3] regulator: Ensure enough delay time for enabling regulator Axel Lin
  2010-11-05  7:27 ` [PATCH 3/3] regulator: Return proper error for regulator_register() Axel Lin
@ 2010-11-05 13:18 ` Mark Brown
  2 siblings, 0 replies; 6+ messages in thread
From: Mark Brown @ 2010-11-05 13:18 UTC (permalink / raw)
  To: Axel Lin; +Cc: linux-kernel, Liam Girdwood

On Fri, Nov 05, 2010 at 03:25:12PM +0800, Axel Lin wrote:
> We already have device_remove_file() in error path,
> no need to call it before goto link_name_err.
> 
> Signed-off-by: Axel Lin <axel.lin@gmail.com>

Acked-by: Mark Brown <broonie@opensource.wolfsonmicro.com>

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [PATCH 2/3] regulator: Ensure enough delay time for enabling regulator
  2010-11-05  7:26 ` [PATCH 2/3] regulator: Ensure enough delay time for enabling regulator Axel Lin
@ 2010-11-05 13:19   ` Mark Brown
  0 siblings, 0 replies; 6+ messages in thread
From: Mark Brown @ 2010-11-05 13:19 UTC (permalink / raw)
  To: Axel Lin; +Cc: linux-kernel, Liam Girdwood

On Fri, Nov 05, 2010 at 03:26:20PM +0800, Axel Lin wrote:

> -			if (delay >= 1000)
> +			if (delay >= 1000) {
>  				mdelay(delay / 1000);
> -			else if (delay)
> +				udelay(delay % 1000);
> +			} else if (delay)
>  				udelay(delay);

This looks good but please change this to use { } in the else case also;
I find this very helpful for legibility.

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [PATCH 3/3] regulator: Return proper error for regulator_register()
  2010-11-05  7:27 ` [PATCH 3/3] regulator: Return proper error for regulator_register() Axel Lin
@ 2010-11-05 13:20   ` Mark Brown
  0 siblings, 0 replies; 6+ messages in thread
From: Mark Brown @ 2010-11-05 13:20 UTC (permalink / raw)
  To: Axel Lin; +Cc: linux-kernel, Liam Girdwood

On Fri, Nov 05, 2010 at 03:27:17PM +0800, Axel Lin wrote:
> Signed-off-by: Axel Lin <axel.lin@gmail.com>

Acked-by: Mark Brown <broonie@opensource.wolfsonmicro.com>

^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2010-11-05 13:20 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2010-11-05  7:25 [PATCH 1/3] regulator: Remove a redundant device_remove_file call in create_regulator Axel Lin
2010-11-05  7:26 ` [PATCH 2/3] regulator: Ensure enough delay time for enabling regulator Axel Lin
2010-11-05 13:19   ` Mark Brown
2010-11-05  7:27 ` [PATCH 3/3] regulator: Return proper error for regulator_register() Axel Lin
2010-11-05 13:20   ` Mark Brown
2010-11-05 13:18 ` [PATCH 1/3] regulator: Remove a redundant device_remove_file call in create_regulator Mark Brown

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox