Linux-PCI Archive on
 help / color / Atom feed
From: Luc Van Oostenryck <>
To: Bjorn Helgaas <>
	Luc Van Oostenryck <>
Subject: [PATCH v2 3/3] pci: update to doc to use 'pci_channel_state_t'
Date: Thu,  2 Jul 2020 18:26:51 +0200
Message-ID: <> (raw)
In-Reply-To: <>

The type used to describe the PCI channel state is a combination
of a bitwise typedef 'pci_channel_state_t' and an enumeration
of constant __force casted to this typedef: enum pci_channel_state.

It's a bit complex and quite ugly because:
* in C enums are weakly typed (they're essentially the same as 'int')
* sparse only allow to define bitwise ints, not bitwise enums.
But the idea is clearly to enforce typechecking and thus to
use 'pci_channel_state_t' everywhere.

So, update the documentation to use 'pci_chanell_state_t' and hide
'enum pci_channel_state' by showing a simplified but somehow equivalent
	typedef enum { ... } pci_channel_state_t;
which makes abstraction of the '__bitwise' which would otherwise
just bring unneeded complications here.

Signed-off-by: Luc Van Oostenryck <>
 Documentation/PCI/pci-error-recovery.rst | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/Documentation/PCI/pci-error-recovery.rst b/Documentation/PCI/pci-error-recovery.rst
index c055deec8c56..ccd713423133 100644
--- a/Documentation/PCI/pci-error-recovery.rst
+++ b/Documentation/PCI/pci-error-recovery.rst
@@ -87,11 +87,11 @@ This structure has the form::
 The possible channel states are::
-	enum pci_channel_state {
+	typedef enum {
 		pci_channel_io_normal,  /* I/O channel is in normal state */
 		pci_channel_io_frozen,  /* I/O to channel is blocked */
 		pci_channel_io_perm_failure, /* PCI card is dead */
-	};
+	} pci_channel_state_t;
 Possible return values are::

  parent reply index

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-07-02 16:26 [PATCH v2 0/3] pci: enforce usage of 'pci_channel_state_t' Luc Van Oostenryck
2020-07-02 16:26 ` [PATCH v2 1/3] pci: use 'pci_channel_state_t' instead of 'enum pci_channel_state' Luc Van Oostenryck
2020-07-02 16:26 ` [PATCH v2 2/3] pci: use anonymous 'enum' " Luc Van Oostenryck
2020-07-02 16:26 ` Luc Van Oostenryck [this message]
2020-07-07 22:17 ` [PATCH v2 0/3] pci: enforce usage of 'pci_channel_state_t' Bjorn Helgaas

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:

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

  git send-email \ \ \ \ \ \

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link

Linux-PCI Archive on

Archives are clonable:
	git clone --mirror linux-pci/git/0.git

	# If you have public-inbox 1.1+ installed, you may
	# initialize and index your mirror using the following commands:
	public-inbox-init -V2 linux-pci linux-pci/ \
	public-inbox-index linux-pci

Example config snippet for mirrors

Newsgroup available over NNTP:

AGPL code for this site: git clone