Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 250098
b: refs/heads/master
c: b9d320f
h: refs/heads/master
v: v3
  • Loading branch information
Yinghai Lu authored and Jesse Barnes committed May 21, 2011
1 parent e2e57a5 commit 7e67b17
Show file tree
Hide file tree
Showing 5 changed files with 38 additions and 1 deletion.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: da7822e5ad71ec9b745b412639f1e5e0ba795a20
refs/heads/master: b9d320fcb6259baffaeaf93a5fce252cd09333d6
9 changes: 9 additions & 0 deletions trunk/Documentation/ABI/testing/sysfs-bus-pci
Original file line number Diff line number Diff line change
Expand Up @@ -74,6 +74,15 @@ Description:
hot-remove the PCI device and any of its children.
Depends on CONFIG_HOTPLUG.

What: /sys/bus/pci/devices/.../pci_bus/.../rescan
Date: May 2011
Contact: Linux PCI developers <linux-pci@vger.kernel.org>
Description:
Writing a non-zero value to this attribute will
force a rescan of the bus and all child buses,
and re-discover devices removed earlier from this
part of the device tree. Depends on CONFIG_HOTPLUG.

What: /sys/bus/pci/devices/.../rescan
Date: January 2009
Contact: Linux PCI developers <linux-pci@vger.kernel.org>
Expand Down
26 changes: 26 additions & 0 deletions trunk/drivers/pci/pci-sysfs.c
Original file line number Diff line number Diff line change
Expand Up @@ -318,6 +318,25 @@ remove_store(struct device *dev, struct device_attribute *dummy,
count = ret;
return count;
}

static ssize_t
dev_bus_rescan_store(struct device *dev, struct device_attribute *attr,
const char *buf, size_t count)
{
unsigned long val;
struct pci_bus *bus = to_pci_bus(dev);

if (strict_strtoul(buf, 0, &val) < 0)
return -EINVAL;

if (val) {
mutex_lock(&pci_remove_rescan_mutex);
pci_rescan_bus(bus);
mutex_unlock(&pci_remove_rescan_mutex);
}
return count;
}

#endif

struct device_attribute pci_dev_attrs[] = {
Expand Down Expand Up @@ -347,6 +366,13 @@ struct device_attribute pci_dev_attrs[] = {
__ATTR_NULL,
};

struct device_attribute pcibus_dev_attrs[] = {
#ifdef CONFIG_HOTPLUG
__ATTR(rescan, (S_IWUSR|S_IWGRP), NULL, dev_bus_rescan_store),
#endif
__ATTR_NULL,
};

static ssize_t
boot_vga_show(struct device *dev, struct device_attribute *attr, char *buf)
{
Expand Down
1 change: 1 addition & 0 deletions trunk/drivers/pci/pci.h
Original file line number Diff line number Diff line change
Expand Up @@ -156,6 +156,7 @@ static inline int pci_no_d1d2(struct pci_dev *dev)

}
extern struct device_attribute pci_dev_attrs[];
extern struct device_attribute pcibus_dev_attrs[];
extern struct device_attribute dev_attr_cpuaffinity;
extern struct device_attribute dev_attr_cpulistaffinity;
#ifdef CONFIG_HOTPLUG
Expand Down
1 change: 1 addition & 0 deletions trunk/drivers/pci/probe.c
Original file line number Diff line number Diff line change
Expand Up @@ -95,6 +95,7 @@ static void release_pcibus_dev(struct device *dev)
static struct class pcibus_class = {
.name = "pci_bus",
.dev_release = &release_pcibus_dev,
.dev_attrs = pcibus_dev_attrs,
};

static int __init pcibus_class_init(void)
Expand Down

0 comments on commit 7e67b17

Please sign in to comment.