From: Yijing Wang <wangyijing@huawei.com>
To: Bjorn Helgaas <bhelgaas@google.com>
Cc: <linux-kernel@vger.kernel.org>, <linux-pci@vger.kernel.org>,
Yijing Wang <wangyijing@huawei.com>,
Hanjun Guo <guohanjun@huawei.com>,
Oliver Neukum <oneukum@suse.de>,
Gu Zheng <guz.fnst@cn.fujitsu.com>
Subject: [PATCH part1 v6 7/7] PCI: pciehp: Don't enable/disable slot on resume unless status changed
Date: Wed, 12 Feb 2014 10:52:53 +0800 [thread overview]
Message-ID: <1392173573-59844-8-git-send-email-wangyijing@huawei.com> (raw)
In-Reply-To: <1392173573-59844-1-git-send-email-wangyijing@huawei.com>
Currently pciehp_resume() always enables the slot if it is occupied. But
often the slot was already occupied before the suspend, so we complain like
this:
pciehp 0000:00:1c.1:pcie04: Device 0000:03:00.0 already exists at 0000:03:00, cannot hot-add
pciehp 0000:00:1c.1:pcie04: Cannot add device at 0000:03:00
This patch only enables the slot if it was empty before the suspend and is
now occupied, i.e., a card was inserted while suspended.
Similarly, we only disable the slot if a card was removed while suspended.
If it was already empty before the suspend, we don't need to do anything.
[bhelgaas: changelog]
Tested-by: Paul Bolle <pebolle@tiscali.nl>
Signed-off-by: Yijing Wang <wangyijing@huawei.com>
Signed-off-by: Bjorn Helgaas <bhelgaas@google.com>
Cc: Oliver Neukum <oneukum@suse.de>
Cc: Gu Zheng <guz.fnst@cn.fujitsu.com>
---
drivers/pci/hotplug/pciehp_core.c | 10 +++++++---
1 files changed, 7 insertions(+), 3 deletions(-)
diff --git a/drivers/pci/hotplug/pciehp_core.c b/drivers/pci/hotplug/pciehp_core.c
index 53b58de..551137f 100644
--- a/drivers/pci/hotplug/pciehp_core.c
+++ b/drivers/pci/hotplug/pciehp_core.c
@@ -317,6 +317,7 @@ static int pciehp_resume (struct pcie_device *dev)
{
struct controller *ctrl;
struct slot *slot;
+ struct pci_bus *pbus = dev->port->subordinate;
u8 status;
ctrl = get_service_data(dev);
@@ -328,10 +329,13 @@ static int pciehp_resume (struct pcie_device *dev)
/* Check if slot is occupied */
pciehp_get_adapter_status(slot, &status);
- if (status)
- pciehp_enable_slot(slot);
- else
+ if (status) {
+ if (list_empty(&pbus->devices))
+ pciehp_enable_slot(slot);
+ } else if (!list_empty(&pbus->devices)) {
pciehp_disable_slot(slot);
+ }
+
return 0;
}
#endif /* PM */
--
1.7.1
next prev parent reply other threads:[~2014-02-12 2:55 UTC|newest]
Thread overview: 13+ messages / expand[flat|nested] mbox.gz Atom feed top
2014-02-12 2:52 [PATCH part1 v6 0/7] Introduce PCIe Device Serial Number capability support Yijing Wang
2014-02-12 2:52 ` [PATCH part1 v6 1/7] PCI: rework pci_find_next_ext_capability() Yijing Wang
2014-02-12 2:52 ` [PATCH part1 v6 2/7] PCI: introduce pci_bus_find_ext_capability() Yijing Wang
2014-02-12 2:52 ` [PATCH part1 v6 3/7] PCI: Add support for Device Serial Number capability Yijing Wang
2014-02-12 2:52 ` [PATCH part1 v6 4/7] PCI: Introduce pci_serial_number_changed() Yijing Wang
2014-02-12 7:26 ` Gu Zheng
2014-02-12 7:57 ` Yijing Wang
2014-02-12 2:52 ` [PATCH part1 v6 5/7] PCI: Add pci_dummy_ops to isolate pci device temporarily Yijing Wang
2014-02-12 7:46 ` Gu Zheng
2014-02-12 7:59 ` Yijing Wang
2014-02-12 2:52 ` [PATCH part1 v6 6/7] PCI: Check pci device serial number when scan device Yijing Wang
2014-02-12 2:52 ` Yijing Wang [this message]
2014-02-17 8:52 ` [PATCH part1 v6 0/7] Introduce PCIe Device Serial Number capability support Yijing Wang
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=1392173573-59844-8-git-send-email-wangyijing@huawei.com \
--to=wangyijing@huawei.com \
--cc=bhelgaas@google.com \
--cc=guohanjun@huawei.com \
--cc=guz.fnst@cn.fujitsu.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-pci@vger.kernel.org \
--cc=oneukum@suse.de \
/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
all inboxes | Powered by JetHome®