* [RFC][PATCH 4/6] PCI PM: update pci_enable_wake()
@ 2005-11-16 3:31 Adam Belay
0 siblings, 0 replies; only message in thread
From: Adam Belay @ 2005-11-16 3:31 UTC (permalink / raw)
To: Linux-pm mailing list, Greg KH; +Cc: linux-kernel
This patch updates pci_enable_wake() to use "struct pci_dev_pm".
--- a/drivers/pci/pm.c 2005-11-07 08:18:18.000000000 -0500
+++ b/drivers/pci/pm.c 2005-11-07 08:17:21.000000000 -0500
@@ -247,28 +247,19 @@
*/
int pci_enable_wake(struct pci_dev *dev, pci_power_t state, int enable)
{
- int pm;
u16 value;
-
- /* find PCI PM capability in list */
- pm = pci_find_capability(dev, PCI_CAP_ID_PM);
+ struct pci_dev_pm *data = dev->pm;
/* If device doesn't support PM Capabilities, but request is to disable
* wake events, it's a nop; otherwise fail */
- if (!pm)
+ if (!data)
return enable ? -EIO : 0;
- /* Check device's ability to generate PME# */
- pci_read_config_word(dev,pm+PCI_PM_PMC,&value);
-
- value &= PCI_PM_CAP_PME_MASK;
- value >>= ffs(PCI_PM_CAP_PME_MASK) - 1; /* First bit of mask */
-
/* Check if it can generate PME# from requested state. */
- if (!value || !(value & (1 << state)))
+ if (!data->pme_mask || !(data->pme_mask & (1 << state)))
return enable ? -EINVAL : 0;
- pci_read_config_word(dev, pm + PCI_PM_CTRL, &value);
+ pci_read_config_word(dev, data->pm_offset + PCI_PM_CTRL, &value);
/* Clear PME_Status by writing 1 to it and enable PME# */
value |= PCI_PM_CTRL_PME_STATUS | PCI_PM_CTRL_PME_ENABLE;
@@ -276,7 +267,7 @@
if (!enable)
value &= ~PCI_PM_CTRL_PME_ENABLE;
- pci_write_config_word(dev, pm + PCI_PM_CTRL, value);
+ pci_write_config_word(dev, data->pm_offset + PCI_PM_CTRL, value);
return 0;
}
^ permalink raw reply [flat|nested] only message in thread
only message in thread, other threads:[~2005-11-16 3:31 UTC | newest]
Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2005-11-16 3:31 [RFC][PATCH 4/6] PCI PM: update pci_enable_wake() Adam Belay
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox