diff options
author | Jiang Liu <liuj97@gmail.com> | 2013-05-25 09:48:29 -0400 |
---|---|---|
committer | Bjorn Helgaas <bhelgaas@google.com> | 2013-05-27 18:22:09 -0400 |
commit | fe830ef62ac6d8814e27b7e2f632848694b0e5c7 (patch) | |
tree | 7a75eef662b6186781efb11566f3a7aa01a7cc60 | |
parent | f722406faae2d073cc1d01063d1123c35425939e (diff) |
PCI: Introduce pci_bus_{get|put}() to manage PCI bus reference count
Introduce helper functions pci_bus_{get|put}() to manage PCI bus
reference count.
Signed-off-by: Jiang Liu <jiang.liu@huawei.com>
Signed-off-by: Yijing Wang <wangyijing@huawei.com>
Signed-off-by: Gu Zheng <guz.fnst@cn.fujitsu.com>
Signed-off-by: Bjorn Helgaas <bhelgaas@google.com>
-rw-r--r-- | drivers/pci/bus.c | 15 | ||||
-rw-r--r-- | include/linux/pci.h | 2 |
2 files changed, 17 insertions, 0 deletions
diff --git a/drivers/pci/bus.c b/drivers/pci/bus.c index 32e66a6f12d9..b1ff02ab4f13 100644 --- a/drivers/pci/bus.c +++ b/drivers/pci/bus.c | |||
@@ -283,6 +283,21 @@ void pci_walk_bus(struct pci_bus *top, int (*cb)(struct pci_dev *, void *), | |||
283 | } | 283 | } |
284 | EXPORT_SYMBOL_GPL(pci_walk_bus); | 284 | EXPORT_SYMBOL_GPL(pci_walk_bus); |
285 | 285 | ||
286 | struct pci_bus *pci_bus_get(struct pci_bus *bus) | ||
287 | { | ||
288 | if (bus) | ||
289 | get_device(&bus->dev); | ||
290 | return bus; | ||
291 | } | ||
292 | EXPORT_SYMBOL(pci_bus_get); | ||
293 | |||
294 | void pci_bus_put(struct pci_bus *bus) | ||
295 | { | ||
296 | if (bus) | ||
297 | put_device(&bus->dev); | ||
298 | } | ||
299 | EXPORT_SYMBOL(pci_bus_put); | ||
300 | |||
286 | EXPORT_SYMBOL(pci_bus_alloc_resource); | 301 | EXPORT_SYMBOL(pci_bus_alloc_resource); |
287 | EXPORT_SYMBOL_GPL(pci_bus_add_device); | 302 | EXPORT_SYMBOL_GPL(pci_bus_add_device); |
288 | EXPORT_SYMBOL(pci_bus_add_devices); | 303 | EXPORT_SYMBOL(pci_bus_add_devices); |
diff --git a/include/linux/pci.h b/include/linux/pci.h index 3a24e4ff3248..7556c590ddfd 100644 --- a/include/linux/pci.h +++ b/include/linux/pci.h | |||
@@ -1018,6 +1018,8 @@ int pci_request_selected_regions_exclusive(struct pci_dev *, int, const char *); | |||
1018 | void pci_release_selected_regions(struct pci_dev *, int); | 1018 | void pci_release_selected_regions(struct pci_dev *, int); |
1019 | 1019 | ||
1020 | /* drivers/pci/bus.c */ | 1020 | /* drivers/pci/bus.c */ |
1021 | struct pci_bus *pci_bus_get(struct pci_bus *bus); | ||
1022 | void pci_bus_put(struct pci_bus *bus); | ||
1021 | void pci_add_resource(struct list_head *resources, struct resource *res); | 1023 | void pci_add_resource(struct list_head *resources, struct resource *res); |
1022 | void pci_add_resource_offset(struct list_head *resources, struct resource *res, | 1024 | void pci_add_resource_offset(struct list_head *resources, struct resource *res, |
1023 | resource_size_t offset); | 1025 | resource_size_t offset); |