All of lore.kernel.org
 help / color / mirror / Atom feed
From: Daniel Mack <daniel@caiaq.de>
To: Steve.Glendinning@smsc.com
Cc: netdev@vger.kernel.org, David Miller <davem@davemloft.net>,
	Ian.Saturley@smsc.com
Subject: Re: [PATCH] net: smsc911x: add power management functions
Date: Tue, 5 May 2009 10:40:46 +0200	[thread overview]
Message-ID: <20090505084046.GB22117@buzzloop.caiaq.de> (raw)
In-Reply-To: <OF7B58C3C5.29BA38D0-ON802575AD.002E7A8A-802575AD.002F637B@smsc.com>

On Tue, May 05, 2009 at 09:37:42AM +0100, Steve.Glendinning@smsc.com wrote:
> > This adds a power management implementation for smsc911x.c which assumes
> > the chips remains powered during suspend. The device is put in its D1
> > power saving mode.
> 
> [....]
> 
> > +static int smsc911x_resume(struct platform_device *pdev)
> > +{
> > +   struct net_device *dev = platform_get_drvdata(pdev);
> > +   struct smsc911x_data *pdata = netdev_priv(dev);
> > +   unsigned int to = 100;
> > +
> > +   /* Note 3.11 from the datasheet:
> > +    *    "When the LAN9220 is in a power saving state, a write of any
> > +    *     data to the BYTE_TEST register will wake-up the device."
> > +    */
> > +   smsc911x_reg_write(pdata, BYTE_TEST, 0);
> > +
> > +   /* poll the READY bit in PMT_CTRL. Any other access to the device is
> > +    * forbidden while this bit isn't set. Try for 100ms and return -EIO
> > +    * if it failed. */
> > +   while (!(smsc911x_reg_read(pdata, PMT_CTRL) & PMT_CTRL_READY_) && 
> to--)
> > +      udelay(1000);
> > +
> > +   return (to == 0) ? -EIO : 0;
> > +}
> 
> to-- should be --to, otherwise it'll end up as -1 when the loop times out
> (and the error code return below won't work).  Roel Kluin recently fixed
> many instances of this.

Yep, that's been pointed out by Enrik Berkhan already. David Miller
offered to fix that on the fly when commiting.

> Other than that, the power saving logic looks fine.

Thanks for your review :)

Daniel


      reply	other threads:[~2009-05-05  8:40 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-05-04 17:12 [PATCH] net: smsc911x: add power management functions Daniel Mack
2009-05-05  4:32 ` David Miller
2009-05-05  8:37 ` Steve.Glendinning
2009-05-05  8:40   ` Daniel Mack [this message]

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=20090505084046.GB22117@buzzloop.caiaq.de \
    --to=daniel@caiaq.de \
    --cc=Ian.Saturley@smsc.com \
    --cc=Steve.Glendinning@smsc.com \
    --cc=davem@davemloft.net \
    --cc=netdev@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.