diff options
-rw-r--r-- | drivers/net/mac8390.c | 31 |
1 files changed, 14 insertions, 17 deletions
diff --git a/drivers/net/mac8390.c b/drivers/net/mac8390.c index d8c99f038fa0..06cb460361a8 100644 --- a/drivers/net/mac8390.c +++ b/drivers/net/mac8390.c | |||
@@ -559,55 +559,52 @@ static void mac8390_no_reset(struct net_device *dev) | |||
559 | /* directly from daynaport.c by Alan Cox */ | 559 | /* directly from daynaport.c by Alan Cox */ |
560 | static void dayna_memcpy_fromcard(struct net_device *dev, void *to, int from, int count) | 560 | static void dayna_memcpy_fromcard(struct net_device *dev, void *to, int from, int count) |
561 | { | 561 | { |
562 | volatile unsigned short *ptr; | 562 | volatile unsigned char *ptr; |
563 | unsigned short *target=to; | 563 | unsigned char *target=to; |
564 | from<<=1; /* word, skip overhead */ | 564 | from<<=1; /* word, skip overhead */ |
565 | ptr=(unsigned short *)(dev->mem_start+from); | 565 | ptr=(unsigned char *)(dev->mem_start+from); |
566 | /* Leading byte? */ | 566 | /* Leading byte? */ |
567 | if (from&2) { | 567 | if (from&2) { |
568 | *((char *)target)++ = *(((char *)ptr++)-1); | 568 | *target++ = ptr[-1]; |
569 | ptr += 2; | ||
569 | count--; | 570 | count--; |
570 | } | 571 | } |
571 | while(count>=2) | 572 | while(count>=2) |
572 | { | 573 | { |
573 | *target++=*ptr++; /* Copy and */ | 574 | *(unsigned short *)target = *(unsigned short volatile *)ptr; |
574 | ptr++; /* skip cruft */ | 575 | ptr += 4; /* skip cruft */ |
576 | target += 2; | ||
575 | count-=2; | 577 | count-=2; |
576 | } | 578 | } |
577 | /* Trailing byte? */ | 579 | /* Trailing byte? */ |
578 | if(count) | 580 | if(count) |
579 | { | 581 | *target = *ptr; |
580 | /* Big endian */ | ||
581 | unsigned short v=*ptr; | ||
582 | *((char *)target)=v>>8; | ||
583 | } | ||
584 | } | 582 | } |
585 | 583 | ||
586 | static void dayna_memcpy_tocard(struct net_device *dev, int to, const void *from, int count) | 584 | static void dayna_memcpy_tocard(struct net_device *dev, int to, const void *from, int count) |
587 | { | 585 | { |
588 | volatile unsigned short *ptr; | 586 | volatile unsigned short *ptr; |
589 | const unsigned short *src=from; | 587 | const unsigned char *src=from; |
590 | to<<=1; /* word, skip overhead */ | 588 | to<<=1; /* word, skip overhead */ |
591 | ptr=(unsigned short *)(dev->mem_start+to); | 589 | ptr=(unsigned short *)(dev->mem_start+to); |
592 | /* Leading byte? */ | 590 | /* Leading byte? */ |
593 | if (to&2) { /* avoid a byte write (stomps on other data) */ | 591 | if (to&2) { /* avoid a byte write (stomps on other data) */ |
594 | ptr[-1] = (ptr[-1]&0xFF00)|*((unsigned char *)src)++; | 592 | ptr[-1] = (ptr[-1]&0xFF00)|*src++; |
595 | ptr++; | 593 | ptr++; |
596 | count--; | 594 | count--; |
597 | } | 595 | } |
598 | while(count>=2) | 596 | while(count>=2) |
599 | { | 597 | { |
600 | *ptr++=*src++; /* Copy and */ | 598 | *ptr++=*(unsigned short *)src; /* Copy and */ |
601 | ptr++; /* skip cruft */ | 599 | ptr++; /* skip cruft */ |
600 | src += 2; | ||
602 | count-=2; | 601 | count-=2; |
603 | } | 602 | } |
604 | /* Trailing byte? */ | 603 | /* Trailing byte? */ |
605 | if(count) | 604 | if(count) |
606 | { | 605 | { |
607 | /* Big endian */ | ||
608 | unsigned short v=*src; | ||
609 | /* card doesn't like byte writes */ | 606 | /* card doesn't like byte writes */ |
610 | *ptr=(*ptr&0x00FF)|(v&0xFF00); | 607 | *ptr=(*ptr&0x00FF)|(*src << 8); |
611 | } | 608 | } |
612 | } | 609 | } |
613 | 610 | ||