mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Krystian Garbaciak <dd.diasemi@gmail.com>
To: Mark Brown <broonie@opensource.wolfsonmicro.com>
Cc: linux-kernel@vger.kernel.org
Subject: drivers/regulator/core.c: Fixes mapping inside regulator_mode_to_status() and makes it returning -EINVAL on invalid input.
Date: Mon, 09 Jan 2012 12:12:20 +0000	[thread overview]
Message-ID: <1326111140.22107.9.camel@sw-eng-lt-dc-vm2> (raw)

Minor fix that makes the function working correctly with
REGULATOR_MODE_STANDBY as parameter.
Also, on invalid input (bad mode), it is better to return -EINVAL,
instead of meaningless 0 value (which actually is interpreted as
REGULATOR_STATUS_OFF).

--- 
diff --git a/drivers/regulator/core.c b/drivers/regulator/core.c
index 938398f..45aa874 100644
--- a/drivers/regulator/core.c
+++ b/drivers/regulator/core.c
@@ -2484,10 +2484,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 -EINVAL;
 	}
 }
 EXPORT_SYMBOL_GPL(regulator_mode_to_status);


             reply	other threads:[~2012-01-09 12:12 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-01-09 12:12 Krystian Garbaciak [this message]
2012-01-09 16:14 ` Mark Brown
2012-01-09 19:20   ` dd diasemi
2012-01-09 20:07     ` Mark Brown
2012-01-10  0:11       ` dd diasemi
2012-01-10  0:14         ` Mark Brown
2012-01-10 17:09           ` dd diasemi
2012-01-10 17:14             ` 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=1326111140.22107.9.camel@sw-eng-lt-dc-vm2 \
    --to=dd.diasemi@gmail.com \
    --cc=broonie@opensource.wolfsonmicro.com \
    --cc=linux-kernel@vger.kernel.org \
    /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

all inboxes | Powered by JetHome®