diff options
author | Russell King <rmk+kernel@arm.linux.org.uk> | 2012-03-10 08:31:34 -0500 |
---|---|---|
committer | Russell King <rmk+kernel@arm.linux.org.uk> | 2012-05-16 10:24:11 -0400 |
commit | 43ba990bb7bf741f4b2f405b35dc02823d68a682 (patch) | |
tree | c32201f703e096c2fcd98a76c217052de4e37d07 /arch/arm/mach-mv78xx0/pcie.c | |
parent | c23bfc3835173f5229b2503e3b616001a28affad (diff) |
ARM: PCI: dove/kirkwood/mv78xx0: use sys->private_data
Use sys->private_data to store the PCIe port data structure.
Signed-off-by: Russell King <rmk+kernel@arm.linux.org.uk>
Diffstat (limited to 'arch/arm/mach-mv78xx0/pcie.c')
-rw-r--r-- | arch/arm/mach-mv78xx0/pcie.c | 23 |
1 files changed, 7 insertions, 16 deletions
diff --git a/arch/arm/mach-mv78xx0/pcie.c b/arch/arm/mach-mv78xx0/pcie.c index 53f2fb5607f9..2e56e86b6d68 100644 --- a/arch/arm/mach-mv78xx0/pcie.c +++ b/arch/arm/mach-mv78xx0/pcie.c | |||
@@ -147,6 +147,7 @@ static int __init mv78xx0_pcie_setup(int nr, struct pci_sys_data *sys) | |||
147 | return 0; | 147 | return 0; |
148 | 148 | ||
149 | pp = &pcie_port[nr]; | 149 | pp = &pcie_port[nr]; |
150 | sys->private_data = pp; | ||
150 | pp->root_bus_nr = sys->busnr; | 151 | pp->root_bus_nr = sys->busnr; |
151 | 152 | ||
152 | /* | 153 | /* |
@@ -161,19 +162,6 @@ static int __init mv78xx0_pcie_setup(int nr, struct pci_sys_data *sys) | |||
161 | return 1; | 162 | return 1; |
162 | } | 163 | } |
163 | 164 | ||
164 | static struct pcie_port *bus_to_port(int bus) | ||
165 | { | ||
166 | int i; | ||
167 | |||
168 | for (i = num_pcie_ports - 1; i >= 0; i--) { | ||
169 | int rbus = pcie_port[i].root_bus_nr; | ||
170 | if (rbus != -1 && rbus <= bus) | ||
171 | break; | ||
172 | } | ||
173 | |||
174 | return i >= 0 ? pcie_port + i : NULL; | ||
175 | } | ||
176 | |||
177 | static int pcie_valid_config(struct pcie_port *pp, int bus, int dev) | 165 | static int pcie_valid_config(struct pcie_port *pp, int bus, int dev) |
178 | { | 166 | { |
179 | /* | 167 | /* |
@@ -189,7 +177,8 @@ static int pcie_valid_config(struct pcie_port *pp, int bus, int dev) | |||
189 | static int pcie_rd_conf(struct pci_bus *bus, u32 devfn, int where, | 177 | static int pcie_rd_conf(struct pci_bus *bus, u32 devfn, int where, |
190 | int size, u32 *val) | 178 | int size, u32 *val) |
191 | { | 179 | { |
192 | struct pcie_port *pp = bus_to_port(bus->number); | 180 | struct pci_sys_data *sys = bus->sysdata; |
181 | struct pcie_port *pp = sys->private_data; | ||
193 | unsigned long flags; | 182 | unsigned long flags; |
194 | int ret; | 183 | int ret; |
195 | 184 | ||
@@ -208,7 +197,8 @@ static int pcie_rd_conf(struct pci_bus *bus, u32 devfn, int where, | |||
208 | static int pcie_wr_conf(struct pci_bus *bus, u32 devfn, | 197 | static int pcie_wr_conf(struct pci_bus *bus, u32 devfn, |
209 | int where, int size, u32 val) | 198 | int where, int size, u32 val) |
210 | { | 199 | { |
211 | struct pcie_port *pp = bus_to_port(bus->number); | 200 | struct pci_sys_data *sys = bus->sysdata; |
201 | struct pcie_port *pp = sys->private_data; | ||
212 | unsigned long flags; | 202 | unsigned long flags; |
213 | int ret; | 203 | int ret; |
214 | 204 | ||
@@ -263,7 +253,8 @@ mv78xx0_pcie_scan_bus(int nr, struct pci_sys_data *sys) | |||
263 | static int __init mv78xx0_pcie_map_irq(const struct pci_dev *dev, u8 slot, | 253 | static int __init mv78xx0_pcie_map_irq(const struct pci_dev *dev, u8 slot, |
264 | u8 pin) | 254 | u8 pin) |
265 | { | 255 | { |
266 | struct pcie_port *pp = bus_to_port(dev->bus->number); | 256 | struct pci_sys_data *sys = dev->bus->sysdata; |
257 | struct pcie_port *pp = sys->private_data; | ||
267 | 258 | ||
268 | return IRQ_MV78XX0_PCIE_00 + (pp->maj << 2) + pp->min; | 259 | return IRQ_MV78XX0_PCIE_00 + (pp->maj << 2) + pp->min; |
269 | } | 260 | } |