lkml.org 
[lkml]   [2012]   [Mar]   [6]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
    Patch in this message
    /
    From
    Subject[PATCH 15/23] PCI: add pci_stop_and_remove_bus()
    Date
    it supports both pci root bus and pci bus under pci bridge.

    Signed-off-by: Yinghai Lu <yinghai@kernel.org>
    ---
    drivers/pci/remove.c | 27 +++++++++++++++++++++++++++
    include/linux/pci.h | 1 +
    2 files changed, 28 insertions(+), 0 deletions(-)

    diff --git a/drivers/pci/remove.c b/drivers/pci/remove.c
    index 62c348c..13a1555 100644
    --- a/drivers/pci/remove.c
    +++ b/drivers/pci/remove.c
    @@ -172,6 +172,33 @@ void pci_stop_bus_device(struct pci_dev *dev)
    pci_stop_dev(dev);
    }

    +static void pci_stop_host_bridge(struct pci_host_bridge *bridge)
    +{
    + device_unregister(&bridge->dev);
    +}
    +/*
    + * it will support pci root bus too, in that case we need
    + * stop and remove host bridge
    + */
    +void pci_stop_and_remove_bus(struct pci_bus *bus)
    +{
    + struct pci_host_bridge *host_bridge = NULL;
    +
    + pci_stop_bus_devices(bus);
    +
    + if (pci_is_root_bus(bus)) {
    + host_bridge = to_pci_host_bridge(bus->bridge);
    + pci_stop_host_bridge(host_bridge);
    + }
    +
    + __pci_remove_bus_devices(bus);
    +
    + pci_remove_bus(bus);
    +
    + if (host_bridge)
    + host_bridge->bus = NULL;
    +}
    +
    EXPORT_SYMBOL(pci_stop_and_remove_bus_device);
    EXPORT_SYMBOL(pci_stop_and_remove_behind_bridge);
    EXPORT_SYMBOL_GPL(pci_stop_bus_device);
    diff --git a/include/linux/pci.h b/include/linux/pci.h
    index 4f30cd1..3d5feda 100644
    --- a/include/linux/pci.h
    +++ b/include/linux/pci.h
    @@ -702,6 +702,7 @@ extern void pci_dev_put(struct pci_dev *dev);
    extern void pci_remove_bus(struct pci_bus *b);
    extern void __pci_remove_bus_device(struct pci_dev *dev);
    extern void pci_stop_and_remove_bus_device(struct pci_dev *dev);
    +void pci_stop_and_remove_bus(struct pci_bus *bus);
    extern void pci_stop_bus_device(struct pci_dev *dev);
    void pci_setup_cardbus(struct pci_bus *bus);
    extern void pci_sort_breadthfirst(void);
    --
    1.7.7


    \
     
     \ /
      Last update: 2012-03-06 08:19    [W:4.815 / U:0.396 seconds]
    ©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site