From: Pavel Machek <pavel@suse.cz>
To: Greg KH <greg@kroah.com>
Cc: kernel list <linux-kernel@vger.kernel.org>,
Andrew Morton <akpm@zip.com.au>,
torvalds@osdl.org
Subject: Re: Cleanup PCI power states
Date: Sat, 18 Dec 2004 00:50:51 +0100 [thread overview]
Message-ID: <20041217235051.GC29084@elf.ucw.cz> (raw)
In-Reply-To: <20041217220208.GA22752@kroah.com>
Hi!
> > Okay, here it is, slightly expanded version. It actually makes use of
> > newly defined type for type-checking purposes; still no code changes.
>
> Alright, I've applied this, and it will show up in the next -mm release.
> I also fixed up pci.h for when CONFIG_PCI=N due to your changed
> functions.
>
> Now, care to send patches to fix up all of the new sparse warnings in
> the drivers/pci/* directory?
This should reduce number of warnings in pci.c. It will still warn on
comparison (because we are using __bitwise, but in fact we want
something like "this is unique but arithmetic is still ok"), but that
probably needs to be fixed in sparse.
Also killed "function does not return anything" warning.
Please apply,
Pavel
Signed-off-by: Pavel Machek <pavel@suse.cz>
--- linux.middle//drivers/pci/pci.c 2004-11-14 23:36:46.000000000 +0100
+++ linux/drivers/pci/pci.c 2004-12-18 00:47:53.000000000 +0100
@@ -248,13 +248,13 @@
u16 pmcsr;
/* bound the state we're entering */
- if (state > 3) state = 3;
+ if (state > PCI_D3hot) state = PCI_D3hot;
/* Validate current state:
* Can enter D0 from any state, but if we can only go deeper
* to sleep if we're already in a low power state
*/
- if (state > 0 && dev->current_state > state)
+ if (state != PCI_D0 && dev->current_state > state)
return -EINVAL;
else if (dev->current_state == state)
return 0; /* we're already there */
@@ -266,18 +266,18 @@
if (!pm) return -EIO;
/* check if this device supports the desired state */
- if (state == 1 || state == 2) {
+ if (state == PCI_D1 || state == PCI_D2) {
u16 pmc;
pci_read_config_word(dev,pm + PCI_PM_PMC,&pmc);
- if (state == 1 && !(pmc & PCI_PM_CAP_D1)) return -EIO;
- else if (state == 2 && !(pmc & PCI_PM_CAP_D2)) return -EIO;
+ if (state == PCI_D1 && !(pmc & PCI_PM_CAP_D1)) return -EIO;
+ else if (state == PCI_D2 && !(pmc & PCI_PM_CAP_D2)) return -EIO;
}
/* If we're in D3, force entire word to 0.
* This doesn't affect PME_Status, disables PME_En, and
* sets PowerState to 0.
*/
- if (dev->current_state >= 3)
+ if (dev->current_state >= PCI_D3hot)
pmcsr = 0;
else {
pci_read_config_word(dev, pm + PCI_PM_CTRL, &pmcsr);
@@ -290,9 +290,9 @@
/* Mandatory power management transition delays */
/* see PCI PM 1.1 5.6.1 table 18 */
- if(state == 3 || dev->current_state == 3)
+ if (state == PCI_D3hot || dev->current_state == PCI_D3hot)
msleep(10);
- else if(state == 2 || dev->current_state == 2)
+ else if (state == PCI_D2 || dev->current_state == PCI_D2)
udelay(200);
dev->current_state = state;
@@ -319,6 +319,7 @@
case 3: return PCI_D3hot;
default: BUG();
}
+ return PCI_D0;
}
EXPORT_SYMBOL(pci_choose_state);
--
People were complaining that M$ turns users into beta-testers...
...jr ghea gurz vagb qrirybcref, naq gurl frrz gb yvxr vg gung jnl!
next prev parent reply other threads:[~2004-12-17 23:53 UTC|newest]
Thread overview: 26+ messages / expand[flat|nested] mbox.gz Atom feed top
2004-11-16 13:04 Cleanup PCI power states Pavel Machek
2004-11-16 15:56 ` 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 [this message]
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=20041217235051.GC29084@elf.ucw.cz \
--to=pavel@suse.cz \
--cc=akpm@zip.com.au \
--cc=greg@kroah.com \
--cc=linux-kernel@vger.kernel.org \
--cc=torvalds@osdl.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.