From: Jeff Garzik <jeff@garzik.org>
To: "Rafael J. Wysocki" <rjw@sisk.pl>
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: Tue, 07 Aug 2007 17:40:36 -0400 [thread overview]
Message-ID: <46B8E6D4.30405@garzik.org> (raw)
In-Reply-To: <200708052114.01790.rjw@sisk.pl>
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.
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.
Jeff
next prev parent reply other threads:[~2007-08-07 22:05 UTC|newest]
Thread overview: 24+ messages / expand[flat|nested] mbox.gz Atom feed top
2007-08-05 19:14 [RFC][PATCH] uli526x: Add suspend and resume routines Rafael J. Wysocki
2007-08-07 21:40 ` Jeff Garzik [this message]
2007-08-07 22:24 ` Rafael J. Wysocki
2007-08-07 22:26 ` Jeff Garzik
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-07 22:56 ` Rafael J. Wysocki
2007-08-09 6:27 ` Grant Grundler
2007-08-09 6:27 ` Grant Grundler
2007-08-14 5:58 ` Jeff Garzik
2007-08-14 5:58 ` Jeff Garzik
2007-08-14 18:09 ` Rafael J. Wysocki
2007-08-14 18:09 ` Rafael J. Wysocki
2007-08-31 12:52 ` Jeff Garzik
2007-08-31 12:52 ` Jeff Garzik
2007-08-07 22:24 ` [RFC][PATCH] uli526x: Add suspend and resume routines Rafael J. Wysocki
2007-08-07 21:40 ` Jeff Garzik
2007-08-07 23:03 ` Andrew Morton
2007-08-08 12:05 ` Rafael J. Wysocki
2007-08-08 12:05 ` Rafael J. Wysocki
2007-08-08 12:09 ` Rafael J. Wysocki
2007-08-08 12:09 ` Rafael J. Wysocki
2007-08-07 23:03 ` Andrew Morton
-- strict thread matches above, loose matches on Subject: below --
2007-08-05 19:14 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=46B8E6D4.30405@garzik.org \
--to=jeff@garzik.org \
--cc=grundler@parisc-linux.org \
--cc=kyle@mcmartin.ca \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-pm@lists.linux-foundation.org \
--cc=rjw@sisk.pl \
/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.