Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1754108AbcCRMNY (ORCPT ); Fri, 18 Mar 2016 08:13:24 -0400 Received: from smtp2-g21.free.fr ([212.27.42.2]:15601 "EHLO smtp2-g21.free.fr" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751514AbcCRMNK (ORCPT ); Fri, 18 Mar 2016 08:13:10 -0400 Subject: Re: [PATCH] net: phy: at803x: don't depend on GPIOLIB To: Sebastian Frias Cc: Uwe Kleine-Koenig , "David S. Miller" , netdev , LKML , Daniel Mack , Florian Fainelli , Mans Rullgard , Fabio Estevam , Martin Blumenstingl References: <56E99727.9040702@laposte.net> From: Mason Message-ID: <56EBF0C6.6080905@free.fr> Date: Fri, 18 Mar 2016 13:12:54 +0100 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:42.0) Gecko/20100101 Firefox/42.0 SeaMonkey/2.39 MIME-Version: 1.0 In-Reply-To: <56E99727.9040702@laposte.net> 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 Content-Length: 1215 Lines: 36 [ CCing a few devs who might be interested ] On 16/03/2016 18:25, Sebastian Frias wrote: > Commit 687908c2b649 ("net: phy: at803x: simplify using > devm_gpiod_get_optional and its 4th argument") introduced a dependency > on GPIOLIB that was not there before. > > This commit removes such dependency by checking the return code and > comparing it against ENOSYS which is returned when GPIOLIB is not > selected. > > Fixes: 687908c2b649 ("net: phy: at803x: simplify using > devm_gpiod_get_optional and its 4th argument") > > Signed-off-by: Sebastian Frias > --- > drivers/net/phy/at803x.c | 4 +++- > 1 file changed, 3 insertions(+), 1 deletion(-) > > diff --git a/drivers/net/phy/at803x.c b/drivers/net/phy/at803x.c > index 2174ec9..88b7ff3 100644 > --- a/drivers/net/phy/at803x.c > +++ b/drivers/net/phy/at803x.c > @@ -252,7 +252,9 @@ static int at803x_probe(struct phy_device *phydev) > return -ENOMEM; > > gpiod_reset = devm_gpiod_get_optional(dev, "reset", GPIOD_OUT_HIGH); > - if (IS_ERR(gpiod_reset)) > + if (PTR_ERR(gpiod_reset) == -ENOSYS) > + gpiod_reset = NULL; > + else if (IS_ERR(gpiod_reset)) > return PTR_ERR(gpiod_reset); > > priv->gpiod_reset = gpiod_reset; >