Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > linux.kernel > #1432596
| From | Tomasz Nowicki <tn@semihalf.com> |
|---|---|
| Newsgroups | linux.kernel |
| Subject | [RFC PATCH v4 1/5] PCI: Embed pci_ecam_ops in pci_config_window structure |
| Date | 2016-06-28 10:00 +0200 |
| Message-ID | <rOW66-3XK-21@gated-at.bofh.it> (permalink) |
| References | <rOW65-3XK-9@gated-at.bofh.it> |
| Organization | linux.* mail to news gateway |
pci_config_window keeps pointer to pci_ecam_ops and every time
we want to deallocate pci_config_window (pci_ecam_free()) we need to make
sure to free pci_ecam_ops in case it was dynamically allocated prior to
pci_ecam_create() call.
To avoid that extra effort, embed pci_ecam_ops in pci_config_window,
instead of just a pointer.
Signed-off-by: Tomasz Nowicki <tn@semihalf.com>
To: Jayachandran C <jchandra@broadcom.com>
---
arch/arm64/kernel/pci.c | 2 +-
drivers/pci/ecam.c | 6 +++---
include/linux/pci-ecam.h | 2 +-
3 files changed, 5 insertions(+), 5 deletions(-)
diff --git a/arch/arm64/kernel/pci.c b/arch/arm64/kernel/pci.c
index 94cd43c..cb4dee7 100644
--- a/arch/arm64/kernel/pci.c
+++ b/arch/arm64/kernel/pci.c
@@ -196,7 +196,7 @@ struct pci_bus *pci_acpi_scan_root(struct acpi_pci_root *root)
return NULL;
}
- acpi_pci_root_ops.pci_ops = &ri->cfg->ops->pci_ops;
+ acpi_pci_root_ops.pci_ops = &ri->cfg->ops.pci_ops;
bus = acpi_pci_root_create(root, &acpi_pci_root_ops, &ri->common,
ri->cfg);
if (!bus)
diff --git a/drivers/pci/ecam.c b/drivers/pci/ecam.c
index 43ed08d..24242f0 100644
--- a/drivers/pci/ecam.c
+++ b/drivers/pci/ecam.c
@@ -52,7 +52,7 @@ struct pci_config_window *pci_ecam_create(struct device *dev,
return ERR_PTR(-ENOMEM);
cfg->parent = dev;
- cfg->ops = ops;
+ cfg->ops = *ops;
cfg->busr.start = busr->start;
cfg->busr.end = busr->end;
cfg->busr.flags = IORESOURCE_BUS;
@@ -138,7 +138,7 @@ void __iomem *pci_ecam_map_bus(struct pci_bus *bus, unsigned int devfn,
int where)
{
struct pci_config_window *cfg = bus->sysdata;
- unsigned int devfn_shift = cfg->ops->bus_shift - 8;
+ unsigned int devfn_shift = cfg->ops.bus_shift - 8;
unsigned int busn = bus->number;
void __iomem *base;
@@ -149,7 +149,7 @@ void __iomem *pci_ecam_map_bus(struct pci_bus *bus, unsigned int devfn,
if (per_bus_mapping)
base = cfg->winp[busn];
else
- base = cfg->win + (busn << cfg->ops->bus_shift);
+ base = cfg->win + (busn << cfg->ops.bus_shift);
return base + (devfn << devfn_shift) + where;
}
diff --git a/include/linux/pci-ecam.h b/include/linux/pci-ecam.h
index 7adad20..0ce2920 100644
--- a/include/linux/pci-ecam.h
+++ b/include/linux/pci-ecam.h
@@ -39,7 +39,7 @@ struct pci_config_window {
struct resource res;
struct resource busr;
void *priv;
- struct pci_ecam_ops *ops;
+ struct pci_ecam_ops ops;
union {
void __iomem *win; /* 64-bit single mapping */
void __iomem **winp; /* 32-bit per-bus mapping */
--
1.9.1
Back to linux.kernel | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread
[RFC PATCH v4 0/5] ECAM quirks handling for ARM64 platforms Tomasz Nowicki <tn@semihalf.com> - 2016-06-28 10:00 +0200 [RFC PATCH v4 5/5] PCI: thunder: Add ThunderX PEM MCFG quirk to the list Tomasz Nowicki <tn@semihalf.com> - 2016-06-28 10:00 +0200 [RFC PATCH v4 1/5] PCI: Embed pci_ecam_ops in pci_config_window structure Tomasz Nowicki <tn@semihalf.com> - 2016-06-28 10:00 +0200 [RFC PATCH v4 4/5] ARM64/PCI: Start using quirks handling for ACPI based PCI host controller Tomasz Nowicki <tn@semihalf.com> - 2016-06-28 10:00 +0200
csiph-web