All of lore.kernel.org
 help / color / mirror / Atom feed
From: Pavel Machek <pavel@ucw.cz>
To: kernel list <linux-kernel@vger.kernel.org>,
	Andrew Morton <akpm@zip.com.au>, Greg KH <greg@kroah.com>
Subject: Cleanup PCI power states
Date: Tue, 16 Nov 2004 14:04:45 +0100	[thread overview]
Message-ID: <20041116130445.GA10085@elf.ucw.cz> (raw)

Hi!

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,

								Pavel

[amd8111e.c piece below shows exactly why this is needed; feel free to
apply it or not...]

--- clean/include/linux/pci.h	2004-10-01 00:30:30.000000000 +0200
+++ linux/include/linux/pci.h	2004-11-14 23:36:46.000000000 +0100
@@ -480,6 +480,14 @@
 #define DEVICE_COUNT_COMPATIBLE	4
 #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.
  */
--- clean/drivers/net/amd8111e.c	2004-10-01 00:30:15.000000000 +0200
+++ linux/drivers/net/amd8111e.c	2004-11-14 23:48:04.000000000 +0100
@@ -1865,17 +1865,17 @@
 		if(lp->options & OPTION_WAKE_PHY_ENABLE)
 			amd8111e_enable_link_change(lp);	
 		
-		pci_enable_wake(pci_dev, 3, 1);
-		pci_enable_wake(pci_dev, 4, 1); /* D3 cold */
+		pci_enable_wake(pci_dev, PCI_D3hot, 1);
+		pci_enable_wake(pci_dev, PCI_D3cold, 1);
 
 	}
 	else{		
-		pci_enable_wake(pci_dev, 3, 0);
-		pci_enable_wake(pci_dev, 4, 0); /* 4 == D3 cold */
+		pci_enable_wake(pci_dev, PCI_D3hot, 0);
+		pci_enable_wake(pci_dev, PCI_D3cold, 0);
 	}
 	
 	pci_save_state(pci_dev, lp->pm_state);
-	pci_set_power_state(pci_dev, 3);
+	pci_set_power_state(pci_dev, PCI_D3hot);
 
 	return 0;
 }
@@ -1887,11 +1887,11 @@
 	if (!netif_running(dev))
 		return 0;
 
-	pci_set_power_state(pci_dev, 0);
+	pci_set_power_state(pci_dev, PCI_D0);
 	pci_restore_state(pci_dev, lp->pm_state);
 
-	pci_enable_wake(pci_dev, 3, 0);
-	pci_enable_wake(pci_dev, 4, 0); /* D3 cold */
+	pci_enable_wake(pci_dev, PCI_D3hot, 0);
+	pci_enable_wake(pci_dev, PCI_D3cold, 0);
 
 	netif_device_attach(dev);
 


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

             reply	other threads:[~2004-11-16 13:06 UTC|newest]

Thread overview: 26+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2004-11-16 13:04 Pavel Machek [this message]
2004-11-16 15:56 ` Cleanup PCI power states Greg KH
2004-11-17 12:08   ` Pavel Machek
2004-11-24 23:40     ` Greg KH
2004-11-25 11:36       ` Pavel Machek
2004-12-17  0:05         ` Greg KH
2004-12-17  0:31           ` Pavel Machek
2004-12-17 16:12           ` [linux-pm] " Alan Stern
2004-12-17 16:33             ` Pavel Machek
2004-12-17 22:02         ` Greg KH
2004-12-17 23:39           ` Pavel Machek
2004-12-21 19:57             ` Greg KH
2004-12-17 23:50           ` Pavel Machek
2004-12-21 20:03             ` Greg KH
2004-12-21 23:25               ` Pavel Machek
2004-12-21 23:29                 ` Greg KH
2004-12-18  0:09           ` Pavel Machek
2004-12-21 20:04             ` Greg KH
2004-12-21 23:37               ` Pavel Machek
2004-12-22  0:41                 ` Greg KH
2004-11-25 11:39       ` Pavel Machek
2004-12-17  0:06         ` Greg KH
2004-12-17  0:34           ` Pavel Machek
2004-12-17  7:48           ` [linux-pm] " Benjamin Herrenschmidt
2004-12-17 19:22             ` Greg KH
2004-12-17 22:02         ` Greg KH

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20041116130445.GA10085@elf.ucw.cz \
    --to=pavel@ucw.cz \
    --cc=akpm@zip.com.au \
    --cc=greg@kroah.com \
    --cc=linux-kernel@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.