From: Hans Grobler (kam.uiyjxeayz@tat.co.jp)
Date: Sun Dec 10 2000 - 09:38:22 EET
mkiss.c-2.4.0-test12-pre7-patch-v1:
- removed unused AX25_VERSION/min macro
- ax_open: removed unreachable code. removed comment about cbuff, which
is not part of mkiss (came from slip.c)
- kiss_esc,ax_set_mac_address,mkiss_init_ctrl_dev: made static functions
- ax_set_mac_address: return result of get_user/put_user to make
visible errors in userspace programs.
- mkiss_chars_in_buffer,mkiss_set_termios: removed unnecessary functions
as the tty layer will correctly handle the NULL methods.
- init_module,cleanup_module: converted to linux2.4 module format
diff -u3Nr -X dontdiff linux-2.4.0-test12-pre7.orig/drivers/net/hamradio/mkiss.c linux-2.4.0-test12-pre7/drivers/net/hamradio/mkiss.c
--- linux-2.4.0-test12-pre7.orig/drivers/net/hamradio/mkiss.c Thu May 4 20:31:21 2000
+++ linux-2.4.0-test12-pre7/drivers/net/hamradio/mkiss.c Sun Dec 10 09:35:45 2000
@@ -56,13 +56,6 @@
#include <linux/tcp.h>
#endif
-#ifdef MODULE
-#define AX25_VERSION "AX25-MODULAR-NET3.019-NEWTTY"
-#define min(a,b) (a < b ? a : b)
-#else
-#define AX25_VERSION "AX25-NET3.019-NEWTTY"
-#endif
-
#define NR_MKISS 4
#define MKISS_SERIAL_TYPE_NORMAL 1
@@ -87,7 +80,7 @@
static struct tty_struct *mkiss_table[NR_MKISS];
static struct termios *mkiss_termios[NR_MKISS];
static struct termios *mkiss_termios_locked[NR_MKISS];
-struct mkiss_channel MKISS_Info[NR_MKISS];
+static struct mkiss_channel MKISS_Info[NR_MKISS];
static int ax25_init(struct net_device *);
static int mkiss_init(void);
@@ -322,7 +315,7 @@
}
-/* Clear the "sending" flag. This must be atomic, hence the ASM. */
+/* Clear the "sending" flag. This must be atomic. */
static inline void ax_unlock(struct ax_disp *ax)
{
netif_start_queue(ax->dev);
@@ -554,7 +547,6 @@
*
* rbuff Receive buffer.
* xbuff Transmit buffer.
- * cbuff Temporary compression buffer.
*/
len = dev->mtu * 2;
@@ -582,9 +574,6 @@
netif_start_queue(dev);
return 0;
- /* Cleanup */
- kfree(ax->xbuff);
-
noxbuff:
kfree(ax->rbuff);
@@ -753,7 +742,7 @@
* STANDARD ENCAPSULATION *
************************************************************************/
-int kiss_esc(unsigned char *s, unsigned char *d, int len)
+static int kiss_esc(unsigned char *s, unsigned char *d, int len)
{
unsigned char *ptr = d;
unsigned char c;
@@ -866,7 +855,7 @@
}
-int ax_set_mac_address(struct net_device *dev, void *addr)
+static int ax_set_mac_address(struct net_device *dev, void *addr)
{
if (copy_from_user(dev->dev_addr, addr, AX25_ADDR_LEN))
return -EFAULT;
@@ -900,12 +889,12 @@
return 0;
case SIOCGIFENCAP:
- put_user(4, (int *)arg);
- return 0;
+ return put_user(4, (int *)arg);
case SIOCSIFENCAP:
- get_user(tmp, (int *)arg);
- ax->mode = tmp;
+ if (get_user(tmp, (int *)arg))
+ return -EFAULT;
+ ax->mode = tmp;
ax->dev->addr_len = AX25_ADDR_LEN; /* sizeof an AX.25 addr */
ax->dev->hard_header_len = AX25_KISS_HEADER_LEN + AX25_MAX_HEADER_LEN + 3;
ax->dev->type = ARPHRD_AX25;
@@ -930,7 +919,7 @@
}
/* Initialize AX25 control device -- register AX25 line discipline */
-int __init mkiss_init_ctrl_dev(void)
+static int __init mkiss_init_ctrl_dev(void)
{
int status;
@@ -1116,25 +1105,6 @@
}
-static int mkiss_chars_in_buffer(struct tty_struct *tty)
-{
- struct mkiss_channel *mkiss = tty->driver_data;
-
- if (tty == NULL)
- return 0;
-
- if (mkiss == NULL)
- return 0;
-
- return 0;
-}
-
-
-static void mkiss_set_termios(struct tty_struct *tty, struct termios *old_termios)
-{
- /* we don't do termios */
-}
-
/* ******************************************************************** */
/* * Init MKISS driver * */
/* ******************************************************************** */
@@ -1166,8 +1136,6 @@
mkiss_driver.close = mkiss_close;
mkiss_driver.write = mkiss_write;
mkiss_driver.write_room = mkiss_write_room;
- mkiss_driver.chars_in_buffer = mkiss_chars_in_buffer;
- mkiss_driver.set_termios = mkiss_set_termios;
/* some unused functions */
mkiss_driver.flush_buffer = mkiss_dummy;
@@ -1189,21 +1157,12 @@
return 0;
}
-#ifdef MODULE
-EXPORT_NO_SYMBOLS;
-
-MODULE_PARM(ax25_maxdev, "i");
-MODULE_PARM_DESC(ax25_maxdev, "number of MKISS devices");
-
-MODULE_AUTHOR("Hans Albas PE1AYX <bpjmkkbi.cnlo@mail.dy.fi>");
-MODULE_DESCRIPTION("KISS driver for AX.25 over TTYs");
-
-int init_module(void)
+static int __init mkiss_init_module(void)
{
return mkiss_init_ctrl_dev();
}
-void cleanup_module(void)
+static void __exit mkiss_exit_module(void)
{
int i;
@@ -1233,4 +1192,11 @@
printk(KERN_ERR "mkiss: can't unregister MKISS device\n");
}
-#endif /* MODULE */
+MODULE_AUTHOR("Hans Albas PE1AYX <xfwgs.vnydw@oulu.fi>");
+MODULE_DESCRIPTION("KISS driver for AX.25 over TTYs");
+MODULE_PARM(ax25_maxdev, "i");
+MODULE_PARM_DESC(ax25_maxdev, "number of MKISS devices");
+
+module_init(mkiss_init_module);
+module_exit(mkiss_exit_module);
+
-
To unsubscribe from this list: send the line "unsubscribe linux-hams" in
the body of a message to qfmisdg.fbsaw@vodafone.com.au
This archive was generated by hypermail 2b30 : Sun Dec 10 2000 - 09:41:16 EET