All of lore.kernel.org
 help / color / mirror / Atom feed
From: Darren Hart <dvhart@linux.intel.com>
To: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Cc: Linux Kernel Mailing List <linux-kernel@vger.kernel.org>,
	"David S. Miller" <davem@davemloft.net>,
	"H. Peter Anvin" <hpa@zytor.com>,
	Peter Waskiewicz <peter.p.waskiewicz.jr@intel.com>,
	netdev@vger.kernel.org, stable@vger.kernel.org
Subject: Re: [PATCH 3/3] pch_gbe: Add MinnowBoard support
Date: Mon, 15 Jul 2013 13:41:10 -0700	[thread overview]
Message-ID: <1373920870.3475.200.camel@envy.home> (raw)
In-Reply-To: <1373877289.24799.242.camel@smile>

On Mon, 2013-07-15 at 11:34 +0300, Andy Shevchenko wrote:
> On Fri, 2013-07-12 at 17:58 -0700, Darren Hart wrote: 

... 
> > +/* The AR803X PHY on the MinnowBoard requires a physical pin to be toggled to
> > + * ensure it is awake for probe and init. Request the line and reset the PHY.
> > + */
> > +static int pch_gbe_minnow_platform_init(struct pci_dev *pdev)
> > +{
> > +	int ret = 0;
> > +	int flags = GPIOF_DIR_OUT | GPIOF_INIT_HIGH | GPIOF_EXPORT;
> > +	int gpio = MINNOW_PHY_RESET_GPIO;
> > +
> > +	ret = gpio_request_one(gpio, flags, "minnow_phy_reset");
> > +	if (ret){
> > +		dev_err(&pdev->dev,
> > +			"ERR: Can't request PHY reset GPIO line '%d'\n", gpio);
> > +		return ret;
> > +	}
> > +
> > +	gpio_set_value(gpio, 0);
> > +	usleep_range(1250, 1500);
> > +	gpio_set_value(gpio, 1);
> > +	usleep_range(1250, 1500);
> 
> First of all, who is going to release gpio? Perhaps
> devm_gpio_request_one?

Thanks for the pointer, this works and appears to be the best way to
handle this.

...
> > + */
> > +int pch_gbe_phy_tx_clk_delay(struct pch_gbe_hw *hw)
> > +{
> > +	/* The RGMII interface requires a ~2ns TX clock delay. This is typically
> > +	 * done in layout with a longer trace or via PHY strapping, but can also
> > +	 * be done via PHY configuration registers.
> > +	 */
> > +	struct pch_gbe_adapter *adapter = pch_gbe_hw_to_adapter(hw);
> > +	u16 mii_reg;
> > +	int ret = 0;
> 
> No need to assign. Are you trying to shut (sparse?) warning?

On this point, I did find one instance where I initialized init only to
have my first line of executable code assign to ret, that's obviously
silly, so I fixed that one.

Here, where the first assignment is nested inside case statements or
skipped altogether with explicit returns of error codes, I prefer to
assign it explicitly. A quick survey lists 4k initialized "int ret;"
lines and 16k uninitialized.  The latter appears to be the more common,
but there is certainly precedent for the former.

-- 
Darren Hart
Intel Open Source Technology Center
Yocto Project - Technical Lead - Linux Kernel


  reply	other threads:[~2013-07-15 20:41 UTC|newest]

Thread overview: 19+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-07-13  0:58 [PATCH 0/3] MinnowBoard Support V2 (Serial and Ethernet) Darren Hart
2013-07-13  0:58 ` [PATCH 1/3] pch_uart: Use DMI interface for board detection Darren Hart
2013-07-13  0:58   ` [PATCH 2/3] pch_gbe: Use PCH_GBE_PHY_REGS_LEN instead of 32 Darren Hart
2013-07-13  0:58   ` [PATCH 3/3] pch_gbe: Add MinnowBoard support Darren Hart
2013-07-13  1:10     ` Joe Perches
2013-07-13  5:52       ` Darren Hart
2013-07-13  1:17     ` Greg KH
2013-07-13  5:46       ` Darren Hart
2013-07-13  6:26         ` Greg KH
2013-07-13 16:08           ` Darren Hart
2013-07-13 17:09             ` Greg KH
2013-07-13 19:33               ` Darren Hart
2013-07-15  8:34     ` Andy Shevchenko
2013-07-15 20:41       ` Darren Hart [this message]
2013-07-18 17:05       ` Darren Hart
2013-07-15 20:55     ` Darren Hart
2013-07-17 20:13     ` Darren Hart
2013-07-17 20:15   ` [PATCH 1/3] pch_uart: Use DMI interface for board detection Darren Hart
2013-07-17 21:55     ` Greg Kroah-Hartman

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=1373920870.3475.200.camel@envy.home \
    --to=dvhart@linux.intel.com \
    --cc=andriy.shevchenko@linux.intel.com \
    --cc=davem@davemloft.net \
    --cc=hpa@zytor.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=netdev@vger.kernel.org \
    --cc=peter.p.waskiewicz.jr@intel.com \
    --cc=stable@vger.kernel.org \
    /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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.