From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1754023AbbFOFnk (ORCPT ); Mon, 15 Jun 2015 01:43:40 -0400 Received: from comal.ext.ti.com ([198.47.26.152]:47348 "EHLO comal.ext.ti.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753986AbbFOFnc (ORCPT ); Mon, 15 Jun 2015 01:43:32 -0400 Message-ID: <557E65F4.1050400@ti.com> Date: Mon, 15 Jun 2015 11:13:16 +0530 From: Kishon Vijay Abraham I User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:31.0) Gecko/20100101 Thunderbird/31.0 MIME-Version: 1.0 To: =?UTF-8?B?VXdlIEtsZWluZS1Lw7ZuaWc=?= , Heikki Krogerus , Felipe Balbi , Linus Walleij , Alexandre Courbot CC: , , Subject: Re: [PATCH RESENT] phy: tusb1210: make better use of gpiod API References: <1434131504-26407-1-git-send-email-u.kleine-koenig@pengutronix.de> In-Reply-To: <1434131504-26407-1-git-send-email-u.kleine-koenig@pengutronix.de> Content-Type: text/plain; charset="utf-8"; format=flowed Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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 > --- > 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 >