Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1754292AbbLACbP (ORCPT ); Mon, 30 Nov 2015 21:31:15 -0500 Received: from mail-bl2on0146.outbound.protection.outlook.com ([65.55.169.146]:44064 "EHLO na01-bl2-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1751849AbbLACbN (ORCPT ); Mon, 30 Nov 2015 21:31:13 -0500 X-Greylist: delayed 847 seconds by postgrey-1.27 at vger.kernel.org; Mon, 30 Nov 2015 21:31:13 EST From: Duan Andy To: =?utf-8?B?TG90aGFyIFdhw59tYW5u?= , Andrew Lunn , "David S. Miller" , Fabio Estevam , Greg Ungerer , Kevin Hao , Lucas Stach , Philippe Reynes , Richard Cochran , Russell King , Sascha Hauer , "Stefan Agner" , "linux-kernel@vger.kernel.org" , "netdev@vger.kernel.org" , Jeff Kirsher , "Uwe Kleine-K?nig" Subject: RE: [PATCH 2/3] net: fec: convert to using gpiod framework Thread-Topic: [PATCH 2/3] net: fec: convert to using gpiod framework Thread-Index: AQHRK2LokJokHOEc+kqISglbuVok+Z61Y3vA Date: Tue, 1 Dec 2015 02:17:01 +0000 Message-ID: References: <1448883168-30742-1-git-send-email-LW@KARO-electronics.de> <1448883168-30742-2-git-send-email-LW@KARO-electronics.de> <1448883168-30742-3-git-send-email-LW@KARO-electronics.de> In-Reply-To: <1448883168-30742-3-git-send-email-LW@KARO-electronics.de> Accept-Language: en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: authentication-results: spf=none (sender IP is ) smtp.mailfrom=fugang.duan@freescale.com; x-originating-ip: [123.151.195.51] x-microsoft-exchange-diagnostics: 1;BY1PR03MB1433;5:RChzFE2ZtMhSAu9QdoeBCzwXtpx7Ci2CqhGR0vCpmepWiXhLtEgbfqKaWGBwzd3+hBpiiDnJQYWCrw4qv2Lkh/3B/pwKmtz19Xw2ma2OZdo7LXWInpASJds4Vbgm6/96RFrvzbuyRWF2ujj7dDZ5OA==;24:RIulTWKyKnhlGK+EpklWMduf1Ir30k7Hm0sQQcjtblYEM2BWqUl+5UD0wmxh8JocwTMOH2SvXnGWf3Lpe9uiYWhtbO8dujD39Ra9C4vswrY= x-microsoft-antispam: UriScan:;BCL:0;PCL:0;RULEID:;SRVR:BY1PR03MB1433; x-microsoft-antispam-prvs: x-exchange-antispam-report-test: UriScan:; x-exchange-antispam-report-cfa-test: BCL:0;PCL:0;RULEID:(601004)(2401047)(520078)(5005006)(8121501046)(3002001)(10201501046);SRVR:BY1PR03MB1433;BCL:0;PCL:0;RULEID:;SRVR:BY1PR03MB1433; x-forefront-prvs: 07778E4001 x-forefront-antispam-report: SFV:NSPM;SFS:(10019020)(979002)(6009001)(189002)(199003)(377454003)(106356001)(87936001)(99286002)(50986999)(101416001)(106116001)(81156007)(1096002)(74316001)(5002640100001)(2900100001)(19580395003)(66066001)(2201001)(19580405001)(77096005)(5001770100001)(122556002)(86362001)(5008740100001)(54356999)(10400500002)(5003600100002)(6116002)(76576001)(40100003)(2950100001)(105586002)(11100500001)(3846002)(189998001)(102836003)(586003)(5001960100002)(2501003)(1220700001)(5004730100002)(76176999)(107886002)(33656002)(92566002)(97736004)(921003)(1121003)(969003)(989001)(999001)(1009001)(1019001);DIR:OUT;SFP:1102;SCL:1;SRVR:BY1PR03MB1433;H:BN3PR0301MB1219.namprd03.prod.outlook.com;FPR:;SPF:None;PTR:InfoNoRecords;MX:1;A:1;LANG:en; Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 X-OriginatorOrg: freescale.com X-MS-Exchange-CrossTenant-originalarrivaltime: 01 Dec 2015 02:17:01.4241 (UTC) X-MS-Exchange-CrossTenant-fromentityheader: Hosted X-MS-Exchange-CrossTenant-id: 710a03f5-10f6-4d38-9ff4-a80b81da590d X-MS-Exchange-Transport-CrossTenantHeadersStamped: BY1PR03MB1433 Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Transfer-Encoding: 8bit X-MIME-Autoconverted: from base64 to 8bit by mail.home.local id tB12W5ls024316 Content-Length: 2522 Lines: 65 From: Lothar Waßmann Sent: Monday, November 30, 2015 7:33 PM > To: Andrew Lunn; David S. Miller; Estevam Fabio-R49496; Greg Ungerer; > Kevin Hao; Lothar Waßmann; Lucas Stach; Duan Fugang-B38611; Philippe > Reynes; Richard Cochran; Russell King; Sascha Hauer; Stefan Agner; linux- > kernel@vger.kernel.org; netdev@vger.kernel.org; Jeff Kirsher; Uwe Kleine- > König > Subject: [PATCH 2/3] net: fec: convert to using gpiod framework > > Use gpiod_get_optional() instead of checking for a valid GPIO number and > calling devm_gpio_request_one() conditionally. > > Signed-off-by: Lothar Waßmann > --- > drivers/net/ethernet/freescale/fec_main.c | 17 +++++++---------- > 1 file changed, 7 insertions(+), 10 deletions(-) > > diff --git a/drivers/net/ethernet/freescale/fec_main.c > b/drivers/net/ethernet/freescale/fec_main.c > index e17d74f..1a983fc 100644 > --- a/drivers/net/ethernet/freescale/fec_main.c > +++ b/drivers/net/ethernet/freescale/fec_main.c > @@ -3233,7 +3233,7 @@ static int fec_enet_init(struct net_device *ndev) > #ifdef CONFIG_OF static void fec_reset_phy(struct platform_device *pdev) > { > - int err, phy_reset; > + struct gpio_desc *phy_reset; > int msec = 1; > struct device_node *np = pdev->dev.of_node; > > @@ -3245,18 +3245,15 @@ static void fec_reset_phy(struct platform_device > *pdev) > if (msec > 1000) > msec = 1; > > - phy_reset = of_get_named_gpio(np, "phy-reset-gpios", 0); > - if (!gpio_is_valid(phy_reset)) > - return; > - > - err = devm_gpio_request_one(&pdev->dev, phy_reset, > - GPIOF_OUT_INIT_LOW, "phy-reset"); > - if (err) { > - dev_err(&pdev->dev, "failed to get phy-reset-gpios: %d\n", > err); > + phy_reset = devm_gpiod_get_optional(&pdev->dev, "phy-reset", > + GPIOD_OUT_LOW); > + if (IS_ERR(phy_reset)) { > + dev_err(&pdev->dev, "failed to get phy-reset-gpios: %ld\n", > + PTR_ERR(phy_reset)); > return; > } > msleep(msec); > - gpio_set_value_cansleep(phy_reset, 1); > + gpiod_set_value_cansleep(phy_reset, 1); This API will judge the GPIO active polarity, there many imx boards in dts files don't care the polarity. So pls drop the patch. Or use gpiod_set_raw_value_cansleep() instead of gpiod_set_value_cansleep(). > } > #else /* CONFIG_OF */ > static void fec_reset_phy(struct platform_device *pdev) > -- > 2.1.4 ????{.n?+???????+%?????ݶ??w??{.n?+????{??G?????{ay?ʇڙ?,j??f???h?????????z_??(?階?ݢj"???m??????G????????????&???~???iO???z??v?^?m???? ????????I?