From: k.kozlowski@samsung.com (Krzysztof Kozłowski)
To: linux-arm-kernel@lists.infradead.org
Subject: [PATCH 2/5] regulator: Set ena_gpio_valid in regulator drivers
Date: Tue, 07 Oct 2014 10:46:27 +0200 [thread overview]
Message-ID: <5433A863.1040206@samsung.com> (raw)
In-Reply-To: <1412626635-7404-3-git-send-email-mpa@pengutronix.de>
On 06.10.2014 22:17, Markus Pargmann wrote:
> This patch sets the new field ena_gpio_valid for all drivers which set a
> valid ena_gpio.
>
> Signed-off-by: Markus Pargmann <mpa@pengutronix.de>
> ---
(... looking only on s2m/s5m drivers)
> diff --git a/drivers/regulator/s2mps11.c b/drivers/regulator/s2mps11.c
> index b16c53a8272f..4d78477b9f57 100644
> --- a/drivers/regulator/s2mps11.c
> +++ b/drivers/regulator/s2mps11.c
> @@ -986,6 +986,7 @@ common_reg:
> config.of_node = rdata[i].of_node;
> }
> config.ena_gpio = s2mps11->ext_control_gpio[i];
> + config.ena_gpio_valid = true;
This way you'll mark all regulators as GPIO enabled. This is won't
produce an error (ena_gpio is initialized to -EINVAL by default) but I
think it is misuse of the idea "ena_gpio_valid".
Instead maybe:
+ if (gpio_is_valid(s2mps11->ext_control_gpio[i]))
+ config.ena_gpio_valid = true;
?
>
> regulator = devm_regulator_register(&pdev->dev,
> ®ulators[i], &config);
> diff --git a/drivers/regulator/s5m8767.c b/drivers/regulator/s5m8767.c
> index 0ab5cbeeb797..d258e6613831 100644
> --- a/drivers/regulator/s5m8767.c
> +++ b/drivers/regulator/s5m8767.c
> @@ -466,6 +466,7 @@ static void s5m8767_regulator_config_ext_control(struct s5m8767_info *s5m8767,
> }
>
> config->ena_gpio = rdata->ext_control_gpio;
> + config->ena_gpio_valid = true;
> config->ena_gpio_flags = GPIOF_OUT_INIT_HIGH;
> }
This looks fine.
Best regards,
Krzysztof
WARNING: multiple messages have this Message-ID (diff)
From: "Krzysztof Kozłowski" <k.kozlowski@samsung.com>
To: Markus Pargmann <mpa@pengutronix.de>, Mark Brown <broonie@kernel.org>
Cc: kernel@pengutronix.de, Liam Girdwood <lgirdwood@gmail.com>,
linux-arm-kernel@lists.infradead.org,
linux-kernel@vger.kernel.org
Subject: Re: [PATCH 2/5] regulator: Set ena_gpio_valid in regulator drivers
Date: Tue, 07 Oct 2014 10:46:27 +0200 [thread overview]
Message-ID: <5433A863.1040206@samsung.com> (raw)
In-Reply-To: <1412626635-7404-3-git-send-email-mpa@pengutronix.de>
On 06.10.2014 22:17, Markus Pargmann wrote:
> This patch sets the new field ena_gpio_valid for all drivers which set a
> valid ena_gpio.
>
> Signed-off-by: Markus Pargmann <mpa@pengutronix.de>
> ---
(... looking only on s2m/s5m drivers)
> diff --git a/drivers/regulator/s2mps11.c b/drivers/regulator/s2mps11.c
> index b16c53a8272f..4d78477b9f57 100644
> --- a/drivers/regulator/s2mps11.c
> +++ b/drivers/regulator/s2mps11.c
> @@ -986,6 +986,7 @@ common_reg:
> config.of_node = rdata[i].of_node;
> }
> config.ena_gpio = s2mps11->ext_control_gpio[i];
> + config.ena_gpio_valid = true;
This way you'll mark all regulators as GPIO enabled. This is won't
produce an error (ena_gpio is initialized to -EINVAL by default) but I
think it is misuse of the idea "ena_gpio_valid".
Instead maybe:
+ if (gpio_is_valid(s2mps11->ext_control_gpio[i]))
+ config.ena_gpio_valid = true;
?
>
> regulator = devm_regulator_register(&pdev->dev,
> ®ulators[i], &config);
> diff --git a/drivers/regulator/s5m8767.c b/drivers/regulator/s5m8767.c
> index 0ab5cbeeb797..d258e6613831 100644
> --- a/drivers/regulator/s5m8767.c
> +++ b/drivers/regulator/s5m8767.c
> @@ -466,6 +466,7 @@ static void s5m8767_regulator_config_ext_control(struct s5m8767_info *s5m8767,
> }
>
> config->ena_gpio = rdata->ext_control_gpio;
> + config->ena_gpio_valid = true;
> config->ena_gpio_flags = GPIOF_OUT_INIT_HIGH;
> }
This looks fine.
Best regards,
Krzysztof
next prev parent reply other threads:[~2014-10-07 8:46 UTC|newest]
Thread overview: 38+ messages / expand[flat|nested] mbox.gz Atom feed top
2014-10-06 20:17 [PATCH 0/5] regulator: Fix core behaviour for gpio 0 Markus Pargmann
2014-10-06 20:17 ` Markus Pargmann
2014-10-06 20:17 ` [PATCH 1/5] regulator: Add ena_gpio_valid config Markus Pargmann
2014-10-06 20:17 ` Markus Pargmann
2014-10-07 11:53 ` Mark Brown
2014-10-07 11:53 ` Mark Brown
2014-10-07 13:03 ` Markus Pargmann
2014-10-07 13:03 ` Markus Pargmann
2014-10-07 16:19 ` Mark Brown
2014-10-07 16:19 ` Mark Brown
2014-10-07 19:18 ` Markus Pargmann
2014-10-07 19:18 ` Markus Pargmann
2014-10-06 20:17 ` [PATCH 2/5] regulator: Set ena_gpio_valid in regulator drivers Markus Pargmann
2014-10-06 20:17 ` Markus Pargmann
2014-10-07 8:46 ` Krzysztof Kozłowski [this message]
2014-10-07 8:46 ` Krzysztof Kozłowski
2014-10-07 9:10 ` Markus Pargmann
2014-10-07 9:10 ` Markus Pargmann
2014-10-07 11:58 ` Mark Brown
2014-10-07 11:58 ` Mark Brown
2014-10-07 13:05 ` Markus Pargmann
2014-10-07 13:05 ` Markus Pargmann
2014-10-06 20:17 ` [PATCH 3/5] regulator: Fix ena_gpio check Markus Pargmann
2014-10-06 20:17 ` Markus Pargmann
2014-10-06 20:17 ` [PATCH 4/5] regulator: Use gpio_is_valid Markus Pargmann
2014-10-06 20:17 ` Markus Pargmann
2014-10-07 12:01 ` Mark Brown
2014-10-07 12:01 ` Mark Brown
2014-10-07 13:07 ` Markus Pargmann
2014-10-07 13:07 ` Markus Pargmann
2014-10-07 16:20 ` Mark Brown
2014-10-07 16:20 ` Mark Brown
2014-10-06 20:17 ` [PATCH 5/5] regulator: Remove unnecessary ena_gpio initializations Markus Pargmann
2014-10-06 20:17 ` Markus Pargmann
2014-10-07 8:52 ` Krzysztof Kozłowski
2014-10-07 8:52 ` Krzysztof Kozłowski
2014-10-07 9:14 ` Markus Pargmann
2014-10-07 9:14 ` Markus Pargmann
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=5433A863.1040206@samsung.com \
--to=k.kozlowski@samsung.com \
--cc=linux-arm-kernel@lists.infradead.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 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.