[PATCH 1/7]: PCI revised (2) [PATCH 16/42]: PCI: PCI Error reporting callbacks

Greg KH greg at kroah.com
Tue Nov 8 09:54:29 EST 2005


On Mon, Nov 07, 2005 at 01:54:35PM -0800, Linus Torvalds wrote:
> On Mon, 7 Nov 2005, Greg KH wrote:
> > >  enum pci_channel_state {
> > > -	pci_channel_io_normal = 0,	/* I/O channel is in normal state */
> > > -	pci_channel_io_frozen = 1,	/* I/O to channel is blocked */
> > > -	pci_channel_io_perm_failure,	/* PCI card is dead */
> > > +	pci_channel_io_normal = (__force pci_channel_state_t) 0,	/* I/O channel is in normal state */
> > > +	pci_channel_io_frozen = (__force pci_channel_state_t) 1,	/* I/O to channel is blocked */
> > > +	pci_channel_io_perm_failure = (__force pci_channel_state_t) 2,	/* PCI card is dead */
> > >  };
> > 
> > You don't have to use an enum anymore, just use a #define.
> 
> The enum works fine, though, and has less namespace pollution than a 
> #define, so sometimes an enum can be preferred.

Good point.

> > Sparse developers, I see code in the kernel that that does both 
> > (__force foo_t) and (foo_t __force).  Which one is correct?
> 
> sparse doesn't care. Whatever scans better for humans. Attributes like 
> "force" parse the same way things like "const" and "volatile" parses, and 
> while most people _tend_ to write "const int", it's not incorrect to write 
> "int const". Same with "__attribute__((force))", aka __force.

Ok, thanks for clearing this up.

greg k-h



More information about the Linuxppc64-dev mailing list