[PATCH] swsusp: switch pm_message_t to struct
This adds type-checking to pm_message_t, so that people can't confuse it with int or u32. It also allows us to fix "disk yoyo" during suspend (disk spinning down/up/down). [We've tried that before; since that cpufreq problems were fixed and I've tried make allyes config and fixed resulting damage.] Signed-off-by: Pavel Machek <pavel@suse.cz> Signed-off-by: Alexander Nyberg <alexn@telia.com> Signed-off-by: Andrew Morton <akpm@osdl.org> Signed-off-by: Linus Torvalds <torvalds@osdl.org>
This commit is contained in:

committed by
Linus Torvalds

parent
829ca9a30a
commit
ca078bae81
@@ -2323,17 +2323,16 @@ static int aty128_pci_suspend(struct pci_dev *pdev, pm_message_t state)
|
||||
* can properly take care of D3 ? Also, with swsusp, we
|
||||
* know we'll be rebooted, ...
|
||||
*/
|
||||
#ifdef CONFIG_PPC_PMAC
|
||||
#ifndef CONFIG_PPC_PMAC
|
||||
/* HACK ALERT ! Once I find a proper way to say to each driver
|
||||
* individually what will happen with it's PCI slot, I'll change
|
||||
* that. On laptops, the AGP slot is just unclocked, so D2 is
|
||||
* expected, while on desktops, the card is powered off
|
||||
*/
|
||||
if (state >= 3)
|
||||
state = 2;
|
||||
return 0;
|
||||
#endif /* CONFIG_PPC_PMAC */
|
||||
|
||||
if (state != 2 || state == pdev->dev.power.power_state)
|
||||
if (state.event == pdev->dev.power.power_state.event)
|
||||
return 0;
|
||||
|
||||
printk(KERN_DEBUG "aty128fb: suspending...\n");
|
||||
@@ -2367,7 +2366,7 @@ static int aty128_pci_suspend(struct pci_dev *pdev, pm_message_t state)
|
||||
* used dummy fb ops, 2.5 need proper support for this at the
|
||||
* fbdev level
|
||||
*/
|
||||
if (state == 2)
|
||||
if (state.event != PM_EVENT_ON)
|
||||
aty128_set_suspend(par, 1);
|
||||
|
||||
release_console_sem();
|
||||
@@ -2382,12 +2381,11 @@ static int aty128_do_resume(struct pci_dev *pdev)
|
||||
struct fb_info *info = pci_get_drvdata(pdev);
|
||||
struct aty128fb_par *par = info->par;
|
||||
|
||||
if (pdev->dev.power.power_state == 0)
|
||||
if (pdev->dev.power.power_state.event == PM_EVENT_ON)
|
||||
return 0;
|
||||
|
||||
/* Wakeup chip */
|
||||
if (pdev->dev.power.power_state == 2)
|
||||
aty128_set_suspend(par, 0);
|
||||
aty128_set_suspend(par, 0);
|
||||
par->asleep = 0;
|
||||
|
||||
/* Restore display & engine */
|
||||
|
@@ -2022,17 +2022,16 @@ static int atyfb_pci_suspend(struct pci_dev *pdev, pm_message_t state)
|
||||
struct fb_info *info = pci_get_drvdata(pdev);
|
||||
struct atyfb_par *par = (struct atyfb_par *) info->par;
|
||||
|
||||
#ifdef CONFIG_PPC_PMAC
|
||||
#ifndef CONFIG_PPC_PMAC
|
||||
/* HACK ALERT ! Once I find a proper way to say to each driver
|
||||
* individually what will happen with it's PCI slot, I'll change
|
||||
* that. On laptops, the AGP slot is just unclocked, so D2 is
|
||||
* expected, while on desktops, the card is powered off
|
||||
*/
|
||||
if (state >= 3)
|
||||
state = 2;
|
||||
return 0;
|
||||
#endif /* CONFIG_PPC_PMAC */
|
||||
|
||||
if (state != 2 || state == pdev->dev.power.power_state)
|
||||
if (state.event == pdev->dev.power.power_state.event)
|
||||
return 0;
|
||||
|
||||
acquire_console_sem();
|
||||
@@ -2071,12 +2070,12 @@ static int atyfb_pci_resume(struct pci_dev *pdev)
|
||||
struct fb_info *info = pci_get_drvdata(pdev);
|
||||
struct atyfb_par *par = (struct atyfb_par *) info->par;
|
||||
|
||||
if (pdev->dev.power.power_state == 0)
|
||||
if (pdev->dev.power.power_state.event == PM_EVENT_ON)
|
||||
return 0;
|
||||
|
||||
acquire_console_sem();
|
||||
|
||||
if (pdev->dev.power.power_state == 2)
|
||||
if (pdev->dev.power.power_state.event == 2)
|
||||
aty_power_mgmt(0, par);
|
||||
par->asleep = 0;
|
||||
|
||||
|
@@ -2526,18 +2526,18 @@ int radeonfb_pci_suspend(struct pci_dev *pdev, pm_message_t state)
|
||||
struct radeonfb_info *rinfo = info->par;
|
||||
int i;
|
||||
|
||||
if (state == pdev->dev.power.power_state)
|
||||
if (state.event == pdev->dev.power.power_state.event)
|
||||
return 0;
|
||||
|
||||
printk(KERN_DEBUG "radeonfb (%s): suspending to state: %d...\n",
|
||||
pci_name(pdev), state);
|
||||
pci_name(pdev), state.event);
|
||||
|
||||
/* For suspend-to-disk, we cheat here. We don't suspend anything and
|
||||
* let fbcon continue drawing until we are all set. That shouldn't
|
||||
* really cause any problem at this point, provided that the wakeup
|
||||
* code knows that any state in memory may not match the HW
|
||||
*/
|
||||
if (state != PM_SUSPEND_MEM)
|
||||
if (state.event == PM_EVENT_FREEZE)
|
||||
goto done;
|
||||
|
||||
acquire_console_sem();
|
||||
@@ -2616,7 +2616,7 @@ int radeonfb_pci_resume(struct pci_dev *pdev)
|
||||
struct radeonfb_info *rinfo = info->par;
|
||||
int rc = 0;
|
||||
|
||||
if (pdev->dev.power.power_state == 0)
|
||||
if (pdev->dev.power.power_state.event == PM_EVENT_ON)
|
||||
return 0;
|
||||
|
||||
if (rinfo->no_schedule) {
|
||||
@@ -2626,7 +2626,7 @@ int radeonfb_pci_resume(struct pci_dev *pdev)
|
||||
acquire_console_sem();
|
||||
|
||||
printk(KERN_DEBUG "radeonfb (%s): resuming from state: %d...\n",
|
||||
pci_name(pdev), pdev->dev.power.power_state);
|
||||
pci_name(pdev), pdev->dev.power.power_state.event);
|
||||
|
||||
|
||||
if (pci_enable_device(pdev)) {
|
||||
@@ -2637,7 +2637,7 @@ int radeonfb_pci_resume(struct pci_dev *pdev)
|
||||
}
|
||||
pci_set_master(pdev);
|
||||
|
||||
if (pdev->dev.power.power_state == PM_SUSPEND_MEM) {
|
||||
if (pdev->dev.power.power_state.event == PM_EVENT_SUSPEND) {
|
||||
/* Wakeup chip. Check from config space if we were powered off
|
||||
* (todo: additionally, check CLK_PIN_CNTL too)
|
||||
*/
|
||||
|
@@ -462,9 +462,9 @@ static int chipsfb_pci_suspend(struct pci_dev *pdev, pm_message_t state)
|
||||
{
|
||||
struct fb_info *p = pci_get_drvdata(pdev);
|
||||
|
||||
if (state == pdev->dev.power.power_state)
|
||||
if (state.event == pdev->dev.power.power_state.event)
|
||||
return 0;
|
||||
if (state != PM_SUSPEND_MEM)
|
||||
if (state.event != PM_SUSPEND_MEM)
|
||||
goto done;
|
||||
|
||||
acquire_console_sem();
|
||||
|
@@ -1506,12 +1506,12 @@ static int i810fb_suspend(struct pci_dev *dev, pm_message_t state)
|
||||
struct i810fb_par *par = (struct i810fb_par *) info->par;
|
||||
int blank = 0, prev_state = par->cur_state;
|
||||
|
||||
if (state == prev_state)
|
||||
if (state.event == prev_state)
|
||||
return 0;
|
||||
|
||||
par->cur_state = state;
|
||||
par->cur_state = state.event;
|
||||
|
||||
switch (state) {
|
||||
switch (state.event) {
|
||||
case 1:
|
||||
blank = VESA_VSYNC_SUSPEND;
|
||||
break;
|
||||
|
Reference in New Issue
Block a user