pci.c (6cbf82148ff286ec22a55be6836c3a5bffc489c1) pci.c (89a74ecccd1f78e51faf6287e5c0e93a92ac096e)
1/*
2 * PCI Bus Services, see include/linux/pci.h for further explanation.
3 *
4 * Copyright 1993 -- 1997 Drew Eckhardt, Frederic Potter,
5 * David Mosberger-Tang
6 *
7 * Copyright 1997 -- 2000 Martin Mares <mj@ucw.cz>
8 */

--- 372 unchanged lines hidden (view full) ---

381 * region of parent bus the given region is contained in or where
382 * it should be allocated from.
383 */
384struct resource *
385pci_find_parent_resource(const struct pci_dev *dev, struct resource *res)
386{
387 const struct pci_bus *bus = dev->bus;
388 int i;
1/*
2 * PCI Bus Services, see include/linux/pci.h for further explanation.
3 *
4 * Copyright 1993 -- 1997 Drew Eckhardt, Frederic Potter,
5 * David Mosberger-Tang
6 *
7 * Copyright 1997 -- 2000 Martin Mares <mj@ucw.cz>
8 */

--- 372 unchanged lines hidden (view full) ---

381 * region of parent bus the given region is contained in or where
382 * it should be allocated from.
383 */
384struct resource *
385pci_find_parent_resource(const struct pci_dev *dev, struct resource *res)
386{
387 const struct pci_bus *bus = dev->bus;
388 int i;
389 struct resource *best = NULL;
389 struct resource *best = NULL, *r;
390
390
391 for(i = 0; i < PCI_BUS_NUM_RESOURCES; i++) {
392 struct resource *r = bus->resource[i];
391 pci_bus_for_each_resource(bus, r, i) {
393 if (!r)
394 continue;
395 if (res->start && !(res->start >= r->start && res->end <= r->end))
396 continue; /* Not contained */
397 if ((res->flags ^ r->flags) & (IORESOURCE_IO | IORESOURCE_MEM))
398 continue; /* Wrong type */
399 if (!((res->flags ^ r->flags) & IORESOURCE_PREFETCH))
400 return r; /* Exact match */

--- 2618 unchanged lines hidden ---
392 if (!r)
393 continue;
394 if (res->start && !(res->start >= r->start && res->end <= r->end))
395 continue; /* Not contained */
396 if ((res->flags ^ r->flags) & (IORESOURCE_IO | IORESOURCE_MEM))
397 continue; /* Wrong type */
398 if (!((res->flags ^ r->flags) & IORESOURCE_PREFETCH))
399 return r; /* Exact match */

--- 2618 unchanged lines hidden ---