From mboxrd@z Thu Jan 1 00:00:00 1970 From: kishon@ti.com (Kishon Vijay Abraham I) Date: Tue, 6 Oct 2015 19:52:35 +0530 Subject: [PATCH RESEND] phy: sun4i-usb: Use devm_gpiod_get_optional for optional GPIOs In-Reply-To: <1443142049.13662.1.camel@ingics.com> References: <1443142049.13662.1.camel@ingics.com> Message-ID: <5613D92B.8040609@ti.com> To: linux-arm-kernel@lists.infradead.org List-Id: linux-arm-kernel.lists.infradead.org Hi, On Friday 25 September 2015 06:17 AM, Axel Lin wrote: > Both data->id_det_gpio and data->vbus_det_gpio are optional, so use > devm_gpiod_get_optional for them. > > Signed-off-by: Axel Lin > Reviewed-by: Hans de Goede merged this to linux-phy tree. Thanks Kishon > --- > This patch was sent on https://lkml.org/lkml/2015/8/21/177 > > drivers/phy/phy-sun4i-usb.c | 22 +++++++++------------- > 1 file changed, 9 insertions(+), 13 deletions(-) > > diff --git a/drivers/phy/phy-sun4i-usb.c b/drivers/phy/phy-sun4i-usb.c > index 731b395..b12964b 100644 > --- a/drivers/phy/phy-sun4i-usb.c > +++ b/drivers/phy/phy-sun4i-usb.c > @@ -551,19 +551,15 @@ static int sun4i_usb_phy_probe(struct platform_device *pdev) > if (IS_ERR(data->base)) > return PTR_ERR(data->base); > > - data->id_det_gpio = devm_gpiod_get(dev, "usb0_id_det", GPIOD_IN); > - if (IS_ERR(data->id_det_gpio)) { > - if (PTR_ERR(data->id_det_gpio) == -EPROBE_DEFER) > - return -EPROBE_DEFER; > - data->id_det_gpio = NULL; > - } > - > - data->vbus_det_gpio = devm_gpiod_get(dev, "usb0_vbus_det", GPIOD_IN); > - if (IS_ERR(data->vbus_det_gpio)) { > - if (PTR_ERR(data->vbus_det_gpio) == -EPROBE_DEFER) > - return -EPROBE_DEFER; > - data->vbus_det_gpio = NULL; > - } > + data->id_det_gpio = devm_gpiod_get_optional(dev, "usb0_id_det", > + GPIOD_IN); > + if (IS_ERR(data->id_det_gpio)) > + return PTR_ERR(data->id_det_gpio); > + > + data->vbus_det_gpio = devm_gpiod_get_optional(dev, "usb0_vbus_det", > + GPIOD_IN); > + if (IS_ERR(data->vbus_det_gpio)) > + return PTR_ERR(data->vbus_det_gpio); > > if (of_find_property(np, "usb0_vbus_power-supply", NULL)) { > data->vbus_power_supply = devm_power_supply_get_by_phandle(dev, > From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752753AbbJFOXS (ORCPT ); Tue, 6 Oct 2015 10:23:18 -0400 Received: from bear.ext.ti.com ([192.94.94.41]:53602 "EHLO bear.ext.ti.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751460AbbJFOXR (ORCPT ); Tue, 6 Oct 2015 10:23:17 -0400 Subject: Re: [PATCH RESEND] phy: sun4i-usb: Use devm_gpiod_get_optional for optional GPIOs To: Axel Lin References: <1443142049.13662.1.camel@ingics.com> CC: Hans de Goede , Maxime Ripard , , From: Kishon Vijay Abraham I Message-ID: <5613D92B.8040609@ti.com> Date: Tue, 6 Oct 2015 19:52:35 +0530 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:38.0) Gecko/20100101 Thunderbird/38.2.0 MIME-Version: 1.0 In-Reply-To: <1443142049.13662.1.camel@ingics.com> Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: 7bit Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Hi, On Friday 25 September 2015 06:17 AM, Axel Lin wrote: > Both data->id_det_gpio and data->vbus_det_gpio are optional, so use > devm_gpiod_get_optional for them. > > Signed-off-by: Axel Lin > Reviewed-by: Hans de Goede merged this to linux-phy tree. Thanks Kishon > --- > This patch was sent on https://lkml.org/lkml/2015/8/21/177 > > drivers/phy/phy-sun4i-usb.c | 22 +++++++++------------- > 1 file changed, 9 insertions(+), 13 deletions(-) > > diff --git a/drivers/phy/phy-sun4i-usb.c b/drivers/phy/phy-sun4i-usb.c > index 731b395..b12964b 100644 > --- a/drivers/phy/phy-sun4i-usb.c > +++ b/drivers/phy/phy-sun4i-usb.c > @@ -551,19 +551,15 @@ static int sun4i_usb_phy_probe(struct platform_device *pdev) > if (IS_ERR(data->base)) > return PTR_ERR(data->base); > > - data->id_det_gpio = devm_gpiod_get(dev, "usb0_id_det", GPIOD_IN); > - if (IS_ERR(data->id_det_gpio)) { > - if (PTR_ERR(data->id_det_gpio) == -EPROBE_DEFER) > - return -EPROBE_DEFER; > - data->id_det_gpio = NULL; > - } > - > - data->vbus_det_gpio = devm_gpiod_get(dev, "usb0_vbus_det", GPIOD_IN); > - if (IS_ERR(data->vbus_det_gpio)) { > - if (PTR_ERR(data->vbus_det_gpio) == -EPROBE_DEFER) > - return -EPROBE_DEFER; > - data->vbus_det_gpio = NULL; > - } > + data->id_det_gpio = devm_gpiod_get_optional(dev, "usb0_id_det", > + GPIOD_IN); > + if (IS_ERR(data->id_det_gpio)) > + return PTR_ERR(data->id_det_gpio); > + > + data->vbus_det_gpio = devm_gpiod_get_optional(dev, "usb0_vbus_det", > + GPIOD_IN); > + if (IS_ERR(data->vbus_det_gpio)) > + return PTR_ERR(data->vbus_det_gpio); > > if (of_find_property(np, "usb0_vbus_power-supply", NULL)) { > data->vbus_power_supply = devm_power_supply_get_by_phandle(dev, >