From: Jiang Liu <liuj97@gmail.com>
To: Bjorn Helgaas <bhelgaas@google.com>, "Rafael J . Wysocki" <rjw@sisk.pl>
Cc: Jiang Liu <jiang.liu@huawei.com>, Yinghai Lu <yinghai@kernel.org>,
Yijing Wang <wangyijing@huawei.com>, Jiang Liu <liuj97@gmail.com>,
linux-kernel@vger.kernel.org, linux-pci@vger.kernel.org,
Greg Kroah-Hartman <gregkh@linuxfoundation.org>,
ACPI Devel Maling List <linux-acpi@vger.kernel.org>,
Toshi Kani <toshi.kani@hp.com>,
Myron Stowe <myron.stowe@redhat.com>,
"Rafael J. Wysocki" <rafael.j.wysocki@intel.com>
Subject: [PATCH v8 01/13] PCI: do not check is_added flag in pci_remove_bus()
Date: Tue, 26 Feb 2013 23:25:41 +0800 [thread overview]
Message-ID: <1361892353-14786-2-git-send-email-jiang.liu@huawei.com> (raw)
In-Reply-To: <1361892353-14786-1-git-send-email-jiang.liu@huawei.com>
The is_added flag in struct pci_bus is always set after invoking
device_register() and pci_create_legacy_files(). The related code
paths are:
1) pci_create_root_bus() and pci_add_new_bus()
bus = pci_alloc_bus()
device_register(&bus->dev)
pci_create_legacy_file(bus)
2.a) pci_scan_child_bus(bus)
set is_added flag for PCI root buses
2.b) pci_bus_add_devices(bus)
set is_added flag for normal PCI buses
So pci_remove_bus() shouldn't use is_added flag to guard invoking of
pci_remove_lagecy_files() and device_unregister().
One more step further, now bus->is_added is only used to guard invoking
of pcibios_fixup_bus(), so cleaup the code.
Signed-off-by: Jiang Liu <jiang.liu@huawei.com>
Signed-off-by: Yijing Wang <wangyijing@huawei.com>
Cc: Yinghai Lu <yinghai@kernel.org>
Cc: "Rafael J. Wysocki" <rafael.j.wysocki@intel.com>
Cc: Toshi Kani <toshi.kani@hp.com>
Cc: linux-pci@vger.kernel.org
Cc: linux-kernel@vger.kernel.org
---
drivers/pci/bus.c | 11 ++---------
drivers/pci/probe.c | 3 +--
drivers/pci/remove.c | 3 ---
3 files changed, 3 insertions(+), 14 deletions(-)
diff --git a/drivers/pci/bus.c b/drivers/pci/bus.c
index 8647dc6..bdc1e8b 100644
--- a/drivers/pci/bus.c
+++ b/drivers/pci/bus.c
@@ -206,16 +206,9 @@ void pci_bus_add_devices(const struct pci_bus *bus)
list_for_each_entry(dev, &bus->devices, bus_list) {
BUG_ON(!dev->is_added);
-
child = dev->subordinate;
-
- if (!child)
- continue;
- pci_bus_add_devices(child);
-
- if (child->is_added)
- continue;
- child->is_added = 1;
+ if (child)
+ pci_bus_add_devices(child);
}
}
diff --git a/drivers/pci/probe.c b/drivers/pci/probe.c
index b494066..45c93b3 100644
--- a/drivers/pci/probe.c
+++ b/drivers/pci/probe.c
@@ -1627,8 +1627,7 @@ unsigned int pci_scan_child_bus(struct pci_bus *bus)
if (!bus->is_added) {
dev_dbg(&bus->dev, "fixups for bus\n");
pcibios_fixup_bus(bus);
- if (pci_is_root_bus(bus))
- bus->is_added = 1;
+ bus->is_added = 1;
}
for (pass=0; pass < 2; pass++)
diff --git a/drivers/pci/remove.c b/drivers/pci/remove.c
index fc38c48..66967e5 100644
--- a/drivers/pci/remove.c
+++ b/drivers/pci/remove.c
@@ -48,9 +48,6 @@ void pci_remove_bus(struct pci_bus *bus)
list_del(&bus->node);
pci_bus_release_busn_res(bus);
up_write(&pci_bus_sem);
- if (!bus->is_added)
- return;
-
pci_remove_legacy_files(bus);
device_unregister(&bus->dev);
}
--
1.7.9.5
next prev parent reply other threads:[~2013-02-26 15:25 UTC|newest]
Thread overview: 22+ messages / expand[flat|nested] mbox.gz Atom feed top
2013-02-26 15:25 [PATCH v8 00/13] Get rid of the ACPI PCI subdriver mechanism Jiang Liu
2013-02-26 15:25 ` Jiang Liu [this message]
2013-02-26 15:25 ` [PATCH v8 02/13] PCI/acpiphp: use list_for_each_entry_safe() in acpiphp_sanitize_bus() Jiang Liu
2013-02-26 15:25 ` [PATCH v8 03/13] PCI/acpiphp: don't rely on function 0 in disable_device() Jiang Liu
2013-02-26 15:25 ` [PATCH v8 04/13] ACPI/acpiphp: replace local macros with standard ACPI macros Jiang Liu
2013-02-26 15:25 ` [PATCH v8 05/13] PCI: introduce platform dependent hooks for creating/destroying PCI busses Jiang Liu
2013-02-26 15:25 ` [PATCH v8 06/13] PCI, ACPI: prepare stub functions to handle ACPI PCI (hotplug) slots Jiang Liu
2013-02-26 15:25 ` [PATCH v8 07/13] PCI, IA64: implement pcibios_{add|remove}_bus() hooks Jiang Liu
2013-02-26 15:25 ` [PATCH v8 08/13] PCI, x86: " Jiang Liu
2013-02-26 15:25 ` [PATCH v8 09/13] PCI, ACPI: handle PCI slot devices when creating/destroying PCI busses Jiang Liu
2013-02-26 15:25 ` [PATCH v8 10/13] PCI/acpiphp: do not use ACPI PCI subdriver mechanism Jiang Liu
2013-04-09 23:38 ` Bjorn Helgaas
2013-04-10 16:14 ` Jiang Liu
2013-04-10 17:07 ` Bjorn Helgaas
2013-04-11 1:50 ` Yijing Wang
2013-04-11 17:29 ` Bjorn Helgaas
2013-04-12 1:04 ` Yijing Wang
2013-02-26 15:25 ` [PATCH v8 11/13] PCI/acpiphp: use normal list to simplify implementation Jiang Liu
2013-02-26 15:25 ` [PATCH v8 12/13] PCI/acpiphp: protect acpiphp data structures from concurrent updating Jiang Liu
2013-02-26 15:25 ` [PATCH v8 13/13] PCI, ACPI: remove support of ACPI PCI subdrivers Jiang Liu
2013-02-26 19:07 ` Yinghai Lu
2013-02-27 0:42 ` Jiang Liu
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1361892353-14786-2-git-send-email-jiang.liu@huawei.com \
--to=liuj97@gmail.com \
--cc=bhelgaas@google.com \
--cc=gregkh@linuxfoundation.org \
--cc=jiang.liu@huawei.com \
--cc=linux-acpi@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-pci@vger.kernel.org \
--cc=myron.stowe@redhat.com \
--cc=rafael.j.wysocki@intel.com \
--cc=rjw@sisk.pl \
--cc=toshi.kani@hp.com \
--cc=wangyijing@huawei.com \
--cc=yinghai@kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).