diff options
author | Bjorn Helgaas <bhelgaas@google.com> | 2016-10-06 14:30:56 -0400 |
---|---|---|
committer | Bjorn Helgaas <bhelgaas@google.com> | 2016-10-11 21:49:33 -0400 |
commit | b6f5f434f079eb6dd3fe105d6dbc00a361df86fe (patch) | |
tree | f4d32acba70e12a59914222b06ee98579ba566fc | |
parent | acaa88e4e21f737c270892c31b4846a5d11b3b49 (diff) |
PCI: artpec6: Pass device-specific struct to internal functions
Only interfaces used from outside the driver, e.g., those called by the
DesignWare core, need to accept pointers to the generic struct pcie_port.
Internal interfaces can accept pointers to the device-specific struct,
which makes them more straightforward. No functional change intended.
Signed-off-by: Bjorn Helgaas <bhelgaas@google.com>
Acked-by: Jesper Nilsson <jesper.nilsson@axis.com>
-rw-r--r-- | drivers/pci/host/pcie-artpec6.c | 24 |
1 files changed, 15 insertions, 9 deletions
diff --git a/drivers/pci/host/pcie-artpec6.c b/drivers/pci/host/pcie-artpec6.c index d3e7a40241f1..bdfdea200f4b 100644 --- a/drivers/pci/host/pcie-artpec6.c +++ b/drivers/pci/host/pcie-artpec6.c | |||
@@ -78,9 +78,9 @@ static void artpec6_pcie_writel(struct artpec6_pcie *artpec6_pcie, u32 offset, u | |||
78 | regmap_write(artpec6_pcie->regmap, offset, val); | 78 | regmap_write(artpec6_pcie->regmap, offset, val); |
79 | } | 79 | } |
80 | 80 | ||
81 | static int artpec6_pcie_establish_link(struct pcie_port *pp) | 81 | static int artpec6_pcie_establish_link(struct artpec6_pcie *artpec6_pcie) |
82 | { | 82 | { |
83 | struct artpec6_pcie *artpec6_pcie = to_artpec6_pcie(pp); | 83 | struct pcie_port *pp = &artpec6_pcie->pp; |
84 | u32 val; | 84 | u32 val; |
85 | unsigned int retries; | 85 | unsigned int retries; |
86 | 86 | ||
@@ -165,16 +165,20 @@ static int artpec6_pcie_establish_link(struct pcie_port *pp) | |||
165 | return -ETIMEDOUT; | 165 | return -ETIMEDOUT; |
166 | } | 166 | } |
167 | 167 | ||
168 | static void artpec6_pcie_enable_interrupts(struct pcie_port *pp) | 168 | static void artpec6_pcie_enable_interrupts(struct artpec6_pcie *artpec6_pcie) |
169 | { | 169 | { |
170 | struct pcie_port *pp = &artpec6_pcie->pp; | ||
171 | |||
170 | if (IS_ENABLED(CONFIG_PCI_MSI)) | 172 | if (IS_ENABLED(CONFIG_PCI_MSI)) |
171 | dw_pcie_msi_init(pp); | 173 | dw_pcie_msi_init(pp); |
172 | } | 174 | } |
173 | 175 | ||
174 | static void artpec6_pcie_host_init(struct pcie_port *pp) | 176 | static void artpec6_pcie_host_init(struct pcie_port *pp) |
175 | { | 177 | { |
176 | artpec6_pcie_establish_link(pp); | 178 | struct artpec6_pcie *artpec6_pcie = to_artpec6_pcie(pp); |
177 | artpec6_pcie_enable_interrupts(pp); | 179 | |
180 | artpec6_pcie_establish_link(artpec6_pcie); | ||
181 | artpec6_pcie_enable_interrupts(artpec6_pcie); | ||
178 | } | 182 | } |
179 | 183 | ||
180 | static struct pcie_host_ops artpec6_pcie_host_ops = { | 184 | static struct pcie_host_ops artpec6_pcie_host_ops = { |
@@ -183,14 +187,16 @@ static struct pcie_host_ops artpec6_pcie_host_ops = { | |||
183 | 187 | ||
184 | static irqreturn_t artpec6_pcie_msi_handler(int irq, void *arg) | 188 | static irqreturn_t artpec6_pcie_msi_handler(int irq, void *arg) |
185 | { | 189 | { |
186 | struct pcie_port *pp = arg; | 190 | struct artpec6_pcie *artpec6_pcie = arg; |
191 | struct pcie_port *pp = &artpec6_pcie->pp; | ||
187 | 192 | ||
188 | return dw_handle_msi_irq(pp); | 193 | return dw_handle_msi_irq(pp); |
189 | } | 194 | } |
190 | 195 | ||
191 | static int artpec6_add_pcie_port(struct pcie_port *pp, | 196 | static int artpec6_add_pcie_port(struct artpec6_pcie *artpec6_pcie, |
192 | struct platform_device *pdev) | 197 | struct platform_device *pdev) |
193 | { | 198 | { |
199 | struct pcie_port *pp = &artpec6_pcie->pp; | ||
194 | struct device *dev = pp->dev; | 200 | struct device *dev = pp->dev; |
195 | int ret; | 201 | int ret; |
196 | 202 | ||
@@ -204,7 +210,7 @@ static int artpec6_add_pcie_port(struct pcie_port *pp, | |||
204 | ret = devm_request_irq(dev, pp->msi_irq, | 210 | ret = devm_request_irq(dev, pp->msi_irq, |
205 | artpec6_pcie_msi_handler, | 211 | artpec6_pcie_msi_handler, |
206 | IRQF_SHARED | IRQF_NO_THREAD, | 212 | IRQF_SHARED | IRQF_NO_THREAD, |
207 | "artpec6-pcie-msi", pp); | 213 | "artpec6-pcie-msi", artpec6_pcie); |
208 | if (ret) { | 214 | if (ret) { |
209 | dev_err(dev, "failed to request MSI irq\n"); | 215 | dev_err(dev, "failed to request MSI irq\n"); |
210 | return ret; | 216 | return ret; |
@@ -255,7 +261,7 @@ static int artpec6_pcie_probe(struct platform_device *pdev) | |||
255 | if (IS_ERR(artpec6_pcie->regmap)) | 261 | if (IS_ERR(artpec6_pcie->regmap)) |
256 | return PTR_ERR(artpec6_pcie->regmap); | 262 | return PTR_ERR(artpec6_pcie->regmap); |
257 | 263 | ||
258 | ret = artpec6_add_pcie_port(pp, pdev); | 264 | ret = artpec6_add_pcie_port(artpec6_pcie, pdev); |
259 | if (ret < 0) | 265 | if (ret < 0) |
260 | return ret; | 266 | return ret; |
261 | 267 | ||