From: "Rafael J. Wysocki" <rjw@sisk.pl>
To: Jeff Garzik <jeff@garzik.org>
Cc: LKML <linux-kernel@vger.kernel.org>,
pm list <linux-pm@lists.linux-foundation.org>,
Grant Grundler <grundler@parisc-linux.org>,
Kyle McMartin <kyle@mcmartin.ca>
Subject: Re: [RFC][PATCH] uli526x: Add suspend and resume routines
Date: Wed, 8 Aug 2007 00:24:28 +0200 [thread overview]
Message-ID: <200708080024.28692.rjw@sisk.pl> (raw)
In-Reply-To: <46B8E6D4.30405@garzik.org>
On Tuesday, 7 August 2007 23:40, Jeff Garzik wrote:
> Rafael J. Wysocki wrote:
> > +static int uli526x_suspend(struct pci_dev *pdev, pm_message_t state)
> > +{
> > + struct net_device *dev = pci_get_drvdata(pdev);
> > + int err = 0;
> > +
> > + ULI526X_DBUG(0, "uli526x_suspend", 0);
> > +
> > + if (dev && netdev_priv(dev)) {
> > + pci_power_t power_state;
> > +
> > + pci_save_state(pdev);
> > +
> > + if (!netif_running(dev))
> > + return 0;
> > +
> > + netif_device_detach(dev);
> > + uli526x_reset_prepare(dev);
> > +
> > + power_state = pci_choose_state(pdev, state);
> > + pci_enable_wake(pdev, power_state, 0);
> > + err = pci_set_power_state(pdev, power_state);
> > + if (err) {
> > + netif_device_attach(dev);
> > + /* Re-initialize ULI526X board */
> > + uli526x_init(dev);
> > + /* Restart upper layer interface */
> > + netif_wake_queue(dev);
> > + }
> > + }
> > + return err;
> > +}
> > +
> > +/*
> > + * Resume the interface.
> > + */
> > +
> > +static int uli526x_resume(struct pci_dev *pdev)
> > +{
> > + struct net_device *dev = pci_get_drvdata(pdev);
> > + struct uli526x_board_info *db = netdev_priv(dev);
> > +
> > + ULI526X_DBUG(0, "uli526x_resume", 0);
> > +
> > + if (dev && db) {
> > + int err;
> > +
> > + pci_restore_state(pdev);
> > +
> > + if (!netif_running(dev))
> > + return 0;
> > +
> > + err = pci_set_power_state(pdev, PCI_D0);
> > + if (err) {
> > + printk(KERN_WARNING
> > + "%s: Could not put device into D0\n",
> > + dev->name);
> > + return err;
> > + }
> > +
> > + netif_device_attach(dev);
> > + /* Re-initialize ULI526X board */
> > + uli526x_init(dev);
> > + /* Restart upper layer interface */
> > + netif_wake_queue(dev);
> > + }
> > + return 0;
>
>
> Ugh -- please fix indentation. This is not proper Linux code.
>
> If you have the -vast majority- of code on an indented branch, as you
> have here, then you should either add an early 'return x;' or a goto,
> and unindent the main body of code.
OK, I will.
> I'll let our new tulip maintainer see what he thinks about the
> implementation. Seems fairly sane to me, but should at least get an "it
> works" test.
It has been tested, as stated in the changelog, and works (on my test system).
Greetings,
Rafael
--
"Premature optimization is the root of all evil." - Donald Knuth
next prev parent reply other threads:[~2007-08-07 22:15 UTC|newest]
Thread overview: 12+ messages / expand[flat|nested] mbox.gz Atom feed top
2007-08-05 19:14 Rafael J. Wysocki
2007-08-07 21:40 ` Jeff Garzik
2007-08-07 22:24 ` Rafael J. Wysocki [this message]
2007-08-07 22:26 ` Jeff Garzik
2007-08-07 22:56 ` [RFC][PATCH] uli526x: Add suspend and resume routines (updated) Rafael J. Wysocki
2007-08-09 6:27 ` Grant Grundler
2007-08-14 5:58 ` Jeff Garzik
2007-08-14 18:09 ` Rafael J. Wysocki
2007-08-31 12:52 ` Jeff Garzik
2007-08-07 23:03 ` [RFC][PATCH] uli526x: Add suspend and resume routines Andrew Morton
2007-08-08 12:05 ` Rafael J. Wysocki
2007-08-08 12:09 ` Rafael J. Wysocki
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=200708080024.28692.rjw@sisk.pl \
--to=rjw@sisk.pl \
--cc=grundler@parisc-linux.org \
--cc=jeff@garzik.org \
--cc=kyle@mcmartin.ca \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-pm@lists.linux-foundation.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®