Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

PCI: pci_set_power_state(): check for PM capabilities earlier

Check for PCI_CAP_ID_PM before checking the device state. Apparently fixes
some log spam via the 3c59x driver.

Signed-off-by: Andrew Lunn <andrew.lunn@ascom.ch>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>

authored by

Andrew Lunn and committed by
Greg Kroah-Hartman
cca03dec 0bec2c85

+7 -7
+7 -7
drivers/pci/pci.c
··· 406 406 if ((state == PCI_D1 || state == PCI_D2) && pci_no_d1d2(dev)) 407 407 return 0; 408 408 409 + /* find PCI PM capability in list */ 410 + pm = pci_find_capability(dev, PCI_CAP_ID_PM); 411 + 412 + /* abort if the device doesn't support PM capabilities */ 413 + if (!pm) 414 + return -EIO; 415 + 409 416 /* Validate current state: 410 417 * Can enter D0 from any state, but if we can only go deeper 411 418 * to sleep if we're already in a low power state ··· 424 417 } else if (dev->current_state == state) 425 418 return 0; /* we're already there */ 426 419 427 - 428 - /* find PCI PM capability in list */ 429 - pm = pci_find_capability(dev, PCI_CAP_ID_PM); 430 - 431 - /* abort if the device doesn't support PM capabilities */ 432 - if (!pm) 433 - return -EIO; 434 420 435 421 pci_read_config_word(dev,pm + PCI_PM_PMC,&pmc); 436 422 if ((pmc & PCI_PM_CAP_VER_MASK) > 3) {