mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: linas@austin.ibm.com (Linas Vepstas)
To: Greg KH <greg@kroah.com>, linux-pci@atrey.karlin.mff.cuni.cz
Cc: Andrew Morton <akpm@osdl.org>, linux-kernel@vger.kernel.org
Subject: [PATCH] Fix PCI error token awkward value
Date: Thu, 6 Jul 2006 17:01:19 -0500	[thread overview]
Message-ID: <20060706220119.GB29526@austin.ibm.com> (raw)



The pci channel state token currently has a poor choice of values;
there  are two ways of indicating that "everything's OK": 0 and 1.
This is a bit of a burden.

If a devce driver wants to check if the pci channel is in a working
or a disconnected state, the driver writer must perform checks similar
to

   if((pdev->error_state != 0) &&
      (pdev->error_state != pci_channel_io_normal)) {
         whatever();
   }

which is rather akward. The first check is needed because 
stuct pci_dev is inited to all-zeros. The scond is needed 
because the error recovery will set the state to 
pci_channel_io_normal (which is not zero).

This patch fixes this awkwardness.

Signed-off-by: Linas Vepstas <linas@austin.ibm.com>

----

 include/linux/pci.h |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

Index: linux-2.6.17-mm3/include/linux/pci.h
===================================================================
--- linux-2.6.17-mm3.orig/include/linux/pci.h	2006-06-27 11:39:16.000000000 -0500
+++ linux-2.6.17-mm3/include/linux/pci.h	2006-07-06 15:15:09.000000000 -0500
@@ -85,7 +85,7 @@ typedef unsigned int __bitwise pci_chann
 
 enum pci_channel_state {
 	/* I/O channel is in normal state */
-	pci_channel_io_normal = (__force pci_channel_state_t) 1,
+	pci_channel_io_normal = (__force pci_channel_state_t) 0,
 
 	/* I/O to channel is blocked */
 	pci_channel_io_frozen = (__force pci_channel_state_t) 2,

             reply	other threads:[~2006-07-06 22:01 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2006-07-06 22:01 Linas Vepstas [this message]
2006-07-06 22:22 ` Andrew Morton
2006-07-06 22:48   ` Linas Vepstas

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=20060706220119.GB29526@austin.ibm.com \
    --to=linas@austin.ibm.com \
    --cc=akpm@osdl.org \
    --cc=greg@kroah.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-pci@atrey.karlin.mff.cuni.cz \
    /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

all inboxes | Powered by JetHome®