public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Samuel Ortiz <sameo@linux.intel.com>
To: Mark Brown <broonie@opensource.wolfsonmicro.com>
Cc: linux-kernel@vger.kernel.org, stable@kernel.org
Subject: Re: [PATCH] gpiolib: Actually set output state in wm831x_gpio_direction_output()
Date: Fri, 19 Feb 2010 12:52:16 +0100	[thread overview]
Message-ID: <20100219115215.GF10255@sortiz.org> (raw)
In-Reply-To: <1266429875-4046-1-git-send-email-broonie@opensource.wolfsonmicro.com>

Hi Mark,

On Wed, Feb 17, 2010 at 06:04:35PM +0000, Mark Brown wrote:
> wm831x_gpio_direction_output() ignored the state passed into it.
> 
> Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
> Cc: stable@kernel.org
> ---
> 
> Ideally this could make it into 2.6.33, though it's not super critical
> and it's probably reasonable to handle it via the stable releases.
Agreed. I'll push it upstream through my for-next branch, thanks.

Cheers,
Samuel.

>  drivers/gpio/wm831x-gpio.c |   22 +++++++++++++++-------
>  1 files changed, 15 insertions(+), 7 deletions(-)
> 
> diff --git a/drivers/gpio/wm831x-gpio.c b/drivers/gpio/wm831x-gpio.c
> index b4468b6..c5a00f7 100644
> --- a/drivers/gpio/wm831x-gpio.c
> +++ b/drivers/gpio/wm831x-gpio.c
> @@ -60,23 +60,31 @@ static int wm831x_gpio_get(struct gpio_chip *chip, unsigned offset)
>  		return 0;
>  }
>  
> -static int wm831x_gpio_direction_out(struct gpio_chip *chip,
> -				     unsigned offset, int value)
> +static void wm831x_gpio_set(struct gpio_chip *chip, unsigned offset, int value)
>  {
>  	struct wm831x_gpio *wm831x_gpio = to_wm831x_gpio(chip);
>  	struct wm831x *wm831x = wm831x_gpio->wm831x;
>  
> -	return wm831x_set_bits(wm831x, WM831X_GPIO1_CONTROL + offset,
> -			       WM831X_GPN_DIR | WM831X_GPN_TRI, 0);
> +	wm831x_set_bits(wm831x, WM831X_GPIO_LEVEL, 1 << offset,
> +			value << offset);
>  }
>  
> -static void wm831x_gpio_set(struct gpio_chip *chip, unsigned offset, int value)
> +static int wm831x_gpio_direction_out(struct gpio_chip *chip,
> +				     unsigned offset, int value)
>  {
>  	struct wm831x_gpio *wm831x_gpio = to_wm831x_gpio(chip);
>  	struct wm831x *wm831x = wm831x_gpio->wm831x;
> +	int ret;
>  
> -	wm831x_set_bits(wm831x, WM831X_GPIO_LEVEL, 1 << offset,
> -			value << offset);
> +	ret = wm831x_set_bits(wm831x, WM831X_GPIO1_CONTROL + offset,
> +			      WM831X_GPN_DIR | WM831X_GPN_TRI, 0);
> +	if (ret < 0)
> +		return ret;
> +
> +	/* Can only set GPIO state once it's in output mode */
> +	wm831x_gpio_set(chip, offset, value);
> +
> +	return 0;
>  }
>  
>  static int wm831x_gpio_to_irq(struct gpio_chip *chip, unsigned offset)
> -- 
> 1.6.6.1
> 

-- 
Intel Open Source Technology Centre
http://oss.intel.com/

      reply	other threads:[~2010-02-19 11:51 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-02-17 18:04 [PATCH] gpiolib: Actually set output state in wm831x_gpio_direction_output() Mark Brown
2010-02-19 11:52 ` Samuel Ortiz [this message]

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=20100219115215.GF10255@sortiz.org \
    --to=sameo@linux.intel.com \
    --cc=broonie@opensource.wolfsonmicro.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=stable@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