diff options
-rw-r--r-- | Documentation/ABI/testing/sysfs-bus-pci | 9 | ||||
-rw-r--r-- | drivers/pci/pci-sysfs.c | 26 | ||||
-rw-r--r-- | drivers/pci/pci.h | 1 | ||||
-rw-r--r-- | drivers/pci/probe.c | 1 |
4 files changed, 37 insertions, 0 deletions
diff --git a/Documentation/ABI/testing/sysfs-bus-pci b/Documentation/ABI/testing/sysfs-bus-pci index 36bf454ba855..349ecf26ce10 100644 --- a/Documentation/ABI/testing/sysfs-bus-pci +++ b/Documentation/ABI/testing/sysfs-bus-pci | |||
@@ -74,6 +74,15 @@ Description: | |||
74 | hot-remove the PCI device and any of its children. | 74 | hot-remove the PCI device and any of its children. |
75 | Depends on CONFIG_HOTPLUG. | 75 | Depends on CONFIG_HOTPLUG. |
76 | 76 | ||
77 | What: /sys/bus/pci/devices/.../pci_bus/.../rescan | ||
78 | Date: May 2011 | ||
79 | Contact: Linux PCI developers <linux-pci@vger.kernel.org> | ||
80 | Description: | ||
81 | Writing a non-zero value to this attribute will | ||
82 | force a rescan of the bus and all child buses, | ||
83 | and re-discover devices removed earlier from this | ||
84 | part of the device tree. Depends on CONFIG_HOTPLUG. | ||
85 | |||
77 | What: /sys/bus/pci/devices/.../rescan | 86 | What: /sys/bus/pci/devices/.../rescan |
78 | Date: January 2009 | 87 | Date: January 2009 |
79 | Contact: Linux PCI developers <linux-pci@vger.kernel.org> | 88 | Contact: Linux PCI developers <linux-pci@vger.kernel.org> |
diff --git a/drivers/pci/pci-sysfs.c b/drivers/pci/pci-sysfs.c index f8deb3e380a2..c690abc0e5b8 100644 --- a/drivers/pci/pci-sysfs.c +++ b/drivers/pci/pci-sysfs.c | |||
@@ -318,6 +318,25 @@ remove_store(struct device *dev, struct device_attribute *dummy, | |||
318 | count = ret; | 318 | count = ret; |
319 | return count; | 319 | return count; |
320 | } | 320 | } |
321 | |||
322 | static ssize_t | ||
323 | dev_bus_rescan_store(struct device *dev, struct device_attribute *attr, | ||
324 | const char *buf, size_t count) | ||
325 | { | ||
326 | unsigned long val; | ||
327 | struct pci_bus *bus = to_pci_bus(dev); | ||
328 | |||
329 | if (strict_strtoul(buf, 0, &val) < 0) | ||
330 | return -EINVAL; | ||
331 | |||
332 | if (val) { | ||
333 | mutex_lock(&pci_remove_rescan_mutex); | ||
334 | pci_rescan_bus(bus); | ||
335 | mutex_unlock(&pci_remove_rescan_mutex); | ||
336 | } | ||
337 | return count; | ||
338 | } | ||
339 | |||
321 | #endif | 340 | #endif |
322 | 341 | ||
323 | struct device_attribute pci_dev_attrs[] = { | 342 | struct device_attribute pci_dev_attrs[] = { |
@@ -347,6 +366,13 @@ struct device_attribute pci_dev_attrs[] = { | |||
347 | __ATTR_NULL, | 366 | __ATTR_NULL, |
348 | }; | 367 | }; |
349 | 368 | ||
369 | struct device_attribute pcibus_dev_attrs[] = { | ||
370 | #ifdef CONFIG_HOTPLUG | ||
371 | __ATTR(rescan, (S_IWUSR|S_IWGRP), NULL, dev_bus_rescan_store), | ||
372 | #endif | ||
373 | __ATTR_NULL, | ||
374 | }; | ||
375 | |||
350 | static ssize_t | 376 | static ssize_t |
351 | boot_vga_show(struct device *dev, struct device_attribute *attr, char *buf) | 377 | boot_vga_show(struct device *dev, struct device_attribute *attr, char *buf) |
352 | { | 378 | { |
diff --git a/drivers/pci/pci.h b/drivers/pci/pci.h index a6ec200fe5ee..dcf640ad8df6 100644 --- a/drivers/pci/pci.h +++ b/drivers/pci/pci.h | |||
@@ -156,6 +156,7 @@ static inline int pci_no_d1d2(struct pci_dev *dev) | |||
156 | 156 | ||
157 | } | 157 | } |
158 | extern struct device_attribute pci_dev_attrs[]; | 158 | extern struct device_attribute pci_dev_attrs[]; |
159 | extern struct device_attribute pcibus_dev_attrs[]; | ||
159 | extern struct device_attribute dev_attr_cpuaffinity; | 160 | extern struct device_attribute dev_attr_cpuaffinity; |
160 | extern struct device_attribute dev_attr_cpulistaffinity; | 161 | extern struct device_attribute dev_attr_cpulistaffinity; |
161 | #ifdef CONFIG_HOTPLUG | 162 | #ifdef CONFIG_HOTPLUG |
diff --git a/drivers/pci/probe.c b/drivers/pci/probe.c index 44cbbbaa499d..c471295cd4b9 100644 --- a/drivers/pci/probe.c +++ b/drivers/pci/probe.c | |||
@@ -95,6 +95,7 @@ static void release_pcibus_dev(struct device *dev) | |||
95 | static struct class pcibus_class = { | 95 | static struct class pcibus_class = { |
96 | .name = "pci_bus", | 96 | .name = "pci_bus", |
97 | .dev_release = &release_pcibus_dev, | 97 | .dev_release = &release_pcibus_dev, |
98 | .dev_attrs = pcibus_dev_attrs, | ||
98 | }; | 99 | }; |
99 | 100 | ||
100 | static int __init pcibus_class_init(void) | 101 | static int __init pcibus_class_init(void) |