Commit d814dee0 authored by Russell King - ARM Linux's avatar Russell King - ARM Linux Committed by David S. Miller

NET: am79c961: ensure asm() statements are marked volatile

Without this the compiler can (and does) optimize register reads away
from within loops, and other such optimizations.
Signed-off-by: default avatarRussell King <rmk+kernel@arm.linux.org.uk>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parent b4c8cc88
...@@ -50,7 +50,7 @@ static const char version[] = ...@@ -50,7 +50,7 @@ static const char version[] =
#ifdef __arm__ #ifdef __arm__
static void write_rreg(u_long base, u_int reg, u_int val) static void write_rreg(u_long base, u_int reg, u_int val)
{ {
__asm__( asm volatile(
"str%?h %1, [%2] @ NET_RAP\n\t" "str%?h %1, [%2] @ NET_RAP\n\t"
"str%?h %0, [%2, #-4] @ NET_RDP" "str%?h %0, [%2, #-4] @ NET_RDP"
: :
...@@ -60,7 +60,7 @@ static void write_rreg(u_long base, u_int reg, u_int val) ...@@ -60,7 +60,7 @@ static void write_rreg(u_long base, u_int reg, u_int val)
static inline unsigned short read_rreg(u_long base_addr, u_int reg) static inline unsigned short read_rreg(u_long base_addr, u_int reg)
{ {
unsigned short v; unsigned short v;
__asm__( asm volatile(
"str%?h %1, [%2] @ NET_RAP\n\t" "str%?h %1, [%2] @ NET_RAP\n\t"
"ldr%?h %0, [%2, #-4] @ NET_RDP" "ldr%?h %0, [%2, #-4] @ NET_RDP"
: "=r" (v) : "=r" (v)
...@@ -70,7 +70,7 @@ static inline unsigned short read_rreg(u_long base_addr, u_int reg) ...@@ -70,7 +70,7 @@ static inline unsigned short read_rreg(u_long base_addr, u_int reg)
static inline void write_ireg(u_long base, u_int reg, u_int val) static inline void write_ireg(u_long base, u_int reg, u_int val)
{ {
__asm__( asm volatile(
"str%?h %1, [%2] @ NET_RAP\n\t" "str%?h %1, [%2] @ NET_RAP\n\t"
"str%?h %0, [%2, #8] @ NET_IDP" "str%?h %0, [%2, #8] @ NET_IDP"
: :
...@@ -80,7 +80,7 @@ static inline void write_ireg(u_long base, u_int reg, u_int val) ...@@ -80,7 +80,7 @@ static inline void write_ireg(u_long base, u_int reg, u_int val)
static inline unsigned short read_ireg(u_long base_addr, u_int reg) static inline unsigned short read_ireg(u_long base_addr, u_int reg)
{ {
u_short v; u_short v;
__asm__( asm volatile(
"str%?h %1, [%2] @ NAT_RAP\n\t" "str%?h %1, [%2] @ NAT_RAP\n\t"
"ldr%?h %0, [%2, #8] @ NET_IDP\n\t" "ldr%?h %0, [%2, #8] @ NET_IDP\n\t"
: "=r" (v) : "=r" (v)
...@@ -131,7 +131,7 @@ am_readbuffer(struct net_device *dev, u_int offset, unsigned char *buf, unsigned ...@@ -131,7 +131,7 @@ am_readbuffer(struct net_device *dev, u_int offset, unsigned char *buf, unsigned
length = (length + 1) & ~1; length = (length + 1) & ~1;
if ((int)buf & 2) { if ((int)buf & 2) {
unsigned int tmp; unsigned int tmp;
__asm__ __volatile__( asm volatile(
"ldr%?h %2, [%0], #4\n\t" "ldr%?h %2, [%0], #4\n\t"
"str%?b %2, [%1], #1\n\t" "str%?b %2, [%1], #1\n\t"
"mov%? %2, %2, lsr #8\n\t" "mov%? %2, %2, lsr #8\n\t"
...@@ -141,7 +141,7 @@ am_readbuffer(struct net_device *dev, u_int offset, unsigned char *buf, unsigned ...@@ -141,7 +141,7 @@ am_readbuffer(struct net_device *dev, u_int offset, unsigned char *buf, unsigned
} }
while (length > 8) { while (length > 8) {
unsigned int tmp, tmp2, tmp3; unsigned int tmp, tmp2, tmp3;
__asm__ __volatile__( asm volatile(
"ldr%?h %2, [%0], #4\n\t" "ldr%?h %2, [%0], #4\n\t"
"ldr%?h %3, [%0], #4\n\t" "ldr%?h %3, [%0], #4\n\t"
"orr%? %2, %2, %3, lsl #16\n\t" "orr%? %2, %2, %3, lsl #16\n\t"
...@@ -155,7 +155,7 @@ am_readbuffer(struct net_device *dev, u_int offset, unsigned char *buf, unsigned ...@@ -155,7 +155,7 @@ am_readbuffer(struct net_device *dev, u_int offset, unsigned char *buf, unsigned
} }
while (length > 0) { while (length > 0) {
unsigned int tmp; unsigned int tmp;
__asm__ __volatile__( asm volatile(
"ldr%?h %2, [%0], #4\n\t" "ldr%?h %2, [%0], #4\n\t"
"str%?b %2, [%1], #1\n\t" "str%?b %2, [%1], #1\n\t"
"mov%? %2, %2, lsr #8\n\t" "mov%? %2, %2, lsr #8\n\t"
......
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