From: Hans Grobler (spkblk.erxspt@ediscom.de)
Date: Sun Dec 10 2000 - 17:49:30 EET
yam.c-2.4.0-test12-pre7-patch-v2:
- yam_data,yam_init_driver: removed explicit data initialization as per
linux2.4 style '.bss' clearing.
- yam_drvinfo: tagged initialization data for later ejection.
- yam_rx_flag,yam_rx_byte: fixed static inline definition order
- yam_send_packet: removed unnecessary skb == NULL check. the
network layer will never pass a NULL skbuff
- yam_net_procfs_init,yam_net_procfs_remove: removed unnecessary
conditional macros. the linux2.4 proc headers already handle this.
patch version 1:
- yam_init,init_module,cleanup_module: converted to use new linux2.4
module definition format.
- free_mcs: merged into yam_cleanup_driver (and get rid of conditional
compile flag)
- irqs array: removed unnecessary variable
diff -u3Nr -X dontdiff linux-2.4.0-test12-pre7.orig/drivers/net/hamradio/yam.c linux-2.4.0-test12-pre7/drivers/net/hamradio/yam.c
--- linux-2.4.0-test12-pre7.orig/drivers/net/hamradio/yam.c Thu May 4 20:31:21 2000
+++ linux-2.4.0-test12-pre7/drivers/net/hamradio/yam.c Sun Dec 10 11:28:13 2000
@@ -81,7 +81,7 @@
/* --------------------------------------------------------------------- */
static const char yam_drvname[] = "yam";
-static const char yam_drvinfo[] = KERN_INFO "YAM driver version 0.8 by F1OAT/F6FBB\n";
+static const char yam_drvinfo[] __initdata = KERN_INFO "YAM driver version 0.8 by F1OAT/F6FBB\n";
/* --------------------------------------------------------------------- */
@@ -160,9 +160,7 @@
static struct yam_port yam_ports[NR_PORTS];
-static struct yam_mcs *yam_data = NULL;
-
-static unsigned irqs[16];
+static struct yam_mcs *yam_data;
static char ax25_bcast[7] =
{'Q' << 1, 'S' << 1, 'T' << 1, ' ' << 1, ' ' << 1, ' ' << 1, '0' << 1};
@@ -357,19 +355,6 @@
return 0;
}
-#ifdef MODULE
-static void free_mcs(void)
-{
- struct yam_mcs *p;
-
- while (yam_data) {
- p = yam_data;
- yam_data = yam_data->next;
- kfree(p);
- }
-}
-#endif
-
static unsigned char *
add_mcs(unsigned char *bits, int bitrate)
{
@@ -523,7 +508,7 @@
/******************************************************************************
* Rx Section
******************************************************************************/
-static void inline
+static inline void
yam_rx_flag(struct net_device *dev, struct yam_port *yp)
{
if (yp->dcd && yp->rx_len >= 3 && yp->rx_len < YAM_MAX_FRAME) {
@@ -554,7 +539,7 @@
yp->rx_crch = 0xf3;
}
-static void inline
+static inline void
yam_rx_byte(struct net_device *dev, struct yam_port *yp, unsigned char rxb)
{
if (yp->rx_len < YAM_MAX_FRAME) {
@@ -583,9 +568,6 @@
{
struct yam_port *yp = dev->priv;
- if (skb == NULL) {
- return 0;
- }
skb_queue_tail(&yp->send_queue, skb);
dev->trans_start = jiffies;
return 0;
@@ -833,19 +815,6 @@
return len;
}
-#ifdef CONFIG_INET
-#ifdef CONFIG_PROC_FS
-#define yam_net_procfs_init() proc_net_create("yam",0,yam_net_get_info)
-#define yam_net_procfs_remove() proc_net_remove("yam")
-#else
-#define yam_net_procfs_init()
-#define yam_net_procfs_remove()
-#endif /* CONFIG_PROC_FS */
-#else
-#define yam_net_procfs_init()
-#define yam_net_procfs_remove()
-#endif /* CONFIG_INET */
-
/* --------------------------------------------------------------------- */
static struct net_device_stats *yam_get_stats(struct net_device *dev)
@@ -1135,17 +1104,13 @@
/* --------------------------------------------------------------------- */
-int __init yam_init(void)
+static int __init yam_init_driver(void)
{
struct net_device *dev;
int i;
printk(yam_drvinfo);
- /* Clears the IRQ table */
- memset(irqs, 0, sizeof(irqs));
- memset(yam_ports, 0, sizeof(yam_ports));
-
for (i = 0; i < NR_PORTS; i++) {
sprintf(yam_ports[i].dev.name, "yam%d", i);
yam_ports[i].magic = YAM_MAGIC;
@@ -1178,33 +1143,15 @@
yam_timer.expires = jiffies + HZ / 100;
add_timer(&yam_timer);
- yam_net_procfs_init();
- return 1;
-}
-
-/* --------------------------------------------------------------------- */
-
-#ifdef MODULE
-
-/*
- * command line settable parameters
- */
-
-
-MODULE_AUTHOR("Frederic Rible F1OAT terhi.victor@logonet.com");
-MODULE_DESCRIPTION("Yam amateur radio modem driver");
-
-int init_module(void)
-{
- int ret = yam_init();
-
- return (ret == 1) ? 0 : ret;
+ proc_net_create("yam", 0, yam_net_get_info);
+ return 0;
}
/* --------------------------------------------------------------------- */
-void cleanup_module(void)
+static void __exit yam_cleanup_driver(void)
{
+ struct yam_mcs *p;
int i;
del_timer(&yam_timer);
@@ -1216,9 +1163,23 @@
yam_close(dev);
unregister_netdev(dev);
}
- free_mcs();
- yam_net_procfs_remove();
+
+ while (yam_data) {
+ p = yam_data;
+ yam_data = yam_data->next;
+ kfree(p);
+ }
+
+ proc_net_remove("yam");
}
-#endif /* MODULE */
/* --------------------------------------------------------------------- */
+
+MODULE_AUTHOR("Frederic Rible F1OAT avqx@lyit.ie");
+MODULE_DESCRIPTION("Yam amateur radio modem driver");
+
+module_init(yam_init_driver);
+module_exit(yam_cleanup_driver);
+
+/* --------------------------------------------------------------------- */
+
-
To unsubscribe from this list: send the line "unsubscribe linux-hams" in
the body of a message to xfjcsen.geatuvu@katko.fi
This archive was generated by hypermail 2b30 : Sun Dec 10 2000 - 18:18:01 EET