aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/pci/probe.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/pci/probe.c')
-rw-r--r--drivers/pci/probe.c53
1 files changed, 7 insertions, 46 deletions
diff --git a/drivers/pci/probe.c b/drivers/pci/probe.c
index 12625d90f8b5..bafb3c3d4a89 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)
@@ -95,6 +58,7 @@ static void release_pcibus_dev(struct device *dev)
95static struct class pcibus_class = { 58static struct class pcibus_class = {
96 .name = "pci_bus", 59 .name = "pci_bus",
97 .dev_release = &release_pcibus_dev, 60 .dev_release = &release_pcibus_dev,
61 .dev_attrs = pcibus_dev_attrs,
98}; 62};
99 63
100static int __init pcibus_class_init(void) 64static int __init pcibus_class_init(void)
@@ -204,7 +168,7 @@ int __pci_read_base(struct pci_dev *dev, enum pci_bar_type type,
204 res->flags |= pci_calc_resource_flags(l) | IORESOURCE_SIZEALIGN; 168 res->flags |= pci_calc_resource_flags(l) | IORESOURCE_SIZEALIGN;
205 if (type == pci_bar_io) { 169 if (type == pci_bar_io) {
206 l &= PCI_BASE_ADDRESS_IO_MASK; 170 l &= PCI_BASE_ADDRESS_IO_MASK;
207 mask = PCI_BASE_ADDRESS_IO_MASK & IO_SPACE_LIMIT; 171 mask = PCI_BASE_ADDRESS_IO_MASK & (u32) IO_SPACE_LIMIT;
208 } else { 172 } else {
209 l &= PCI_BASE_ADDRESS_MEM_MASK; 173 l &= PCI_BASE_ADDRESS_MEM_MASK;
210 mask = (u32)PCI_BASE_ADDRESS_MEM_MASK; 174 mask = (u32)PCI_BASE_ADDRESS_MEM_MASK;
@@ -764,6 +728,8 @@ int __devinit pci_scan_bridge(struct pci_bus *bus, struct pci_dev *dev, int max,
764 if (pci_find_bus(pci_domain_nr(bus), max+1)) 728 if (pci_find_bus(pci_domain_nr(bus), max+1))
765 goto out; 729 goto out;
766 child = pci_add_new_bus(bus, dev, ++max); 730 child = pci_add_new_bus(bus, dev, ++max);
731 if (!child)
732 goto out;
767 buses = (buses & 0xff000000) 733 buses = (buses & 0xff000000)
768 | ((unsigned int)(child->primary) << 0) 734 | ((unsigned int)(child->primary) << 0)
769 | ((unsigned int)(child->secondary) << 8) 735 | ((unsigned int)(child->secondary) << 8)
@@ -777,7 +743,7 @@ int __devinit pci_scan_bridge(struct pci_bus *bus, struct pci_dev *dev, int max,
777 buses &= ~0xff000000; 743 buses &= ~0xff000000;
778 buses |= CARDBUS_LATENCY_TIMER << 24; 744 buses |= CARDBUS_LATENCY_TIMER << 24;
779 } 745 }
780 746
781 /* 747 /*
782 * We need to blast all three values with a single write. 748 * We need to blast all three values with a single write.
783 */ 749 */
@@ -961,8 +927,8 @@ int pci_setup_device(struct pci_dev *dev)
961 dev->class = class; 927 dev->class = class;
962 class >>= 8; 928 class >>= 8;
963 929
964 dev_dbg(&dev->dev, "found [%04x:%04x] class %06x header type %02x\n", 930 dev_printk(KERN_DEBUG, &dev->dev, "[%04x:%04x] type %d class %#08x\n",
965 dev->vendor, dev->device, class, dev->hdr_type); 931 dev->vendor, dev->device, dev->hdr_type, class);
966 932
967 /* need to have dev->class ready */ 933 /* need to have dev->class ready */
968 dev->cfg_size = pci_cfg_space_size(dev); 934 dev->cfg_size = pci_cfg_space_size(dev);
@@ -1453,9 +1419,6 @@ struct pci_bus * pci_create_bus(struct device *parent,
1453 error = device_register(&b->dev); 1419 error = device_register(&b->dev);
1454 if (error) 1420 if (error)
1455 goto class_dev_reg_err; 1421 goto class_dev_reg_err;
1456 error = device_create_file(&b->dev, &dev_attr_cpuaffinity);
1457 if (error)
1458 goto dev_create_file_err;
1459 1422
1460 /* Create legacy_io and legacy_mem files for this bus */ 1423 /* Create legacy_io and legacy_mem files for this bus */
1461 pci_create_legacy_files(b); 1424 pci_create_legacy_files(b);
@@ -1466,8 +1429,6 @@ struct pci_bus * pci_create_bus(struct device *parent,
1466 1429
1467 return b; 1430 return b;
1468 1431
1469dev_create_file_err:
1470 device_unregister(&b->dev);
1471class_dev_reg_err: 1432class_dev_reg_err:
1472 device_unregister(dev); 1433 device_unregister(dev);
1473dev_reg_err: 1434dev_reg_err: