Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753792AbbK3Lde (ORCPT ); Mon, 30 Nov 2015 06:33:34 -0500 Received: from mail.karo-electronics.de ([81.173.242.67]:60622 "EHLO mail.karo-electronics.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753275AbbK3Lda (ORCPT ); Mon, 30 Nov 2015 06:33:30 -0500 From: =?UTF-8?q?Lothar=20Wa=C3=9Fmann?= To: Andrew Lunn , "David S. Miller" , Fabio Estevam , Greg Ungerer , Kevin Hao , =?UTF-8?q?Lothar=20Wa=C3=9Fmann?= , Lucas Stach , Nimrod Andy , Philippe Reynes , Richard Cochran , Russell King , Sascha Hauer , Stefan Agner , linux-kernel@vger.kernel.org, netdev@vger.kernel.org, Jeff Kirsher , =?UTF-8?q?Uwe=20Kleine-K=C3=B6nig?= Subject: [PATCH 2/3] net: fec: convert to using gpiod framework Date: Mon, 30 Nov 2015 12:32:47 +0100 Message-Id: <1448883168-30742-3-git-send-email-LW@KARO-electronics.de> X-Mailer: git-send-email 2.1.4 In-Reply-To: <1448883168-30742-2-git-send-email-LW@KARO-electronics.de> References: <1448883168-30742-1-git-send-email-LW@KARO-electronics.de> <1448883168-30742-2-git-send-email-LW@KARO-electronics.de> MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 1843 Lines: 54 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); } #else /* CONFIG_OF */ static void fec_reset_phy(struct platform_device *pdev) -- 2.1.4 -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/