public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH 1/2]: Renumber PCI error enums to start at zero
@ 2006-11-01 23:54 Linas Vepstas
  2006-11-02  0:00 ` [PATCH 2/2]: Use newly defined PCI channel offline routine Linas Vepstas
  2006-11-02  1:08 ` [PATCH 1/2 v2]: Renumber PCI error enums to start at zero Linas Vepstas
  0 siblings, 2 replies; 10+ messages in thread
From: Linas Vepstas @ 2006-11-01 23:54 UTC (permalink / raw)
  To: gregkh; +Cc: linux-kernel, linux-pci


Greg,

This is a low-prioriity patch to fix an annoying numbering mistake. 
Please apply this (and the next patch) at net convenience.

--linas

Subject: [PATCH 1/2]: Renumber PCI error enums to start at zero

Renumber the PCI error enums to start at zero for "normal/online".
This allows un-initialized pci channel state (which defaults to zero)
to be interpreted as "normal".  Add very simple routine to check
state, just in case this ever has to be fiddled with again.

Signed-off-by: Linas Vepstas <linas@linas.org>

----
 include/linux/pci.h |   11 ++++++++---
 1 file changed, 8 insertions(+), 3 deletions(-)

Index: linux-2.6.19-rc4-git3/include/linux/pci.h
===================================================================
--- linux-2.6.19-rc4-git3.orig/include/linux/pci.h	2006-11-01 16:15:49.000000000 -0600
+++ linux-2.6.19-rc4-git3/include/linux/pci.h	2006-11-01 16:20:49.000000000 -0600
@@ -86,15 +86,20 @@ 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,
+	pci_channel_io_frozen = (__force pci_channel_state_t) 1,
 
 	/* PCI card is dead */
-	pci_channel_io_perm_failure = (__force pci_channel_state_t) 3,
+	pci_channel_io_perm_failure = (__force pci_channel_state_t) 2,
 };
 
+static inline int pci_channel_offline(pci_channel_state_t state)
+{
+	return (state != pci_channel_io_normal);
+}
+
 typedef unsigned short __bitwise pci_bus_flags_t;
 enum pci_bus_flags {
 	PCI_BUS_FLAGS_NO_MSI = (__force pci_bus_flags_t) 1,

^ permalink raw reply	[flat|nested] 10+ messages in thread
* [PATCH 1/2]: Renumber PCI error enums to start at zero
@ 2006-12-12 19:55 Linas Vepstas
  2006-12-12 20:01 ` [PATCH 2/2]: Use newly defined PCI channel offline routine Linas Vepstas
  0 siblings, 1 reply; 10+ messages in thread
From: Linas Vepstas @ 2006-12-12 19:55 UTC (permalink / raw)
  To: gregkh, akpm; +Cc: linux-kernel, linux-pci


Greg, Andrew,

This patch fixes an annoying numbering mistake. 
Please apply this (and the next patch).

--linas

Subject: [PATCH 1/2]: Renumber PCI error enums to start at zero

Renumber the PCI error enums to start at zero for "normal/online".
This allows un-initialized pci channel state (which defaults to zero)
to be interpreted as "normal".  Add very simple routine to check
state, just in case this ever has to be fiddled with again.

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

----
 include/linux/pci.h |   11 ++++++++---
 1 file changed, 8 insertions(+), 3 deletions(-)

Index: linux-2.6.19-git7/include/linux/pci.h
===================================================================
--- linux-2.6.19-git7.orig/include/linux/pci.h	2006-12-05 17:11:02.000000000 -0600
+++ linux-2.6.19-git7/include/linux/pci.h	2006-12-05 17:12:12.000000000 -0600
@@ -87,13 +87,13 @@ 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,
+	pci_channel_io_frozen = (__force pci_channel_state_t) 1,
 
 	/* PCI card is dead */
-	pci_channel_io_perm_failure = (__force pci_channel_state_t) 3,
+	pci_channel_io_perm_failure = (__force pci_channel_state_t) 2,
 };
 
 typedef unsigned short __bitwise pci_bus_flags_t;
@@ -181,6 +181,11 @@ struct pci_dev {
 #define	to_pci_dev(n) container_of(n, struct pci_dev, dev)
 #define for_each_pci_dev(d) while ((d = pci_get_device(PCI_ANY_ID, PCI_ANY_ID, d)) != NULL)
 
+static inline int pci_channel_offline(struct pci_dev *pdev)
+{
+	return (pdev->error_state != pci_channel_io_normal);
+}
+
 static inline struct pci_cap_saved_state *pci_find_saved_cap(
 	struct pci_dev *pci_dev,char cap)
 {

^ permalink raw reply	[flat|nested] 10+ messages in thread
* Revised [PATCH 1/2]: define inline for test of channel error state
@ 2006-12-12 22:55 Linas Vepstas
  2006-12-13  0:29 ` [PATCH 2/2]: Use newly defined PCI channel offline routine Linas Vepstas
  0 siblings, 1 reply; 10+ messages in thread
From: Linas Vepstas @ 2006-12-12 22:55 UTC (permalink / raw)
  To: gregkh, akpm; +Cc: linux-kernel, linux-pci

Greg,

Per discussion, a revised patch. Silly me, the value was already
initialized in drivers/pci/probe.c and I'd been dragging along
a prehistoric version of the if checks.

--linas

[PATCH 1/2]: define inline for test of pci channel error state

Add very simple routine to indicate the pci channel error state.

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

----
 include/linux/pci.h |    5 +++++
 1 file changed, 5 insertions(+)

Index: linux-2.6.19-git7/include/linux/pci.h
===================================================================
--- linux-2.6.19-git7.orig/include/linux/pci.h	2006-12-06 15:53:30.000000000 -0600
+++ linux-2.6.19-git7/include/linux/pci.h	2006-12-12 15:48:04.000000000 -0600
@@ -181,6 +181,11 @@ struct pci_dev {
 #define	to_pci_dev(n) container_of(n, struct pci_dev, dev)
 #define for_each_pci_dev(d) while ((d = pci_get_device(PCI_ANY_ID, PCI_ANY_ID, d)) != NULL)
 
+static inline int pci_channel_offline(struct pci_dev *pdev)
+{
+	return (pdev->error_state != pci_channel_io_normal);
+}
+
 static inline struct pci_cap_saved_state *pci_find_saved_cap(
 	struct pci_dev *pci_dev,char cap)
 {

^ permalink raw reply	[flat|nested] 10+ messages in thread

end of thread, other threads:[~2006-12-13  0:29 UTC | newest]

Thread overview: 10+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2006-11-01 23:54 [PATCH 1/2]: Renumber PCI error enums to start at zero Linas Vepstas
2006-11-02  0:00 ` [PATCH 2/2]: Use newly defined PCI channel offline routine Linas Vepstas
2006-11-02  0:20   ` Auke Kok
2006-11-02  0:40     ` Linas Vepstas
2006-11-02  1:10   ` [PATCH 2/2 v2]: " Linas Vepstas
2006-11-02  5:13     ` Auke Kok
2006-11-02  1:08 ` [PATCH 1/2 v2]: Renumber PCI error enums to start at zero Linas Vepstas
  -- strict thread matches above, loose matches on Subject: below --
2006-12-12 19:55 [PATCH 1/2]: " Linas Vepstas
2006-12-12 20:01 ` [PATCH 2/2]: Use newly defined PCI channel offline routine Linas Vepstas
2006-12-12 21:27   ` Auke Kok
2006-12-12 22:55 Revised [PATCH 1/2]: define inline for test of channel error state Linas Vepstas
2006-12-13  0:29 ` [PATCH 2/2]: Use newly defined PCI channel offline routine Linas Vepstas

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox