linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] regulator: core: request only valid gpio pins for regulator enable
@ 2012-08-09 14:33 Marek Szyprowski
  2012-08-09 18:57 ` Mark Brown
  0 siblings, 1 reply; 2+ messages in thread
From: Marek Szyprowski @ 2012-08-09 14:33 UTC (permalink / raw)
  To: linux-kernel; +Cc: Marek Szyprowski, Kyungmin Park, Mark Brown

Commit 65f735082de3 ("regulator: core: Add core support for GPIO controlled
enable lines") introduced enable gpio entry in regulator configuration
structure. Some drivers use '-1' as a placeholder for marking that such
gpio line is not available, because '0' is considered as a valid gpio
number. This patch fixes initialization of such drivers (like MAX8952
on UniversalC210 board), when '-1' is provided as enable gpio pin in the
regulator's platform data.

Signed-off-by: Marek Szyprowski <m.szyprowski@samsung.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 f092588..4838531 100644
--- a/drivers/regulator/core.c
+++ b/drivers/regulator/core.c
@@ -3217,7 +3217,7 @@ regulator_register(const struct regulator_desc *regulator_desc,
 
 	dev_set_drvdata(&rdev->dev, rdev);
 
-	if (config->ena_gpio) {
+	if (config->ena_gpio && gpio_is_valid(config->ena_gpio)) {
 		ret = gpio_request_one(config->ena_gpio,
 				       GPIOF_DIR_OUT | config->ena_gpio_flags,
 				       rdev_get_name(rdev));
-- 
1.7.1.569.g6f426


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

* Re: [PATCH] regulator: core: request only valid gpio pins for regulator enable
  2012-08-09 14:33 [PATCH] regulator: core: request only valid gpio pins for regulator enable Marek Szyprowski
@ 2012-08-09 18:57 ` Mark Brown
  0 siblings, 0 replies; 2+ messages in thread
From: Mark Brown @ 2012-08-09 18:57 UTC (permalink / raw)
  To: Marek Szyprowski; +Cc: linux-kernel, Kyungmin Park

On Thu, Aug 09, 2012 at 04:33:00PM +0200, Marek Szyprowski wrote:
> Commit 65f735082de3 ("regulator: core: Add core support for GPIO controlled
> enable lines") introduced enable gpio entry in regulator configuration
> structure. Some drivers use '-1' as a placeholder for marking that such
> gpio line is not available, because '0' is considered as a valid gpio
> number. This patch fixes initialization of such drivers (like MAX8952
> on UniversalC210 board), when '-1' is provided as enable gpio pin in the
> regulator's platform data.

Applied, thanks.

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

end of thread, other threads:[~2012-08-09 18:57 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2012-08-09 14:33 [PATCH] regulator: core: request only valid gpio pins for regulator enable Marek Szyprowski
2012-08-09 18:57 ` 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).