public inbox for netdev@vger.kernel.org
 help / color / mirror / Atom feed
From: "Lothar Waßmann" <LW@KARO-electronics.de>
To: Duan Andy <fugang.duan@freescale.com>
Cc: Andrew Lunn <andrew@lunn.ch>,
	"David S. Miller" <davem@davemloft.net>,
	Fabio Estevam <Fabio.Estevam@freescale.com>,
	Greg Ungerer <gerg@uclinux.org>, Kevin Hao <haokexin@gmail.com>,
	Lucas Stach <l.stach@pengutronix.de>,
	Philippe Reynes <tremyfr@gmail.com>,
	Richard Cochran <richardcochran@gmail.com>,
	Russell King <rmk+kernel@arm.linux.org.uk>,
	Sascha Hauer <s.hauer@pengutronix.de>,
	"Stefan Agner" <stefan@agner.ch>,
	"linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>,
	"netdev@vger.kernel.org" <netdev@vger.kernel.org>,
	Jeff Kirsher <jeffrey.t.kirsher@intel.com>,
	"Uwe Kleine-K?nig" <u.kleine-koenig@pengutronix.de>
Subject: Re: [PATCH 2/3] net: fec: convert to using gpiod framework
Date: Tue, 1 Dec 2015 11:29:17 +0100	[thread overview]
Message-ID: <20151201112917.1f47af66@ipc1.ka-ro> (raw)
In-Reply-To: <BN3PR0301MB1219D8F59FEB74A4C445E405F50F0@BN3PR0301MB1219.namprd03.prod.outlook.com>

Hi,

> From: Lothar Waßmann <LW@KARO-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@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 <LW@KARO-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().
> 
I could prepare a patch that temporarily uses the raw functions and add
a comment to convert these to the proper functions once all DTB files
have been corrected and some time has passed to account for boards using
old dtbs with newer kernels.

I could also send a patch to convert all in-tree dts files to use
GPIO_ACTIVE_LOW if that is desired.


Lothar Waßmann

  reply	other threads:[~2015-12-01 10:29 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-11-30 11:32 [PATCH 0/3] net: fec: Reset ethernet PHY whenever the enet_out clock Lothar Waßmann
2015-11-30 11:32 ` [PATCH 1/3] net: fec: Remove redundant checks for NULL clk pointer Lothar Waßmann
2015-11-30 11:32   ` [PATCH 2/3] net: fec: convert to using gpiod framework Lothar Waßmann
2015-11-30 11:32     ` [PATCH 3/3] net: fec: Reset ethernet PHY whenever the enet_out clock is being enabled Lothar Waßmann
2015-12-01  2:31       ` Duan Andy
2015-11-30 12:17     ` [PATCH 2/3] net: fec: convert to using gpiod framework Fabio Estevam
2015-12-01  2:17     ` Duan Andy
2015-12-01 10:29       ` Lothar Waßmann [this message]
2015-12-01  2:04   ` [PATCH 1/3] net: fec: Remove redundant checks for NULL clk pointer Duan Andy
2015-12-01  7:24     ` Lothar Waßmann
2015-12-01  1:52 ` [PATCH 0/3] net: fec: Reset ethernet PHY whenever the enet_out clock Duan Andy
2015-12-01  7:24   ` Lothar Waßmann
2015-12-01  7:33     ` Duan Andy

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20151201112917.1f47af66@ipc1.ka-ro \
    --to=lw@karo-electronics.de \
    --cc=Fabio.Estevam@freescale.com \
    --cc=andrew@lunn.ch \
    --cc=davem@davemloft.net \
    --cc=fugang.duan@freescale.com \
    --cc=gerg@uclinux.org \
    --cc=haokexin@gmail.com \
    --cc=jeffrey.t.kirsher@intel.com \
    --cc=l.stach@pengutronix.de \
    --cc=linux-kernel@vger.kernel.org \
    --cc=netdev@vger.kernel.org \
    --cc=richardcochran@gmail.com \
    --cc=rmk+kernel@arm.linux.org.uk \
    --cc=s.hauer@pengutronix.de \
    --cc=stefan@agner.ch \
    --cc=tremyfr@gmail.com \
    --cc=u.kleine-koenig@pengutronix.de \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox