linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Greg KH <greg@kroah.com>
To: linux-kernel@vger.kernel.org
Subject: Re: [PATCH] PCI patches for 2.6.10
Date: Mon, 10 Jan 2005 09:20:58 -0800	[thread overview]
Message-ID: <11053776582129@kroah.com> (raw)
In-Reply-To: <11053776585@kroah.com>

ChangeSet 1.1938.447.14, 2004/12/21 16:21:25-08:00, pavel@suse.cz

[PATCH] PCI: clean up state usage in pci core

> 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.


Signed-off-by: Pavel Machek <pavel@suse.cz>
Signed-off-by: Greg Kroah-Hartman <greg@kroah.com>


 drivers/pci/pci.c |   23 ++++++++++++++---------
 1 files changed, 14 insertions(+), 9 deletions(-)


diff -Nru a/drivers/pci/pci.c b/drivers/pci/pci.c
--- a/drivers/pci/pci.c	2005-01-10 09:00:25 -08:00
+++ b/drivers/pci/pci.c	2005-01-10 09:00:25 -08:00
@@ -248,13 +248,14 @@
 	u16 pmcsr, pmc;
 
 	/* 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 */
@@ -263,7 +264,8 @@
 	pm = pci_find_capability(dev, PCI_CAP_ID_PM);
 	
 	/* abort if the device doesn't support PM capabilities */
-	if (!pm) return -EIO; 
+	if (!pm)
+		return -EIO; 
 
 	pci_read_config_word(dev,pm + PCI_PM_PMC,&pmc);
 	if ((pmc & PCI_PM_CAP_VER_MASK) != 2) {
@@ -274,16 +276,18 @@
 	}
 
 	/* check if this device supports the desired state */
-	if (state == 1 || state == 2) {
-		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 || state == PCI_D2) {
+		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);
@@ -296,9 +300,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;
 
@@ -325,6 +329,7 @@
 	case 3: return PCI_D3hot;
 	default: BUG();
 	}
+	return PCI_D0;
 }
 
 EXPORT_SYMBOL(pci_choose_state);


  reply	other threads:[~2005-01-10 17:38 UTC|newest]

Thread overview: 29+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2005-01-10 17:18 [BK PATCH] PCI patches for 2.6.10-rc2 Greg KH
2005-01-10 17:19 ` Greg KH
2005-01-10 17:20 ` [PATCH] PCI patches for 2.6.10 Greg KH
2005-01-10 17:20   ` Greg KH
2005-01-10 17:20     ` Greg KH
2005-01-10 17:20       ` Greg KH
2005-01-10 17:20         ` Greg KH
2005-01-10 17:20           ` Greg KH
2005-01-10 17:20             ` Greg KH
2005-01-10 17:20               ` Greg KH
2005-01-10 17:20                 ` Greg KH
2005-01-10 17:20                   ` Greg KH
2005-01-10 17:20                     ` Greg KH
2005-01-10 17:20                       ` Greg KH
2005-01-10 17:20                         ` Greg KH
2005-01-10 17:20                           ` Greg KH
2005-01-10 17:20                             ` Greg KH
2005-01-10 17:20                               ` Greg KH
2005-01-10 17:20                                 ` Greg KH
2005-01-10 17:20                                   ` Greg KH
2005-01-10 17:20                                     ` Greg KH [this message]
2005-01-10 17:20                                       ` Greg KH
2005-01-10 17:20                                         ` Greg KH
2005-01-10 17:20                                           ` Greg KH
2005-01-10 17:20                                             ` Greg KH
2005-01-10 17:20                                               ` Greg KH
2005-01-11 22:39   ` Matt Mackall
2005-01-11 22:44     ` Greg KH
2005-01-12 13:09       ` Domen Puncer

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=11053776582129@kroah.com \
    --to=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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).