Patchwork [4/6] pcie/slot: factor out the logic to update hotplug event status.

login
register
mail settings
Submitter Isaku Yamahata
Date Oct. 27, 2010, 10:21 a.m.
Message ID <67d0f3c8c7775d75654fb2921b7bb05976570bc6.1288174753.git.yamahata@valinux.co.jp>
Download mbox | patch
Permalink /patch/69338/
State New
Headers show

Comments

Isaku Yamahata - Oct. 27, 2010, 10:21 a.m.
This patch factors out the hot plug event logic.

Signed-off-by: Isaku Yamahata <yamahata@valinux.co.jp>
---
 hw/pcie.c |   10 ++++++++--
 1 files changed, 8 insertions(+), 2 deletions(-)

Patch

diff --git a/hw/pcie.c b/hw/pcie.c
index 37d7457..97d17fa 100644
--- a/hw/pcie.c
+++ b/hw/pcie.c
@@ -139,9 +139,8 @@  void pcie_cap_deverr_reset(PCIDevice *dev)
                                  PCI_EXP_DEVCTL_FERE | PCI_EXP_DEVCTL_URRE);
 }
 
-static void hotplug_event_notify(PCIDevice *dev)
+static void hotplug_event_update_event_status(PCIDevice *dev)
 {
-    bool prev = dev->exp.hpev_notified;
     uint32_t pos = dev->exp.exp_cap;
     uint8_t *exp_cap = dev->config + pos;
     uint16_t sltctl = pci_get_word(exp_cap + PCI_EXP_SLTCTL);
@@ -149,6 +148,13 @@  static void hotplug_event_notify(PCIDevice *dev)
 
     dev->exp.hpev_notified = (sltctl & PCI_EXP_SLTCTL_HPIE) &&
         (sltsta & sltctl & PCI_EXP_HP_EV_SUPPORTED);
+}
+
+static void hotplug_event_notify(PCIDevice *dev)
+{
+    bool prev = dev->exp.hpev_notified;
+
+    hotplug_event_update_event_status(dev);
 
     if (prev == dev->exp.hpev_notified) {
         return;