Commit 490a0ece authored by Sergey Ryazanov's avatar Sergey Ryazanov Committed by Ralf Baechle

MIPS: pci-ar7{1x, 24}x: remove odd locking in PCI config space access code

Caller (generic PCI code) already do proper locking so no need to add
another one here.
Signed-off-by: default avatarSergey Ryazanov <ryazanov.s.a@gmail.com>
Cc: Linux MIPS <linux-mips@linux-mips.org>
Cc: Gabor Juhos <juhosg@openwrt.org>
Patchwork: https://patchwork.linux-mips.org/patch/7602/Signed-off-by: default avatarRalf Baechle <ralf@linux-mips.org>
parent c4a30537
...@@ -50,7 +50,6 @@ ...@@ -50,7 +50,6 @@
struct ar71xx_pci_controller { struct ar71xx_pci_controller {
void __iomem *cfg_base; void __iomem *cfg_base;
spinlock_t lock;
int irq; int irq;
int irq_base; int irq_base;
struct pci_controller pci_ctrl; struct pci_controller pci_ctrl;
...@@ -182,7 +181,6 @@ static int ar71xx_pci_read_config(struct pci_bus *bus, unsigned int devfn, ...@@ -182,7 +181,6 @@ static int ar71xx_pci_read_config(struct pci_bus *bus, unsigned int devfn,
{ {
struct ar71xx_pci_controller *apc = pci_bus_to_ar71xx_controller(bus); struct ar71xx_pci_controller *apc = pci_bus_to_ar71xx_controller(bus);
void __iomem *base = apc->cfg_base; void __iomem *base = apc->cfg_base;
unsigned long flags;
u32 data; u32 data;
int err; int err;
int ret; int ret;
...@@ -190,8 +188,6 @@ static int ar71xx_pci_read_config(struct pci_bus *bus, unsigned int devfn, ...@@ -190,8 +188,6 @@ static int ar71xx_pci_read_config(struct pci_bus *bus, unsigned int devfn,
ret = PCIBIOS_SUCCESSFUL; ret = PCIBIOS_SUCCESSFUL;
data = ~0; data = ~0;
spin_lock_irqsave(&apc->lock, flags);
err = ar71xx_pci_set_cfgaddr(bus, devfn, where, size, err = ar71xx_pci_set_cfgaddr(bus, devfn, where, size,
AR71XX_PCI_CFG_CMD_READ); AR71XX_PCI_CFG_CMD_READ);
if (err) if (err)
...@@ -199,8 +195,6 @@ static int ar71xx_pci_read_config(struct pci_bus *bus, unsigned int devfn, ...@@ -199,8 +195,6 @@ static int ar71xx_pci_read_config(struct pci_bus *bus, unsigned int devfn,
else else
data = __raw_readl(base + AR71XX_PCI_REG_CFG_RDDATA); data = __raw_readl(base + AR71XX_PCI_REG_CFG_RDDATA);
spin_unlock_irqrestore(&apc->lock, flags);
*value = (data >> (8 * (where & 3))) & ar71xx_pci_read_mask[size & 7]; *value = (data >> (8 * (where & 3))) & ar71xx_pci_read_mask[size & 7];
return ret; return ret;
...@@ -211,15 +205,12 @@ static int ar71xx_pci_write_config(struct pci_bus *bus, unsigned int devfn, ...@@ -211,15 +205,12 @@ static int ar71xx_pci_write_config(struct pci_bus *bus, unsigned int devfn,
{ {
struct ar71xx_pci_controller *apc = pci_bus_to_ar71xx_controller(bus); struct ar71xx_pci_controller *apc = pci_bus_to_ar71xx_controller(bus);
void __iomem *base = apc->cfg_base; void __iomem *base = apc->cfg_base;
unsigned long flags;
int err; int err;
int ret; int ret;
value = value << (8 * (where & 3)); value = value << (8 * (where & 3));
ret = PCIBIOS_SUCCESSFUL; ret = PCIBIOS_SUCCESSFUL;
spin_lock_irqsave(&apc->lock, flags);
err = ar71xx_pci_set_cfgaddr(bus, devfn, where, size, err = ar71xx_pci_set_cfgaddr(bus, devfn, where, size,
AR71XX_PCI_CFG_CMD_WRITE); AR71XX_PCI_CFG_CMD_WRITE);
if (err) if (err)
...@@ -227,8 +218,6 @@ static int ar71xx_pci_write_config(struct pci_bus *bus, unsigned int devfn, ...@@ -227,8 +218,6 @@ static int ar71xx_pci_write_config(struct pci_bus *bus, unsigned int devfn,
else else
__raw_writel(value, base + AR71XX_PCI_REG_CFG_WRDATA); __raw_writel(value, base + AR71XX_PCI_REG_CFG_WRDATA);
spin_unlock_irqrestore(&apc->lock, flags);
return ret; return ret;
} }
...@@ -360,8 +349,6 @@ static int ar71xx_pci_probe(struct platform_device *pdev) ...@@ -360,8 +349,6 @@ static int ar71xx_pci_probe(struct platform_device *pdev)
if (!apc) if (!apc)
return -ENOMEM; return -ENOMEM;
spin_lock_init(&apc->lock);
res = platform_get_resource_byname(pdev, IORESOURCE_MEM, "cfg_base"); res = platform_get_resource_byname(pdev, IORESOURCE_MEM, "cfg_base");
apc->cfg_base = devm_ioremap_resource(&pdev->dev, res); apc->cfg_base = devm_ioremap_resource(&pdev->dev, res);
if (IS_ERR(apc->cfg_base)) if (IS_ERR(apc->cfg_base))
......
...@@ -9,7 +9,6 @@ ...@@ -9,7 +9,6 @@
* by the Free Software Foundation. * by the Free Software Foundation.
*/ */
#include <linux/spinlock.h>
#include <linux/irq.h> #include <linux/irq.h>
#include <linux/pci.h> #include <linux/pci.h>
#include <linux/module.h> #include <linux/module.h>
...@@ -48,8 +47,6 @@ struct ar724x_pci_controller { ...@@ -48,8 +47,6 @@ struct ar724x_pci_controller {
bool bar0_is_cached; bool bar0_is_cached;
u32 bar0_value; u32 bar0_value;
spinlock_t lock;
struct pci_controller pci_controller; struct pci_controller pci_controller;
struct resource io_res; struct resource io_res;
struct resource mem_res; struct resource mem_res;
...@@ -75,7 +72,6 @@ pci_bus_to_ar724x_controller(struct pci_bus *bus) ...@@ -75,7 +72,6 @@ pci_bus_to_ar724x_controller(struct pci_bus *bus)
static int ar724x_pci_local_write(struct ar724x_pci_controller *apc, static int ar724x_pci_local_write(struct ar724x_pci_controller *apc,
int where, int size, u32 value) int where, int size, u32 value)
{ {
unsigned long flags;
void __iomem *base; void __iomem *base;
u32 data; u32 data;
int s; int s;
...@@ -86,8 +82,6 @@ static int ar724x_pci_local_write(struct ar724x_pci_controller *apc, ...@@ -86,8 +82,6 @@ static int ar724x_pci_local_write(struct ar724x_pci_controller *apc,
return PCIBIOS_DEVICE_NOT_FOUND; return PCIBIOS_DEVICE_NOT_FOUND;
base = apc->crp_base; base = apc->crp_base;
spin_lock_irqsave(&apc->lock, flags);
data = __raw_readl(base + (where & ~3)); data = __raw_readl(base + (where & ~3));
switch (size) { switch (size) {
...@@ -105,14 +99,12 @@ static int ar724x_pci_local_write(struct ar724x_pci_controller *apc, ...@@ -105,14 +99,12 @@ static int ar724x_pci_local_write(struct ar724x_pci_controller *apc,
data = value; data = value;
break; break;
default: default:
spin_unlock_irqrestore(&apc->lock, flags);
return PCIBIOS_BAD_REGISTER_NUMBER; return PCIBIOS_BAD_REGISTER_NUMBER;
} }
__raw_writel(data, base + (where & ~3)); __raw_writel(data, base + (where & ~3));
/* flush write */ /* flush write */
__raw_readl(base + (where & ~3)); __raw_readl(base + (where & ~3));
spin_unlock_irqrestore(&apc->lock, flags);
return PCIBIOS_SUCCESSFUL; return PCIBIOS_SUCCESSFUL;
} }
...@@ -121,7 +113,6 @@ static int ar724x_pci_read(struct pci_bus *bus, unsigned int devfn, int where, ...@@ -121,7 +113,6 @@ static int ar724x_pci_read(struct pci_bus *bus, unsigned int devfn, int where,
int size, uint32_t *value) int size, uint32_t *value)
{ {
struct ar724x_pci_controller *apc; struct ar724x_pci_controller *apc;
unsigned long flags;
void __iomem *base; void __iomem *base;
u32 data; u32 data;
...@@ -133,8 +124,6 @@ static int ar724x_pci_read(struct pci_bus *bus, unsigned int devfn, int where, ...@@ -133,8 +124,6 @@ static int ar724x_pci_read(struct pci_bus *bus, unsigned int devfn, int where,
return PCIBIOS_DEVICE_NOT_FOUND; return PCIBIOS_DEVICE_NOT_FOUND;
base = apc->devcfg_base; base = apc->devcfg_base;
spin_lock_irqsave(&apc->lock, flags);
data = __raw_readl(base + (where & ~3)); data = __raw_readl(base + (where & ~3));
switch (size) { switch (size) {
...@@ -153,13 +142,9 @@ static int ar724x_pci_read(struct pci_bus *bus, unsigned int devfn, int where, ...@@ -153,13 +142,9 @@ static int ar724x_pci_read(struct pci_bus *bus, unsigned int devfn, int where,
case 4: case 4:
break; break;
default: default:
spin_unlock_irqrestore(&apc->lock, flags);
return PCIBIOS_BAD_REGISTER_NUMBER; return PCIBIOS_BAD_REGISTER_NUMBER;
} }
spin_unlock_irqrestore(&apc->lock, flags);
if (where == PCI_BASE_ADDRESS_0 && size == 4 && if (where == PCI_BASE_ADDRESS_0 && size == 4 &&
apc->bar0_is_cached) { apc->bar0_is_cached) {
/* use the cached value */ /* use the cached value */
...@@ -175,7 +160,6 @@ static int ar724x_pci_write(struct pci_bus *bus, unsigned int devfn, int where, ...@@ -175,7 +160,6 @@ static int ar724x_pci_write(struct pci_bus *bus, unsigned int devfn, int where,
int size, uint32_t value) int size, uint32_t value)
{ {
struct ar724x_pci_controller *apc; struct ar724x_pci_controller *apc;
unsigned long flags;
void __iomem *base; void __iomem *base;
u32 data; u32 data;
int s; int s;
...@@ -209,8 +193,6 @@ static int ar724x_pci_write(struct pci_bus *bus, unsigned int devfn, int where, ...@@ -209,8 +193,6 @@ static int ar724x_pci_write(struct pci_bus *bus, unsigned int devfn, int where,
} }
base = apc->devcfg_base; base = apc->devcfg_base;
spin_lock_irqsave(&apc->lock, flags);
data = __raw_readl(base + (where & ~3)); data = __raw_readl(base + (where & ~3));
switch (size) { switch (size) {
...@@ -228,15 +210,12 @@ static int ar724x_pci_write(struct pci_bus *bus, unsigned int devfn, int where, ...@@ -228,15 +210,12 @@ static int ar724x_pci_write(struct pci_bus *bus, unsigned int devfn, int where,
data = value; data = value;
break; break;
default: default:
spin_unlock_irqrestore(&apc->lock, flags);
return PCIBIOS_BAD_REGISTER_NUMBER; return PCIBIOS_BAD_REGISTER_NUMBER;
} }
__raw_writel(data, base + (where & ~3)); __raw_writel(data, base + (where & ~3));
/* flush write */ /* flush write */
__raw_readl(base + (where & ~3)); __raw_readl(base + (where & ~3));
spin_unlock_irqrestore(&apc->lock, flags);
return PCIBIOS_SUCCESSFUL; return PCIBIOS_SUCCESSFUL;
} }
...@@ -380,8 +359,6 @@ static int ar724x_pci_probe(struct platform_device *pdev) ...@@ -380,8 +359,6 @@ static int ar724x_pci_probe(struct platform_device *pdev)
if (apc->irq < 0) if (apc->irq < 0)
return -EINVAL; return -EINVAL;
spin_lock_init(&apc->lock);
res = platform_get_resource_byname(pdev, IORESOURCE_IO, "io_base"); res = platform_get_resource_byname(pdev, IORESOURCE_IO, "io_base");
if (!res) if (!res)
return -EINVAL; return -EINVAL;
......
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