On Fri, Feb 10, 2012 at 12:25 PM, Yinghai Lu <yinghai@xxxxxxxxxx> wrote: > On Fri, Feb 10, 2012 at 9:24 AM, Bjorn Helgaas <bhelgaas@xxxxxxxxxx> wrote: >> On Fri, Feb 10, 2012 at 9:20 AM, Yinghai Lu <yinghai@xxxxxxxxxx> wrote: >> >> That's exactly what I said above, isn't it? (In the paragraph >> starting "Let me try again.") > > no, not create one. make them looks like one struct with some common fields. The difference I see is that you kept the ugliness (enforcing cut-and-paste of generic members across all architectures) and threw out the possible goodness (replacing a "void *" with a "struct pci_sysdata *"). >> As I said, the reason I don't like that approach is that I don't want >> a dozen copies of first_busno, last_busno, domain, node, io_offset, >> mem_offset, etc. That information is not architecture-specific, so we >> shouldn't keep it in an architecture-specific struct. > > but you want to add hostbridge struct list and that just produce > duplicated info. You can think of it as merely being duplicated uselessly. I think of it as "putting it in the logical place and enabling its removal from the wrong places." > and search hostbridge for dev looks not good. > Now you try to: for every device or resource find root bus and then > check hostbridge list to get hostbridge and get offset. > > use sysdata pointer to get sys data like hostbridge info quickly > > i drafted one patch, and it seems not ugly with macro. please check it. I hate to say it, but I think it's ugly. It looks like a hack bolted on at the end because we were too lazy to do a nice design up front. It might be the fewest lines of code change, but I think it's much harder to read. It's much more important that code be easier to read and understand than it is to minimize code change. Bjorn -- To unsubscribe from this list: send the line "unsubscribe linux-pci" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html