driver model: more pci_choose_state()s are needed

From: Pavel Machek
Date: Sat Jan 22 2005 - 16:09:25 EST


Hi!

During my conversion, I discovered two more places where
pci_choose_state is needed to preserve type information. Code should
be equivalent, because we only pass 0 or 3 in "state"
parameter. Please apply,

Pavel

--- clean/drivers/net/tg3.c 2005-01-22 21:24:52.000000000 +0100
+++ linux-delme/drivers/net/tg3.c 2005-01-22 21:44:19.000000000 +0100
@@ -8475,7 +8475,7 @@
spin_unlock(&dev->xmit_lock);
spin_unlock_irq(&tp->lock);

- err = tg3_set_power_state(tp, state);
+ err = tg3_set_power_state(tp, pci_choose_state(pdev, state));
if (err) {
spin_lock_irq(&tp->lock);
spin_lock(&dev->xmit_lock);
--- clean/drivers/usb/core/hcd-pci.c 2005-01-12 11:07:40.000000000 +0100
+++ linux-delme/drivers/usb/core/hcd-pci.c 2005-01-22 21:44:19.000000000 +0100
@@ -274,11 +274,12 @@
*
* Store this function in the HCD's struct pci_driver as suspend().
*/
-int usb_hcd_pci_suspend (struct pci_dev *dev, u32 state)
+int usb_hcd_pci_suspend (struct pci_dev *dev, pm_message_t pmsg)
{
struct usb_hcd *hcd;
int retval = 0;
int has_pci_pm;
+ pci_power_t state;

hcd = pci_get_drvdata(dev);

@@ -287,8 +288,10 @@
* PM-sensitive HCDs may already have done this.
*/
has_pci_pm = pci_find_capability(dev, PCI_CAP_ID_PM);
- if (state > 4)
- state = 4;
+
+ state = pci_choose_state(dev, pmsg);
+ if (state > PCI_D3cold)
+ state = PCI_D3cold;

switch (hcd->state) {

@@ -396,7 +399,7 @@

if (has_pci_pm)
pci_set_power_state (dev, 0);
- dev->dev.power.power_state = 0;
+ dev->dev.power.power_state = PMSG_ON;
retval = request_irq (dev->irq, usb_hcd_irq, SA_SHIRQ,
hcd->driver->description, hcd);
if (retval < 0) {

--
People were complaining that M$ turns users into beta-testers...
...jr ghea gurz vagb qrirybcref, naq gurl frrz gb yvxr vg gung jnl!
-
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/