lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <BN3PR0301MB1219D8F59FEB74A4C445E405F50F0@BN3PR0301MB1219.namprd03.prod.outlook.com>
Date:	Tue, 1 Dec 2015 02:17:01 +0000
From:	Duan Andy <fugang.duan@...escale.com>
To:	Lothar Waßmann <LW@...O-electronics.de>,
	Andrew Lunn <andrew@...n.ch>,
	"David S. Miller" <davem@...emloft.net>,
	Fabio Estevam <Fabio.Estevam@...escale.com>,
	Greg Ungerer <gerg@...inux.org>,
	Kevin Hao <haokexin@...il.com>,
	Lucas Stach <l.stach@...gutronix.de>,
	Philippe Reynes <tremyfr@...il.com>,
	Richard Cochran <richardcochran@...il.com>,
	Russell King <rmk+kernel@....linux.org.uk>,
	Sascha Hauer <s.hauer@...gutronix.de>,
	"Stefan Agner" <stefan@...er.ch>,
	"linux-kernel@...r.kernel.org" <linux-kernel@...r.kernel.org>,
	"netdev@...r.kernel.org" <netdev@...r.kernel.org>,
	Jeff Kirsher <jeffrey.t.kirsher@...el.com>,
	"Uwe Kleine-K?nig" <u.kleine-koenig@...gutronix.de>
Subject: RE: [PATCH 2/3] net: fec: convert to using gpiod framework

From: Lothar Waßmann <LW@...O-electronics.de> 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@...r.kernel.org; netdev@...r.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 <LW@...O-electronics.de>
> ---
>  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

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ