Skip to contentSkip to conversation

small cleanups for drivers/char/ip2*

PATCH New Adrian Bunk 1 participant 1 message Jan 11, 2003 Char and misc drivers

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 small cleanups for drivers/char/ip2*

The patch below does the following cleanups in drivers/char/ip2*:

drivers/char/ip2/i2os.h:
- removed kernel 2.0 code
- removed unused #define VERSION

drivers/char/ip2main.c:
- removed unused #define MIN/MAX
- removed kernel 2.0 code (including the expansion of no longer needed

                          #define's)

- MODULE_{AUTHOR,DESCRIPTION) don't need to be hidden behind an #ifdef MODULE

drivers/char/ip2/i2lib.c:
- expand a no longer needed #define

drivers/char/ip2.c:
- removed unused #define NULL
- removed kernel 2.0 and 2.2 code

I've tested the compilation with 2.5.56.

cu
Adrian

drivers/char/ip2/i2os.h renamed from drivers/char/ip2/i2os.h.old +0 -15
@@ -19,8 +19,6 @@
 #ifndef I2OS_H    /* To prevent multiple includes */
 #define I2OS_H 1
 
-#define VERSION(ver,rel,seq) (((ver)<<16) | ((rel)<<8) | (seq))
-
 //-------------------------------------------------
 // Required Includes
 //-------------------------------------------------
@@ -46,19 +44,6 @@
 // Interrupt control
 //--------------------------------------------
 
-#if LINUX_VERSION_CODE < 0x00020100
-typedef int spinlock_t;
-#define spin_lock_init() 
-#define spin_lock(a)
-#define spin_unlock(a)
-#define spin_lock_irqsave(a,b)			{save_flags((b));cli();}
-#define spin_unlock_irqrestore(a,b)		{restore_flags((b));}
-#define write_lock_irqsave(a,b)			spin_lock_irqsave(a,b)
-#define write_unlock_irqrestore(a,b)	spin_unlock_irqrestore(a,b)
-#define read_lock_irqsave(a,b)			spin_lock_irqsave(a,b)
-#define read_unlock_irqrestore(a,b)		spin_unlock_irqrestore(a,b)
-#endif
-
 //#define SAVE_AND_DISABLE_INTS(a,b)	spin_lock_irqsave(a,b)
 //#define RESTORE_INTS(a,b)         	spin_unlock_irqrestore(a,b)
 
drivers/char/ip2main.c renamed from drivers/char/ip2main.c.old +129 -273

557 lines not on this page · raw message

drivers/char/ip2.c renamed from drivers/char/ip2.c.old +8 -25
@@ -11,16 +11,6 @@
 #include <linux/init.h>
 #include <linux/wait.h>
 
-#ifndef __init
-#define __init
-#endif
-#ifndef __initfunc
-#define __initfunc(a) a
-#endif
-#ifndef __initdata
-#define __initdata
-#endif
-
 #include "./ip2/ip2types.h"		
 #include "./ip2/fip_firm.h"		// the meat
 
@@ -38,16 +28,14 @@
 
 static int poll_only = 0;
 
-#	if LINUX_VERSION_CODE >= KERNEL_VERSION(2,1,0)
-		MODULE_AUTHOR("Doug McNash");
-		MODULE_DESCRIPTION("Computone IntelliPort Plus Driver");
-		MODULE_PARM(irq,"1-"__MODULE_STRING(IP2_MAX_BOARDS) "i");
-		MODULE_PARM_DESC(irq,"Interrupts for IntelliPort Cards");
-		MODULE_PARM(io,"1-"__MODULE_STRING(IP2_MAX_BOARDS) "i");
-		MODULE_PARM_DESC(io,"I/O ports for IntelliPort Cards");
-		MODULE_PARM(poll_only,"1i");
-		MODULE_PARM_DESC(poll_only,"Do not use card interrupts");
-#	endif	/* LINUX_VERSION */
+MODULE_AUTHOR("Doug McNash");
+MODULE_DESCRIPTION("Computone IntelliPort Plus Driver");
+MODULE_PARM(irq,"1-"__MODULE_STRING(IP2_MAX_BOARDS) "i");
+MODULE_PARM_DESC(irq,"Interrupts for IntelliPort Cards");
+MODULE_PARM(io,"1-"__MODULE_STRING(IP2_MAX_BOARDS) "i");
+MODULE_PARM_DESC(io,"I/O ports for IntelliPort Cards");
+MODULE_PARM(poll_only,"1i");
+MODULE_PARM_DESC(poll_only,"Do not use card interrupts");
 
 
 //======================================================================
@@ -88,9 +76,6 @@
 
 #else	// !MODULE 
 
-#ifndef NULL
-# define NULL		((void *) 0)
-#endif
 
 /******************************************************************************
  *	ip2_setup:
@@ -144,9 +129,7 @@
 	return ip2_loadmain(io,irq,(unsigned char *)fip_firm,sizeof(fip_firm));
 }
 
-#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,3,13))
 __setup("ip2=", ip2_setup);
 __initcall(ip2_init);
-#endif
 
 #endif /* !MODULE */
drivers/char/ip2/i2lib.c renamed from drivers/char/ip2/i2lib.c.old +2 -2
@@ -1091,8 +1091,8 @@
 
 			// Move the data
 			if ( user ) {
-				COPY_FROM_USER(rc, (char*)(DATA_OF(pInsert)), pSource,
-						amountToMove );
+				rc = copy_from_user( (char*)(DATA_OF(pInsert)), pSource,
+						     amountToMove ) ? -EFAULT : 0;
 			} else {
 				memcpy( (char*)(DATA_OF(pInsert)), pSource, amountToMove );
 			}