* [PATCH] regulator: Fix bug in regulator_mode_to_status() core function.
@ 2012-07-11 12:10 Krystian Garbaciak
2012-07-11 13:28 ` Mark Brown
0 siblings, 1 reply; 11+ messages in thread
From: Krystian Garbaciak @ 2012-07-11 12:10 UTC (permalink / raw)
To: Mark Brown, Liam Girdwood; +Cc: linux-kernel
Fix typo for case REGULATOR_STATUS_STANDBY -> REGULATOR_MODE_STANDBY.
For undefined mode, return REGULATOR_STATUS_ERROR (0 is not valid status).
Signed-off-by: Krystian Garbaciak <krystian.garbaciak@diasemi.com>
---
drivers/regulator/core.c | 4 ++--
1 files changed, 2 insertions(+), 2 deletions(-)
diff --git a/drivers/regulator/core.c b/drivers/regulator/core.c
index 09a737c..b821a9f 100644
--- a/drivers/regulator/core.c
+++ b/drivers/regulator/core.c
@@ -2909,10 +2909,10 @@ int regulator_mode_to_status(unsigned int mode)
return REGULATOR_STATUS_NORMAL;
case REGULATOR_MODE_IDLE:
return REGULATOR_STATUS_IDLE;
- case REGULATOR_STATUS_STANDBY:
+ case REGULATOR_MODE_STANDBY:
return REGULATOR_STATUS_STANDBY;
default:
- return 0;
+ return REGULATOR_STATUS_ERROR;
}
}
EXPORT_SYMBOL_GPL(regulator_mode_to_status);
--
1.7.0.4
^ permalink raw reply related [flat|nested] 11+ messages in thread
* Re: [PATCH] regulator: Fix bug in regulator_mode_to_status() core function.
2012-07-11 12:10 [PATCH] regulator: Fix bug in regulator_mode_to_status() core function Krystian Garbaciak
@ 2012-07-11 13:28 ` Mark Brown
2012-07-11 14:18 ` Krystian Garbaciak
0 siblings, 1 reply; 11+ messages in thread
From: Mark Brown @ 2012-07-11 13:28 UTC (permalink / raw)
To: Krystian Garbaciak; +Cc: Liam Girdwood, linux-kernel
[-- Attachment #1: Type: text/plain, Size: 335 bytes --]
On Wed, Jul 11, 2012 at 01:10:01PM +0100, Krystian Garbaciak wrote:
> Fix typo for case REGULATOR_STATUS_STANDBY -> REGULATOR_MODE_STANDBY.
> For undefined mode, return REGULATOR_STATUS_ERROR (0 is not valid status).
This is deliberate. It's not reporting an error, it's reporting an
indeterminate status which is a different thing.
[-- Attachment #2: Digital signature --]
[-- Type: application/pgp-signature, Size: 836 bytes --]
^ permalink raw reply [flat|nested] 11+ messages in thread
* Re: [PATCH] regulator: Fix bug in regulator_mode_to_status() core function.
2012-07-11 13:28 ` Mark Brown
@ 2012-07-11 14:18 ` Krystian Garbaciak
2012-07-11 14:26 ` Mark Brown
2012-07-11 15:13 ` Krystian Garbaciak
0 siblings, 2 replies; 11+ messages in thread
From: Krystian Garbaciak @ 2012-07-11 14:18 UTC (permalink / raw)
To: Mark Brown; +Cc: Liam Girdwood, linux-kernel
> From: Mark Brown [mailto:broonie@opensource.wolfsonmicro.com]
> Sent: 11 July 2012 14:29
>
> On Wed, Jul 11, 2012 at 01:10:01PM +0100, Krystian Garbaciak wrote:
> > Fix typo for case REGULATOR_STATUS_STANDBY -> REGULATOR_MODE_STANDBY.
> > For undefined mode, return REGULATOR_STATUS_ERROR (0 is not valid status).
>
> This is deliberate. It's not reporting an error, it's reporting an
> indeterminate status which is a different thing.
Ok, then I would propose to use REGULATOR_STATUS_OFF instead of 0, to present
your deliberate decision here.
^ permalink raw reply [flat|nested] 11+ messages in thread
* Re: [PATCH] regulator: Fix bug in regulator_mode_to_status() core function.
2012-07-11 14:18 ` Krystian Garbaciak
@ 2012-07-11 14:26 ` Mark Brown
2012-07-11 15:13 ` Krystian Garbaciak
1 sibling, 0 replies; 11+ messages in thread
From: Mark Brown @ 2012-07-11 14:26 UTC (permalink / raw)
To: Krystian Garbaciak; +Cc: Liam Girdwood, linux-kernel
[-- Attachment #1: Type: text/plain, Size: 483 bytes --]
On Wed, Jul 11, 2012 at 03:18:00PM +0100, Krystian Garbaciak wrote:
> > This is deliberate. It's not reporting an error, it's reporting an
> > indeterminate status which is a different thing.
> Ok, then I would propose to use REGULATOR_STATUS_OFF instead of 0, to present
> your deliberate decision here.
I don't think you're fully understanding "indeterminate" there... the
whole point is that we can't adequately represent the state, making
something up isn't helping things.
[-- Attachment #2: Digital signature --]
[-- Type: application/pgp-signature, Size: 836 bytes --]
^ permalink raw reply [flat|nested] 11+ messages in thread
* Re: [PATCH] regulator: Fix bug in regulator_mode_to_status() core function.
2012-07-11 14:18 ` Krystian Garbaciak
2012-07-11 14:26 ` Mark Brown
@ 2012-07-11 15:13 ` Krystian Garbaciak
2012-07-11 17:42 ` Mark Brown
1 sibling, 1 reply; 11+ messages in thread
From: Krystian Garbaciak @ 2012-07-11 15:13 UTC (permalink / raw)
To: Mark Brown; +Cc: Liam Girdwood, linux-kernel
> > > This is deliberate. It's not reporting an error, it's reporting an
> > > indeterminate status which is a different thing.
>
> > Ok, then I would propose to use REGULATOR_STATUS_OFF instead of 0, to present
> > your deliberate decision here.
>
> I don't think you're fully understanding "indeterminate" there... the
> whole point is that we can't adequately represent the state, making
> something up isn't helping things.
Would it make more sense to have some special enum value for that case, let say
there would be REGULATOR_STATUS_UNDEFINED?
Returning 0 is interpreted as REGULATOR_STATUS_OFF outside the function.
But it may change, if ever the enumeration changes.
^ permalink raw reply [flat|nested] 11+ messages in thread
* Re: [PATCH] regulator: Fix bug in regulator_mode_to_status() core function.
2012-07-11 15:13 ` Krystian Garbaciak
@ 2012-07-11 17:42 ` Mark Brown
2012-07-12 10:50 ` [PATCH] regulator: Fix a typo " Krystian Garbaciak
0 siblings, 1 reply; 11+ messages in thread
From: Mark Brown @ 2012-07-11 17:42 UTC (permalink / raw)
To: Krystian Garbaciak; +Cc: Liam Girdwood, linux-kernel
[-- Attachment #1: Type: text/plain, Size: 396 bytes --]
On Wed, Jul 11, 2012 at 04:13:00PM +0100, Krystian Garbaciak wrote:
> Would it make more sense to have some special enum value for that case, let say
> there would be REGULATOR_STATUS_UNDEFINED?
> Returning 0 is interpreted as REGULATOR_STATUS_OFF outside the function.
> But it may change, if ever the enumeration changes.
That'd be fine.
Also, please do submit separate changes separately.
[-- Attachment #2: Digital signature --]
[-- Type: application/pgp-signature, Size: 836 bytes --]
^ permalink raw reply [flat|nested] 11+ messages in thread
* [PATCH] regulator: Fix a typo in regulator_mode_to_status() core function.
2012-07-11 17:42 ` Mark Brown
@ 2012-07-12 10:50 ` Krystian Garbaciak
2012-07-12 12:53 ` [PATCH] regulator: Add REGULATOR_STATUS_UNDEFINED Krystian Garbaciak
` (2 more replies)
0 siblings, 3 replies; 11+ messages in thread
From: Krystian Garbaciak @ 2012-07-12 10:50 UTC (permalink / raw)
To: Mark Brown; +Cc: Liam Girdwood, linux-kernel
Case REGULATOR_STATUS_STANDBY -> REGULATOR_MODE_STANDBY.
Signed-off-by: Krystian Garbaciak <krystian.garbaciak@diasemi.com>
---
drivers/regulator/core.c | 2 +-
1 files changed, 1 insertions(+), 1 deletions(-)
diff --git a/drivers/regulator/core.c b/drivers/regulator/core.c
index 09a737c..af44b94 100644
--- a/drivers/regulator/core.c
+++ b/drivers/regulator/core.c
@@ -2909,7 +2909,7 @@ int regulator_mode_to_status(unsigned int mode)
return REGULATOR_STATUS_NORMAL;
case REGULATOR_MODE_IDLE:
return REGULATOR_STATUS_IDLE;
- case REGULATOR_STATUS_STANDBY:
+ case REGULATOR_MODE_STANDBY:
return REGULATOR_STATUS_STANDBY;
default:
return 0;
--
1.7.0.4
^ permalink raw reply related [flat|nested] 11+ messages in thread
* [PATCH] regulator: Add REGULATOR_STATUS_UNDEFINED.
2012-07-12 10:50 ` [PATCH] regulator: Fix a typo " Krystian Garbaciak
@ 2012-07-12 12:53 ` Krystian Garbaciak
2012-07-12 17:20 ` Mark Brown
2012-07-12 17:18 ` [PATCH] regulator: Fix a typo in regulator_mode_to_status() core function Mark Brown
2012-07-12 17:20 ` Mark Brown
2 siblings, 1 reply; 11+ messages in thread
From: Krystian Garbaciak @ 2012-07-12 12:53 UTC (permalink / raw)
To: Mark Brown; +Cc: Liam Girdwood, linux-kernel
REGULATOR_STATUS_UNDEFINED is to be returned by regulator, if any other state
doesn't really apply.
Signed-off-by: Krystian Garbaciak <krystian.garbaciak@diasemi.com>
---
drivers/regulator/core.c | 5 ++++-
include/linux/regulator/driver.h | 2 ++
2 files changed, 6 insertions(+), 1 deletions(-)
diff --git a/drivers/regulator/core.c b/drivers/regulator/core.c
index af44b94..f042a8a 100644
--- a/drivers/regulator/core.c
+++ b/drivers/regulator/core.c
@@ -427,6 +427,9 @@ static ssize_t regulator_status_show(struct device *dev,
case REGULATOR_STATUS_STANDBY:
label = "standby";
break;
+ case REGULATOR_STATUS_UNDEFINED:
+ label = "undefined";
+ break;
default:
return -ERANGE;
}
@@ -2912,7 +2915,7 @@ int regulator_mode_to_status(unsigned int mode)
case REGULATOR_MODE_STANDBY:
return REGULATOR_STATUS_STANDBY;
default:
- return 0;
+ return REGULATOR_STATUS_UNDEFINED;
}
}
EXPORT_SYMBOL_GPL(regulator_mode_to_status);
diff --git a/include/linux/regulator/driver.h b/include/linux/regulator/driver.h
index b0432cc..180ac49 100644
--- a/include/linux/regulator/driver.h
+++ b/include/linux/regulator/driver.h
@@ -32,6 +32,8 @@ enum regulator_status {
REGULATOR_STATUS_NORMAL,
REGULATOR_STATUS_IDLE,
REGULATOR_STATUS_STANDBY,
+ /* in case that any other status doesn't apply */
+ REGULATOR_STATUS_UNDEFINED,
};
/**
--
1.7.0.4
^ permalink raw reply related [flat|nested] 11+ messages in thread
* Re: [PATCH] regulator: Fix a typo in regulator_mode_to_status() core function.
2012-07-12 10:50 ` [PATCH] regulator: Fix a typo " Krystian Garbaciak
2012-07-12 12:53 ` [PATCH] regulator: Add REGULATOR_STATUS_UNDEFINED Krystian Garbaciak
@ 2012-07-12 17:18 ` Mark Brown
2012-07-12 17:20 ` Mark Brown
2 siblings, 0 replies; 11+ messages in thread
From: Mark Brown @ 2012-07-12 17:18 UTC (permalink / raw)
To: Krystian Garbaciak; +Cc: Liam Girdwood, linux-kernel
[-- Attachment #1: Type: text/plain, Size: 305 bytes --]
On Thu, Jul 12, 2012 at 11:50:38AM +0100, Krystian Garbaciak wrote:
> Case REGULATOR_STATUS_STANDBY -> REGULATOR_MODE_STANDBY.
>
> Signed-off-by: Krystian Garbaciak <krystian.garbaciak@diasemi.com>
This doesn't apply against -next (or the topic/core branch). Please
check what's going on there.
[-- Attachment #2: Digital signature --]
[-- Type: application/pgp-signature, Size: 836 bytes --]
^ permalink raw reply [flat|nested] 11+ messages in thread
* Re: [PATCH] regulator: Fix a typo in regulator_mode_to_status() core function.
2012-07-12 10:50 ` [PATCH] regulator: Fix a typo " Krystian Garbaciak
2012-07-12 12:53 ` [PATCH] regulator: Add REGULATOR_STATUS_UNDEFINED Krystian Garbaciak
2012-07-12 17:18 ` [PATCH] regulator: Fix a typo in regulator_mode_to_status() core function Mark Brown
@ 2012-07-12 17:20 ` Mark Brown
2 siblings, 0 replies; 11+ messages in thread
From: Mark Brown @ 2012-07-12 17:20 UTC (permalink / raw)
To: Krystian Garbaciak; +Cc: Liam Girdwood, linux-kernel
[-- Attachment #1: Type: text/plain, Size: 233 bytes --]
On Thu, Jul 12, 2012 at 11:50:38AM +0100, Krystian Garbaciak wrote:
> Case REGULATOR_STATUS_STANDBY -> REGULATOR_MODE_STANDBY.
Gah, actually this was due to git am applying your two patches in the
wrong order - applied now, thanks.
[-- Attachment #2: Digital signature --]
[-- Type: application/pgp-signature, Size: 836 bytes --]
^ permalink raw reply [flat|nested] 11+ messages in thread
end of thread, other threads:[~2012-07-12 17:20 UTC | newest]
Thread overview: 11+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2012-07-11 12:10 [PATCH] regulator: Fix bug in regulator_mode_to_status() core function Krystian Garbaciak
2012-07-11 13:28 ` Mark Brown
2012-07-11 14:18 ` Krystian Garbaciak
2012-07-11 14:26 ` Mark Brown
2012-07-11 15:13 ` Krystian Garbaciak
2012-07-11 17:42 ` Mark Brown
2012-07-12 10:50 ` [PATCH] regulator: Fix a typo " Krystian Garbaciak
2012-07-12 12:53 ` [PATCH] regulator: Add REGULATOR_STATUS_UNDEFINED Krystian Garbaciak
2012-07-12 17:20 ` Mark Brown
2012-07-12 17:18 ` [PATCH] regulator: Fix a typo in regulator_mode_to_status() core function Mark Brown
2012-07-12 17:20 ` Mark Brown
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.