]> pilppa.com Git - linux-2.6-omap-h63xx.git/commitdiff
drivers/ide/pci/sc1200.c: fix suspend/resume buglets and warnings
authorJeff Garzik <jeff@garzik.org>
Fri, 26 Oct 2007 18:31:15 +0000 (20:31 +0200)
committerBartlomiej Zolnierkiewicz <bzolnier@gmail.com>
Fri, 26 Oct 2007 18:31:15 +0000 (20:31 +0200)
* We shouldn't bother with dev->current_state, the PCI API functions we
  call manage this for us (and do a far better job at it too).

* Remove pci_set_power_state(dev, PCI_D0) call in resume, as
  pci_enable_device() does the same thing.

* Check pci_enable_device() return value.  If it failed, fail
  the entire resume and avoid programming timings into the [potentially
  dead/asleep] chip.

Signed-off-by: Jeff Garzik <jgarzik@redhat.com>
Cc: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Bartlomiej Zolnierkiewicz <bzolnier@gmail.com>
drivers/ide/pci/sc1200.c

index d2c8b5524f283df712581463e0c80a59b99fa0dc..0a7b3202066d99ee88c78902b4b4b03ee2904151 100644 (file)
@@ -324,17 +324,18 @@ static int sc1200_suspend (struct pci_dev *dev, pm_message_t state)
 
        pci_disable_device(dev);
        pci_set_power_state(dev, pci_choose_state(dev, state));
-       dev->current_state = state.event;
        return 0;
 }
 
 static int sc1200_resume (struct pci_dev *dev)
 {
        ide_hwif_t      *hwif = NULL;
+       int             i;
+
+       i = pci_enable_device(dev);
+       if (i)
+               return i;
 
-       pci_set_power_state(dev, PCI_D0);       // bring chip back from sleep state
-       dev->current_state = PM_EVENT_ON;
-       pci_enable_device(dev);
        //
        // loop over all interfaces that are part of this pci device:
        //