All of lore.kernel.org
 help / color / mirror / Atom feed
From: nicolas.ferre@atmel.com (Nicolas Ferre)
To: linux-arm-kernel@lists.infradead.org
Subject: [PATCH] at91: at91-ohci: fix set/get power
Date: Mon, 14 Nov 2011 11:57:50 +0100	[thread overview]
Message-ID: <4EC0F42E.3000808@atmel.com> (raw)
In-Reply-To: <1321112773-8360-1-git-send-email-plagnioj@jcrosoft.com>

On 11/12/2011 04:46 PM, Jean-Christophe PLAGNIOL-VILLARD :
> in commit aa6e52a35 we introduce the support of overcurrent notification
> but the set and get of the power without checking if the gpio is valid or not
> 
> Signed-off-by: Jean-Christophe PLAGNIOL-VILLARD <plagnioj@jcrosoft.com>
> Cc: Thomas Petazzoni <thomas.petazzoni@free-electrons.com>
> Cc: Nicolas Ferre <nicolas.ferre@atmel.com>

Acked-by: Nicolas Ferre <nicolas.ferre@atmel.com>

> ---
>  drivers/usb/host/ohci-at91.c |    6 ++++++
>  1 files changed, 6 insertions(+), 0 deletions(-)
> 
> diff --git a/drivers/usb/host/ohci-at91.c b/drivers/usb/host/ohci-at91.c
> index ba3a46b..95a9fec 100644
> --- a/drivers/usb/host/ohci-at91.c
> +++ b/drivers/usb/host/ohci-at91.c
> @@ -223,6 +223,9 @@ static void ohci_at91_usb_set_power(struct at91_usbh_data *pdata, int port, int
>  	if (port < 0 || port >= 2)
>  		return;
>  
> +	if (pdata->vbus_pin[port] <= 0)
> +		return;
> +
>  	gpio_set_value(pdata->vbus_pin[port], !pdata->vbus_pin_inverted ^ enable);
>  }
>  
> @@ -231,6 +234,9 @@ static int ohci_at91_usb_get_power(struct at91_usbh_data *pdata, int port)
>  	if (port < 0 || port >= 2)
>  		return -EINVAL;
>  
> +	if (pdata->vbus_pin[port] <= 0)
> +		return -EINVAL;
> +
>  	return gpio_get_value(pdata->vbus_pin[port]) ^ !pdata->vbus_pin_inverted;
>  }
>  


-- 
Nicolas Ferre

  reply	other threads:[~2011-11-14 10:57 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-11-12 15:46 [PATCH] at91: at91-ohci: fix set/get power Jean-Christophe PLAGNIOL-VILLARD
2011-11-14 10:57 ` Nicolas Ferre [this message]
2011-11-14 18:22 ` Thomas Petazzoni
2011-11-14 20:39 ` Andrew Victor
2011-11-14 20:51   ` Thomas Petazzoni
2011-11-15  0:59   ` Jean-Christophe PLAGNIOL-VILLARD

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=4EC0F42E.3000808@atmel.com \
    --to=nicolas.ferre@atmel.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.