Re: [PATCH 2/2] regulator: core: Allow enable GPIO to be specified using GPIOD

From: Charles Keepax
Date: Tue Nov 29 2016 - 06:38:19 EST


On Tue, Nov 29, 2016 at 11:30:45AM +0000, Charles Keepax wrote:
> The regulator subsystem has used GPIOs internally for a while, however,
> end drivers must still specify their enable GPIO using a GPIO number. This
> patch allows the end drivers to specify the enable GPIO using GPIOD
> directly.
>
> Signed-off-by: Charles Keepax <ckeepax@xxxxxxxxxxxxxxxxxxxxxxxxxxx>
> ---
> drivers/regulator/core.c | 38 ++++++++++++++++++++++++++------------
> include/linux/regulator/driver.h | 14 +++++++++-----
> 2 files changed, 35 insertions(+), 17 deletions(-)
>
> diff --git a/drivers/regulator/core.c b/drivers/regulator/core.c
> index b3417ac..48f2813 100644
> --- a/drivers/regulator/core.c
> +++ b/drivers/regulator/core.c
>
> pin->gpiod = gpiod;
> @@ -4027,14 +4042,13 @@ regulator_register(const struct regulator_desc *regulator_desc,
> goto clean;
> }
>
> - if ((config->ena_gpio || config->ena_gpio_initialized) &&
> - gpio_is_valid(config->ena_gpio)) {
> + if (regulator_ena_gpio_valid(config)) {
> mutex_lock(&regulator_list_mutex);
> ret = regulator_ena_gpio_request(rdev, config);
> mutex_unlock(&regulator_list_mutex);
> if (ret != 0) {
> rdev_err(rdev, "Failed to request enable GPIO%d: %d\n",
> - config->ena_gpio, ret);
> + desc_to_gpio(config->ena_gpiod), ret);

Ah sorry small bug here I will respin.

Thanks,
Charles