All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH 6/6] atm/ambassador: use bitrev8
@ 2006-10-18 16:49 Akinobu Mita
  0 siblings, 0 replies; only message in thread
From: Akinobu Mita @ 2006-10-18 16:49 UTC (permalink / raw)
  To: linux-kernel; +Cc: Chas Williams, Giuliano Procida at Madge Networks

Use bitrev8 for ambassador driver.

Cc: Chas Williams <linux-atm-general@lists.sourceforge.net>
Cc: Giuliano Procida at Madge Networks <gprocida@madge.com>
Signed-off-by: Akinobu Mita <akinobu.mita@gmail.com>

 drivers/atm/Kconfig      |    1 +
 drivers/atm/ambassador.c |   17 +++--------------
 2 files changed, 4 insertions(+), 14 deletions(-)

Index: work-fault-inject/drivers/atm/ambassador.c
===================================================================
--- work-fault-inject.orig/drivers/atm/ambassador.c
+++ work-fault-inject/drivers/atm/ambassador.c
@@ -32,6 +32,7 @@
 #include <linux/delay.h>
 #include <linux/interrupt.h>
 #include <linux/poison.h>
+#include <linux/bitrev.h>
 
 #include <asm/atomic.h>
 #include <asm/io.h>
@@ -2068,18 +2069,6 @@ static void __devinit amb_ucode_version 
   PRINTK (KERN_INFO, "microcode version is %u.%u", major, minor);
 }
   
-// swap bits within byte to get Ethernet ordering
-static u8 bit_swap (u8 byte)
-{
-    const u8 swap[] = {
-      0x0, 0x8, 0x4, 0xc,
-      0x2, 0xa, 0x6, 0xe,
-      0x1, 0x9, 0x5, 0xd,
-      0x3, 0xb, 0x7, 0xf
-    };
-    return ((swap[byte & 0xf]<<4) | swap[byte>>4]);
-}
-
 // get end station address
 static void __devinit amb_esi (amb_dev * dev, u8 * esi) {
   u32 lower4;
@@ -2101,9 +2090,9 @@ static void __devinit amb_esi (amb_dev *
     PRINTDB (DBG_INIT, "ESI:");
     for (i = 0; i < ESI_LEN; ++i) {
       if (i < 4)
-	  esi[i] = bit_swap (lower4>>(8*i));
+	  esi[i] = bitrev8(lower4>>(8*i));
       else
-	  esi[i] = bit_swap (upper2>>(8*(i-4)));
+	  esi[i] = bitrev8(upper2>>(8*(i-4)));
       PRINTDM (DBG_INIT, " %02x", esi[i]);
     }
     
Index: work-fault-inject/drivers/atm/Kconfig
===================================================================
--- work-fault-inject.orig/drivers/atm/Kconfig
+++ work-fault-inject/drivers/atm/Kconfig
@@ -242,6 +242,7 @@ config ATM_IDT77252_USE_SUNI
 config ATM_AMBASSADOR
 	tristate "Madge Ambassador (Collage PCI 155 Server)"
 	depends on PCI && ATM
+	select BITREVERSE
 	help
 	  This is a driver for ATMizer based ATM card produced by Madge
 	  Networks Ltd. Say Y (or M to compile as a module named ambassador)

^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2006-10-18 16:48 UTC | newest]

Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2006-10-18 16:49 [PATCH 6/6] atm/ambassador: use bitrev8 Akinobu Mita

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.