Linux HAM/Amateur Radio development
 help / color / mirror / Atom feed
* [PATCH] mkiss
@ 2003-07-05 19:17 Jeroen Vreeken
  2003-07-07  0:11 ` Ralf Baechle DO1GRB
  0 siblings, 1 reply; 7+ messages in thread
From: Jeroen Vreeken @ 2003-07-05 19:17 UTC (permalink / raw)
  To: linux-hams; +Cc: ralf

[-- Attachment #1: Type: text/plain, Size: 432 bytes --]

Hi,

This is a patch to get mkiss working under 2.5.74
It used the driver_data field of the tty structure, this field can be NULL.
Further the whole mkiss magic stuff seems to be unreachable as I can't find
a single piece of code in the kernel that sets the driver_data field with
this structure... Is is something from a long time ago?? Shouldn't it be
removed completly?
This patch also removes the MOD_*_USE_COUNT calls.

Jeroen

[-- Attachment #2: mkiss-2.5.74.rxq.diff --]
[-- Type: application/octet-stream, Size: 2149 bytes --]

diff -ru linux-2.5.74/drivers/net/hamradio/mkiss.c linux-2.5.74.rxq/drivers/net/hamradio/mkiss.c
--- linux-2.5.74/drivers/net/hamradio/mkiss.c	2003-07-02 22:57:13.000000000 +0200
+++ linux-2.5.74.rxq/drivers/net/hamradio/mkiss.c	2003-07-05 19:33:20.000000000 +0200
@@ -22,6 +22,8 @@
  *	Matthias (DG2FEF)       Added support for FlexNet CRC (on special request)
  *                              Fixed bug in ax25_close(): dev_lock_wait() was
  *                              called twice, causing a deadlock.
+ *	Jeroen (PE1RXQ)		Added NULL check for tty->driver_data and removed
+ *				MOD_*_USE_COUNT calls
  */
 
 #include <linux/config.h>
@@ -320,7 +322,7 @@
 	if (ax->rbuff[0] > 0x0f) {
 		if (ax->mkiss != NULL) {
 			mkiss= ax->mkiss->tty->driver_data;
-			if (mkiss->magic == MKISS_DRIVER_MAGIC)
+			if (mkiss && mkiss->magic == MKISS_DRIVER_MAGIC)
 				tmp_ax = ax->mkiss;
 		} else if (ax->rbuff[0] & 0x20) {
 		        ax->crcmode = CRC_MODE_FLEX;
@@ -376,7 +378,7 @@
 
 	p = icp;
 
-	if (mkiss->magic  != MKISS_DRIVER_MAGIC) {
+	if (!mkiss || mkiss->magic  != MKISS_DRIVER_MAGIC) {
 	        switch (ax->crcmode) {
 		         unsigned short crc;
 
@@ -430,7 +432,7 @@
 
 		if (ax->mkiss != NULL) {
 			mkiss= ax->mkiss->tty->driver_data;
-			if (mkiss->magic  == MKISS_DRIVER_MAGIC)
+			if (mkiss && mkiss->magic  == MKISS_DRIVER_MAGIC)
 				ax_unlock(ax->mkiss);
 	        }
 
@@ -452,7 +454,7 @@
 
 	tmp_ax = NULL;
 
-	if (mkiss->magic  == MKISS_DRIVER_MAGIC) {
+	if (mkiss && mkiss->magic  == MKISS_DRIVER_MAGIC) {
 		if (skb->data[0] < 0x10)
 			skb->data[0] = skb->data[0] + 0x10;
 		tmp_ax = ax->mkiss;
@@ -666,7 +668,7 @@
 
 	mkiss = ax->tty->driver_data;
 
-	if (mkiss->magic  == MKISS_DRIVER_MAGIC) {
+	if (mkiss && mkiss->magic  == MKISS_DRIVER_MAGIC) {
 		for (cnt = 1; cnt < ax25_maxdev; cnt++) {
 			if (ax25_ctrls[cnt]) {
 				if (netif_running(&ax25_ctrls[cnt]->dev)) {
@@ -685,8 +687,6 @@
 		tmp_ax->mkiss = ax;
 	}
 
-	MOD_INC_USE_COUNT;
-
 	/* Done.  We have linked the TTY line to a channel. */
 	return ax->dev->base_addr;
 }
@@ -705,7 +705,6 @@
 	ax->tty        = NULL;
 
 	ax_free(ax);
-	MOD_DEC_USE_COUNT;
 }
 
 

^ permalink raw reply	[flat|nested] 7+ messages in thread

end of thread, other threads:[~2003-09-05  8:15 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2003-07-05 19:17 [PATCH] mkiss Jeroen Vreeken
2003-07-07  0:11 ` Ralf Baechle DO1GRB
2003-07-07 20:39   ` Jeroen Vreeken
2003-07-09  6:35     ` Request change ??? Ronald Jochems
2003-07-09 17:18       ` Arno Verhoeven
2003-07-11  7:32         ` Martijn Hijdra
2003-09-05  8:15         ` Statistics patch for scc.c driver Martijn Hijdra

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox