Re: [patch 2.5.31] transparent PCI-to-PCI bridges

Ivan Kokshaysky
2002-08-28T00:53:54Z

On Mon, Aug 26, 2002 at 10:42:34AM -0700, Linus Torvalds wrote:
> Please don't do it like this: I hate code that changes standard PCI data
> structure meaning (in this case the "class" thing) behind peoples back..

Fairly speaking, I wasn't happy about that either - that's why
I tried to change only a single bit in the first patch.
Note that this stuff was intended for 2.4 in the first place :-)

> So instead, I would suggest that you add a single-bit "transparent" field
> to the PCI structure, and initialize it to "(class & 0xff) == 1" when
> initializing the device data. Then, any fixup can just set the transparent
> bit to 1.
>
> That would make the code more robust, and more readable in my opionion.
>
> Ok?

Agreed.
I would even go further and add a "quirks" field to the struct
pci_dev (probably 16 bits would be enough). Thus we can define
specific bits for common PCI bugs - not only QUIRK_TRANSPARENT_BRIDGE
but also things like QUIRK_BROKEN_MWI or even
QUIRK_SOME_COMMON_PCI_IDE_BUG and so on. This would allow generic code
to check a single bit instead of looking through several
vendor/device ID lists.

Thoughts?

Ivan.