aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/pci/slot.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/pci/slot.c')
-rw-r--r--drivers/pci/slot.c48
1 files changed, 0 insertions, 48 deletions
diff --git a/drivers/pci/slot.c b/drivers/pci/slot.c
index e0189cf7c558..659eaa0fc48f 100644
--- a/drivers/pci/slot.c
+++ b/drivers/pci/slot.c
@@ -97,50 +97,6 @@ static ssize_t cur_speed_read_file(struct pci_slot *slot, char *buf)
97 return bus_speed_read(slot->bus->cur_bus_speed, buf); 97 return bus_speed_read(slot->bus->cur_bus_speed, buf);
98} 98}
99 99
100static void remove_sysfs_files(struct pci_slot *slot)
101{
102 char func[10];
103 struct list_head *tmp;
104
105 list_for_each(tmp, &slot->bus->devices) {
106 struct pci_dev *dev = pci_dev_b(tmp);
107 if (PCI_SLOT(dev->devfn) != slot->number)
108 continue;
109 sysfs_remove_link(&dev->dev.kobj, "slot");
110
111 snprintf(func, 10, "function%d", PCI_FUNC(dev->devfn));
112 sysfs_remove_link(&slot->kobj, func);
113 }
114}
115
116static int create_sysfs_files(struct pci_slot *slot)
117{
118 int result;
119 char func[10];
120 struct list_head *tmp;
121
122 list_for_each(tmp, &slot->bus->devices) {
123 struct pci_dev *dev = pci_dev_b(tmp);
124 if (PCI_SLOT(dev->devfn) != slot->number)
125 continue;
126
127 result = sysfs_create_link(&dev->dev.kobj, &slot->kobj, "slot");
128 if (result)
129 goto fail;
130
131 snprintf(func, 10, "function%d", PCI_FUNC(dev->devfn));
132 result = sysfs_create_link(&slot->kobj, &dev->dev.kobj, func);
133 if (result)
134 goto fail;
135 }
136
137 return 0;
138
139fail:
140 remove_sysfs_files(slot);
141 return result;
142}
143
144static void pci_slot_release(struct kobject *kobj) 100static void pci_slot_release(struct kobject *kobj)
145{ 101{
146 struct pci_dev *dev; 102 struct pci_dev *dev;
@@ -153,8 +109,6 @@ static void pci_slot_release(struct kobject *kobj)
153 if (PCI_SLOT(dev->devfn) == slot->number) 109 if (PCI_SLOT(dev->devfn) == slot->number)
154 dev->slot = NULL; 110 dev->slot = NULL;
155 111
156 remove_sysfs_files(slot);
157
158 list_del(&slot->list); 112 list_del(&slot->list);
159 113
160 kfree(slot); 114 kfree(slot);
@@ -346,8 +300,6 @@ placeholder:
346 INIT_LIST_HEAD(&slot->list); 300 INIT_LIST_HEAD(&slot->list);
347 list_add(&slot->list, &parent->slots); 301 list_add(&slot->list, &parent->slots);
348 302
349 create_sysfs_files(slot);
350
351 list_for_each_entry(dev, &parent->devices, bus_list) 303 list_for_each_entry(dev, &parent->devices, bus_list)
352 if (PCI_SLOT(dev->devfn) == slot_nr) 304 if (PCI_SLOT(dev->devfn) == slot_nr)
353 dev->slot = slot; 305 dev->slot = slot;