From: Hans Grobler (rgne.fenertdf@gibliestal.ch)
Date: Thu Dec 07 2000 - 09:36:17 EET
patch version 2:
- scc_net_header: Removed unnecessary function. Use ax25_encapsulate
directly as is done for ax25_rebuild_header.
- scc_cli,scc_sti: Remove unused functions.
patch version 1:
- scc_cleanup_driver: For the case when the driver is loaded and
immediately unload, fix the memory leak of scc->dev.
- scc_cleanup_driver: The NULL check during channel deregistering is not
sufficient. The pointer 'scc' will never be NULL as it points to
a static structure. To prevent invalid release_region calls, check
to see if the ports where requested (i.e. ->ctrl != 0).
diff -u3Nr -X dontdiff linux-2.4.0-test12-pre7.orig/drivers/net/hamradio/scc.c linux-2.4.0-test12-pre7/drivers/net/hamradio/scc.c
--- linux-2.4.0-test12-pre7.orig/drivers/net/hamradio/scc.c Thu Oct 12 23:05:34 2000
+++ linux-2.4.0-test12-pre7/drivers/net/hamradio/scc.c Thu Dec 7 08:56:21 2000
@@ -142,8 +142,7 @@
#define SCC_MAXCHIPS 4 /* number of max. supported chips */
#define SCC_BUFSIZE 384 /* must not exceed 4096 */
-#undef SCC_DISABLE_ALL_INTS /* use cli()/sti() in ISR instead of */
- /* enable_irq()/disable_irq() */
+
#undef SCC_DEBUG
#define SCC_DEFAULT_CLOCK 4915200
@@ -192,8 +191,6 @@
void cleanup_module(void);
#endif
-int scc_init(void);
-
static void t_dwait(unsigned long);
static void t_txdelay(unsigned long);
static void t_tail(unsigned long);
@@ -220,7 +217,6 @@
static int scc_net_tx(struct sk_buff *skb, struct net_device *dev);
static int scc_net_ioctl(struct net_device *dev, struct ifreq *ifr, int cmd);
static int scc_net_set_mac_address(struct net_device *dev, void *addr);
-static int scc_net_header(struct sk_buff *skb, struct net_device *dev, unsigned short type, void *daddr, void *saddr, unsigned len);
static struct net_device_stats * scc_net_get_stats(struct net_device *dev);
static unsigned char *SCC_DriverName = "scc";
@@ -298,18 +294,6 @@
OutReg(scc->ctrl, reg, (scc->wreg[reg] &= ~val));
}
-#ifdef SCC_DISABLE_ALL_INTS
-static inline void scc_cli(int irq)
-{ cli(); }
-static inline void scc_sti(int irq)
-{ sti(); }
-#else
-static inline void scc_cli(int irq)
-{ disable_irq(irq); }
-static inline void scc_sti(int irq)
-{ enable_irq(irq); }
-#endif
-
/* ******************************************************************** */
/* * Some useful macros * */
/* ******************************************************************** */
@@ -1604,7 +1588,7 @@
dev->stop = scc_net_close;
dev->hard_start_xmit = scc_net_tx;
- dev->hard_header = scc_net_header;
+ dev->hard_header = ax25_encapsulate;
dev->rebuild_header = ax25_rebuild_header;
dev->set_mac_address = scc_net_set_mac_address;
dev->get_stats = scc_net_get_stats;
@@ -2001,14 +1985,6 @@
return 0;
}
-/* ----> "hard" header <---- */
-
-static int scc_net_header(struct sk_buff *skb, struct net_device *dev,
- unsigned short type, void *daddr, void *saddr, unsigned len)
-{
- return ax25_encapsulate(skb, dev, type, daddr, saddr, len);
-}
-
/* ----> get statistics <---- */
static struct net_device_stats *scc_net_get_stats(struct net_device *dev)
@@ -2193,7 +2169,10 @@
cli();
if (Nchips == 0)
+ {
unregister_netdev(SCC_Info[0].dev);
+ kfree(SCC_Info[0].dev);
+ }
for (k = 0; k < Nchips; k++)
if ( (ctrl = SCC_ctrl[k].chan_A) )
@@ -2206,15 +2185,15 @@
for (k = 0; k < Nchips*2; k++)
{
scc = &SCC_Info[k];
- if (scc)
+ if (scc->ctrl)
{
release_region(scc->ctrl, 1);
release_region(scc->data, 1);
- if (scc->dev)
- {
- unregister_netdev(scc->dev);
- kfree(scc->dev);
- }
+ }
+ if (scc->dev)
+ {
+ unregister_netdev(scc->dev);
+ kfree(scc->dev);
}
}
-
To unsubscribe from this list: send the line "unsubscribe linux-hams" in
the body of a message to icg.mkanydbg@usg.com
This archive was generated by hypermail 2b30 : Thu Dec 07 2000 - 09:56:56 EET