Commit d5ad622a authored by Pavel Machek's avatar Pavel Machek Committed by Linus Torvalds

[PATCH] driver model: pass pm_message_t down to pci drivers

This passes pm_message_t down to PCI drivers.  Ugly translation code can be
removed and this will allow PCI devices to do right thing during swsusp
snapshot -- like not unneccessarily blanking display.

Only obscure /sysfs code passes anything but 3 to pci_device_suspend,
anyway, so this is pretty close to a nop.
Signed-off-by: default avatarPavel Machek <pavel@suse.cz>
Signed-off-by: default avatarAndrew Morton <akpm@osdl.org>
Signed-off-by: default avatarLinus Torvalds <torvalds@osdl.org>
parent 9dbd80b7
......@@ -288,23 +288,10 @@ static int pci_device_suspend(struct device * dev, pm_message_t state)
{
struct pci_dev * pci_dev = to_pci_dev(dev);
struct pci_driver * drv = pci_dev->driver;
u32 dev_state;
int i = 0;
/* Translate PM_SUSPEND_xx states to PCI device states */
static u32 state_conversion[] = {
[PM_SUSPEND_ON] = 0,
[PM_SUSPEND_STANDBY] = 1,
[PM_SUSPEND_MEM] = 3,
[PM_SUSPEND_DISK] = 3,
};
if (state >= sizeof(state_conversion) / sizeof(state_conversion[1]))
return -EINVAL;
dev_state = state_conversion[state];
if (drv && drv->suspend)
i = drv->suspend(pci_dev, dev_state);
i = drv->suspend(pci_dev, state);
else
pci_save_state(pci_dev);
return i;
......
......@@ -667,7 +667,7 @@ struct pci_driver {
const struct pci_device_id *id_table; /* must be non-NULL for probe to be called */
int (*probe) (struct pci_dev *dev, const struct pci_device_id *id); /* New device inserted */
void (*remove) (struct pci_dev *dev); /* Device removed (NULL if not a hot-plug capable driver) */
int (*suspend) (struct pci_dev *dev, u32 state); /* Device suspended */
int (*suspend) (struct pci_dev *dev, pm_message_t state); /* Device suspended */
int (*resume) (struct pci_dev *dev); /* Device woken up */
int (*enable_wake) (struct pci_dev *dev, u32 state, int enable); /* Enable wake event */
......@@ -823,7 +823,7 @@ void pci_remove_rom(struct pci_dev *pdev);
int pci_save_state(struct pci_dev *dev);
int pci_restore_state(struct pci_dev *dev);
int pci_set_power_state(struct pci_dev *dev, pci_power_t state);
pci_power_t pci_choose_state(struct pci_dev *dev, u32 state);
pci_power_t pci_choose_state(struct pci_dev *dev, pm_message_t state);
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) */
......
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