Re: [PATCH] fix tulip suspend/resume

From: Adam Belay
Date: Tue Jun 07 2005 - 21:21:48 EST


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);


-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/