PCI: pciehp: Don't turn slot off when hot-added device already exists
authorYijing Wang <wangyijing@huawei.com>
Wed, 12 Feb 2014 00:36:51 +0000 (17:36 -0700)
committerBjorn Helgaas <bhelgaas@google.com>
Fri, 14 Feb 2014 17:13:56 +0000 (10:13 -0700)
If we found device already exists during hot add device, we should leave
it, not turn the slot off.

Signed-off-by: Yijing Wang <wangyijing@huawei.com>
Signed-off-by: Bjorn Helgaas <bhelgaas@google.com>
drivers/pci/hotplug/pciehp_ctrl.c
drivers/pci/hotplug/pciehp_pci.c

index fec99a164d9393d63e868f22dc9041742a5f7f2a..b4a4ac150e615ac044de79c909879c52bc2692ed 100644 (file)
@@ -233,7 +233,8 @@ static int board_added(struct slot *p_slot)
        if (retval) {
                ctrl_err(ctrl, "Cannot add device at %04x:%02x:00\n",
                         pci_domain_nr(parent), parent->number);
-               goto err_exit;
+               if (retval != -EEXIST)
+                       goto err_exit;
        }
 
        pciehp_green_led_on(p_slot);
index b07d7cc2d697e8c9ce9152eaca90980e90906015..1b533060ce650778bbdc74e2a676d333c9afe7d7 100644 (file)
@@ -50,7 +50,7 @@ int pciehp_configure_device(struct slot *p_slot)
                         "at %04x:%02x:00, cannot hot-add\n", pci_name(dev),
                         pci_domain_nr(parent), parent->number);
                pci_dev_put(dev);
-               ret = -EINVAL;
+               ret = -EEXIST;
                goto out;
        }