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

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Tue, Dec 12, 2006 at 12:35:43PM -0800, Greg KH wrote:
> On Tue, Dec 12, 2006 at 01:55:24PM -0600, Linas Vepstas wrote:
> > 
> > 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.
> 
> No, as you have a specific type for this state, never test it against
> "zero".  That just defeats the whole issue of having a special type for
> this state.

Yes, well, I guess that was my initial thinking, which is why it got
coded that way. But "in real life", the value in the struct isn't
initialized (thus taking a value of zero). Its not initialized 
in deference to the traditional idea that "just saying bzero() 
should be enough".  

However, that turned the test for error into a dorky double test:
if(pdev->error_state && pdev->error_state != pci_channel_io_normal)
which struck me as lame. 

So, I'll ask: is it better to test for (state!=0 && state!=1) or,
to initialize pdev->error_state = pci_channel_io_normal; in the driver 
probe code?

--linas
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to [email protected]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

[Index of Archives]     [Kernel Newbies]     [Netfilter]     [Bugtraq]     [Photo]     [Stuff]     [Gimp]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Video 4 Linux]     [Linux for the blind]     [Linux Resources]
  Powered by Linux