From: Tony Lindgren <tony@atomide.com>
To: Roger Quadros <rogerq@ti.com>
Cc: linus.walleij@linaro.org, peter.ujfalusi@ti.com, nm@ti.com,
tomi.valkeinen@ti.com, balbi@ti.com, linux-gpio@vger.kernel.org,
linux-kernel@vger.kernel.org, linux-omap@vger.kernel.org,
linux-arm-kernel@lists.infradead.org
Subject: Re: [PATCH 1/1] gpio: twl4030: Fix regression for twl gpio LED output
Date: Wed, 4 Dec 2013 09:37:05 -0800 [thread overview]
Message-ID: <20131204173705.GQ26766@atomide.com> (raw)
In-Reply-To: <1386156871-7639-2-git-send-email-rogerq@ti.com>
* Roger Quadros <rogerq@ti.com> [131204 03:35]:
> Commit 0b2aa8be introduced a regression that causes failure
> in setting LED GPO direction to OUT.
>
> This causes USB host probe failures for Beagleboard C4.
>
> [ 2.075469] platform usb_phy_gen_xceiv.2: Driver usb_phy_gen_xceiv requests probe deferral
> [ 2.090454] hsusb2_vcc: Failed to request enable GPIO510: -22
> [ 2.100982] reg-fixed-voltage reg-fixed-voltage.0.auto: Failed to register regulator: -22
> [ 2.109954] reg-fixed-voltage: probe of reg-fixed-voltage.0.auto failed with error -22
>
> direction_out/direction_in must return 0 if the operation succeeded.
Uh, OK, sorry that was an unexpected side effect. We still should keep the
return values though instead of just ignoring them.
> 1 file changed, 9 insertions(+), 6 deletions(-)
>
> diff --git a/drivers/gpio/gpio-twl4030.c b/drivers/gpio/gpio-twl4030.c
> index b97d6a6..0999ed1 100644
> --- a/drivers/gpio/gpio-twl4030.c
> +++ b/drivers/gpio/gpio-twl4030.c
> @@ -294,13 +294,13 @@ out:
> static int twl_direction_in(struct gpio_chip *chip, unsigned offset)
> {
> struct gpio_twl4030_priv *priv = to_gpio_twl4030(chip);
> - int ret;
> + int ret = 0;
>
> mutex_lock(&priv->mutex);
> if (offset < TWL4030_GPIO_MAX)
> - ret = twl4030_set_gpio_direction(offset, 1);
> + twl4030_set_gpio_direction(offset, 1);
> else
> - ret = -EINVAL;
> + ret = -EINVAL; /* LED outputs can't be set as input */
>
> if (!ret)
> priv->direction &= ~BIT(offset);
This looks OK to me.
> @@ -354,18 +354,21 @@ static void twl_set(struct gpio_chip *chip, unsigned offset, int value)
> static int twl_direction_out(struct gpio_chip *chip, unsigned offset, int value)
> {
> struct gpio_twl4030_priv *priv = to_gpio_twl4030(chip);
> - int ret = -EINVAL;
>
Can't you just have:
int ret = 0;
> mutex_lock(&priv->mutex);
> if (offset < TWL4030_GPIO_MAX)
> - ret = twl4030_set_gpio_direction(offset, 0);
> + twl4030_set_gpio_direction(offset, 0);
> +
> + /*
> + * LED gpio's i.e. offset >= TWL4030_GPIO_MAX are always output
> + */
>
> priv->direction |= BIT(offset);
> mutex_unlock(&priv->mutex);
>
> twl_set(chip, offset, value);
>
> - return ret;
> + return 0;
> }
Then the rest of this change is not needed and we check the return value for
twl4030_set_gpio_direction. Makes sense to keep the comment there though.
Regards,
Tony
WARNING: multiple messages have this Message-ID (diff)
From: tony@atomide.com (Tony Lindgren)
To: linux-arm-kernel@lists.infradead.org
Subject: [PATCH 1/1] gpio: twl4030: Fix regression for twl gpio LED output
Date: Wed, 4 Dec 2013 09:37:05 -0800 [thread overview]
Message-ID: <20131204173705.GQ26766@atomide.com> (raw)
In-Reply-To: <1386156871-7639-2-git-send-email-rogerq@ti.com>
* Roger Quadros <rogerq@ti.com> [131204 03:35]:
> Commit 0b2aa8be introduced a regression that causes failure
> in setting LED GPO direction to OUT.
>
> This causes USB host probe failures for Beagleboard C4.
>
> [ 2.075469] platform usb_phy_gen_xceiv.2: Driver usb_phy_gen_xceiv requests probe deferral
> [ 2.090454] hsusb2_vcc: Failed to request enable GPIO510: -22
> [ 2.100982] reg-fixed-voltage reg-fixed-voltage.0.auto: Failed to register regulator: -22
> [ 2.109954] reg-fixed-voltage: probe of reg-fixed-voltage.0.auto failed with error -22
>
> direction_out/direction_in must return 0 if the operation succeeded.
Uh, OK, sorry that was an unexpected side effect. We still should keep the
return values though instead of just ignoring them.
> 1 file changed, 9 insertions(+), 6 deletions(-)
>
> diff --git a/drivers/gpio/gpio-twl4030.c b/drivers/gpio/gpio-twl4030.c
> index b97d6a6..0999ed1 100644
> --- a/drivers/gpio/gpio-twl4030.c
> +++ b/drivers/gpio/gpio-twl4030.c
> @@ -294,13 +294,13 @@ out:
> static int twl_direction_in(struct gpio_chip *chip, unsigned offset)
> {
> struct gpio_twl4030_priv *priv = to_gpio_twl4030(chip);
> - int ret;
> + int ret = 0;
>
> mutex_lock(&priv->mutex);
> if (offset < TWL4030_GPIO_MAX)
> - ret = twl4030_set_gpio_direction(offset, 1);
> + twl4030_set_gpio_direction(offset, 1);
> else
> - ret = -EINVAL;
> + ret = -EINVAL; /* LED outputs can't be set as input */
>
> if (!ret)
> priv->direction &= ~BIT(offset);
This looks OK to me.
> @@ -354,18 +354,21 @@ static void twl_set(struct gpio_chip *chip, unsigned offset, int value)
> static int twl_direction_out(struct gpio_chip *chip, unsigned offset, int value)
> {
> struct gpio_twl4030_priv *priv = to_gpio_twl4030(chip);
> - int ret = -EINVAL;
>
Can't you just have:
int ret = 0;
> mutex_lock(&priv->mutex);
> if (offset < TWL4030_GPIO_MAX)
> - ret = twl4030_set_gpio_direction(offset, 0);
> + twl4030_set_gpio_direction(offset, 0);
> +
> + /*
> + * LED gpio's i.e. offset >= TWL4030_GPIO_MAX are always output
> + */
>
> priv->direction |= BIT(offset);
> mutex_unlock(&priv->mutex);
>
> twl_set(chip, offset, value);
>
> - return ret;
> + return 0;
> }
Then the rest of this change is not needed and we check the return value for
twl4030_set_gpio_direction. Makes sense to keep the comment there though.
Regards,
Tony
next prev parent reply other threads:[~2013-12-04 17:37 UTC|newest]
Thread overview: 18+ messages / expand[flat|nested] mbox.gz Atom feed top
2013-12-04 11:34 [PATCH 0/1] gpio: twl4030: gpio LED regression fix for 3.13 rc Roger Quadros
2013-12-04 11:34 ` Roger Quadros
2013-12-04 11:34 ` Roger Quadros
2013-12-04 11:34 ` [PATCH 1/1] gpio: twl4030: Fix regression for twl gpio LED output Roger Quadros
2013-12-04 11:34 ` Roger Quadros
2013-12-04 11:34 ` Roger Quadros
2013-12-04 17:37 ` Tony Lindgren [this message]
2013-12-04 17:37 ` Tony Lindgren
2013-12-05 9:15 ` Roger Quadros
2013-12-05 9:15 ` Roger Quadros
2013-12-05 9:15 ` Roger Quadros
2013-12-05 9:23 ` [PATCH v2 " Roger Quadros
2013-12-05 9:23 ` Roger Quadros
2013-12-05 9:23 ` Roger Quadros
2013-12-05 16:55 ` Tony Lindgren
2013-12-05 16:55 ` Tony Lindgren
2013-12-10 12:16 ` Linus Walleij
2013-12-10 12:16 ` Linus Walleij
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=20131204173705.GQ26766@atomide.com \
--to=tony@atomide.com \
--cc=balbi@ti.com \
--cc=linus.walleij@linaro.org \
--cc=linux-arm-kernel@lists.infradead.org \
--cc=linux-gpio@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-omap@vger.kernel.org \
--cc=nm@ti.com \
--cc=peter.ujfalusi@ti.com \
--cc=rogerq@ti.com \
--cc=tomi.valkeinen@ti.com \
/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.