diff options
Diffstat (limited to 'drivers/pci/pci-sysfs.c')
-rw-r--r-- | drivers/pci/pci-sysfs.c | 36 |
1 files changed, 36 insertions, 0 deletions
diff --git a/drivers/pci/pci-sysfs.c b/drivers/pci/pci-sysfs.c index c690abc0e5b8..7bcf12adced7 100644 --- a/drivers/pci/pci-sysfs.c +++ b/drivers/pci/pci-sysfs.c | |||
@@ -108,6 +108,40 @@ static ssize_t local_cpulist_show(struct device *dev, | |||
108 | return len; | 108 | return len; |
109 | } | 109 | } |
110 | 110 | ||
111 | /* | ||
112 | * PCI Bus Class Devices | ||
113 | */ | ||
114 | static ssize_t pci_bus_show_cpuaffinity(struct device *dev, | ||
115 | int type, | ||
116 | struct device_attribute *attr, | ||
117 | char *buf) | ||
118 | { | ||
119 | int ret; | ||
120 | const struct cpumask *cpumask; | ||
121 | |||
122 | cpumask = cpumask_of_pcibus(to_pci_bus(dev)); | ||
123 | ret = type ? | ||
124 | cpulist_scnprintf(buf, PAGE_SIZE-2, cpumask) : | ||
125 | cpumask_scnprintf(buf, PAGE_SIZE-2, cpumask); | ||
126 | buf[ret++] = '\n'; | ||
127 | buf[ret] = '\0'; | ||
128 | return ret; | ||
129 | } | ||
130 | |||
131 | static inline ssize_t pci_bus_show_cpumaskaffinity(struct device *dev, | ||
132 | struct device_attribute *attr, | ||
133 | char *buf) | ||
134 | { | ||
135 | return pci_bus_show_cpuaffinity(dev, 0, attr, buf); | ||
136 | } | ||
137 | |||
138 | static inline ssize_t pci_bus_show_cpulistaffinity(struct device *dev, | ||
139 | struct device_attribute *attr, | ||
140 | char *buf) | ||
141 | { | ||
142 | return pci_bus_show_cpuaffinity(dev, 1, attr, buf); | ||
143 | } | ||
144 | |||
111 | /* show resources */ | 145 | /* show resources */ |
112 | static ssize_t | 146 | static ssize_t |
113 | resource_show(struct device * dev, struct device_attribute *attr, char * buf) | 147 | resource_show(struct device * dev, struct device_attribute *attr, char * buf) |
@@ -370,6 +404,8 @@ struct device_attribute pcibus_dev_attrs[] = { | |||
370 | #ifdef CONFIG_HOTPLUG | 404 | #ifdef CONFIG_HOTPLUG |
371 | __ATTR(rescan, (S_IWUSR|S_IWGRP), NULL, dev_bus_rescan_store), | 405 | __ATTR(rescan, (S_IWUSR|S_IWGRP), NULL, dev_bus_rescan_store), |
372 | #endif | 406 | #endif |
407 | __ATTR(cpuaffinity, S_IRUGO, pci_bus_show_cpumaskaffinity, NULL), | ||
408 | __ATTR(cpulistaffinity, S_IRUGO, pci_bus_show_cpulistaffinity, NULL), | ||
373 | __ATTR_NULL, | 409 | __ATTR_NULL, |
374 | }; | 410 | }; |
375 | 411 | ||