Current code will create rescan for every pci device, that is not right. the device is already there, there is no reason to rescan it. We could have rescan for pci bridges. less confusing. Need to move rescan attr to pci dev bridge attribute group. And We should rescan bridge's secondary bus instead of primary bus. -v3: Use device_type for pci dev. -v4: Seperate pci device type change out Signed-off-by: Yinghai Lu <yinghai@xxxxxxxxxx> --- drivers/pci/pci-sysfs.c | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) Index: linux-2.6/drivers/pci/pci-sysfs.c =================================================================== --- linux-2.6.orig/drivers/pci/pci-sysfs.c +++ linux-2.6/drivers/pci/pci-sysfs.c @@ -303,12 +303,15 @@ dev_rescan_store(struct device *dev, str if (val) { mutex_lock(&pci_remove_rescan_mutex); - pci_rescan_bus(pdev->bus); + pci_rescan_bus(pdev->subordinate); mutex_unlock(&pci_remove_rescan_mutex); } return count; } +static struct device_attribute pci_dev_bridge_rescan_attr = + __ATTR(rescan, (S_IWUSR|S_IWGRP), NULL, dev_rescan_store); + static void remove_callback(struct device *dev) { struct pci_dev *pdev = to_pci_dev(dev); @@ -383,7 +386,6 @@ struct device_attribute pci_dev_attrs[] __ATTR(msi_bus, 0644, msi_bus_show, msi_bus_store), #ifdef CONFIG_HOTPLUG __ATTR(remove, (S_IWUSR|S_IWGRP), NULL, remove_store), - __ATTR(rescan, (S_IWUSR|S_IWGRP), NULL, dev_rescan_store), #endif __ATTR_NULL, }; @@ -1321,6 +1323,9 @@ static int __init pci_sysfs_init(void) late_initcall(pci_sysfs_init); static struct attribute *pci_dev_bridge_attrs[] = { +#ifdef CONFIG_HOTPLUG + &pci_dev_bridge_rescan_attr.attr, +#endif NULL, }; -- To unsubscribe from this list: send the line "unsubscribe linux-pci" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html