Commit 1cb34166 authored by Pavel Machek's avatar Pavel Machek Committed by Greg Kroah-Hartman

[PATCH] PCI: Cleanup PCI power states

> > > > This is step 0 before adding type-safety to PCI layer... It introduces
> > > > constants and uses them to clean driver up. I'd like this to go in
> > > > now, so that I can convert drivers during 2.6.10... Please apply,

Okay, here it is, slightly expanded version. It actually makes use of
newly defined type for type-checking purposes; still no code changes.

From: Pavel Machek <pavel@ucw.cz>
Signed-off-by: default avatarGreg Kroah-Hartman <greg@kroah.com>
parent 75d1e937
...@@ -229,7 +229,7 @@ pci_find_parent_resource(const struct pci_dev *dev, struct resource *res) ...@@ -229,7 +229,7 @@ pci_find_parent_resource(const struct pci_dev *dev, struct resource *res)
/** /**
* pci_set_power_state - Set the power state of a PCI device * pci_set_power_state - Set the power state of a PCI device
* @dev: PCI device to be suspended * @dev: PCI device to be suspended
* @state: Power state we're entering * @state: PCI power state (D0, D1, D2, D3hot, D3cold) we're entering
* *
* Transition a device to a new power state, using the Power Management * Transition a device to a new power state, using the Power Management
* Capabilities in the device's config space. * Capabilities in the device's config space.
...@@ -242,7 +242,7 @@ pci_find_parent_resource(const struct pci_dev *dev, struct resource *res) ...@@ -242,7 +242,7 @@ pci_find_parent_resource(const struct pci_dev *dev, struct resource *res)
*/ */
int int
pci_set_power_state(struct pci_dev *dev, int state) pci_set_power_state(struct pci_dev *dev, pci_power_t state)
{ {
int pm; int pm;
u16 pmcsr, pmc; u16 pmcsr, pmc;
...@@ -354,7 +354,7 @@ pci_enable_device_bars(struct pci_dev *dev, int bars) ...@@ -354,7 +354,7 @@ pci_enable_device_bars(struct pci_dev *dev, int bars)
{ {
int err; int err;
pci_set_power_state(dev, 0); pci_set_power_state(dev, PCI_D0);
if ((err = pcibios_enable_device(dev, bars)) < 0) if ((err = pcibios_enable_device(dev, bars)) < 0)
return err; return err;
return 0; return 0;
...@@ -428,7 +428,7 @@ pci_disable_device(struct pci_dev *dev) ...@@ -428,7 +428,7 @@ pci_disable_device(struct pci_dev *dev)
* 0 if operation is successful. * 0 if operation is successful.
* *
*/ */
int pci_enable_wake(struct pci_dev *dev, u32 state, int enable) int pci_enable_wake(struct pci_dev *dev, pci_power_t state, int enable)
{ {
int pm; int pm;
u16 value; u16 value;
......
...@@ -480,6 +480,14 @@ enum pci_mmap_state { ...@@ -480,6 +480,14 @@ enum pci_mmap_state {
#define DEVICE_COUNT_COMPATIBLE 4 #define DEVICE_COUNT_COMPATIBLE 4
#define DEVICE_COUNT_RESOURCE 12 #define DEVICE_COUNT_RESOURCE 12
typedef int __bitwise pci_power_t;
#define PCI_D0 ((pci_power_t __force) 0)
#define PCI_D1 ((pci_power_t __force) 1)
#define PCI_D2 ((pci_power_t __force) 2)
#define PCI_D3hot ((pci_power_t __force) 3)
#define PCI_D3cold ((pci_power_t __force) 4)
/* /*
* The pci_dev structure is used to describe PCI devices. * The pci_dev structure is used to describe PCI devices.
*/ */
...@@ -508,7 +516,7 @@ struct pci_dev { ...@@ -508,7 +516,7 @@ struct pci_dev {
this if your device has broken DMA this if your device has broken DMA
or supports 64-bit transfers. */ or supports 64-bit transfers. */
u32 current_state; /* Current operating state. In ACPI-speak, pci_power_t current_state; /* Current operating state. In ACPI-speak,
this is D0-D3, D0 being fully functional, this is D0-D3, D0 being fully functional,
and D3 being off. */ and D3 being off. */
...@@ -797,8 +805,8 @@ void pci_remove_rom(struct pci_dev *pdev); ...@@ -797,8 +805,8 @@ void pci_remove_rom(struct pci_dev *pdev);
/* Power management related routines */ /* Power management related routines */
int pci_save_state(struct pci_dev *dev); int pci_save_state(struct pci_dev *dev);
int pci_restore_state(struct pci_dev *dev); int pci_restore_state(struct pci_dev *dev);
int pci_set_power_state(struct pci_dev *dev, int state); int pci_set_power_state(struct pci_dev *dev, pci_power_t state);
int pci_enable_wake(struct pci_dev *dev, u32 state, int enable); int pci_enable_wake(struct pci_dev *dev, pci_power_t state, int enable);
/* Helper functions for low-level code (drivers/pci/setup-[bus,res].c) */ /* Helper functions for low-level code (drivers/pci/setup-[bus,res].c) */
void pci_bus_assign_resources(struct pci_bus *bus); void pci_bus_assign_resources(struct pci_bus *bus);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment