summaryrefslogtreecommitdiffstats
path: root/drivers
diff options
context:
space:
mode:
authorBen Dooks <ben-linux@fluff.org>2008-02-05 00:02:00 +0000
committerJeff Garzik <jeff@garzik.org>2008-02-11 11:05:15 -0500
commit931165739a75f88530d5b02cafaacf9bb6b66d87 (patch)
tree68bc8dfb4a0d89c106ae6462384088fb8f7f171c /drivers
parenta8cc21f64648073e443365d113c55755b92622a6 (diff)
downloadop-kernel-dev-931165739a75f88530d5b02cafaacf9bb6b66d87.zip
op-kernel-dev-931165739a75f88530d5b02cafaacf9bb6b66d87.tar.gz
DM9000: Fix endian-ness of data accesses.
Patch from: Laurent Pinchart <laurentp@cse-semaphore.com> This patch splits the receive status in 8bit wide fields and convert the packet length from little endian to CPU byte order. Signed-off-by: Laurent Pinchart <laurentp@cse-semaphore.com> Signed-off-by: Ben Dooks <ben-linux@fluff.org> Signed-off-by: Jeff Garzik <jeff@garzik.org>
Diffstat (limited to 'drivers')
-rw-r--r--drivers/net/dm9000.c13
1 files changed, 7 insertions, 6 deletions
diff --git a/drivers/net/dm9000.c b/drivers/net/dm9000.c
index 6a20a54..e4390d9 100644
--- a/drivers/net/dm9000.c
+++ b/drivers/net/dm9000.c
@@ -867,7 +867,8 @@ dm9000_timer(unsigned long data)
}
struct dm9000_rxhdr {
- u16 RxStatus;
+ u8 RxPktReady;
+ u8 RxStatus;
u16 RxLen;
} __attribute__((__packed__));
@@ -908,7 +909,7 @@ dm9000_rx(struct net_device *dev)
(db->inblk)(db->io_data, &rxhdr, sizeof(rxhdr));
- RxLen = rxhdr.RxLen;
+ RxLen = le16_to_cpu(rxhdr.RxLen);
/* Packet Status check */
if (RxLen < 0x40) {
@@ -920,17 +921,17 @@ dm9000_rx(struct net_device *dev)
PRINTK1("RST: RX Len:%x\n", RxLen);
}
- if (rxhdr.RxStatus & 0xbf00) {
+ if (rxhdr.RxStatus & 0xbf) {
GoodPacket = false;
- if (rxhdr.RxStatus & 0x100) {
+ if (rxhdr.RxStatus & 0x01) {
PRINTK1("fifo error\n");
dev->stats.rx_fifo_errors++;
}
- if (rxhdr.RxStatus & 0x200) {
+ if (rxhdr.RxStatus & 0x02) {
PRINTK1("crc error\n");
dev->stats.rx_crc_errors++;
}
- if (rxhdr.RxStatus & 0x8000) {
+ if (rxhdr.RxStatus & 0x80) {
PRINTK1("length error\n");
dev->stats.rx_length_errors++;
}
OpenPOWER on IntegriCloud