public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Kishon Vijay Abraham I <kishon@ti.com>
To: "Uwe Kleine-König" <u.kleine-koenig@pengutronix.de>,
	"Heikki Krogerus" <heikki.krogerus@linux.intel.com>,
	"Felipe Balbi" <balbi@ti.com>,
	"Linus Walleij" <linus.walleij@linaro.org>,
	"Alexandre Courbot" <gnurou@gmail.com>
Cc: <kernel@pengutronix.de>, <linux-kernel@vger.kernel.org>,
	<linux-usb@vger.kernel.org>
Subject: Re: [PATCH RESENT] phy: tusb1210: make better use of gpiod API
Date: Mon, 15 Jun 2015 11:13:16 +0530	[thread overview]
Message-ID: <557E65F4.1050400@ti.com> (raw)
In-Reply-To: <1434131504-26407-1-git-send-email-u.kleine-koenig@pengutronix.de>

Hi,

On Friday 12 June 2015 11:21 PM, Uwe Kleine-König wrote:
> Since 39b2bbe3d715 (gpio: add flags argument to gpiod_get*() functions)
> which appeared in v3.17-rc1, the gpiod_get* functions take an additional
> parameter that allows to specify direction and initial value for output.
>
> Furthermore there is devm_gpiod_get_optional which is designed to get
> optional gpios.
>
> Simplify driver accordingly. Furthermore this is one caller less that
> stops us making the flags argument to gpiod_get*() mandatory.
>
> Signed-off-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de>
> ---
> Hello,
>
> [for the initial submission I forgot linux-usb on Cc, Felipe Balbi
> requested a resend]
>
> note I plan to make the flags parameter mandatory for 4.3. So unless
> this change gets into 4.2, would it be ok to let it go in via the gpio
> tree?

This looks like a cleanup patch so it might not get in 4.2
If there is a dependency it should be fine. If you can just post this patch 
again before queuing this in your tree (for 4.3), I can see if there are 
patches that might cause merge conflicts with your change.

Thanks
Kishon
>
> Best regards
> Uwe
>
>   drivers/phy/phy-tusb1210.c | 30 ++++++++++++------------------
>   1 file changed, 12 insertions(+), 18 deletions(-)
>
> diff --git a/drivers/phy/phy-tusb1210.c b/drivers/phy/phy-tusb1210.c
> index 07efdd318bdc..93dd45f2f26e 100644
> --- a/drivers/phy/phy-tusb1210.c
> +++ b/drivers/phy/phy-tusb1210.c
> @@ -61,32 +61,26 @@ static struct phy_ops phy_ops = {
>
>   static int tusb1210_probe(struct ulpi *ulpi)
>   {
> -	struct gpio_desc *gpio;
>   	struct tusb1210 *tusb;
>   	u8 val, reg;
> -	int ret;
>
>   	tusb = devm_kzalloc(&ulpi->dev, sizeof(*tusb), GFP_KERNEL);
>   	if (!tusb)
>   		return -ENOMEM;
>
> -	gpio = devm_gpiod_get(&ulpi->dev, "reset");
> -	if (!IS_ERR(gpio)) {
> -		ret = gpiod_direction_output(gpio, 0);
> -		if (ret)
> -			return ret;
> -		gpiod_set_value_cansleep(gpio, 1);
> -		tusb->gpio_reset = gpio;
> -	}
> +	tusb->gpio_reset = devm_gpiod_get_optional(&ulpi->dev, "reset",
> +						   GPIOD_OUT_LOW);
> +	if (IS_ERR(tusb->gpio_reset))
> +		return PTR_ERR(tusb->gpio_reset);
>
> -	gpio = devm_gpiod_get(&ulpi->dev, "cs");
> -	if (!IS_ERR(gpio)) {
> -		ret = gpiod_direction_output(gpio, 0);
> -		if (ret)
> -			return ret;
> -		gpiod_set_value_cansleep(gpio, 1);
> -		tusb->gpio_cs = gpio;
> -	}
> +	gpiod_set_value_cansleep(tusb->gpio_reset, 1);
> +
> +	tusb->gpio_cs = devm_gpiod_get_optional(&ulpi->dev, "cs",
> +						GPIOD_OUT_LOW);
> +	if (IS_ERR(tusb->gpio_cs))
> +		return PTR_ERR(tusb->gpio_cs);
> +
> +	gpiod_set_value_cansleep(tusb->gpio_cs, 1);
>
>   	/*
>   	 * VENDOR_SPECIFIC2 register in TUSB1210 can be used for configuring eye
>

      reply	other threads:[~2015-06-15  5:43 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-06-12 17:51 [PATCH RESENT] phy: tusb1210: make better use of gpiod API Uwe Kleine-König
2015-06-15  5:43 ` Kishon Vijay Abraham I [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=557E65F4.1050400@ti.com \
    --to=kishon@ti.com \
    --cc=balbi@ti.com \
    --cc=gnurou@gmail.com \
    --cc=heikki.krogerus@linux.intel.com \
    --cc=kernel@pengutronix.de \
    --cc=linus.walleij@linaro.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-usb@vger.kernel.org \
    --cc=u.kleine-koenig@pengutronix.de \
    /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