lkml.org 
[lkml]   [2011]   [Oct]   [17]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
Patch in this message
/
Date
From
Subject[PATCH -v4 8_2/8] PCI, sys: only create rescan under /sys/.../pci/devices/... for pci bridges

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@kernel.org>

---
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,
};


\
 
 \ /
  Last update: 2011-10-17 20:31    [W:0.056 / U:0.116 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site