[3631] in linux-net channel archive

home help back first fref pref prev next nref lref last post

new lance patch

daemon@ATHENA.MIT.EDU (Tekno Soft Snc)
Thu Jul 11 14:43:02 1996

To: linux-net@vger.rutgers.edu
Date: 	Wed, 10 Jul 96 13:32:57 CEST
From: Tekno Soft Snc <MC3641@mclink.it>

Hi all,

this patch reorganize the lance driver when is used with the lance32
option enabled. It free about 6/8Kb.

--- cut here --- cut here --- cut here --- cut here --- cut here --- cut
here
--- linux-2.0.4/drivers/net/lance.old   Wed Jul 10 12:36:42 1996
+++ linux/drivers/net/lance.c   Wed Jul 10 13:23:36 1996
@@ -32,8 +32,6 @@
                                                           SAW
 */
 
-static const char *version = "lance.c:v1.08.02 Mar 17 1996
tsbogend@bigbug.franken.de\n";
-
 #include <linux/config.h>
 #include <linux/kernel.h>
 #include <linux/sched.h>
@@ -53,6 +51,10 @@
 #include <linux/etherdevice.h>
 #include <linux/skbuff.h>
 
+#ifndef CONFIG_LANCE32
+static const char *version = "lance.c:v1.08.02 Mar 17 1996
tsbogend@bigbug.franken.de\n";
+#endif /* CONFIG_LANCE32 */
+
 static unsigned int lance_portlist[] = {0x300, 0x320, 0x340, 0x360, 0};
 void lance_probe1(int ioaddr);
 
@@ -169,6 +171,8 @@
  *
  *     Paul Gortmaker (gpg109@rsphy1.anu.edu.au):
  *     - hopefully fix above so Linux/Alpha can use ISA cards too.
+ *     Roberto Fichera (MC3641@mclink.it):
+ *     - reorganized the code when CONFIG_LANCE32 is used, it free about
6/8Kb
  */
 
 /* Set the number of Tx and Rx buffers, using Log_2(# buffers).
@@ -286,8 +290,10 @@
    Assume yes until we know the memory size. */
 static unsigned char lance_need_isa_bounce_buffers = 1;
 
-static int lance_open(struct device *dev);
 static int lance_open_fail(struct device *dev);
+
+#ifndef CONFIG_LANCE32
+static int lance_open(struct device *dev);
 static void lance_init_ring(struct device *dev);
 static int lance_start_xmit(struct sk_buff *skb, struct device *dev);
 static int lance_rx(struct device *dev);
@@ -295,6 +301,7 @@
 static int lance_close(struct device *dev);
 static struct enet_statistics *lance_get_stats(struct device *dev);
 static void set_multicast_list(struct device *dev);
+#endif /* CONFIG_LANCE32 */
 
 
 
@@ -369,14 +376,16 @@
 void lance_probe1(int ioaddr)
 {
        struct device *dev;
+#ifndef CONFIG_LANCE32
        struct lance_private *lp;
        short dma_channels;                                     /* Mark
spuriously-busy DMA channels */
+       static int did_version = 0;                     /* Already printed
version info. */
+#endif /* CONFIG_LANCE32 */
        int i, reset_val, lance_version;
        const char *chipname;
        /* Flags for specific chips or boards. */
        unsigned char hpJ2405A = 0;                     /* HP ISA adaptor
*/
        int hp_builtin = 0;                                     /* HP
on-board ethernet. */
-       static int did_version = 0;                     /* Already printed
version info. */
 
        /* First we look for special cases.
           Check for HP's on-board ethernet by looking for 'HP' in the
BIOS.
@@ -447,7 +456,7 @@
            lance32_probe1 (dev, chipname, pci_irq_line);
            return;
        }
-#endif    
+#else    
        /* Make certain the data structures used by the LANCE are aligned
and DMAble. */
        lp = (struct lance_private *) LANCE_KMALLOC(sizeof(*lp));
        if (lance_debug > 6) printk(" (#0x%05lx)", (unsigned long)lp);
@@ -600,6 +609,7 @@
        dev->get_stats = lance_get_stats;
        dev->set_multicast_list = set_multicast_list;
 
+#endif /* CONFIG_LANCE32 */
        return;
 }
 
@@ -611,6 +621,7 @@
 
 
 
+#ifndef CONFIG_LANCE32
 static int
 lance_open(struct device *dev)
 {
@@ -684,8 +695,9 @@
                printk("%s: LANCE open after %d ticks, init block %#x csr0
%4.4x.\n",
                           dev->name, i, (u32)
virt_to_bus(&lp->init_block), inw(ioaddr+LANCE_DATA));
 
-       return 0;                                       /* Always succeed
*/
+       return 0;
 }
+#endif /* CONFIG_LANCE32 */
 
 /* The LANCE has been halted for one reason or another (busmaster memory
    arbitration error, Tx FIFO underflow, driver stopped it to
reconfigure,
@@ -699,6 +711,7 @@
    restarting the chip, but I'm too lazy to do so right now. 
dplatt@3do.com
 */
 
+#ifndef CONFIG_LANCE32
 static void 
 lance_purge_tx_ring(struct device *dev)
 {
@@ -712,8 +725,10 @@
                }
        }
 }
+#endif /* CONFIG_LANCE32 */
 
 
+#ifndef CONFIG_LANCE32
 /* Initialize the LANCE Rx and Tx rings. */
 static void
 lance_init_ring(struct device *dev)
@@ -743,7 +758,9 @@
        lp->init_block.rx_ring = ((u32)virt_to_bus(lp->rx_ring) &
0xffffff) | RX_RING_LEN_BITS;
        lp->init_block.tx_ring = ((u32)virt_to_bus(lp->tx_ring) &
0xffffff) | TX_RING_LEN_BITS;
 }
+#endif /* CONFIG_LANCE32 */
 
+#ifndef CONFIG_LANCE32
 static void
 lance_restart(struct device *dev, unsigned int csr0_bits, int
must_reinit)
 {
@@ -757,7 +774,9 @@
        outw(0x0000,    dev->base_addr + LANCE_ADDR);
        outw(csr0_bits, dev->base_addr + LANCE_DATA);
 }
+#endif /* CONFIG_LANCE32 */
 
+#ifndef CONFIG_LANCE32
 static int
 lance_start_xmit(struct sk_buff *skb, struct device *dev)
 {
@@ -880,7 +899,9 @@
 
        return 0;
 }
+#endif /* CONFIG_LANCE32 */
 
+#ifndef CONFIG_LANCE32
 /* The LANCE interrupt handler. */
 static void
 lance_interrupt(int irq, void *dev_id, struct pt_regs * regs)
@@ -1009,7 +1030,9 @@
        dev->interrupt = 0;
        return;
 }
+#endif /* CONFIG_LANCE32 */
 
+#ifndef CONFIG_LANCE32
 static int
 lance_rx(struct device *dev)
 {
@@ -1086,7 +1109,9 @@
 
        return 0;
 }
+#endif /* CONFIG_LANCE32 */
 
+#ifndef CONFIG_LANCE32
 static int
 lance_close(struct device *dev)
 {
@@ -1119,7 +1144,9 @@
 
        return 0;
 }
+#endif /* CONFIG_LANCE32 */
 
+#ifndef CONFIG_LANCE32
 static struct enet_statistics *
 lance_get_stats(struct device *dev)
 {
@@ -1140,8 +1167,11 @@
 
        return &lp->stats;
 }
+#endif /* CONFIG_LANCE32 */
 
-/* Set or clear the multicast filter for this adaptor.
+#ifndef CONFIG_LANCE32
+/* 
+ * Set or clear the multicast filter for this adaptor.
  */
 
 static void set_multicast_list(struct device *dev)
@@ -1175,6 +1205,7 @@
        lance_restart(dev, 0x0142, 0); /*  Resume normal operation */
 
 }
+#endif /* CONFIG_LANCE32 */
 
 
 /*
--- cut here --- cut here --- cut here --- cut here --- cut here --- cut
here

--
Roberto Fichera - email MC3641@mclink.it


home help back first fref pref prev next nref lref last post