Re: [PATCH 1/2] pci: don't assign non root buses

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

 



Yinghai Lu wrote:
> Matthew Wilcox wrote:
>> On Thu, Apr 16, 2009 at 09:02:16PM -0700, Yinghai Lu wrote:
>>> Impact: cleanup
>>>
>>> it will be assigned late pci_scan_child_bus/pcibios_fixup_bus
>> Seems to me they're assigned in pci_alloc_child_bus(), not in
>> pci_scan_child_bus().  Also, pcibios_fixup_bus may adjust them, but it
>> doesn't assign them. 
> 
> right.
> 
>> This is all moot as:
>>
>>>      b->number = b->secondary = bus;
>>> -    b->resource[0] = &ioport_resource;
>>> -    b->resource[1] = &iomem_resource;
>>> +
>>> +    /* don't need assign those for non root buses */
>>> +    if (!parent) {
>>> +        b->resource[0] = &ioport_resource;
>>> +        b->resource[1] = &iomem_resource;
>>> +    }
>>>  
>> parent != NULL does *NOT* mean non-root bus.  Get your head out of
>> x86 and realise we have architectures which have pci root busses which
>> have parents.
>>
> 
> interesting.
> 
> how does lspci -tv look like ?

can you fix pci_is_root_bus?

YH

commit 79af72d716cf1bb13b175429cf181a6c4d063ee8
Author: Kenji Kaneshige <kaneshige.kenji@xxxxxxxxxxxxxx>
Date:   Fri Mar 20 14:55:55 2009 -0600

    PCI: pci_is_root_bus helper
    
    Introduce pci_is_root_bus helper function. This will help make code
    more consistent, as well as prevent incorrect assumptions (such as
    pci_bus->self == NULL on a root bus, which is not always true).
    
    Signed-off-by: Kenji Kaneshige <kaneshige.kenji@xxxxxxxxxxxxxx>
    Signed-off-by: Alex Chiang <achiang@xxxxxx>
    Signed-off-by: Jesse Barnes <jbarnes@xxxxxxxxxxxxxxxx>

diff --git a/include/linux/pci.h b/include/linux/pci.h
index 1216843..50d9438 100644
--- a/include/linux/pci.h
+++ b/include/linux/pci.h
@@ -357,6 +357,15 @@ struct pci_bus {
 #define pci_bus_b(n)   list_entry(n, struct pci_bus, node)
 #define to_pci_bus(n)  container_of(n, struct pci_bus, dev)
 
+/*
+ * Returns true if the pci bus is root (behind host-pci bridge),
+ * false otherwise
+ */
+static inline bool pci_is_root_bus(struct pci_bus *pbus)
+{
+       return !(pbus->parent);
+}
+
 #ifdef CONFIG_PCI_MSI
 static inline bool pci_dev_msi_enabled(struct pci_dev *pci_dev)
 {


--
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

[Index of Archives]     [DMA Engine]     [Linux Coverity]     [Linux USB]     [Video for Linux]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]     [Greybus]

  Powered by Linux