diff options
author | Akinobu Mita <akinobu.mita@gmail.com> | 2006-12-19 16:09:08 -0500 |
---|---|---|
committer | Jeff Garzik <jeff@garzik.org> | 2007-02-05 16:58:47 -0500 |
commit | bc63eb9c7ec0eb7b091db2d82d46d1e68ff9e231 (patch) | |
tree | dfcbc44d49a516eb2c95ac2f724fbee52427d0fd /drivers/net/bmac.c | |
parent | 079ca7da1e6d05c7cb82e9c4f2e1d98839332664 (diff) |
net: use bitrev8
Use bitrev8 for bmac, mace, macmace, macsonic, and skfp drivers.
[akpm@osdl.org: use the API, not the array]
Cc: Jeff Garzik <jgarzik@pobox.com>
Cc: Paul Mackerras <paulus@samba.org>
Cc: Mirko Lindner <mlindner@syskonnect.de>
Cc: Thomas Bogendoerfer <tsbogend@alpha.franken.de>
Signed-off-by: Akinobu Mita <akinobu.mita@gmail.com>
Signed-off-by: Andrew Morton <akpm@osdl.org>
Signed-off-by: Jeff Garzik <jeff@garzik.org>
Diffstat (limited to 'drivers/net/bmac.c')
-rw-r--r-- | drivers/net/bmac.c | 20 |
1 files changed, 4 insertions, 16 deletions
diff --git a/drivers/net/bmac.c b/drivers/net/bmac.c index 4528ce9c4e43..c143304dcff5 100644 --- a/drivers/net/bmac.c +++ b/drivers/net/bmac.c | |||
@@ -18,6 +18,7 @@ | |||
18 | #include <linux/init.h> | 18 | #include <linux/init.h> |
19 | #include <linux/spinlock.h> | 19 | #include <linux/spinlock.h> |
20 | #include <linux/crc32.h> | 20 | #include <linux/crc32.h> |
21 | #include <linux/bitrev.h> | ||
21 | #include <asm/prom.h> | 22 | #include <asm/prom.h> |
22 | #include <asm/dbdma.h> | 23 | #include <asm/dbdma.h> |
23 | #include <asm/io.h> | 24 | #include <asm/io.h> |
@@ -140,7 +141,6 @@ static unsigned char *bmac_emergency_rxbuf; | |||
140 | + (N_RX_RING + N_TX_RING + 4) * sizeof(struct dbdma_cmd) \ | 141 | + (N_RX_RING + N_TX_RING + 4) * sizeof(struct dbdma_cmd) \ |
141 | + sizeof(struct sk_buff_head)) | 142 | + sizeof(struct sk_buff_head)) |
142 | 143 | ||
143 | static unsigned char bitrev(unsigned char b); | ||
144 | static int bmac_open(struct net_device *dev); | 144 | static int bmac_open(struct net_device *dev); |
145 | static int bmac_close(struct net_device *dev); | 145 | static int bmac_close(struct net_device *dev); |
146 | static int bmac_transmit_packet(struct sk_buff *skb, struct net_device *dev); | 146 | static int bmac_transmit_packet(struct sk_buff *skb, struct net_device *dev); |
@@ -586,18 +586,6 @@ bmac_construct_rxbuff(struct sk_buff *skb, volatile struct dbdma_cmd *cp) | |||
586 | virt_to_bus(addr), 0); | 586 | virt_to_bus(addr), 0); |
587 | } | 587 | } |
588 | 588 | ||
589 | /* Bit-reverse one byte of an ethernet hardware address. */ | ||
590 | static unsigned char | ||
591 | bitrev(unsigned char b) | ||
592 | { | ||
593 | int d = 0, i; | ||
594 | |||
595 | for (i = 0; i < 8; ++i, b >>= 1) | ||
596 | d = (d << 1) | (b & 1); | ||
597 | return d; | ||
598 | } | ||
599 | |||
600 | |||
601 | static void | 589 | static void |
602 | bmac_init_tx_ring(struct bmac_data *bp) | 590 | bmac_init_tx_ring(struct bmac_data *bp) |
603 | { | 591 | { |
@@ -1224,8 +1212,8 @@ bmac_get_station_address(struct net_device *dev, unsigned char *ea) | |||
1224 | { | 1212 | { |
1225 | reset_and_select_srom(dev); | 1213 | reset_and_select_srom(dev); |
1226 | data = read_srom(dev, i + EnetAddressOffset/2, SROMAddressBits); | 1214 | data = read_srom(dev, i + EnetAddressOffset/2, SROMAddressBits); |
1227 | ea[2*i] = bitrev(data & 0x0ff); | 1215 | ea[2*i] = bitrev8(data & 0x0ff); |
1228 | ea[2*i+1] = bitrev((data >> 8) & 0x0ff); | 1216 | ea[2*i+1] = bitrev8((data >> 8) & 0x0ff); |
1229 | } | 1217 | } |
1230 | } | 1218 | } |
1231 | 1219 | ||
@@ -1315,7 +1303,7 @@ static int __devinit bmac_probe(struct macio_dev *mdev, const struct of_device_i | |||
1315 | 1303 | ||
1316 | rev = addr[0] == 0 && addr[1] == 0xA0; | 1304 | rev = addr[0] == 0 && addr[1] == 0xA0; |
1317 | for (j = 0; j < 6; ++j) | 1305 | for (j = 0; j < 6; ++j) |
1318 | dev->dev_addr[j] = rev? bitrev(addr[j]): addr[j]; | 1306 | dev->dev_addr[j] = rev ? bitrev8(addr[j]): addr[j]; |
1319 | 1307 | ||
1320 | /* Enable chip without interrupts for now */ | 1308 | /* Enable chip without interrupts for now */ |
1321 | bmac_enable_and_reset_chip(dev); | 1309 | bmac_enable_and_reset_chip(dev); |