diff mbox

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

Message ID 49E8E368.5010804@kernel.org (mailing list archive)
State Superseded, archived
Headers show

Commit Message

Yinghai Lu April 17, 2009, 8:15 p.m. UTC
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@jp.fujitsu.com>
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@jp.fujitsu.com>
    Signed-off-by: Alex Chiang <achiang@hp.com>
    Signed-off-by: Jesse Barnes <jbarnes@virtuousgeek.org>



--
To unsubscribe from this list: send the line "unsubscribe linux-pci" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Comments

Matthew Wilcox April 17, 2009, 8:32 p.m. UTC | #1
On Fri, Apr 17, 2009 at 01:15:36PM -0700, Yinghai Lu wrote:
> can you fix pci_is_root_bus?
> 
> +/*
> + * 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);
> +}

struct pci_bus {
        struct list_head node;          /* node in list of buses */
        struct pci_bus  *parent;        /* parent bus this bridge is on */

different 'parent' ...
Yinghai Lu April 17, 2009, 9:18 p.m. UTC | #2
Matthew Wilcox wrote:
> On Fri, Apr 17, 2009 at 01:15:36PM -0700, Yinghai Lu wrote:
>> can you fix pci_is_root_bus?
>>
>> +/*
>> + * 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);
>> +}
> 
> struct pci_bus {
>         struct list_head node;          /* node in list of buses */
>         struct pci_bus  *parent;        /* parent bus this bridge is on */
> 
> different 'parent' ...
> 
ok, I get it.
it seems pci_create_bus is only for creating root bus

YH
--
To unsubscribe from this list: send the line "unsubscribe linux-pci" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
diff mbox

Patch

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