Re: [PATCH v7 03/60] sparc/PCI: Unify pci_register_region()

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Tue, Oct 20, 2015 at 7:35 PM, Bjorn Helgaas <helgaas@xxxxxxxxxx> wrote:
> On Tue, Oct 20, 2015 at 03:30:44PM -0700, Yinghai Lu wrote:
> I doubt I would agree with a change like this, but maybe, if you can
> explain what's unique about the sparc architecture that would require
> a change like this.

Then how about this one ?

otherwise we need to compare res with pbm->mem_space or pbm->mem64_space
to get direct parent for request_resource_conflict() calling in
pci_register_legacy_regions().

also check if if return is NULL to decide if it is valid region.
---
 drivers/pci/host-bridge.c |   10 +++++++++-
 include/linux/pci.h       |    5 +++--
 2 files changed, 12 insertions(+), 3 deletions(-)

Index: linux-2.6/drivers/pci/host-bridge.c
===================================================================
--- linux-2.6.orig/drivers/pci/host-bridge.c
+++ linux-2.6/drivers/pci/host-bridge.c
@@ -70,12 +70,17 @@ static bool region_contains(struct pci_b
     return region1->start <= region2->start && region1->end >= region2->end;
 }

-void pcibios_bus_to_resource(struct pci_bus *bus, struct resource *res,
+/*
+ * return host bridge window resource
+ */
+struct resource *pcibios_bus_to_resource(struct pci_bus *bus,
+                 struct resource *res,
                  struct pci_bus_region *region)
 {
     struct pci_host_bridge *bridge = pci_find_host_bridge(bus);
     struct resource_entry *window;
     resource_size_t offset = 0;
+    struct resource *res_ret = NULL;

     resource_list_for_each_entry(window, &bridge->windows) {
         struct pci_bus_region bus_region;
@@ -88,11 +93,14 @@ void pcibios_bus_to_resource(struct pci_

         if (region_contains(&bus_region, region)) {
             offset = window->offset;
+            res_ret = window->res;
             break;
         }
     }

     res->start = region->start + offset;
     res->end = region->end + offset;
+
+    return res_ret;
 }
 EXPORT_SYMBOL(pcibios_bus_to_resource);
Index: linux-2.6/include/linux/pci.h
===================================================================
--- linux-2.6.orig/include/linux/pci.h
+++ linux-2.6/include/linux/pci.h
@@ -781,8 +781,9 @@ void pci_fixup_cardbus(struct pci_bus *)

 void pcibios_resource_to_bus(struct pci_bus *bus, struct
pci_bus_region *region,
                  struct resource *res);
-void pcibios_bus_to_resource(struct pci_bus *bus, struct resource *res,
-                 struct pci_bus_region *region);
+struct resource *pcibios_bus_to_resource(struct pci_bus *bus,
+                     struct resource *res,
+                     struct pci_bus_region *region);
 void pcibios_scan_specific_bus(int busn);
 struct pci_bus *pci_find_bus(int domain, int busnr);
 void pci_bus_add_devices(const struct pci_bus *bus);
--
To unsubscribe from this list: send the line "unsubscribe linux-pci" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html



[Index of Archives]     [DMA Engine]     [Linux Coverity]     [Linux USB]     [Video for Linux]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]     [Greybus]

  Powered by Linux