ARM:sa1100: Remove a redundant spin lock
Subsystems (2)
PATCH 1/1 ARM:sa1100: Remove a redundant spin lock
From: Yang Wei <[email protected]>
The pair read/write of accessing pci confiuration space function has already protected by pci_lock. so remove nano_lock.
--- arch/arm/mach-sa1100/pci-nanoengine.c | 9 --------- 1 file changed, 9 deletions(-)
arch/arm/mach-sa1100/pci-nanoengine.c +0 -9
@@ -30,7 +30,6 @@#include <mach/nanoengine.h> #include <mach/hardware.h> -static DEFINE_SPINLOCK (nano_lock);static int nanoengine_get_pci_address (struct pci_bus *bus,unsigned int devfn,int where,unsigned long *address)
@@ -52,7 +51,6 @@ static int nanoengine_read_config(struct pci_bus *bus, unsigned int devfn, int w {int ret;unsigned long address; -unsigned long flags;u32 v;/* nanoEngine PCI bridge does not return -1 for a non-existing
@@ -64,15 +62,12 @@ static int nanoengine_read_config(struct pci_bus *bus, unsigned int devfn, int w goto exit_function; } -spin_lock_irqsave (&nano_lock, flags); ret =nanoengine_get_pci_address (bus, devfn, where, &address);if (ret !=PCIBIOS_SUCCESSFUL )return ret; v =__raw_readl (address); -spin_unlock_irqrestore (&nano_lock, flags); - v >>= ((where &3 ) *8 ); v &= (unsigned long )(-1 ) >> ((4 - size) *8 );
@@ -86,13 +81,11 @@ static int nanoengine_write_config(struct pci_bus *bus, unsigned int devfn, int {int ret;unsigned long address; -unsigned long flags;unsigned shift;u32 v; shift = (where &3 ) *8 ; -spin_lock_irqsave (&nano_lock, flags); ret =nanoengine_get_pci_address (bus, devfn, where, &address);if (ret !=PCIBIOS_SUCCESSFUL )
@@ -113,8 +106,6 @@ static int nanoengine_write_config(struct pci_bus *bus, unsigned int devfn, int }__raw_writel (v, address); -spin_unlock_irqrestore (&nano_lock, flags); -return PCIBIOS_SUCCESSFUL ; }
Signature · 1 line
1.7.9.5
Hi Guys,
What about this patch?
Thanks
Wei
Quoted 69 lines · Wei.Yang at windriver.com
From: Yang Wei <[email protected]>
The pair read/write of accessing pci confiuration space function has already protected by
pci_lock. so removenano_lock.Signed-off-by Yang Wei <[email protected]>--- arch/arm/mach-sa1100/pci-nanoengine.c | 9 --------- 1 file changed, 9 deletions(-)arch/arm/mach-sa1100/pci-nanoengine.c +0
-9@@ -30,7 +30,6 @@#include <mach/nanoengine.h> #include <mach/hardware.h> -static DEFINE_SPINLOCK (nano_lock);static int nanoengine_get_pci_address (struct pci_bus *bus,unsigned int devfn,int where,unsigned long *address)@@ -52,7 +51,6 @@ static int nanoengine_read_config(struct pci_bus *bus, unsigned int devfn, int w {int ret;unsigned long address; -unsigned long flags;u32 v;/* nanoEngine PCI bridge does not return -1 for a non-existing @@ -64,15 +62,12 @@ static int nanoengine_read_config(struct pci_bus *bus, unsigned int devfn, int w goto exit_function; } -spin_lock_irqsave (&nano_lock, flags); ret =nanoengine_get_pci_address (bus, devfn, where, &address);if (ret !=PCIBIOS_SUCCESSFUL )return ret; v =__raw_readl (address); -spin_unlock_irqrestore (&nano_lock, flags); - v >>= ((where &3 ) *8 ); v &= (unsigned long )(-1 ) >> ((4 - size) *8 );@@ -86,13 +81,11 @@ static int nanoengine_write_config(struct pci_bus *bus, unsigned int devfn, int {int ret;unsigned long address; -unsigned long flags;unsigned shift;u32 v; shift = (where &3 ) *8 ; -spin_lock_irqsave (&nano_lock, flags); ret =nanoengine_get_pci_address (bus, devfn, where, &address);if (ret !=PCIBIOS_SUCCESSFUL )@@ -113,8 +106,6 @@ static int nanoengine_write_config(struct pci_bus *bus, unsigned int devfn, int }__raw_writel (v, address); -spin_unlock_irqrestore (&nano_lock, flags); -return PCIBIOS_SUCCESSFUL ; }
Quoted 3 lines · Yang,Wei
Hi Guys,
What about this patch?
The only concern on the face of it is that it removes mutual exclusion from the pci config write path, where a read-modifiy-write operation is performed.
However, the PCI code already gives that guarantee (drivers/pci/access.c) so this should be safe.
As this is fairly old code, it would be useful to know what the motivation is behind this change. Is it purely clean up, or is it something that you've tested, or is this a change that you require for something else?
Thanks.
Signature · 2 lines
FTTC broadband for 0.8mile line: now at 9.7Mbps down 460kbps up... slowly improving, and getting towards what was expected from it.
Quoted 8 lines · Russell King - ARM Linux
Quoted 3 lines · Yang,Wei
Hi Guys,
What about this patch?
The only concern on the face of it is that it removes mutual exclusion from the pci config write path, where a read-modifiy-write operation is performed.
Quoted 9 lines
However, the PCI code already gives that guarantee (
drivers/pci/access.c) so this should be safe.As this is fairly old code, it would be useful to know what the motivation is behind this change. Is it purely clean up, or is it something that you've tested, or is this a change that you require for something else?
Thanks.
Hmm, I fixed a bug of pci config read/write of an ARM board, but unfortunately, so far ML does not support it. So
I cannot send the fix, but I grepped the pci source code of ARM architecure, I found that the pci code of a few boards always define a static spin lock to excluse the pci config read/write path. I just intended to clean up them. If you agree the change,
I want to send v2 to also remove this mutual exclusion for something else board which also used the mutual exclusion.
Thanks
Wei