Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

MIPS: pci-rt2880: remove unneeded locks

Mirror pci-rt3883 fix from commit e5067c718b3a ("MIPS: pci-rt3883:
Remove odd locking in PCI config space access code"). pci-rt2880 shares
the driver layout with pci-rt3883 and the same reasons apply.

Caller (generic PCI code) already does proper locking, so no need to add
another one here. Local PCI read/write functions are never called
simultaneously, also they do not require synchronization with the PCI
controller ops, since they are used before the controller registration.

Suggested-by: Sergey Ryazanov <ryazanov.s.a@gmail.com>
Signed-off-by: Ilya Lipnitskiy <ilya.lipnitskiy@gmail.com>
Reviewed-by: Sergey Ryazanov <ryazanov.s.a@gmail.com>
Signed-off-by: Thomas Bogendoerfer <tsbogend@alpha.franken.de>

authored by

Ilya Lipnitskiy and committed by
Thomas Bogendoerfer
791a7be2 8e98b697

-13
-13
arch/mips/pci/pci-rt2880.c
··· 41 41 #define RT2880_PCI_REG_ARBCTL 0x80 42 42 43 43 static void __iomem *rt2880_pci_base; 44 - static DEFINE_SPINLOCK(rt2880_pci_lock); 45 44 46 45 static u32 rt2880_pci_reg_read(u32 reg) 47 46 { ··· 62 63 static int rt2880_pci_config_read(struct pci_bus *bus, unsigned int devfn, 63 64 int where, int size, u32 *val) 64 65 { 65 - unsigned long flags; 66 66 u32 address; 67 67 u32 data; 68 68 69 69 address = rt2880_pci_get_cfgaddr(bus->number, PCI_SLOT(devfn), 70 70 PCI_FUNC(devfn), where); 71 71 72 - spin_lock_irqsave(&rt2880_pci_lock, flags); 73 72 rt2880_pci_reg_write(address, RT2880_PCI_REG_CONFIG_ADDR); 74 73 data = rt2880_pci_reg_read(RT2880_PCI_REG_CONFIG_DATA); 75 - spin_unlock_irqrestore(&rt2880_pci_lock, flags); 76 74 77 75 switch (size) { 78 76 case 1: ··· 89 93 static int rt2880_pci_config_write(struct pci_bus *bus, unsigned int devfn, 90 94 int where, int size, u32 val) 91 95 { 92 - unsigned long flags; 93 96 u32 address; 94 97 u32 data; 95 98 96 99 address = rt2880_pci_get_cfgaddr(bus->number, PCI_SLOT(devfn), 97 100 PCI_FUNC(devfn), where); 98 101 99 - spin_lock_irqsave(&rt2880_pci_lock, flags); 100 102 rt2880_pci_reg_write(address, RT2880_PCI_REG_CONFIG_ADDR); 101 103 data = rt2880_pci_reg_read(RT2880_PCI_REG_CONFIG_DATA); 102 104 ··· 113 119 } 114 120 115 121 rt2880_pci_reg_write(data, RT2880_PCI_REG_CONFIG_DATA); 116 - spin_unlock_irqrestore(&rt2880_pci_lock, flags); 117 122 118 123 return PCIBIOS_SUCCESSFUL; 119 124 } ··· 144 151 145 152 static inline u32 rt2880_pci_read_u32(unsigned long reg) 146 153 { 147 - unsigned long flags; 148 154 u32 address; 149 155 u32 ret; 150 156 151 157 address = rt2880_pci_get_cfgaddr(0, 0, 0, reg); 152 158 153 - spin_lock_irqsave(&rt2880_pci_lock, flags); 154 159 rt2880_pci_reg_write(address, RT2880_PCI_REG_CONFIG_ADDR); 155 160 ret = rt2880_pci_reg_read(RT2880_PCI_REG_CONFIG_DATA); 156 - spin_unlock_irqrestore(&rt2880_pci_lock, flags); 157 161 158 162 return ret; 159 163 } 160 164 161 165 static inline void rt2880_pci_write_u32(unsigned long reg, u32 val) 162 166 { 163 - unsigned long flags; 164 167 u32 address; 165 168 166 169 address = rt2880_pci_get_cfgaddr(0, 0, 0, reg); 167 170 168 - spin_lock_irqsave(&rt2880_pci_lock, flags); 169 171 rt2880_pci_reg_write(address, RT2880_PCI_REG_CONFIG_ADDR); 170 172 rt2880_pci_reg_write(val, RT2880_PCI_REG_CONFIG_DATA); 171 - spin_unlock_irqrestore(&rt2880_pci_lock, flags); 172 173 } 173 174 174 175 int pcibios_map_irq(const struct pci_dev *dev, u8 slot, u8 pin)