Re: [PATCH 4/6] net: use bitrev8

2006-10-20 Thread Michael Tokarev
Andrew Morton wrote:
 On Thu, 19 Oct 2006 01:46:47 +0900
 Akinobu Mita [EMAIL PROTECTED] wrote:
 
 Use bitrev8 for bmac, mace, macmace, macsonic, and skfp drivers.

[]
 ===
 --- work-fault-inject.orig/drivers/net/Kconfig
 +++ work-fault-inject/drivers/net/Kconfig
 @@ -2500,6 +2500,7 @@ config DEFXX
  config SKFP
  tristate SysKonnect FDDI PCI support
  depends on FDDI  PCI
 +select BITREVERSE
  ---help---
Say Y here if you have a SysKonnect FDDI PCI adapter.
The following adapters are supported by this driver:
 
[]
 But select is problematic and I do wonder whether it'd be simpler to just
 link the thing into vmlinux.

Why it's problematic?  Maintenance costs of various missing selects?
I don't want extra stuff in kernel (vmlinux) if it's not used.

/mjt
-
To unsubscribe from this list: send the line unsubscribe netdev in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [PATCH 4/6] net: use bitrev8

2006-10-19 Thread Andrew Morton
On Thu, 19 Oct 2006 01:46:47 +0900
Akinobu Mita [EMAIL PROTECTED] wrote:

 Use bitrev8 for bmac, mace, macmace, macsonic, and skfp drivers.
 
 Cc: Jeff Garzik [EMAIL PROTECTED]
 Cc: Paul Mackerras [EMAIL PROTECTED]
 Cc: Mirko Lindner [EMAIL PROTECTED]
 Cc: Thomas Bogendoerfer [EMAIL PROTECTED]
 Signed-off-by: Akinobu Mita [EMAIL PROTECTED]
 
  drivers/net/Kconfig|1 
  drivers/net/bmac.c |   20 ++
  drivers/net/mace.c |   16 +---
  drivers/net/macmace.c  |   18 +
  drivers/net/macsonic.c |6 ---
  drivers/net/skfp/can.c |   83 
 -
  drivers/net/skfp/drvfbi.c  |   21 ---
  drivers/net/skfp/fplustm.c |4 +-
  drivers/net/skfp/smt.c |7 +--

A bunch of drivers.

 ===
 --- work-fault-inject.orig/drivers/net/Kconfig
 +++ work-fault-inject/drivers/net/Kconfig
 @@ -2500,6 +2500,7 @@ config DEFXX
  config SKFP
   tristate SysKonnect FDDI PCI support
   depends on FDDI  PCI
 + select BITREVERSE
   ---help---
 Say Y here if you have a SysKonnect FDDI PCI adapter.
 The following adapters are supported by this driver:

But only one of them selects the library.

The patchset adds a large number of `select' statements.  afaict everything
_seems_ to work OK with that (as long as all the needed selects are there).

But select is problematic and I do wonder whether it'd be simpler to just
link the thing into vmlinux.

Oh well, we'll see how it goes.

-
To unsubscribe from this list: send the line unsubscribe netdev in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [PATCH 4/6] net: use bitrev8

2006-10-19 Thread Akinobu Mita
On Thu, Oct 19, 2006 at 01:39:51PM -0700, Andrew Morton wrote:

 A bunch of drivers.
 
  ===
  --- work-fault-inject.orig/drivers/net/Kconfig
  +++ work-fault-inject/drivers/net/Kconfig
  @@ -2500,6 +2500,7 @@ config DEFXX
   config SKFP
  tristate SysKonnect FDDI PCI support
  depends on FDDI  PCI
  +   select BITREVERSE
  ---help---
Say Y here if you have a SysKonnect FDDI PCI adapter.
The following adapters are supported by this driver:
 
 But only one of them selects the library.

Other drivers already select CRC32 and CRC32 selects BITREVERSE.

 But select is problematic and I do wonder whether it'd be simpler to just
 link the thing into vmlinux.

OK. I'll try.

-
To unsubscribe from this list: send the line unsubscribe netdev in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH 4/6] net: use bitrev8

2006-10-18 Thread Akinobu Mita
Use bitrev8 for bmac, mace, macmace, macsonic, and skfp drivers.

Cc: Jeff Garzik [EMAIL PROTECTED]
Cc: Paul Mackerras [EMAIL PROTECTED]
Cc: Mirko Lindner [EMAIL PROTECTED]
Cc: Thomas Bogendoerfer [EMAIL PROTECTED]
Signed-off-by: Akinobu Mita [EMAIL PROTECTED]

 drivers/net/Kconfig|1 
 drivers/net/bmac.c |   20 ++
 drivers/net/mace.c |   16 +---
 drivers/net/macmace.c  |   18 +
 drivers/net/macsonic.c |6 ---
 drivers/net/skfp/can.c |   83 -
 drivers/net/skfp/drvfbi.c  |   21 ---
 drivers/net/skfp/fplustm.c |4 +-
 drivers/net/skfp/smt.c |7 +--
 9 files changed, 25 insertions(+), 151 deletions(-)

Index: work-fault-inject/drivers/net/bmac.c
===
--- work-fault-inject.orig/drivers/net/bmac.c
+++ work-fault-inject/drivers/net/bmac.c
@@ -18,6 +18,7 @@
 #include linux/init.h
 #include linux/spinlock.h
 #include linux/crc32.h
+#include linux/bitrev.h
 #include asm/prom.h
 #include asm/dbdma.h
 #include asm/io.h
@@ -140,7 +141,6 @@ static unsigned char *bmac_emergency_rxb
+ (N_RX_RING + N_TX_RING + 4) * sizeof(struct dbdma_cmd) \
+ sizeof(struct sk_buff_head))
 
-static unsigned char bitrev(unsigned char b);
 static int bmac_open(struct net_device *dev);
 static int bmac_close(struct net_device *dev);
 static int bmac_transmit_packet(struct sk_buff *skb, struct net_device *dev);
@@ -586,18 +586,6 @@ bmac_construct_rxbuff(struct sk_buff *sk
 virt_to_bus(addr), 0);
 }
 
-/* Bit-reverse one byte of an ethernet hardware address. */
-static unsigned char
-bitrev(unsigned char b)
-{
-   int d = 0, i;
-
-   for (i = 0; i  8; ++i, b = 1)
-   d = (d  1) | (b  1);
-   return d;
-}
-
-
 static void
 bmac_init_tx_ring(struct bmac_data *bp)
 {
@@ -1224,8 +1212,8 @@ bmac_get_station_address(struct net_devi
{
reset_and_select_srom(dev);
data = read_srom(dev, i + EnetAddressOffset/2, 
SROMAddressBits);
-   ea[2*i]   = bitrev(data  0x0ff);
-   ea[2*i+1] = bitrev((data  8)  0x0ff);
+   ea[2*i]   = bitrev8(data  0x0ff);
+   ea[2*i+1] = bitrev8((data  8)  0x0ff);
}
 }
 
@@ -1315,7 +1303,7 @@ static int __devinit bmac_probe(struct m
 
rev = addr[0] == 0  addr[1] == 0xA0;
for (j = 0; j  6; ++j)
-   dev-dev_addr[j] = rev? bitrev(addr[j]): addr[j];
+   dev-dev_addr[j] = rev ? bitrev8(addr[j]): addr[j];
 
/* Enable chip without interrupts for now */
bmac_enable_and_reset_chip(dev);
Index: work-fault-inject/drivers/net/mace.c
===
--- work-fault-inject.orig/drivers/net/mace.c
+++ work-fault-inject/drivers/net/mace.c
@@ -15,6 +15,7 @@
 #include linux/init.h
 #include linux/crc32.h
 #include linux/spinlock.h
+#include linux/bitrev.h
 #include asm/prom.h
 #include asm/dbdma.h
 #include asm/io.h
@@ -74,7 +75,6 @@ struct mace_data {
 #define PRIV_BYTES (sizeof(struct mace_data) \
+ (N_RX_RING + NCMDS_TX * N_TX_RING + 3) * sizeof(struct dbdma_cmd))
 
-static int bitrev(int);
 static int mace_open(struct net_device *dev);
 static int mace_close(struct net_device *dev);
 static int mace_xmit_start(struct sk_buff *skb, struct net_device *dev);
@@ -96,18 +96,6 @@ static void __mace_set_address(struct ne
  */
 static unsigned char *dummy_buf;
 
-/* Bit-reverse one byte of an ethernet hardware address. */
-static inline int
-bitrev(int b)
-{
-int d = 0, i;
-
-for (i = 0; i  8; ++i, b = 1)
-   d = (d  1) | (b  1);
-return d;
-}
-
-
 static int __devinit mace_probe(struct macio_dev *mdev, const struct 
of_device_id *match)
 {
struct device_node *mace = macio_get_of_node(mdev);
@@ -173,7 +161,7 @@ static int __devinit mace_probe(struct m
 
rev = addr[0] == 0  addr[1] == 0xA0;
for (j = 0; j  6; ++j) {
-   dev-dev_addr[j] = rev? bitrev(addr[j]): addr[j];
+   dev-dev_addr[j] = rev ? bitrev8(addr[j]): addr[j];
}
mp-chipid = (in_8(mp-mace-chipid_hi)  8) |
in_8(mp-mace-chipid_lo);
Index: work-fault-inject/drivers/net/macmace.c
===
--- work-fault-inject.orig/drivers/net/macmace.c
+++ work-fault-inject/drivers/net/macmace.c
@@ -22,6 +22,7 @@
 #include linux/delay.h
 #include linux/string.h
 #include linux/crc32.h
+#include linux/bitrev.h
 #include asm/io.h
 #include asm/pgtable.h
 #include asm/irq.h
@@ -81,19 +82,6 @@ static irqreturn_t mace_interrupt(int ir
 static irqreturn_t mace_dma_intr(int irq, void *dev_id);
 static void mace_tx_timeout(struct net_device *dev);
 
-/* Bit-reverse one byte of an ethernet hardware address. */
-
-static int bitrev(int b)
-{
-