aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/pci/probe.c
diff options
context:
space:
mode:
authorYinghai Lu <yinghai@kernel.org>2011-05-12 20:11:40 -0400
committerJesse Barnes <jbarnes@virtuousgeek.org>2011-05-21 15:17:13 -0400
commitdc2c2c9dd513dec6c17df04e8abff795e20a5271 (patch)
tree096e73fc6775edbe389c687df08f96bd85788d02 /drivers/pci/probe.c
parentb9d320fcb6259baffaeaf93a5fce252cd09333d6 (diff)
PCI/sysfs: move bus cpuaffinity to class dev_attrs
Requested by Greg KH to fix a race condition in the creating of PCI bus cpuaffinity files. Acked-by: Greg Kroah-Hartman <gregkh@suse.de> Signed-off-by: Yinghai Lu <yinghai@kernel.org> Signed-off-by: Jesse Barnes <jbarnes@virtuousgeek.org>
Diffstat (limited to 'drivers/pci/probe.c')
-rw-r--r--drivers/pci/probe.c42
1 files changed, 0 insertions, 42 deletions
diff --git a/drivers/pci/probe.c b/drivers/pci/probe.c
index c471295cd4b9..48849ffdd672 100644
--- a/drivers/pci/probe.c
+++ b/drivers/pci/probe.c
@@ -43,43 +43,6 @@ int no_pci_devices(void)
43EXPORT_SYMBOL(no_pci_devices); 43EXPORT_SYMBOL(no_pci_devices);
44 44
45/* 45/*
46 * PCI Bus Class Devices
47 */
48static ssize_t pci_bus_show_cpuaffinity(struct device *dev,
49 int type,
50 struct device_attribute *attr,
51 char *buf)
52{
53 int ret;
54 const struct cpumask *cpumask;
55
56 cpumask = cpumask_of_pcibus(to_pci_bus(dev));
57 ret = type?
58 cpulist_scnprintf(buf, PAGE_SIZE-2, cpumask) :
59 cpumask_scnprintf(buf, PAGE_SIZE-2, cpumask);
60 buf[ret++] = '\n';
61 buf[ret] = '\0';
62 return ret;
63}
64
65static ssize_t inline pci_bus_show_cpumaskaffinity(struct device *dev,
66 struct device_attribute *attr,
67 char *buf)
68{
69 return pci_bus_show_cpuaffinity(dev, 0, attr, buf);
70}
71
72static ssize_t inline pci_bus_show_cpulistaffinity(struct device *dev,
73 struct device_attribute *attr,
74 char *buf)
75{
76 return pci_bus_show_cpuaffinity(dev, 1, attr, buf);
77}
78
79DEVICE_ATTR(cpuaffinity, S_IRUGO, pci_bus_show_cpumaskaffinity, NULL);
80DEVICE_ATTR(cpulistaffinity, S_IRUGO, pci_bus_show_cpulistaffinity, NULL);
81
82/*
83 * PCI Bus Class 46 * PCI Bus Class
84 */ 47 */
85static void release_pcibus_dev(struct device *dev) 48static void release_pcibus_dev(struct device *dev)
@@ -1456,9 +1419,6 @@ struct pci_bus * pci_create_bus(struct device *parent,
1456 error = device_register(&b->dev); 1419 error = device_register(&b->dev);
1457 if (error) 1420 if (error)
1458 goto class_dev_reg_err; 1421 goto class_dev_reg_err;
1459 error = device_create_file(&b->dev, &dev_attr_cpuaffinity);
1460 if (error)
1461 goto dev_create_file_err;
1462 1422
1463 /* Create legacy_io and legacy_mem files for this bus */ 1423 /* Create legacy_io and legacy_mem files for this bus */
1464 pci_create_legacy_files(b); 1424 pci_create_legacy_files(b);
@@ -1469,8 +1429,6 @@ struct pci_bus * pci_create_bus(struct device *parent,
1469 1429
1470 return b; 1430 return b;
1471 1431
1472dev_create_file_err:
1473 device_unregister(&b->dev);
1474class_dev_reg_err: 1432class_dev_reg_err:
1475 device_unregister(dev); 1433 device_unregister(dev);
1476dev_reg_err: 1434dev_reg_err: