public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Adam Belay <abelay@novell.com>
To: Benjamin Herrenschmidt <benh@kernel.crashing.org>, greg@kroah.com
Cc: Kernel Mailing List <linux-kernel@vger.kernel.org>,
	Jeff Garzik <jgarzik@pobox.com>, Andrew Morton <akpm@osdl.org>,
	Linus Torvalds <torvalds@osdl.org>, Karsten Keil <kkeil@suse.de>
Subject: Re: [PATCH] fix tulip suspend/resume
Date: Tue, 07 Jun 2005 22:16:19 -0400	[thread overview]
Message-ID: <1118196980.3245.68.camel@localhost.localdomain> (raw)
In-Reply-To: <1118190373.6850.85.camel@gaston>

On Wed, 2005-06-08 at 10:26 +1000, Benjamin Herrenschmidt wrote:
> > pci_power_t pci_choose_state(struct pci_dev *dev, pm_message_t state)
> > {
> > 	if (!pci_find_capability(dev, PCI_CAP_ID_PM))
> > 		return PCI_D0;
> > 
> > 	switch (state) {
> > 	case 0: return PCI_D0;
> > 	case 3: return PCI_D3hot;
> > 	default:
> > 		printk("They asked me for state %d\n", state);
> > 		BUG();
> > 	}
> > 	return PCI_D0;
> > }
> 
> Gack ! I need to remember to fix that one before I change PMSG_FREEZE
> definition to be different than PMSG_SUSPEND upstream.
> 
> Pavel, do you know that there are other ways to deal with errors than
> just BUG()'ing all over the place ? :)
> 
> Ben.

I think we should also use the pm_message_t defines.  We will need to
add PMSG_FREEZE eventually.  I decided to default to the current state
rather than panic.  Does this patch look ok?

Thanks,
Adam

--- a/drivers/pci/pci.c	2005-05-27 22:06:02.000000000 -0400
+++ b/drivers/pci/pci.c	2005-06-07 22:10:02.066151280 -0400
@@ -320,13 +320,15 @@
 		return PCI_D0;
 
 	switch (state) {
-	case 0: return PCI_D0;
-	case 3: return PCI_D3hot;
+	case PMSG_ON:
+		return PCI_D0;
+	case PMSG_SUSPEND:
+		return PCI_D3hot;
 	default:
-		printk("They asked me for state %d\n", state);
-		BUG();
+		printk(KERN_ERR "PCI: invalid PM message state - %d\n", state);
 	}
-	return PCI_D0;
+
+	return dev->current_state;
 }
 
 EXPORT_SYMBOL(pci_choose_state);



  reply	other threads:[~2005-06-08  2:20 UTC|newest]

Thread overview: 33+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2005-06-06 22:46 [PATCH] fix tulip suspend/resume Karsten Keil
2005-06-07  0:04 ` Linus Torvalds
2005-06-07  2:50   ` Adam Belay
2005-06-07  3:34     ` Benjamin Herrenschmidt
2005-06-07  3:58       ` Adam Belay
2005-06-07  4:26         ` Benjamin Herrenschmidt
2005-06-07  5:34           ` Adam Belay
2005-06-07  5:50             ` Benjamin Herrenschmidt
2005-06-07 10:55     ` Karsten Keil
2005-06-07 20:58       ` Adam Belay
2005-06-08  0:26         ` Benjamin Herrenschmidt
2005-06-08  2:16           ` Adam Belay [this message]
2005-06-08 12:23             ` Pavel Machek
2005-06-08 23:00               ` Benjamin Herrenschmidt
2005-06-09  0:04                 ` Pavel Machek
2005-06-09  0:38                   ` Adam Belay
2005-06-09 10:51                     ` Pavel Machek
2005-06-09  2:49                   ` Nigel Cunningham
2005-06-09  8:27                   ` Karsten Keil
2005-06-08 12:19           ` Pavel Machek
2005-06-08  6:39         ` Karsten Keil
2005-06-08 18:11           ` Davide Rossetti
2005-06-09  1:48             ` Adam Belay
2005-06-07 11:52   ` Stefan Seyfried
2005-06-07  2:15 ` Benjamin Herrenschmidt
2005-06-07  2:57   ` Adam Belay
2005-06-07  3:32     ` Benjamin Herrenschmidt
2005-06-07  3:42       ` Adam Belay
2005-06-07  4:29         ` Benjamin Herrenschmidt
2005-06-07  5:03           ` Adam Belay
2005-06-07  5:51             ` Nigel Cunningham
2005-06-07  5:55               ` Benjamin Herrenschmidt
2005-06-07 15:10   ` Pavel Machek

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=1118196980.3245.68.camel@localhost.localdomain \
    --to=abelay@novell.com \
    --cc=akpm@osdl.org \
    --cc=benh@kernel.crashing.org \
    --cc=greg@kroah.com \
    --cc=jgarzik@pobox.com \
    --cc=kkeil@suse.de \
    --cc=linux-kernel@vger.kernel.org \
    --cc=torvalds@osdl.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