diff options
author | Yinghai Lu <yinghai@kernel.org> | 2012-01-21 05:08:25 -0500 |
---|---|---|
committer | Jesse Barnes <jbarnes@virtuousgeek.org> | 2012-02-14 11:44:54 -0500 |
commit | 78c3b329b9dd7097781cb900146e503e499cccfe (patch) | |
tree | 0e7648baae8ac6f17b34108f5793aa1e3d4f23f8 /drivers/pci/setup-res.c | |
parent | 19aa7ee432cec00b647443719eb5c055b69a5e8e (diff) |
PCI: Move pdev_sort_resources() to setup-bus.c
This allows us to move the definition of struct resource_list to
setup_bus.c and later convert resource_list to a regular list.
Suggested-by: Linus Torvalds <torvalds@linux-foundation.org>
Signed-off-by: Yinghai Lu <yinghai@kernel.org>
Signed-off-by: Jesse Barnes <jbarnes@virtuousgeek.org>
Diffstat (limited to 'drivers/pci/setup-res.c')
-rw-r--r-- | drivers/pci/setup-res.c | 47 |
1 files changed, 0 insertions, 47 deletions
diff --git a/drivers/pci/setup-res.c b/drivers/pci/setup-res.c index 241de6c2b9cd..f968185aa192 100644 --- a/drivers/pci/setup-res.c +++ b/drivers/pci/setup-res.c | |||
@@ -302,53 +302,6 @@ int pci_assign_resource(struct pci_dev *dev, int resno) | |||
302 | return ret; | 302 | return ret; |
303 | } | 303 | } |
304 | 304 | ||
305 | |||
306 | /* Sort resources by alignment */ | ||
307 | void pdev_sort_resources(struct pci_dev *dev, struct resource_list *head) | ||
308 | { | ||
309 | int i; | ||
310 | |||
311 | for (i = 0; i < PCI_NUM_RESOURCES; i++) { | ||
312 | struct resource *r; | ||
313 | struct resource_list *list, *tmp; | ||
314 | resource_size_t r_align; | ||
315 | |||
316 | r = &dev->resource[i]; | ||
317 | |||
318 | if (r->flags & IORESOURCE_PCI_FIXED) | ||
319 | continue; | ||
320 | |||
321 | if (!(r->flags) || r->parent) | ||
322 | continue; | ||
323 | |||
324 | r_align = pci_resource_alignment(dev, r); | ||
325 | if (!r_align) { | ||
326 | dev_warn(&dev->dev, "BAR %d: %pR has bogus alignment\n", | ||
327 | i, r); | ||
328 | continue; | ||
329 | } | ||
330 | for (list = head; ; list = list->next) { | ||
331 | resource_size_t align = 0; | ||
332 | struct resource_list *ln = list->next; | ||
333 | |||
334 | if (ln) | ||
335 | align = pci_resource_alignment(ln->dev, ln->res); | ||
336 | |||
337 | if (r_align > align) { | ||
338 | tmp = kmalloc(sizeof(*tmp), GFP_KERNEL); | ||
339 | if (!tmp) | ||
340 | panic("pdev_sort_resources(): " | ||
341 | "kmalloc() failed!\n"); | ||
342 | tmp->next = ln; | ||
343 | tmp->res = r; | ||
344 | tmp->dev = dev; | ||
345 | list->next = tmp; | ||
346 | break; | ||
347 | } | ||
348 | } | ||
349 | } | ||
350 | } | ||
351 | |||
352 | int pci_enable_resources(struct pci_dev *dev, int mask) | 305 | int pci_enable_resources(struct pci_dev *dev, int mask) |
353 | { | 306 | { |
354 | u16 cmd, old_cmd; | 307 | u16 cmd, old_cmd; |