[linux-pm] Convert pm_message_t to struct

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hi!

Who said that doing patches is easy? I need your help now. Conversion
is pretty big job :-(.

								Pavel

--- linux/Documentation/power/devices.txt	2005-01-12 11:11:53.000000000 +0100
+++ linux-mm/Documentation/power/devices.txt	2005-01-17 13:37:39.000000000 +0100
@@ -15,7 +15,7 @@
 
 struct bus_type {
        ...
-       int             (*suspend)(struct device * dev, u32 state);
+       int             (*suspend)(struct device * dev, pm_message_t state);
        int             (*resume)(struct device * dev);
 };
 
--- linux/drivers/base/power/resume.c	2005-01-12 12:07:05.000000000 +0100
+++ linux-mm/drivers/base/power/resume.c	2005-01-17 13:50:43.000000000 +0100
@@ -41,7 +41,7 @@
 		list_add_tail(entry, &dpm_active);
 
 		up(&dpm_list_sem);
-		if (!dev->power.prev_state)
+		if (!dev->power.prev_state.event)
 			resume_device(dev);
 		down(&dpm_list_sem);
 		put_device(dev);
--- linux/drivers/base/power/runtime.c	2005-01-12 10:57:23.000000000 +0100
+++ linux-mm/drivers/base/power/runtime.c	2005-01-17 13:51:31.000000000 +0100
@@ -13,7 +13,7 @@
 static void runtime_resume(struct device * dev)
 {
 	dev_dbg(dev, "resuming\n");
-	if (dev->power.power_state == PMSG_ON)
+	if (!dev->power.power_state.event)
 		return;
 	if (!resume_device(dev))
 		dev->power.power_state = PMSG_ON;
@@ -49,10 +49,10 @@
 	int error = 0;
 
 	down(&dpm_sem);
-	if (dev->power.power_state == state)
+	if (dev->power.power_state.event == state.event)
 		goto Done;
 
-	if (dev->power.power_state != PMSG_ON)
+	if (dev->power.power_state.event)
 		runtime_resume(dev);
 
 	if (!(error = suspend_device(dev, state)))
--- linux/drivers/base/power/suspend.c	2005-01-12 10:57:23.000000000 +0100
+++ linux-mm/drivers/base/power/suspend.c	2005-01-17 13:47:45.000000000 +0100
@@ -43,7 +43,7 @@
 
 	dev->power.prev_state = dev->power.power_state;
 
-	if (dev->bus && dev->bus->suspend && (dev->power.power_state == PMSG_ON))
+	if (dev->bus && dev->bus->suspend && (!dev->power.power_state.event))
 		error = dev->bus->suspend(dev, state);
 
 	return error;
--- linux/drivers/base/power/sysfs.c	2004-10-26 14:51:59.000000000 +0200
+++ linux-mm/drivers/base/power/sysfs.c	2005-01-17 13:54:06.000000000 +0100
@@ -26,19 +26,20 @@
 
 static ssize_t state_show(struct device * dev, char * buf)
 {
-	return sprintf(buf, "%u\n", dev->power.power_state);
+	return sprintf(buf, "%u\n", dev->power.power_state.event);
 }
 
 static ssize_t state_store(struct device * dev, const char * buf, size_t n)
 {
-	u32 state;
+	pm_message_t state;
 	char * rest;
 	int error = 0;
 
-	state = simple_strtoul(buf, &rest, 10);
+	state.event = simple_strtoul(buf, &rest, 10);
+	state.flags = PFL_RUNTIME;
 	if (*rest)
 		return -EINVAL;
-	if (state)
+	if (state.event)
 		error = dpm_runtime_suspend(dev, state);
 	else
 		dpm_runtime_resume(dev);
--- linux/drivers/char/agp/via-agp.c	2005-01-12 11:12:04.000000000 +0100
+++ linux-mm/drivers/char/agp/via-agp.c	2005-01-17 14:04:54.000000000 +0100
@@ -440,10 +440,10 @@
 
 #ifdef CONFIG_PM
 
-static int agp_via_suspend(struct pci_dev *pdev, u32 state)
+static int agp_via_suspend(struct pci_dev *pdev, pm_message_t state)
 {
 	pci_save_state (pdev);
-	pci_set_power_state (pdev, 3);
+	pci_set_power_state (pdev, PCI_D3hot);
 
 	return 0;
 }
@@ -452,7 +452,7 @@
 {
 	struct agp_bridge_data *bridge = pci_get_drvdata(pdev);
 
-	pci_set_power_state (pdev, 0);
+	pci_set_power_state (pdev, PCI_D0);
 	pci_restore_state(pdev);
 
 	if (bridge->driver == &via_agp3_driver)
--- linux/drivers/char/vt.c	2005-01-12 11:12:04.000000000 +0100
+++ linux-mm/drivers/char/vt.c	2005-01-17 14:04:13.000000000 +0100
@@ -742,12 +742,6 @@
 	    screenbuf = (unsigned short *) q;
 	    kmalloced = 1;
 	    vc_init(currcons, vc_cons[currcons].d->vc_rows, vc_cons[currcons].d->vc_cols, 1);
-
-	    if (!pm_con) {
-		    pm_con = pm_register(PM_SYS_DEV,
-					 PM_SYS_VGA,
-					 pm_con_request);
-	    }
 	}
 	return 0;
 }
--- linux/drivers/i2c/i2c-core.c	2004-12-25 15:51:18.000000000 +0100
+++ linux-mm/drivers/i2c/i2c-core.c	2005-01-17 13:56:23.000000000 +0100
@@ -530,7 +530,7 @@
 	return 1;
 }
 
-static int i2c_bus_suspend(struct device * dev, u32 state)
+static int i2c_bus_suspend(struct device * dev, pm_message_t state)
 {
 	int rc = 0;
 
--- linux/drivers/ide/ide-disk.c	2005-01-12 11:12:04.000000000 +0100
+++ linux-mm/drivers/ide/ide-disk.c	2005-01-17 13:58:27.000000000 +0100
@@ -1159,7 +1159,7 @@
 		return;
 	}
 
-	dev->bus->suspend(dev, PM_SUSPEND_STANDBY);
+	dev->bus->suspend(dev, PMSG_SUSPEND);
 }
 
 /*
--- linux/drivers/ide/ide.c	2005-01-12 11:12:04.000000000 +0100
+++ linux-mm/drivers/ide/ide.c	2005-01-17 13:57:52.000000000 +0100
@@ -1394,7 +1394,7 @@
 	rq.special = &args;
 	rq.pm = &rqpm;
 	rqpm.pm_step = ide_pm_state_start_suspend;
-	rqpm.pm_state = state;
+	rqpm.pm_state = state.event;
 
 	return ide_do_drive_cmd(drive, &rq, ide_wait);
 }
--- linux/drivers/ieee1394/nodemgr.c	2004-12-25 15:51:18.000000000 +0100
+++ linux-mm/drivers/ieee1394/nodemgr.c	2005-01-17 13:59:08.000000000 +0100
@@ -1254,7 +1254,7 @@
 
 		if (ud->device.driver &&
 		    (!ud->device.driver->suspend ||
-		      ud->device.driver->suspend(&ud->device, 0, 0)))
+		      ud->device.driver->suspend(&ud->device, PMSG_SUSPEND, 0)))
 			device_release_driver(&ud->device);
 	}
 	up_write(&ne->device.bus->subsys.rwsem);
--- linux/drivers/ieee1394/ohci1394.c	2004-12-25 15:51:18.000000000 +0100
+++ linux-mm/drivers/ieee1394/ohci1394.c	2005-01-17 13:59:44.000000000 +0100
@@ -3510,7 +3510,7 @@
 }
 
 
-static int ohci1394_pci_suspend (struct pci_dev *pdev, u32 state)
+static int ohci1394_pci_suspend (struct pci_dev *pdev, pm_message_t state)
 {
 #ifdef CONFIG_PMAC_PBOOK
 	{
--- linux/drivers/input/serio/i8042.c	2005-01-12 11:12:04.000000000 +0100
+++ linux-mm/drivers/input/serio/i8042.c	2005-01-17 14:05:24.000000000 +0100
@@ -860,7 +860,7 @@
  * Here we try to restore the original BIOS settings
  */
 
-static int i8042_suspend(struct device *dev, u32 state, u32 level)
+static int i8042_suspend(struct device *dev, pm_message_t state, u32 level)
 {
 	if (level == SUSPEND_DISABLE) {
 		del_timer_sync(&i8042_timer);
--- linux/drivers/mmc/mmc_block.c	2005-01-12 11:12:05.000000000 +0100
+++ linux-mm/drivers/mmc/mmc_block.c	2005-01-17 14:17:03.000000000 +0100
@@ -425,7 +425,7 @@
 }
 
 #ifdef CONFIG_PM
-static int mmc_blk_suspend(struct mmc_card *card, u32 state)
+static int mmc_blk_suspend(struct mmc_card *card, pm_message_t state)
 {
 	struct mmc_blk_data *md = mmc_get_drvdata(card);
 
--- linux/drivers/mmc/mmc_sysfs.c	2004-10-19 14:38:35.000000000 +0200
+++ linux-mm/drivers/mmc/mmc_sysfs.c	2005-01-17 14:05:35.000000000 +0100
@@ -74,7 +74,7 @@
 	return 0;
 }
 
-static int mmc_bus_suspend(struct device *dev, u32 state)
+static int mmc_bus_suspend(struct device *dev, pm_message_t state)
 {
 	struct mmc_driver *drv = to_mmc_driver(dev->driver);
 	struct mmc_card *card = dev_to_mmc_card(dev);
--- linux/drivers/net/8139too.c	2005-01-12 11:12:05.000000000 +0100
+++ linux-mm/drivers/net/8139too.c	2005-01-17 14:08:10.000000000 +0100
@@ -2582,7 +2582,7 @@
 
 #ifdef CONFIG_PM
 
-static int rtl8139_suspend (struct pci_dev *pdev, u32 state)
+static int rtl8139_suspend (struct pci_dev *pdev, pm_message_t state)
 {
 	struct net_device *dev = pci_get_drvdata (pdev);
 	struct rtl8139_private *tp = dev->priv;
--- linux/drivers/net/amd8111e.c	2005-01-12 11:12:05.000000000 +0100
+++ linux-mm/drivers/net/amd8111e.c	2005-01-17 14:08:23.000000000 +0100
@@ -1797,7 +1797,7 @@
 	if(!err)
 		netif_wake_queue(dev);
 }
-static int amd8111e_suspend(struct pci_dev *pci_dev, u32 state)
+static int amd8111e_suspend(struct pci_dev *pci_dev, pm_message_t state)
 {	
 	struct net_device *dev = pci_get_drvdata(pci_dev);
 	struct amd8111e_priv *lp = netdev_priv(dev);
--- linux/drivers/net/b44.c	2005-01-12 12:07:05.000000000 +0100
+++ linux-mm/drivers/net/b44.c	2005-01-17 14:07:54.000000000 +0100
@@ -1903,7 +1903,7 @@
 	}
 }
 
-static int b44_suspend(struct pci_dev *pdev, u32 state)
+static int b44_suspend(struct pci_dev *pdev, pm_message_t state)
 {
 	struct net_device *dev = pci_get_drvdata(pdev);
 	struct b44 *bp = netdev_priv(dev);
--- linux/drivers/net/eepro100.c	2005-01-12 11:22:37.000000000 +0100
+++ linux-mm/drivers/net/eepro100.c	2005-01-17 14:06:08.000000000 +0100
@@ -2271,7 +2271,7 @@
 }
 
 #ifdef CONFIG_PM
-static int eepro100_suspend(struct pci_dev *pdev, u32 state)
+static int eepro100_suspend(struct pci_dev *pdev, pm_message_t state)
 {
 	struct net_device *dev = pci_get_drvdata (pdev);
 	struct speedo_private *sp = netdev_priv(dev);
@@ -2289,7 +2289,7 @@
 	
 	/* XXX call pci_set_power_state ()? */
 	pci_disable_device(pdev);
-	pci_set_power_state (pdev, 3);
+	pci_set_power_state (pdev, PCI_D3hot);
 	return 0;
 }
 
@@ -2299,7 +2299,7 @@
 	struct speedo_private *sp = netdev_priv(dev);
 	void __iomem *ioaddr = sp->regs;
 
-	pci_set_power_state(pdev, 0);
+	pci_set_power_state(pdev, PCI_D0);
 	pci_restore_state(pdev);
 	pci_enable_device(pdev);
 	pci_set_master(pdev);
--- linux/drivers/net/irda/donauboe.c	2005-01-12 11:12:05.000000000 +0100
+++ linux-mm/drivers/net/irda/donauboe.c	2005-01-17 14:08:36.000000000 +0100
@@ -1712,7 +1712,7 @@
 }
 
 static int
-toshoboe_gotosleep (struct pci_dev *pci_dev, u32 crap)
+toshoboe_gotosleep (struct pci_dev *pci_dev, pm_message_t crap)
 {
   struct toshoboe_cb *self = (struct toshoboe_cb*)pci_get_drvdata(pci_dev);
   unsigned long flags;
--- linux/drivers/net/tg3.c	2005-01-12 11:12:05.000000000 +0100
+++ linux-mm/drivers/net/tg3.c	2005-01-17 14:07:19.000000000 +0100
@@ -8478,7 +8478,7 @@
 	}
 }
 
-static int tg3_suspend(struct pci_dev *pdev, u32 state)
+static int tg3_suspend(struct pci_dev *pdev, pm_message_t state)
 {
 	struct net_device *dev = pci_get_drvdata(pdev);
 	struct tg3 *tp = netdev_priv(dev);
@@ -8505,7 +8505,7 @@
 	spin_unlock(&tp->tx_lock);
 	spin_unlock_irq(&tp->lock);
 
-	err = tg3_set_power_state(tp, state);
+	err = tg3_set_power_state(tp, pci_choose_state(pdev, state));
 	if (err) {
 		spin_lock_irq(&tp->lock);
 		spin_lock(&tp->tx_lock);
--- linux/drivers/net/tulip/tulip_core.c	2005-01-12 11:12:05.000000000 +0100
+++ linux-mm/drivers/net/tulip/tulip_core.c	2005-01-17 14:08:54.000000000 +0100
@@ -1749,7 +1749,7 @@
 
 #ifdef CONFIG_PM
 
-static int tulip_suspend (struct pci_dev *pdev, u32 state)
+static int tulip_suspend (struct pci_dev *pdev, pm_message_t state)
 {
 	struct net_device *dev = pci_get_drvdata(pdev);
 
--- linux/drivers/net/via-rhine.c	2005-01-12 11:12:05.000000000 +0100
+++ linux-mm/drivers/net/via-rhine.c	2005-01-17 14:07:31.000000000 +0100
@@ -1937,7 +1937,7 @@
 }
 
 #ifdef CONFIG_PM
-static int rhine_suspend(struct pci_dev *pdev, u32 state)
+static int rhine_suspend(struct pci_dev *pdev, pm_message_t state)
 {
 	struct net_device *dev = pci_get_drvdata(pdev);
 	struct rhine_private *rp = netdev_priv(dev);
--- linux/drivers/pci/pci.c	2005-01-16 22:34:02.000000000 +0100
+++ linux-mm/drivers/pci/pci.c	2005-01-17 14:09:13.000000000 +0100
@@ -319,12 +319,12 @@
  * message.
  */
 
-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)
 {
 	if (!pci_find_capability(dev, PCI_CAP_ID_PM))
 		return PCI_D0;
 
-	switch (state) {
+	switch (state.event) {
 	case 0:	return PCI_D0;
 	case 2: return PCI_D2;
 	case 3: return PCI_D3hot;
--- linux/drivers/pcmcia/cs.c	2005-01-12 11:12:07.000000000 +0100
+++ linux-mm/drivers/pcmcia/cs.c	2005-01-17 14:18:39.000000000 +0100
@@ -136,7 +136,7 @@
 static int socket_resume(struct pcmcia_socket *skt);
 static int socket_suspend(struct pcmcia_socket *skt);
 
-int pcmcia_socket_dev_suspend(struct device *dev, u32 state)
+int pcmcia_socket_dev_suspend(struct device *dev, pm_message_t state)
 {
 	struct pcmcia_socket *socket;
 
--- linux/drivers/pcmcia/i82092.c	2005-01-12 11:12:07.000000000 +0100
+++ linux-mm/drivers/pcmcia/i82092.c	2005-01-17 14:17:02.000000000 +0100
@@ -42,7 +42,7 @@
 };
 MODULE_DEVICE_TABLE(pci, i82092aa_pci_ids);
 
-static int i82092aa_socket_suspend (struct pci_dev *dev, u32 state)
+static int i82092aa_socket_suspend (struct pci_dev *dev, pm_message_t state)
 {
 	return pcmcia_socket_dev_suspend(&dev->dev, state);
 }
--- linux/drivers/pcmcia/i82365.c	2005-01-12 11:12:07.000000000 +0100
+++ linux-mm/drivers/pcmcia/i82365.c	2005-01-17 14:17:03.000000000 +0100
@@ -1338,7 +1338,7 @@
 
 /*====================================================================*/
 
-static int i82365_suspend(struct device *dev, u32 state, u32 level)
+static int i82365_suspend(struct device *dev, pm_message_t state, u32 level)
 {
 	int ret = 0;
 	if (level == SUSPEND_SAVE_STATE)
--- linux/drivers/pcmcia/tcic.c	2005-01-12 11:12:07.000000000 +0100
+++ linux-mm/drivers/pcmcia/tcic.c	2005-01-17 14:21:15.000000000 +0100
@@ -369,7 +369,7 @@
 
 /*====================================================================*/
 
-static int tcic_drv_suspend(struct device *dev, u32 state, u32 level)
+static int tcic_drv_suspend(struct device *dev, pm_message_t state, u32 level)
 {
 	int ret = 0;
 	if (level == SUSPEND_SAVE_STATE)
--- linux/drivers/pcmcia/yenta_socket.c	2005-01-12 11:12:07.000000000 +0100
+++ linux-mm/drivers/pcmcia/yenta_socket.c	2005-01-17 14:14:12.000000000 +0100
@@ -1019,7 +1019,7 @@
 }
 
 
-static int yenta_dev_suspend (struct pci_dev *dev, u32 state)
+static int yenta_dev_suspend (struct pci_dev *dev, pm_message_t state)
 {
 	struct yenta_socket *socket = pci_get_drvdata(dev);
 	int ret;
--- linux/drivers/serial/8250.c	2005-01-12 11:12:07.000000000 +0100
+++ linux-mm/drivers/serial/8250.c	2005-01-17 14:16:22.000000000 +0100
@@ -2255,7 +2255,7 @@
 	return 0;
 }
 
-static int serial8250_suspend(struct device *dev, u32 state, u32 level)
+static int serial8250_suspend(struct device *dev, pm_message_t state, u32 level)
 {
 	int i;
 
--- linux/drivers/serial/8250_pci.c	2004-12-25 15:51:24.000000000 +0100
+++ linux-mm/drivers/serial/8250_pci.c	2005-01-17 14:16:38.000000000 +0100
@@ -1759,7 +1759,7 @@
 	}
 }
 
-static int pciserial_suspend_one(struct pci_dev *dev, u32 state)
+static int pciserial_suspend_one(struct pci_dev *dev, pm_message_t state)
 {
 	struct serial_private *priv = pci_get_drvdata(dev);
 
--- linux/drivers/usb/core/hcd-pci.c	2005-01-12 12:07:05.000000000 +0100
+++ linux-mm/drivers/usb/core/hcd-pci.c	2005-01-17 14:30:14.000000000 +0100
@@ -71,7 +71,7 @@
 	if (pci_enable_device (dev) < 0)
 		return -ENODEV;
 	dev->current_state = 0;
-	dev->dev.power.power_state = 0;
+	dev->dev.power.power_state.event = 0;
 	
         if (!dev->irq) {
         	dev_err (&dev->dev,
@@ -274,11 +274,12 @@
  *
  * Store this function in the HCD's struct pci_driver as suspend().
  */
-int usb_hcd_pci_suspend (struct pci_dev *dev, u32 state)
+int usb_hcd_pci_suspend (struct pci_dev *dev, pm_message_t pmsg)
 {
 	struct usb_hcd		*hcd;
 	int			retval = 0;
 	int			has_pci_pm;
+	pci_power_t		state;
 
 	hcd = pci_get_drvdata(dev);
 
@@ -287,8 +288,10 @@
 	 * PM-sensitive HCDs may already have done this.
 	 */
 	has_pci_pm = pci_find_capability(dev, PCI_CAP_ID_PM);
-	if (state > 4)
-		state = 4;
+
+	state = pci_choose_state(dev, pmsg);
+	if (state > PCI_D3cold)
+		state = PCI_D3cold;
 
 	switch (hcd->state) {
 
@@ -360,9 +363,6 @@
 		break;
 	}
 
-	/* update power_state **ONLY** to make sysfs happier */
-	if (retval == 0)
-		dev->dev.power.power_state = state;
 	return retval;
 }
 EXPORT_SYMBOL (usb_hcd_pci_suspend);
@@ -396,7 +396,7 @@
 
 	if (has_pci_pm)
 		pci_set_power_state (dev, 0);
-	dev->dev.power.power_state = 0;
+	dev->dev.power.power_state = PMSG_ON;
 	retval = request_irq (dev->irq, usb_hcd_irq, SA_SHIRQ,
 				hcd->driver->description, hcd);
 	if (retval < 0) {
--- linux/drivers/usb/core/hcd.h	2005-01-12 11:12:07.000000000 +0100
+++ linux-mm/drivers/usb/core/hcd.h	2005-01-17 14:25:39.000000000 +0100
@@ -223,7 +223,7 @@
 extern void usb_hcd_pci_remove (struct pci_dev *dev);
 
 #ifdef CONFIG_PM
-extern int usb_hcd_pci_suspend (struct pci_dev *dev, u32 state);
+extern int usb_hcd_pci_suspend (struct pci_dev *dev, pm_message_t state);
 extern int usb_hcd_pci_resume (struct pci_dev *dev);
 #endif /* CONFIG_PM */
 
--- linux/drivers/usb/core/hub.c	2005-01-12 11:12:07.000000000 +0100
+++ linux-mm/drivers/usb/core/hub.c	2005-01-17 14:23:30.000000000 +0100
@@ -1638,7 +1638,7 @@
  *
  * Returns 0 on success, else negative errno.
  */
-int usb_suspend_device(struct usb_device *udev, u32 state)
+int usb_suspend_device(struct usb_device *udev, pm_message_t state)
 {
 	int	port1, status;
 
@@ -1953,7 +1953,7 @@
 
 #else	/* !CONFIG_USB_SUSPEND */
 
-int usb_suspend_device(struct usb_device *udev, u32 state)
+int usb_suspend_device(struct usb_device *udev, pm_message_t state)
 {
 	return 0;
 }
--- linux/drivers/usb/core/usb.c	2005-01-12 11:12:07.000000000 +0100
+++ linux-mm/drivers/usb/core/usb.c	2005-01-17 14:16:56.000000000 +0100
@@ -1349,7 +1349,7 @@
 			usb_pipein (pipe) ? DMA_FROM_DEVICE : DMA_TO_DEVICE);
 }
 
-static int usb_generic_suspend(struct device *dev, u32 state)
+static int usb_generic_suspend(struct device *dev, pm_message_t state)
 {
 	struct usb_interface *intf;
 	struct usb_driver *driver;
@@ -1365,7 +1365,7 @@
 	driver = to_usb_driver(dev->driver);
 
 	/* there's only one USB suspend state */
-	if (intf->dev.power.power_state)
+	if (intf->dev.power.power_state.event)
 		return 0;
 
 	if (driver->suspend)
--- linux/drivers/usb/input/hid-core.c	2005-01-12 11:12:07.000000000 +0100
+++ linux-mm/drivers/usb/input/hid-core.c	2005-01-17 14:33:34.000000000 +0100
@@ -1850,7 +1850,7 @@
 	return 0;
 }
 
-static int hid_suspend(struct usb_interface *intf, u32 state)
+static int hid_suspend(struct usb_interface *intf, pm_message_t state)
 {
 	struct hid_device *hid = usb_get_intfdata (intf);
 
@@ -1865,7 +1865,7 @@
 	struct hid_device *hid = usb_get_intfdata (intf);
 	int status;
 
-	intf->dev.power.power_state = PM_SUSPEND_ON;
+	intf->dev.power.power_state = PMSG_ON;
 	if (hid->open)
 		status = usb_submit_urb(hid->urbin, GFP_NOIO);
 	else
--- linux/drivers/video/aty/radeon_pm.c	2004-12-25 15:51:24.000000000 +0100
+++ linux-mm/drivers/video/aty/radeon_pm.c	2005-01-17 14:35:46.000000000 +0100
@@ -13,12 +13,12 @@
  * On PowerMac, we assume any mobility chip based machine does D2
  */
 #ifdef CONFIG_PPC_PMAC
-static inline int radeon_suspend_to_d2(struct radeonfb_info *rinfo, u32 state)
+static inline int radeon_suspend_to_d2(struct radeonfb_info *rinfo, pm_message_t state)
 {
 	return rinfo->is_mobility;
 }
 #else
-static inline int radeon_suspend_to_d2(struct radeonfb_info *rinfo, u32 state)
+static inline int radeon_suspend_to_d2(struct radeonfb_info *rinfo, pm_message_t state)
 {
 	return 0;
 }
@@ -850,7 +850,7 @@
 	}
 }
 
-int radeonfb_pci_suspend(struct pci_dev *pdev, u32 state)
+int radeonfb_pci_suspend(struct pci_dev *pdev, pm_message_t state)
 {
         struct fb_info *info = pci_get_drvdata(pdev);
         struct radeonfb_info *rinfo = info->par;
@@ -861,7 +861,7 @@
 	 * know we'll be rebooted, ...
 	 */
 
-	printk(KERN_DEBUG "radeonfb: suspending to state: %d...\n", state);
+	printk(KERN_DEBUG "radeonfb: suspending to state: %d...\n", state.event);
 	
 	acquire_console_sem();
 
@@ -908,14 +908,14 @@
         struct fb_info *info = pci_get_drvdata(pdev);
         struct radeonfb_info *rinfo = info->par;
 
-	if (pdev->dev.power.power_state == 0)
+	if (!pdev->dev.power.power_state.event)
 		return 0;
 
 	acquire_console_sem();
 
 	/* Wakeup chip */
 #ifdef CONFIG_RADEON_HAS_D2
-	if (radeon_suspend_to_d2(rinfo, 0))
+	if (radeon_suspend_to_d2(rinfo, PMSG_ON))
 		radeon_set_suspend(rinfo, 0);
 #endif /* CONFIG_RADEON_HAS_D2 */
 
@@ -935,7 +935,7 @@
 
 	release_console_sem();
 
-	pdev->dev.power.power_state = 0;
+	pdev->dev.power.power_state = PMSG_ON;
 
 	printk(KERN_DEBUG "radeonfb: resumed !\n");
 
--- linux/drivers/video/aty/radeonfb.h	2004-12-25 15:51:24.000000000 +0100
+++ linux-mm/drivers/video/aty/radeonfb.h	2005-01-17 14:34:46.000000000 +0100
@@ -526,7 +526,7 @@
 /* PM Functions */
 extern void radeon_pm_disable_dynamic_mode(struct radeonfb_info *rinfo);
 extern void radeon_pm_enable_dynamic_mode(struct radeonfb_info *rinfo);
-extern int radeonfb_pci_suspend(struct pci_dev *pdev, u32 state);
+extern int radeonfb_pci_suspend(struct pci_dev *pdev, pm_message_t state);
 extern int radeonfb_pci_resume(struct pci_dev *pdev);
 
 /* Monitor probe functions */
--- linux/include/linux/device.h	2005-01-12 11:24:30.000000000 +0100
+++ linux-mm/include/linux/device.h	2005-01-17 13:44:12.000000000 +0100
@@ -111,7 +111,7 @@
 	int	(*probe)	(struct device * dev);
 	int 	(*remove)	(struct device * dev);
 	void	(*shutdown)	(struct device * dev);
-	int	(*suspend)	(struct device * dev, u32 state, u32 level);
+	int	(*suspend)	(struct device * dev, pm_message_t state, u32 level);
 	int	(*resume)	(struct device * dev, u32 level);
 };
 
--- linux/include/linux/mmc/card.h	2004-10-19 14:39:12.000000000 +0200
+++ linux-mm/include/linux/mmc/card.h	2005-01-17 14:11:16.000000000 +0100
@@ -75,7 +75,7 @@
 	struct device_driver drv;
 	int (*probe)(struct mmc_card *);
 	void (*remove)(struct mmc_card *);
-	int (*suspend)(struct mmc_card *, u32);
+	int (*suspend)(struct mmc_card *, pm_message_t);
 	int (*resume)(struct mmc_card *);
 };
 
--- linux/include/linux/pm.h	2005-01-12 11:23:41.000000000 +0100
+++ linux-mm/include/linux/pm.h	2005-01-17 13:52:40.000000000 +0100
@@ -195,7 +195,10 @@
 
 struct device;
 
-typedef u32 __bitwise pm_message_t;
+typedef struct pm_message {
+	int event;
+	int flags;
+} pm_message_t;
 
 /*
  * There are 4 important states driver can be in:
@@ -215,9 +218,16 @@
  * or something similar soon.
  */
 
-#define PMSG_FREEZE	((__force pm_message_t) 3)
-#define PMSG_SUSPEND	((__force pm_message_t) 3)
-#define PMSG_ON		((__force pm_message_t) 0)
+#define EVENT_ON 0
+#define EVENT_FREEZE 1
+#define EVENT_SUSPEND 2
+
+#define PFL_RUNTIME 1
+
+#define PMSG_FREEZE	({struct pm_message m; m.event = EVENT_FREEZE; m.flags = 0; m; })
+#define PMSG_SUSPEND	({struct pm_message m; m.event = EVENT_SUSPEND; m.flags = 0; m; })
+#define PMSG_ON		({struct pm_message m; m.event = EVENT_ON; m.flags = 0; m; })
+
 
 struct dev_pm_info {
 	pm_message_t		power_state;
--- linux/include/linux/usb.h	2005-01-12 11:12:09.000000000 +0100
+++ linux-mm/include/linux/usb.h	2005-01-17 14:22:41.000000000 +0100
@@ -547,7 +547,7 @@
 
 	int (*ioctl) (struct usb_interface *intf, unsigned int code, void *buf);
 
-	int (*suspend) (struct usb_interface *intf, u32 state);
+	int (*suspend) (struct usb_interface *intf, pm_message_t state);
 	int (*resume) (struct usb_interface *intf);
 
 	const struct usb_device_id *id_table;
@@ -966,7 +966,7 @@
 	int timeout);
 
 /* selective suspend/resume */
-extern int usb_suspend_device(struct usb_device *dev, u32 state);
+extern int usb_suspend_device(struct usb_device *dev, pm_message_t state);
 extern int usb_resume_device(struct usb_device *dev);
 
 
--- linux/include/pcmcia/ss.h	2005-01-12 11:12:09.000000000 +0100
+++ linux-mm/include/pcmcia/ss.h	2005-01-17 14:19:04.000000000 +0100
@@ -250,7 +250,7 @@
 extern struct class pcmcia_socket_class;
 
 /* socket drivers are expected to use these callbacks in their .drv struct */
-extern int pcmcia_socket_dev_suspend(struct device *dev, u32 state);
+extern int pcmcia_socket_dev_suspend(struct device *dev, pm_message_t state);
 extern int pcmcia_socket_dev_resume(struct device *dev);
 
 #endif /* _LINUX_SS_H */
--- linux/include/sound/core.h	2005-01-12 11:12:09.000000000 +0100
+++ linux-mm/include/sound/core.h	2005-01-17 14:48:10.000000000 +0100
@@ -26,6 +26,7 @@
 #include <asm/semaphore.h>		/* struct semaphore */
 #include <linux/rwsem.h>		/* struct rw_semaphore */
 #include <linux/workqueue.h>		/* struct workqueue_struct */
+#include <linux/pm.h>			/* pm_message_t */
 
 /* Typedef's */
 typedef struct timespec snd_timestamp_t;
@@ -206,18 +207,18 @@
 	wake_up(&card->power_sleep);
 }
 int snd_card_set_pm_callback(snd_card_t *card,
-			     int (*suspend)(snd_card_t *, unsigned int),
+			     int (*suspend)(snd_card_t *, pm_message_t),
 			     int (*resume)(snd_card_t *, unsigned int),
 			     void *private_data);
 int snd_card_set_dev_pm_callback(snd_card_t *card, int type,
-				 int (*suspend)(snd_card_t *, unsigned int),
+				 int (*suspend)(snd_card_t *, pm_message_t),
 				 int (*resume)(snd_card_t *, unsigned int),
 				 void *private_data);
 #define snd_card_set_isa_pm_callback(card,suspend,resume,data) \
 	snd_card_set_dev_pm_callback(card, PM_ISA_DEV, suspend, resume, data)
 #ifdef CONFIG_PCI
 #ifndef SND_PCI_PM_CALLBACKS
-int snd_card_pci_suspend(struct pci_dev *dev, u32 state);
+int snd_card_pci_suspend(struct pci_dev *dev, pm_message_t state);
 int snd_card_pci_resume(struct pci_dev *dev);
 #define SND_PCI_PM_CALLBACKS \
 	.suspend = snd_card_pci_suspend,  .resume = snd_card_pci_resume
--- linux/sound/core/init.c	2005-01-12 11:12:10.000000000 +0100
+++ linux-mm/sound/core/init.c	2005-01-17 14:51:39.000000000 +0100
@@ -719,7 +719,7 @@
  * handler and from the control API.
  */
 int snd_card_set_pm_callback(snd_card_t *card,
-			     int (*suspend)(snd_card_t *, unsigned int),
+			     int (*suspend)(snd_card_t *, pm_message_t),
 			     int (*resume)(snd_card_t *, unsigned int),
 			     void *private_data)
 {
@@ -765,7 +765,7 @@
  * from the ALSA's common PM handler and from the control API.
  */
 int snd_card_set_dev_pm_callback(snd_card_t *card, int type,
-				 int (*suspend)(snd_card_t *, unsigned int),
+				 int (*suspend)(snd_card_t *, pm_message_t),
 				 int (*resume)(snd_card_t *, unsigned int),
 				 void *private_data)
 {
@@ -778,7 +778,7 @@
 }
 
 #ifdef CONFIG_PCI
-int snd_card_pci_suspend(struct pci_dev *dev, u32 state)
+int snd_card_pci_suspend(struct pci_dev *dev, pm_message_t state)
 {
 	snd_card_t *card = pci_get_drvdata(dev);
 	int err;
--- linux/sound/pci/es1968.c	2005-01-12 11:12:10.000000000 +0100
+++ linux-mm/sound/pci/es1968.c	2005-01-17 14:39:01.000000000 +0100
@@ -2404,7 +2404,7 @@
 /*
  * PM support
  */
-static int es1968_suspend(snd_card_t *card, unsigned int state)
+static int es1968_suspend(snd_card_t *card, pm_message_t state)
 {
 	es1968_t *chip = card->pm_private_data;
 
--- linux/sound/pci/intel8x0.c	2005-01-12 11:12:10.000000000 +0100
+++ linux-mm/sound/pci/intel8x0.c	2005-01-17 14:39:25.000000000 +0100
@@ -2291,7 +2291,7 @@
 /*
  * power management
  */
-static int intel8x0_suspend(snd_card_t *card, unsigned int state)
+static int intel8x0_suspend(snd_card_t *card, pm_message_t state)
 {
 	intel8x0_t *chip = card->pm_private_data;
 	int i;
--- linux/sound/pci/maestro3.c	2005-01-12 11:12:10.000000000 +0100
+++ linux-mm/sound/pci/maestro3.c	2005-01-17 14:39:35.000000000 +0100
@@ -2385,7 +2385,7 @@
  * APM support
  */
 #ifdef CONFIG_PM
-static int m3_suspend(snd_card_t *card, unsigned int state)
+static int m3_suspend(snd_card_t *card, pm_message_t state)
 {
 	m3_t *chip = card->pm_private_data;
 	int i, index;
--- linux/sound/pci/via82xx.c	2005-01-12 11:12:10.000000000 +0100
+++ linux-mm/sound/pci/via82xx.c	2005-01-17 14:39:48.000000000 +0100
@@ -1895,7 +1895,7 @@
 /*
  * power management
  */
-static int snd_via82xx_suspend(snd_card_t *card, unsigned int state)
+static int snd_via82xx_suspend(snd_card_t *card, pm_message_t state)
 {
 	via82xx_t *chip = card->pm_private_data;
 	int i;

-- 
People were complaining that M$ turns users into beta-testers...
...jr ghea gurz vagb qrirybcref, naq gurl frrz gb yvxr vg gung jnl!

[Index of Archives]     [Linux ACPI]     [Netdev]     [Ethernet Bridging]     [Linux Wireless]     [CPU Freq]     [Kernel Newbies]     [Fedora Kernel]     [Security]     [Linux for Hams]     [Netfilter]     [Bugtraq]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux RAID]     [Linux Admin]     [Samba]

  Powered by Linux