Commit 3f7abdef authored by Jiang Liu's avatar Jiang Liu Committed by Rafael J. Wysocki

ia64/PCI: Use common struct resource_entry to replace struct iospace_resource

Use common struct resource_entry to replace private
struct iospace_resource.
Signed-off-by: default avatarJiang Liu <jiang.liu@linux.intel.com>
Reviewed-by: default avatarHanjun Guo <hanjun.guo@linaro.org>
Signed-off-by: default avatarRafael J. Wysocki <rafael.j.wysocki@intel.com>
parent 3772aea7
...@@ -64,11 +64,6 @@ extern int pci_mmap_legacy_page_range(struct pci_bus *bus, ...@@ -64,11 +64,6 @@ extern int pci_mmap_legacy_page_range(struct pci_bus *bus,
#define pci_legacy_read platform_pci_legacy_read #define pci_legacy_read platform_pci_legacy_read
#define pci_legacy_write platform_pci_legacy_write #define pci_legacy_write platform_pci_legacy_write
struct iospace_resource {
struct list_head list;
struct resource res;
};
struct pci_controller { struct pci_controller {
struct acpi_device *companion; struct acpi_device *companion;
void *iommu; void *iommu;
......
...@@ -154,14 +154,14 @@ new_space (u64 phys_base, int sparse) ...@@ -154,14 +154,14 @@ new_space (u64 phys_base, int sparse)
static int add_io_space(struct device *dev, struct pci_root_info *info, static int add_io_space(struct device *dev, struct pci_root_info *info,
struct resource_entry *entry) struct resource_entry *entry)
{ {
struct iospace_resource *iospace; struct resource_entry *iospace;
struct resource *resource, *res = entry->res; struct resource *resource, *res = entry->res;
char *name; char *name;
unsigned long base, min, max, base_port; unsigned long base, min, max, base_port;
unsigned int sparse = 0, space_nr, len; unsigned int sparse = 0, space_nr, len;
len = strlen(info->name) + 32; len = strlen(info->name) + 32;
iospace = kzalloc(sizeof(*iospace) + len, GFP_KERNEL); iospace = resource_list_create_entry(NULL, len);
if (!iospace) { if (!iospace) {
dev_err(dev, "PCI: No memory for %s I/O port space\n", dev_err(dev, "PCI: No memory for %s I/O port space\n",
info->name); info->name);
...@@ -190,7 +190,7 @@ static int add_io_space(struct device *dev, struct pci_root_info *info, ...@@ -190,7 +190,7 @@ static int add_io_space(struct device *dev, struct pci_root_info *info,
if (space_nr == 0) if (space_nr == 0)
sparse = 1; sparse = 1;
resource = &iospace->res; resource = iospace->res;
resource->name = name; resource->name = name;
resource->flags = IORESOURCE_MEM; resource->flags = IORESOURCE_MEM;
resource->start = base + (sparse ? IO_SPACE_SPARSE_ENCODING(min) : min); resource->start = base + (sparse ? IO_SPACE_SPARSE_ENCODING(min) : min);
...@@ -205,12 +205,12 @@ static int add_io_space(struct device *dev, struct pci_root_info *info, ...@@ -205,12 +205,12 @@ static int add_io_space(struct device *dev, struct pci_root_info *info,
entry->offset = base_port; entry->offset = base_port;
res->start = min + base_port; res->start = min + base_port;
res->end = max + base_port; res->end = max + base_port;
list_add_tail(&iospace->list, &info->io_resources); resource_list_add_tail(iospace, &info->io_resources);
return 0; return 0;
free_resource: free_resource:
kfree(iospace); resource_list_free_entry(iospace);
return -ENOSPC; return -ENOSPC;
} }
...@@ -369,12 +369,11 @@ static void add_resources(struct pci_root_info *info, struct device *dev) ...@@ -369,12 +369,11 @@ static void add_resources(struct pci_root_info *info, struct device *dev)
static void __release_pci_root_info(struct pci_root_info *info) static void __release_pci_root_info(struct pci_root_info *info)
{ {
struct resource *res; struct resource *res;
struct iospace_resource *iospace, *tmp;
struct resource_entry *entry, *tentry; struct resource_entry *entry, *tentry;
list_for_each_entry_safe(iospace, tmp, &info->io_resources, list) { resource_list_for_each_entry_safe(entry, tentry, &info->io_resources) {
release_resource(&iospace->res); release_resource(entry->res);
kfree(iospace); resource_list_destroy_entry(entry);
} }
resource_list_for_each_entry_safe(entry, tentry, &info->resources) { resource_list_for_each_entry_safe(entry, tentry, &info->resources) {
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment