提交 09cc07a5 编写于 作者: A Al Viro 提交者: Linus Torvalds

[PATCH] m68k: lvalues abuse in mac8390

Cast is not an lvalue
Signed-off-by: NAl Viro <viro@zeniv.linux.org.uk>
Cc: Roman Zippel <zippel@linux-m68k.org>
Signed-off-by: NAndrew Morton <akpm@osdl.org>
Signed-off-by: NLinus Torvalds <torvalds@osdl.org>
上级 0efb7134
...@@ -559,55 +559,52 @@ static void mac8390_no_reset(struct net_device *dev) ...@@ -559,55 +559,52 @@ static void mac8390_no_reset(struct net_device *dev)
/* directly from daynaport.c by Alan Cox */ /* directly from daynaport.c by Alan Cox */
static void dayna_memcpy_fromcard(struct net_device *dev, void *to, int from, int count) static void dayna_memcpy_fromcard(struct net_device *dev, void *to, int from, int count)
{ {
volatile unsigned short *ptr; volatile unsigned char *ptr;
unsigned short *target=to; unsigned char *target=to;
from<<=1; /* word, skip overhead */ from<<=1; /* word, skip overhead */
ptr=(unsigned short *)(dev->mem_start+from); ptr=(unsigned char *)(dev->mem_start+from);
/* Leading byte? */ /* Leading byte? */
if (from&2) { if (from&2) {
*((char *)target)++ = *(((char *)ptr++)-1); *target++ = ptr[-1];
ptr += 2;
count--; count--;
} }
while(count>=2) while(count>=2)
{ {
*target++=*ptr++; /* Copy and */ *(unsigned short *)target = *(unsigned short volatile *)ptr;
ptr++; /* skip cruft */ ptr += 4; /* skip cruft */
target += 2;
count-=2; count-=2;
} }
/* Trailing byte? */ /* Trailing byte? */
if(count) if(count)
{ *target = *ptr;
/* Big endian */
unsigned short v=*ptr;
*((char *)target)=v>>8;
}
} }
static void dayna_memcpy_tocard(struct net_device *dev, int to, const void *from, int count) static void dayna_memcpy_tocard(struct net_device *dev, int to, const void *from, int count)
{ {
volatile unsigned short *ptr; volatile unsigned short *ptr;
const unsigned short *src=from; const unsigned char *src=from;
to<<=1; /* word, skip overhead */ to<<=1; /* word, skip overhead */
ptr=(unsigned short *)(dev->mem_start+to); ptr=(unsigned short *)(dev->mem_start+to);
/* Leading byte? */ /* Leading byte? */
if (to&2) { /* avoid a byte write (stomps on other data) */ if (to&2) { /* avoid a byte write (stomps on other data) */
ptr[-1] = (ptr[-1]&0xFF00)|*((unsigned char *)src)++; ptr[-1] = (ptr[-1]&0xFF00)|*src++;
ptr++; ptr++;
count--; count--;
} }
while(count>=2) while(count>=2)
{ {
*ptr++=*src++; /* Copy and */ *ptr++=*(unsigned short *)src; /* Copy and */
ptr++; /* skip cruft */ ptr++; /* skip cruft */
src += 2;
count-=2; count-=2;
} }
/* Trailing byte? */ /* Trailing byte? */
if(count) if(count)
{ {
/* Big endian */
unsigned short v=*src;
/* card doesn't like byte writes */ /* card doesn't like byte writes */
*ptr=(*ptr&0x00FF)|(v&0xFF00); *ptr=(*ptr&0x00FF)|(*src << 8);
} }
} }
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册