2002-04-03 14:49:38

by Hiroyuki Toda

[permalink] [raw]
Subject: [PATCH] cleanup KERNEL_VERSION definition and linux/version.h

Hi Marcelo,

I send you a patch to clean up KERNEL_VERSION definition and linux/version.h
generated by linux/Makefile.

Main part of the patch is as follows:

diff -ur linux-2.4.18.org/Makefile linux/Makefile
--- linux-2.4.18.org/Makefile Wed Feb 27 00:15:58 2002
+++ linux/Makefile Wed Mar 20 00:46:23 2002
@@ -325,9 +325,16 @@
@mv -f .ver $@

include/linux/version.h: ./Makefile
- @echo \#define UTS_RELEASE \"$(KERNELRELEASE)\" > .ver
- @echo \#define LINUX_VERSION_CODE `expr $(VERSION) \\* 65536 + $(PATCHLEVEL) \\* 256 + $(SUBLEVEL)` >> .ver
- @echo '#define KERNEL_VERSION(a,b,c) (((a) << 16) + ((b) << 8) + (c))' >>.ver
+ @echo "/* this file is generate automaticaly. don\'t edit */" > .ver
+ @echo '' >> .ver
+ @echo '#if !defined(_LINUX_VERSION_H_INCLUDED)' >> .ver
+ @echo '#define _LINUX_VERSION_H_INCLUDED' >> .ver
+ @echo '' >> .ver
+ @echo \#define UTS_RELEASE \"$(KERNELRELEASE)\" >> .ver
+ @echo '#define KERNEL_VERSION(a, b, c) (((a) << 16) | ((b) << 8) | (c))' >>.ver
+ @echo \#define LINUX_VERSION_CODE KERNEL_VERSION\($(VERSION), $(PATCHLEVEL), $(SUBLEVEL)\) >> .ver
+ @echo '' >> .ver
+ @echo '#endif' >> .ver
@mv -f .ver $@

comma := ,


This patch is against 2.4.18.
I hope it is merged to the tree.


Hiroyuki Toda

diff -ur linux-2.4.18.org/Makefile linux/Makefile
--- linux-2.4.18.org/Makefile Wed Feb 27 00:15:58 2002
+++ linux/Makefile Wed Mar 20 00:46:23 2002
@@ -325,9 +325,16 @@
@mv -f .ver $@

include/linux/version.h: ./Makefile
- @echo \#define UTS_RELEASE \"$(KERNELRELEASE)\" > .ver
- @echo \#define LINUX_VERSION_CODE `expr $(VERSION) \\* 65536 + $(PATCHLEVEL) \\* 256 + $(SUBLEVEL)` >> .ver
- @echo '#define KERNEL_VERSION(a,b,c) (((a) << 16) + ((b) << 8) + (c))' >>.ver
+ @echo "/* this file is generate automaticaly. don\'t edit */" > .ver
+ @echo '' >> .ver
+ @echo '#if !defined(_LINUX_VERSION_H_INCLUDED)' >> .ver
+ @echo '#define _LINUX_VERSION_H_INCLUDED' >> .ver
+ @echo '' >> .ver
+ @echo \#define UTS_RELEASE \"$(KERNELRELEASE)\" >> .ver
+ @echo '#define KERNEL_VERSION(a, b, c) (((a) << 16) | ((b) << 8) | (c))' >>.ver
+ @echo \#define LINUX_VERSION_CODE KERNEL_VERSION\($(VERSION), $(PATCHLEVEL), $(SUBLEVEL)\) >> .ver
+ @echo '' >> .ver
+ @echo '#endif' >> .ver
@mv -f .ver $@

comma := ,
diff -ur linux-2.4.18.org/drivers/char/ip2main.c linux/drivers/char/ip2main.c
--- linux-2.4.18.org/drivers/char/ip2main.c Tue Nov 27 00:27:13 2001
+++ linux/drivers/char/ip2main.c Wed Mar 20 00:46:23 2002
@@ -122,10 +122,6 @@
#include <asm/irq.h>
#include <asm/bitops.h>

-#ifndef KERNEL_VERSION
-#define KERNEL_VERSION(ver,rel,seq) (((ver)<<16) | ((rel)<<8) | (seq))
-#endif
-
#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,1,0)
# include <linux/vmalloc.h>
# include <linux/init.h>
diff -ur linux-2.4.18.org/drivers/message/i2o/i2o_scsi.h linux/drivers/message/i2o/i2o_scsi.h
--- linux-2.4.18.org/drivers/message/i2o/i2o_scsi.h Tue Nov 27 00:26:59 2001
+++ linux/drivers/message/i2o/i2o_scsi.h Wed Mar 20 00:46:53 2002
@@ -1,12 +1,7 @@
#ifndef _I2O_SCSI_H
#define _I2O_SCSI_H

-#if !defined(LINUX_VERSION_CODE)
#include <linux/version.h>
-#endif
-
-#define LinuxVersionCode(v, p, s) (((v)<<16)+((p)<<8)+(s))
-
#include <linux/types.h>
#include <linux/kdev_t.h>

diff -ur linux-2.4.18.org/drivers/net/de4x5.h linux/drivers/net/de4x5.h
--- linux-2.4.18.org/drivers/net/de4x5.h Wed Mar 7 12:28:34 2001
+++ linux/drivers/net/de4x5.h Wed Mar 20 00:59:25 2002
@@ -1026,6 +1026,4 @@
#define DE4X5_SET_OMR 0x0d /* Set the OMR Register contents */
#define DE4X5_GET_REG 0x0e /* Get the DE4X5 Registers */

-#define LinuxVersionCode(v, p, s) (((v)<<16)+((p)<<8)+(s))
-
#define MOTO_SROM_BUG ((lp->active == 8) && (((le32_to_cpu(get_unaligned(((s32 *)dev->dev_addr))))&0x00ffffff)==0x3e0008))
diff -ur linux-2.4.18.org/drivers/scsi/aic7xxx/aic7xxx_osm.h linux/drivers/scsi/aic7xxx/aic7xxx_osm.h
--- linux-2.4.18.org/drivers/scsi/aic7xxx/aic7xxx_osm.h Tue Nov 27 00:27:16 2001
+++ linux/drivers/scsi/aic7xxx/aic7xxx_osm.h Wed Mar 20 00:46:23 2002
@@ -72,10 +72,6 @@
#include <linux/module.h>
#include <asm/byteorder.h>

-#ifndef KERNEL_VERSION
-#define KERNEL_VERSION(x,y,z) (((x)<<16)+((y)<<8)+(z))
-#endif
-
#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,4,0)
#include <linux/config.h>
#endif
diff -ur linux-2.4.18.org/drivers/scsi/cpqfcTScontrol.c linux/drivers/scsi/cpqfcTScontrol.c
--- linux-2.4.18.org/drivers/scsi/cpqfcTScontrol.c Tue Nov 27 00:27:16 2001
+++ linux/drivers/scsi/cpqfcTScontrol.c Wed Mar 20 00:48:01 2002
@@ -28,8 +28,7 @@
Hewlitt Packard Manual Part Number 5968-1083E.
*/

-#define LinuxVersionCode(v, p, s) (((v)<<16)+((p)<<8)+(s))
-
+#include <linux/version.h>
#include <linux/blk.h>
#include <linux/kernel.h>
#include <linux/string.h>
diff -ur linux-2.4.18.org/drivers/scsi/cpqfcTSinit.c linux/drivers/scsi/cpqfcTSinit.c
--- linux-2.4.18.org/drivers/scsi/cpqfcTSinit.c Tue Nov 27 00:27:16 2001
+++ linux/drivers/scsi/cpqfcTSinit.c Wed Mar 20 00:57:10 2002
@@ -29,8 +29,7 @@
*/


-#define LinuxVersionCode(v, p, s) (((v)<<16)+((p)<<8)+(s))
-
+#include <linux/version.h>
#include <linux/blk.h>
#include <linux/kernel.h>
#include <linux/string.h>
@@ -41,7 +40,7 @@
#include <linux/timer.h>
#include <linux/ioport.h> // request_region() prototype
#include <linux/vmalloc.h> // ioremap()
-#if LINUX_VERSION_CODE >= LinuxVersionCode(2,4,7)
+#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,4,7)
#include <linux/completion.h>
#endif
#ifdef __alpha__
@@ -63,7 +62,6 @@

#include <linux/config.h>
#include <linux/module.h>
-#include <linux/version.h>

/* Embedded module documentation macros - see module.h */
MODULE_AUTHOR("Compaq Computer Corporation");
@@ -78,7 +76,7 @@
// few fields...
// NOTE: proc_fs changes in 2.4 kernel

-#if LINUX_VERSION_CODE < LinuxVersionCode(2,3,27)
+#if LINUX_VERSION_CODE < KERNEL_VERSION(2,3,27)
static struct proc_dir_entry proc_scsi_cpqfcTS =
{
PROC_SCSI_CPQFCTS, // ushort low_ino (enumerated list)
@@ -92,7 +90,7 @@

#endif

-#if LINUX_VERSION_CODE >= LinuxVersionCode(2,4,7)
+#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,4,7)
# define CPQFC_DECLARE_COMPLETION(x) DECLARE_COMPLETION(x)
# define CPQFC_WAITING waiting
# define CPQFC_COMPLETE(x) complete(x)
@@ -279,7 +277,7 @@

ENTER("cpqfcTS_detect");

-#if LINUX_VERSION_CODE < LinuxVersionCode(2,3,27)
+#if LINUX_VERSION_CODE < KERNEL_VERSION(2,3,27)
ScsiHostTemplate->proc_dir = &proc_scsi_cpqfcTS;
#else
ScsiHostTemplate->proc_name = "cpqfcTS";
diff -ur linux-2.4.18.org/drivers/scsi/cpqfcTSstructs.h linux/drivers/scsi/cpqfcTSstructs.h
--- linux-2.4.18.org/drivers/scsi/cpqfcTSstructs.h Tue Nov 27 00:27:16 2001
+++ linux/drivers/scsi/cpqfcTSstructs.h Wed Mar 20 00:49:32 2002
@@ -20,6 +20,7 @@
#ifndef CPQFCTSSTRUCTS_H
#define CPQFCTSSTRUCTS_H

+#include <linux/version.h>
#include <linux/timer.h> // timer declaration in our host data
#include <linux/tqueue.h> // task queue sched
#include <asm/atomic.h>
@@ -88,7 +89,6 @@
#define CPQFCTS_CMD_PER_LUN 15 // power of 2 -1, must be >0
#define CPQFCTS_REQ_QUEUE_LEN (TACH_SEST_LEN/2) // must be < TACH_SEST_LEN

-#define LinuxVersionCode(v, p, s) (((v)<<16)+((p)<<8)+(s))
#ifndef DECLARE_MUTEX_LOCKED
#define DECLARE_MUTEX_LOCKED(sem) struct semaphore sem = MUTEX_LOCKED
#endif
diff -ur linux-2.4.18.org/drivers/scsi/dc390.h linux/drivers/scsi/dc390.h
--- linux-2.4.18.org/drivers/scsi/dc390.h Fri Jul 20 13:08:49 2001
+++ linux/drivers/scsi/dc390.h Wed Mar 20 00:46:23 2002
@@ -14,9 +14,6 @@
#define DC390_H

#include <linux/version.h>
-#ifndef KERNEL_VERSION
-# define KERNEL_VERSION(a,b,c) (((a) << 16) + ((b) << 8) + (c))
-#endif

#define DC390_BANNER "Tekram DC390/AM53C974"
#define DC390_VERSION "2.0f 2000-12-20"
diff -ur linux-2.4.18.org/drivers/scsi/eata.c linux/drivers/scsi/eata.c
--- linux-2.4.18.org/drivers/scsi/eata.c Tue Nov 27 00:27:30 2001
+++ linux/drivers/scsi/eata.c Wed Mar 20 00:56:22 2002
@@ -393,10 +393,6 @@

#include <linux/version.h>

-#ifndef LinuxVersionCode
-#define LinuxVersionCode(v, p, s) (((v)<<16)+((p)<<8)+(s))
-#endif
-
#define MAX_INT_PARAM 10

#if defined(MODULE)
diff -ur linux-2.4.18.org/drivers/scsi/ips.c linux/drivers/scsi/ips.c
--- linux-2.4.18.org/drivers/scsi/ips.c Wed Feb 27 00:16:03 2002
+++ linux/drivers/scsi/ips.c Wed Mar 20 00:58:42 2002
@@ -176,13 +176,13 @@
#include <linux/stat.h>
#include <linux/config.h>

-#if LINUX_VERSION_CODE >= LinuxVersionCode(2,3,18)
+#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,3,18)
#include <linux/spinlock.h>
#else
#include <asm/spinlock.h>
#endif

-#if LINUX_VERSION_CODE >= LinuxVersionCode(2,3,13)
+#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,3,13)
#include <linux/init.h>
#endif

@@ -199,7 +199,7 @@
#define IPS_VERSION_HIGH "4.80"
#define IPS_VERSION_LOW ".26 "

-#if LINUX_VERSION_CODE < LinuxVersionCode(2,3,27)
+#if LINUX_VERSION_CODE < KERNEL_VERSION(2,3,27)
struct proc_dir_entry proc_scsi_ips = {
0,
3, "ips",
@@ -211,7 +211,7 @@
#error "This driver has only been tested on the x86/ia64 platforms"
#endif

-#if LINUX_VERSION_CODE < LinuxVersionCode(2,2,0)
+#if LINUX_VERSION_CODE < KERNEL_VERSION(2,2,0)
#error "This driver only works with kernel 2.2.0 and later"
#endif

@@ -454,7 +454,7 @@
/* setup parameters to the driver */
/* */
/****************************************************************************/
-#if LINUX_VERSION_CODE >= LinuxVersionCode(2,3,13)
+#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,3,13)
static int
ips_setup(char *ips_str) {
#else
@@ -463,7 +463,7 @@
#endif
int i;

-#if LINUX_VERSION_CODE < LinuxVersionCode(2,4,0)
+#if LINUX_VERSION_CODE < KERNEL_VERSION(2,4,0)
char *p;
char tokens[3] = {',', '.', 0};
#endif
@@ -485,7 +485,7 @@
METHOD_TRACE("ips_setup", 1);

/* Don't use strtok() anymore ( if 2.4 Kernel or beyond ) */
-#if LINUX_VERSION_CODE >= LinuxVersionCode(2,4,0)
+#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,4,0)
/* Search for value */
while ((key = strsep(&ips_str, ",."))) {
if (!*key)
@@ -538,12 +538,12 @@
}
#endif

-#if LINUX_VERSION_CODE >= LinuxVersionCode(2,3,13)
+#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,3,13)
return (1);
#endif
}

-#if LINUX_VERSION_CODE >= LinuxVersionCode(2,3,13)
+#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,3,13)
__setup("ips=", ips_setup);
#endif

@@ -581,7 +581,7 @@
struct pci_dev *dev[2];
struct pci_dev *morpheus = NULL;
struct pci_dev *trombone = NULL;
-#if LINUX_VERSION_CODE < LinuxVersionCode(2,3,14)
+#if LINUX_VERSION_CODE < KERNEL_VERSION(2,3,14)
u_int32_t currbar;
u_int32_t maskbar;
u_int8_t barnum;
@@ -591,7 +591,7 @@

#ifdef MODULE
if (ips)
-#if LINUX_VERSION_CODE >= LinuxVersionCode(2,3,13)
+#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,3,13)
ips_setup(ips);
#else
ips_setup(ips, NULL);
@@ -609,7 +609,7 @@
}

SHT->proc_info = ips_proc_info;
-#if LINUX_VERSION_CODE < LinuxVersionCode(2,3,27)
+#if LINUX_VERSION_CODE < KERNEL_VERSION(2,3,27)
SHT->proc_dir = &proc_scsi_ips;
#else
SHT->proc_name = "ips";
@@ -676,7 +676,7 @@
if (ips_next_controller >= IPS_MAX_ADAPTERS)
break;

-#if LINUX_VERSION_CODE >= LinuxVersionCode(2,4,0)
+#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,4,0)
if (pci_enable_device(dev[i]))
break;
#endif
@@ -693,7 +693,7 @@
io_len = 0;

for (j = 0; j < 2; j++) {
-#if LINUX_VERSION_CODE >= LinuxVersionCode(2,4,0)
+#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,4,0)
if (!pci_resource_start(dev[i], j))
break;

@@ -704,7 +704,7 @@
mem_addr = pci_resource_start(dev[i], j);
mem_len = pci_resource_len(dev[i], j);
}
-#elif LINUX_VERSION_CODE >= LinuxVersionCode(2,3,14)
+#elif LINUX_VERSION_CODE >= KERNEL_VERSION(2,3,14)
if (!dev[i]->resource[j].start)
break;

@@ -753,7 +753,7 @@
DEBUG_VAR(1, "(%s%d) detect, Memory region %x, size: %d",
ips_name, ips_next_controller, mem_addr, mem_len);

-#if LINUX_VERSION_CODE >= LinuxVersionCode(2,3,17)
+#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,3,17)
if (check_mem_region(mem_addr, mem_len)) {
/* Couldn't allocate io space */
printk(KERN_WARNING "(%s%d) couldn't allocate IO space %x len %d.\n",
@@ -829,7 +829,7 @@
continue;
}

-#if LINUX_VERSION_CODE < LinuxVersionCode(2,3,15)
+#if LINUX_VERSION_CODE < KERNEL_VERSION(2,3,15)
/* get the subdevice id */
if (pci_read_config_word(dev[i], PCI_SUBSYSTEM_ID, &subdevice_id)) {
printk(KERN_WARNING "(%s%d) can't get subdevice id.\n",
@@ -1001,11 +1001,11 @@
sh->unchecked_isa_dma = sh->hostt->unchecked_isa_dma;
sh->use_clustering = sh->hostt->use_clustering;

-#if LINUX_VERSION_CODE >= LinuxVersionCode(2,4,7)
+#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,4,7)
sh->max_sectors = 128;
#endif

-#if LINUX_VERSION_CODE < LinuxVersionCode(2,3,32)
+#if LINUX_VERSION_CODE < KERNEL_VERSION(2,3,32)
sh->wish_block = FALSE;
#endif

@@ -1262,7 +1262,7 @@
if (i == IPS_MAX_ADAPTERS) {
printk(KERN_WARNING "(%s) release, invalid Scsi_Host pointer.\n",
ips_name);
-#if LINUX_VERSION_CODE >= LinuxVersionCode(2,4,0)
+#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,4,0)
BUG();
#endif
return (FALSE);
@@ -5450,7 +5450,7 @@
ha->mem_ptr = NULL;
}

-#if LINUX_VERSION_CODE >= LinuxVersionCode(2,3,17)
+#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,3,17)
if (ha->mem_addr)
release_mem_region(ha->mem_addr, ha->mem_len);
#endif
@@ -7566,7 +7566,7 @@
return (0);
}

-#if defined (MODULE) || (LINUX_VERSION_CODE >= LinuxVersionCode(2,4,0))
+#if defined (MODULE) || (LINUX_VERSION_CODE >= KERNEL_VERSION(2,4,0))
static Scsi_Host_Template driver_template = IPS;
#include "scsi_module.c"
#endif
diff -ur linux-2.4.18.org/drivers/scsi/ips.h linux/drivers/scsi/ips.h
--- linux-2.4.18.org/drivers/scsi/ips.h Mon Oct 1 04:26:08 2001
+++ linux/drivers/scsi/ips.h Wed Mar 20 00:57:54 2002
@@ -47,6 +47,7 @@
#ifndef _IPS_H_
#define _IPS_H_

+ #include <linux/version.h>
#include <asm/uaccess.h>
#include <asm/io.h>

@@ -69,9 +70,6 @@
/*
* Some handy macros
*/
- #ifndef LinuxVersionCode
- #define LinuxVersionCode(x,y,z) (((x)<<16)+((y)<<8)+(z))
- #endif

#define IPS_HA(x) ((ips_ha_t *) x->hostdata)
#define IPS_COMMAND_ID(ha, scb) (int) (scb - ha->scbs)
@@ -415,7 +413,7 @@
/*
* Scsi_Host Template
*/
-#if LINUX_VERSION_CODE < LinuxVersionCode(2,3,27)
+#if LINUX_VERSION_CODE < KERNEL_VERSION(2,3,27)
#define IPS { \
next : NULL, \
module : NULL, \
diff -ur linux-2.4.18.org/drivers/scsi/ncr53c8xx.c linux/drivers/scsi/ncr53c8xx.c
--- linux-2.4.18.org/drivers/scsi/ncr53c8xx.c Mon Dec 24 01:01:55 2001
+++ linux/drivers/scsi/ncr53c8xx.c Wed Mar 20 00:54:19 2002
@@ -114,15 +114,15 @@
**==========================================================
*/

-#define LinuxVersionCode(v, p, s) (((v)<<16)+((p)<<8)+(s))

+#include <linux/version.h>
#include <linux/module.h>
#include <asm/dma.h>
#include <asm/io.h>
#include <asm/system.h>
-#if LINUX_VERSION_CODE >= LinuxVersionCode(2,3,17)
+#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,3,17)
#include <linux/spinlock.h>
-#elif LINUX_VERSION_CODE >= LinuxVersionCode(2,1,93)
+#elif LINUX_VERSION_CODE >= KERNEL_VERSION(2,1,93)
#include <asm/spinlock.h>
#endif
#include <linux/delay.h>
@@ -137,10 +137,9 @@
#include <linux/timer.h>
#include <linux/stat.h>

-#include <linux/version.h>
#include <linux/blk.h>

-#if LINUX_VERSION_CODE >= LinuxVersionCode(2,1,35)
+#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,1,35)
#include <linux/init.h>
#endif

@@ -151,7 +150,7 @@
#define __initdata
#endif

-#if LINUX_VERSION_CODE <= LinuxVersionCode(2,1,92)
+#if LINUX_VERSION_CODE <= KERNEL_VERSION(2,1,92)
#include <linux/bios32.h>
#endif

@@ -186,7 +185,7 @@
** Donnot compile integrity checking code for Linux-2.3.0
** and above since SCSI data structures are not ready yet.
*/
-/* #if LINUX_VERSION_CODE < LinuxVersionCode(2,3,0) */
+/* #if LINUX_VERSION_CODE < KERNEL_VERSION(2,3,0) */
#if 0
#define SCSI_NCR_INTEGRITY_CHECKING
#endif
@@ -1012,7 +1011,7 @@
/* when lcb is not allocated. */
Scsi_Cmnd *done_list; /* Commands waiting for done() */
/* callback to be invoked. */
-#if LINUX_VERSION_CODE >= LinuxVersionCode(2,1,93)
+#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,1,93)
spinlock_t smp_lock; /* Lock for SMP threading */
#endif

@@ -3698,7 +3697,7 @@
instance->max_id = np->maxwide ? 16 : 8;
instance->max_lun = SCSI_NCR_MAX_LUN;
#ifndef SCSI_NCR_IOMAPPED
-#if LINUX_VERSION_CODE >= LinuxVersionCode(2,3,29)
+#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,3,29)
instance->base = (unsigned long) np->reg;
#else
instance->base = (char *) np->reg;
@@ -3787,7 +3786,7 @@

if (request_irq(device->slot.irq, ncr53c8xx_intr,
((driver_setup.irqm & 0x10) ? 0 : SA_SHIRQ) |
-#if LINUX_VERSION_CODE < LinuxVersionCode(2,2,0)
+#if LINUX_VERSION_CODE < KERNEL_VERSION(2,2,0)
((driver_setup.irqm & 0x20) ? 0 : SA_INTERRUPT),
#else
0,
@@ -9171,7 +9170,7 @@
**
**==========================================================
*/
-#if LINUX_VERSION_CODE < LinuxVersionCode(2,3,27)
+#if LINUX_VERSION_CODE < KERNEL_VERSION(2,3,27)
static struct proc_dir_entry proc_scsi_ncr53c8xx = {
PROC_SCSI_NCR53C8XX, 9, NAME53C8XX,
S_IFDIR | S_IRUGO | S_IXUGO, 2
@@ -9186,7 +9185,7 @@
*/
#ifdef MODULE
char *ncr53c8xx = 0; /* command line passed by insmod */
-# if LINUX_VERSION_CODE >= LinuxVersionCode(2,1,30)
+# if LINUX_VERSION_CODE >= KERNEL_VERSION(2,1,30)
MODULE_PARM(ncr53c8xx, "s");
# endif
#endif
@@ -9196,7 +9195,7 @@
return sym53c8xx__setup(str);
}

-#if LINUX_VERSION_CODE >= LinuxVersionCode(2,3,13)
+#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,3,13)
#ifndef MODULE
__setup("ncr53c8xx=", ncr53c8xx_setup);
#endif
@@ -9236,7 +9235,7 @@
** Initialize driver general stuff.
*/
#ifdef SCSI_NCR_PROC_INFO_SUPPORT
-#if LINUX_VERSION_CODE < LinuxVersionCode(2,3,27)
+#if LINUX_VERSION_CODE < KERNEL_VERSION(2,3,27)
tpnt->proc_dir = &proc_scsi_ncr53c8xx;
#else
tpnt->proc_name = NAME53C8XX;
@@ -9269,10 +9268,10 @@
*/
MODULE_LICENSE("GPL");

-#if LINUX_VERSION_CODE >= LinuxVersionCode(2,4,0)
+#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,4,0)
static
#endif
-#if LINUX_VERSION_CODE >= LinuxVersionCode(2,4,0) || defined(MODULE)
+#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,4,0) || defined(MODULE)
Scsi_Host_Template driver_template = NCR53C8XX;
#include "scsi_module.c"
#endif
diff -ur linux-2.4.18.org/drivers/scsi/ncr53c8xx.h linux/drivers/scsi/ncr53c8xx.h
--- linux-2.4.18.org/drivers/scsi/ncr53c8xx.h Mon Dec 24 01:01:55 2001
+++ linux/drivers/scsi/ncr53c8xx.h Wed Mar 20 00:53:53 2002
@@ -67,7 +67,7 @@
#endif


-#if LINUX_VERSION_CODE >= LinuxVersionCode(2,1,75)
+#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,1,75)

#define NCR53C8XX { name: "", \
detect: ncr53c8xx_detect, \
diff -ur linux-2.4.18.org/drivers/scsi/qla1280.c linux/drivers/scsi/qla1280.c
--- linux-2.4.18.org/drivers/scsi/qla1280.c Mon Oct 1 04:26:07 2001
+++ linux/drivers/scsi/qla1280.c Wed Mar 20 00:46:23 2002
@@ -223,11 +223,6 @@
#include <linux/slab.h> /* for kmalloc() */


-#ifndef KERNEL_VERSION
-# define KERNEL_VERSION(x,y,z) (((x)<<16)+((y)<<8)+(z))
-#endif
-
-
/*
* Compile time Options:
* 0 - Disable and 1 - Enable
diff -ur linux-2.4.18.org/drivers/scsi/qla1280.h linux/drivers/scsi/qla1280.h
--- linux-2.4.18.org/drivers/scsi/qla1280.h Tue Sep 18 05:16:31 2001
+++ linux/drivers/scsi/qla1280.h Wed Mar 20 00:46:23 2002
@@ -191,10 +191,6 @@
#endif


-#ifndef KERNEL_VERSION
-# define KERNEL_VERSION(x,y,z) (((x)<<16)+((y)<<8)+(z))
-#endif
-
#if LINUX_VERSION_CODE <= KERNEL_VERSION(2,1,92)
# if defined(__sparc_v9__) || defined(__powerpc__)
# error "PPC and Sparc platforms are only support under 2.1.92 and above"
diff -ur linux-2.4.18.org/drivers/scsi/sym53c416.h linux/drivers/scsi/sym53c416.h
--- linux-2.4.18.org/drivers/scsi/sym53c416.h Fri Jul 20 13:08:23 2001
+++ linux/drivers/scsi/sym53c416.h Wed Mar 20 00:53:12 2002
@@ -18,14 +18,7 @@
#ifndef _SYM53C416_H
#define _SYM53C416_H

-#if !defined(LINUX_VERSION_CODE)
#include <linux/version.h>
-#endif
-
-#ifndef LinuxVersionCode
-#define LinuxVersionCode(v, p, s) (((v)<<16)+((p)<<8)+(s))
-#endif
-
#include <linux/types.h>
#include <linux/kdev_t.h>

diff -ur linux-2.4.18.org/drivers/scsi/sym53c8xx.c linux/drivers/scsi/sym53c8xx.c
--- linux-2.4.18.org/drivers/scsi/sym53c8xx.c Mon Dec 24 01:01:55 2001
+++ linux/drivers/scsi/sym53c8xx.c Wed Mar 20 00:52:43 2002
@@ -99,16 +99,15 @@
**==========================================================
*/

-#define LinuxVersionCode(v, p, s) (((v)<<16)+((p)<<8)+(s))
-
+#include <linux/version.h>
#include <linux/module.h>

#include <asm/dma.h>
#include <asm/io.h>
#include <asm/system.h>
-#if LINUX_VERSION_CODE >= LinuxVersionCode(2,3,17)
+#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,3,17)
#include <linux/spinlock.h>
-#elif LINUX_VERSION_CODE >= LinuxVersionCode(2,1,93)
+#elif LINUX_VERSION_CODE >= KERNEL_VERSION(2,1,93)
#include <asm/spinlock.h>
#endif
#include <linux/delay.h>
@@ -123,10 +122,9 @@
#include <linux/timer.h>
#include <linux/stat.h>

-#include <linux/version.h>
#include <linux/blk.h>

-#if LINUX_VERSION_CODE >= LinuxVersionCode(2,1,35)
+#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,1,35)
#include <linux/init.h>
#endif

@@ -137,7 +135,7 @@
#define __initdata
#endif

-#if LINUX_VERSION_CODE <= LinuxVersionCode(2,1,92)
+#if LINUX_VERSION_CODE <= KERNEL_VERSION(2,1,92)
#include <linux/bios32.h>
#endif

@@ -172,7 +170,7 @@
** Donnot compile integrity checking code for Linux-2.3.0
** and above since SCSI data structures are not ready yet.
*/
-/* #if LINUX_VERSION_CODE < LinuxVersionCode(2,3,0) */
+/* #if LINUX_VERSION_CODE < KERNEL_VERSION(2,3,0) */
#if 0
#define SCSI_NCR_INTEGRITY_CHECKING
#endif
@@ -185,7 +183,7 @@
** despite the fact that the PCI specifications are looking
** so smart and simple! ;-)
*/
-#if LINUX_VERSION_CODE >= LinuxVersionCode(2,3,47)
+#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,3,47)
#define SCSI_NCR_DYNAMIC_DMA_MAPPING
#endif

@@ -441,7 +439,7 @@
** code.
*/

-#if LINUX_VERSION_CODE >= LinuxVersionCode(2,2,0)
+#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,2,0)

typedef struct pci_dev *pcidev_t;
#define PCIDEV_NULL (0)
@@ -456,7 +454,7 @@
{
u_long base;

-#if LINUX_VERSION_CODE > LinuxVersionCode(2,3,12)
+#if LINUX_VERSION_CODE > KERNEL_VERSION(2,3,12)
base = pdev->resource[index].start;
#else
base = pdev->base_address[index];
@@ -576,13 +574,13 @@
return base;
}

-#endif /* LINUX_VERSION_CODE >= LinuxVersionCode(2,2,0) */
+#endif /* LINUX_VERSION_CODE >= KERNEL_VERSION(2,2,0) */

/* Does not make sense in earlier kernels */
-#if LINUX_VERSION_CODE < LinuxVersionCode(2,4,0)
+#if LINUX_VERSION_CODE < KERNEL_VERSION(2,4,0)
#define pci_enable_device(pdev) (0)
#endif
-#if LINUX_VERSION_CODE < LinuxVersionCode(2,4,4)
+#if LINUX_VERSION_CODE < KERNEL_VERSION(2,4,4)
#define scsi_set_pci_device(inst, pdev) (0)
#endif

@@ -632,7 +630,7 @@
** wished (e.g.: threaded by controller).
*/

-#if LINUX_VERSION_CODE >= LinuxVersionCode(2,1,93)
+#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,1,93)

spinlock_t sym53c8xx_lock = SPIN_LOCK_UNLOCKED;
#define NCR_LOCK_DRIVER(flags) spin_lock_irqsave(&sym53c8xx_lock, flags)
@@ -672,7 +670,7 @@
** architecture.
*/

-#if LINUX_VERSION_CODE < LinuxVersionCode(2,1,0)
+#if LINUX_VERSION_CODE < KERNEL_VERSION(2,1,0)
#define ioremap vremap
#define iounmap vfree
#endif
@@ -715,7 +713,7 @@
** inaccurate on Pentium processors.
*/

-#if LINUX_VERSION_CODE >= LinuxVersionCode(2,1,105)
+#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,1,105)
#define UDELAY udelay
#define MDELAY mdelay
#else
@@ -737,7 +735,7 @@
** real bus astraction, btw).
*/

-#if LINUX_VERSION_CODE >= LinuxVersionCode(2,1,0)
+#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,1,0)
#define __GetFreePages(flags, order) __get_free_pages(flags, order)
#else
#define __GetFreePages(flags, order) __get_free_pages(flags, order, 0)
@@ -1294,7 +1292,7 @@
/*
** /proc directory entry and proc_info function
*/
-#if LINUX_VERSION_CODE < LinuxVersionCode(2,3,27)
+#if LINUX_VERSION_CODE < KERNEL_VERSION(2,3,27)
static struct proc_dir_entry proc_scsi_sym53c8xx = {
PROC_SCSI_SYM53C8XX, 9, NAME53C8XX,
S_IFDIR | S_IRUGO | S_IXUGO, 2
@@ -1319,7 +1317,7 @@
driver_safe_setup __initdata = SCSI_NCR_DRIVER_SAFE_SETUP;
# ifdef MODULE
char *sym53c8xx = 0; /* command line passed by insmod */
-# if LINUX_VERSION_CODE >= LinuxVersionCode(2,1,30)
+# if LINUX_VERSION_CODE >= KERNEL_VERSION(2,1,30)
MODULE_PARM(sym53c8xx, "s");
# endif
# endif
@@ -2040,7 +2038,7 @@
/* when lcb is not allocated. */
Scsi_Cmnd *done_list; /* Commands waiting for done() */
/* callback to be invoked. */
-#if LINUX_VERSION_CODE >= LinuxVersionCode(2,1,93)
+#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,1,93)
spinlock_t smp_lock; /* Lock for SMP threading */
#endif

@@ -5827,7 +5825,7 @@
((driver_setup.irqm & 0x20) ? 0 : SA_INTERRUPT),
#else
((driver_setup.irqm & 0x10) ? 0 : SA_SHIRQ) |
-#if LINUX_VERSION_CODE < LinuxVersionCode(2,2,0)
+#if LINUX_VERSION_CODE < KERNEL_VERSION(2,2,0)
((driver_setup.irqm & 0x20) ? 0 : SA_INTERRUPT),
#else
0,
@@ -5896,7 +5894,7 @@
instance->max_id = np->maxwide ? 16 : 8;
instance->max_lun = MAX_LUN;
#ifndef SCSI_NCR_IOMAPPED
-#if LINUX_VERSION_CODE >= LinuxVersionCode(2,3,29)
+#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,3,29)
instance->base = (unsigned long) np->reg;
#else
instance->base = (char *) np->reg;
@@ -7399,7 +7397,7 @@
}
}

-#if LINUX_VERSION_CODE >= LinuxVersionCode(2,3,99)
+#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,3,99)
/*
** Move residual byte count to user structure.
*/
@@ -10383,7 +10381,7 @@

/*==========================================================
**
-** G$BqS(Bard's alchemy:) that deals with with the data
+** G$B".(Bard's alchemy:) that deals with with the data
** pointer for both MDP and the residual calculation.
**
**==========================================================
@@ -12762,7 +12760,7 @@
return 1;
}

-#if LINUX_VERSION_CODE >= LinuxVersionCode(2,3,13)
+#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,3,13)
#ifndef MODULE
__setup("sym53c8xx=", sym53c8xx_setup);
#endif
@@ -12903,7 +12901,7 @@
** Initialize driver general stuff.
*/
#ifdef SCSI_NCR_PROC_INFO_SUPPORT
-#if LINUX_VERSION_CODE < LinuxVersionCode(2,3,27)
+#if LINUX_VERSION_CODE < KERNEL_VERSION(2,3,27)
tpnt->proc_dir = &proc_scsi_sym53c8xx;
#else
tpnt->proc_name = NAME53C8XX;
@@ -13231,7 +13229,7 @@
pci_write_config_word(pdev, PCI_COMMAND, command);
}

-#if LINUX_VERSION_CODE < LinuxVersionCode(2,2,0)
+#if LINUX_VERSION_CODE < KERNEL_VERSION(2,2,0)
if ( is_prep ) {
if (io_port >= 0x10000000) {
printk(NAME53C8XX ": reallocating io_port (Wacky IBM)");
@@ -13257,7 +13255,7 @@

#if defined(__i386__) && !defined(MODULE)
if (!cache_line_size) {
-#if LINUX_VERSION_CODE < LinuxVersionCode(2,1,75)
+#if LINUX_VERSION_CODE < KERNEL_VERSION(2,1,75)
extern char x86;
switch(x86) {
#else
@@ -14713,10 +14711,10 @@

MODULE_LICENSE("GPL");

-#if LINUX_VERSION_CODE >= LinuxVersionCode(2,4,0)
+#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,4,0)
static
#endif
-#if LINUX_VERSION_CODE >= LinuxVersionCode(2,4,0) || defined(MODULE)
+#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,4,0) || defined(MODULE)
Scsi_Host_Template driver_template = SYM53C8XX;
#include "scsi_module.c"
#endif
diff -ur linux-2.4.18.org/drivers/scsi/sym53c8xx.h linux/drivers/scsi/sym53c8xx.h
--- linux-2.4.18.org/drivers/scsi/sym53c8xx.h Mon Dec 24 01:01:55 2001
+++ linux/drivers/scsi/sym53c8xx.h Wed Mar 20 00:52:03 2002
@@ -82,7 +82,7 @@
#endif


-#if LINUX_VERSION_CODE >= LinuxVersionCode(2,1,75)
+#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,1,75)

#define SYM53C8XX { name: "", \
detect: sym53c8xx_detect, \
diff -ur linux-2.4.18.org/drivers/scsi/sym53c8xx_2/sym_glue.c linux/drivers/scsi/sym53c8xx_2/sym_glue.c
--- linux-2.4.18.org/drivers/scsi/sym53c8xx_2/sym_glue.c Mon Dec 24 01:01:55 2001
+++ linux/drivers/scsi/sym53c8xx_2/sym_glue.c Wed Mar 20 00:51:27 2002
@@ -74,7 +74,7 @@
{
u_long base;

-#if LINUX_VERSION_CODE > LinuxVersionCode(2,3,12)
+#if LINUX_VERSION_CODE > KERNEL_VERSION(2,3,12)
base = pdev->resource[index].start;
#else
base = pdev->base_address[index];
@@ -106,11 +106,11 @@
#undef PCI_BAR_OFFSET
}

-#if LINUX_VERSION_CODE < LinuxVersionCode(2,4,0)
+#if LINUX_VERSION_CODE < KERNEL_VERSION(2,4,0)
#define pci_enable_device(pdev) (0)
#endif

-#if LINUX_VERSION_CODE < LinuxVersionCode(2,4,4)
+#if LINUX_VERSION_CODE < KERNEL_VERSION(2,4,4)
#define scsi_set_pci_device(inst, pdev) do { ;} while (0)
#endif

@@ -245,7 +245,7 @@
/*
* /proc directory entry and proc_info.
*/
-#if LINUX_VERSION_CODE < LinuxVersionCode(2,3,27)
+#if LINUX_VERSION_CODE < KERNEL_VERSION(2,3,27)
static struct proc_dir_entry proc_scsi_sym53c8xx = {
PROC_SCSI_SYM53C8XX, 9, NAME53C8XX,
S_IFDIR | S_IRUGO | S_IXUGO, 2
@@ -258,7 +258,7 @@
* Until some linux kernel version near 2.3.40, low-level scsi
* drivers were not told about data transfer direction.
*/
-#if LINUX_VERSION_CODE > LinuxVersionCode(2, 3, 40)
+#if LINUX_VERSION_CODE > KERNEL_VERSION(2, 3, 40)

#define scsi_data_direction(cmd) (cmd->sc_data_direction)

@@ -592,7 +592,7 @@
*/
cam_status = sym_xerr_cam_status(DID_ERROR, cp->xerr_status);
}
-#if LINUX_VERSION_CODE >= LinuxVersionCode(2,3,99)
+#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,3,99)
csio->resid = resid;
#endif
csio->result = (drv_status << 24) + (cam_status << 16) + scsi_status;
@@ -849,7 +849,7 @@
{
u_long thistime = ktime_get(0);

-#if LINUX_VERSION_CODE < LinuxVersionCode(2, 4, 0)
+#if LINUX_VERSION_CODE < KERNEL_VERSION(2, 4, 0)
/*
* If release process in progress, let's go
* Set the release stage from 1 to 2 to synchronize
@@ -1152,7 +1152,7 @@
goto finish;
break;
case SYM_EH_DO_WAIT:
-#if LINUX_VERSION_CODE > LinuxVersionCode(2,3,0)
+#if LINUX_VERSION_CODE > KERNEL_VERSION(2,3,0)
init_MUTEX_LOCKED(&ep->sem);
#else
ep->sem = MUTEX_LOCKED;
@@ -1870,7 +1870,7 @@
#ifdef SYM_LINUX_DYNAMIC_DMA_MAPPING
static int sym_setup_bus_dma_mask(hcb_p np)
{
-#if LINUX_VERSION_CODE < LinuxVersionCode(2,4,3)
+#if LINUX_VERSION_CODE < KERNEL_VERSION(2,4,3)
if (!pci_dma_supported(np->s.device, 0xffffffffUL))
goto out_err32;
#else
@@ -2122,7 +2122,7 @@
instance->max_id = np->maxwide ? 16 : 8;
instance->max_lun = SYM_CONF_MAX_LUN;
#ifndef SYM_CONF_IOMAPPED
-#if LINUX_VERSION_CODE >= LinuxVersionCode(2,3,29)
+#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,3,29)
instance->base = (unsigned long) np->s.mmio_va;
#else
instance->base = (char *) np->s.mmio_va;
@@ -2136,7 +2136,7 @@
instance->cmd_per_lun = SYM_CONF_MAX_TAG;
instance->can_queue = (SYM_CONF_MAX_START-2);
instance->sg_tablesize = SYM_CONF_MAX_SG;
-#if LINUX_VERSION_CODE >= LinuxVersionCode(2,4,0)
+#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,4,0)
instance->max_cmd_len = 16;
#endif
instance->select_queue_depths = sym53c8xx_select_queue_depths;
@@ -2387,7 +2387,7 @@
return 1;
}

-#if LINUX_VERSION_CODE >= LinuxVersionCode(2,3,13)
+#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,3,13)
#ifndef MODULE
__setup("sym53c8xx=", sym53c8xx_setup);
#endif
@@ -2737,7 +2737,7 @@
* Initialize driver general stuff.
*/
#ifdef SYM_LINUX_PROC_INFO_SUPPORT
-#if LINUX_VERSION_CODE < LinuxVersionCode(2,3,27)
+#if LINUX_VERSION_CODE < KERNEL_VERSION(2,3,27)
tpnt->proc_dir = &proc_scsi_sym53c8xx;
#else
tpnt->proc_name = NAME53C8XX;
@@ -2945,7 +2945,7 @@
* In the unlikely situation where this failed,
* try to synchronize with the timer handler.
*/
-#if LINUX_VERSION_CODE < LinuxVersionCode(2, 4, 0)
+#if LINUX_VERSION_CODE < KERNEL_VERSION(2, 4, 0)
np->s.release_stage = 1;
if (!del_timer(&np->s.timer)) {
int i = 1000;
@@ -3003,10 +3003,10 @@
/*
* Driver host template.
*/
-#if LINUX_VERSION_CODE >= LinuxVersionCode(2,4,0)
+#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,4,0)
static
#endif
-#if LINUX_VERSION_CODE >= LinuxVersionCode(2,4,0) || defined(MODULE)
+#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,4,0) || defined(MODULE)
Scsi_Host_Template driver_template = SYM53C8XX;
#include "../scsi_module.c"
#endif
diff -ur linux-2.4.18.org/drivers/scsi/sym53c8xx_2/sym_glue.h linux/drivers/scsi/sym53c8xx_2/sym_glue.h
--- linux-2.4.18.org/drivers/scsi/sym53c8xx_2/sym_glue.h Mon Dec 24 01:01:55 2001
+++ linux/drivers/scsi/sym53c8xx_2/sym_glue.h Wed Mar 20 00:50:31 2002
@@ -57,16 +57,15 @@
#define SYM_CONF_DMA_ADDRESSING_MODE 2
#endif

-#define LinuxVersionCode(v, p, s) (((v)<<16)+((p)<<8)+(s))
#include <linux/version.h>
-#if LINUX_VERSION_CODE < LinuxVersionCode(2, 2, 0)
+#if LINUX_VERSION_CODE < KERNEL_VERSION(2, 2, 0)
#error "This driver requires a kernel version not lower than 2.2.0"
#endif

#include <asm/dma.h>
#include <asm/io.h>
#include <asm/system.h>
-#if LINUX_VERSION_CODE >= LinuxVersionCode(2,3,17)
+#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,3,17)
#include <linux/spinlock.h>
#else
#include <asm/spinlock.h>
@@ -140,7 +139,7 @@
/*
* Configuration addendum for Linux.
*/
-#if LINUX_VERSION_CODE >= LinuxVersionCode(2,3,47)
+#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,3,47)
#define SYM_LINUX_DYNAMIC_DMA_MAPPING
#endif

@@ -473,7 +472,7 @@
u_long lasttime;
u_long settle_time; /* Resetting the SCSI BUS */
u_char settle_time_valid;
-#if LINUX_VERSION_CODE < LinuxVersionCode(2, 4, 0)
+#if LINUX_VERSION_CODE < KERNEL_VERSION(2, 4, 0)
u_char release_stage; /* Synchronisation on release */
#endif
};
@@ -648,7 +647,7 @@
{
Scsi_Cmnd *cmd = cp->cam_ccb;

-#if LINUX_VERSION_CODE >= LinuxVersionCode(2,3,99)
+#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,3,99)
cmd->resid = resid;
#endif
cmd->result = (((DID_OK) << 16) + ((cp->ssss_status) & 0x7f));
diff -ur linux-2.4.18.org/drivers/scsi/sym53c8xx_comm.h linux/drivers/scsi/sym53c8xx_comm.h
--- linux-2.4.18.org/drivers/scsi/sym53c8xx_comm.h Mon Dec 24 01:01:55 2001
+++ linux/drivers/scsi/sym53c8xx_comm.h Wed Mar 20 00:56:06 2002
@@ -54,6 +54,8 @@
*******************************************************************************
*/

+#include<linux/version.h>
+
/*
** This file contains definitions and code that the
** sym53c8xx and ncr53c8xx drivers should share.
@@ -74,7 +76,7 @@
**==========================================================
*/

-#if LINUX_VERSION_CODE >= LinuxVersionCode(2,3,47)
+#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,3,47)
#define SCSI_NCR_DYNAMIC_DMA_MAPPING
#endif

@@ -262,7 +264,7 @@
**==========================================================
*/

-#if LINUX_VERSION_CODE >= LinuxVersionCode(2,2,0)
+#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,2,0)

typedef struct pci_dev *pcidev_t;
#define PCIDEV_NULL (0)
@@ -277,7 +279,7 @@
{
u_long base;

-#if LINUX_VERSION_CODE > LinuxVersionCode(2,3,12)
+#if LINUX_VERSION_CODE > KERNEL_VERSION(2,3,12)
base = pdev->resource[index].start;
#else
base = pdev->base_address[index];
@@ -397,13 +399,13 @@
return base;
}

-#endif /* LINUX_VERSION_CODE >= LinuxVersionCode(2,2,0) */
+#endif /* LINUX_VERSION_CODE >= KERNEL_VERSION(2,2,0) */

/* Does not make sense in earlier kernels */
-#if LINUX_VERSION_CODE < LinuxVersionCode(2,4,0)
+#if LINUX_VERSION_CODE < KERNEL_VERSION(2,4,0)
#define pci_enable_device(pdev) (0)
#endif
-#if LINUX_VERSION_CODE < LinuxVersionCode(2,4,4)
+#if LINUX_VERSION_CODE < KERNEL_VERSION(2,4,4)
#define scsi_set_pci_device(inst, pdev) (0)
#endif

@@ -428,7 +430,7 @@
**==========================================================
*/

-#if LINUX_VERSION_CODE >= LinuxVersionCode(2,1,93)
+#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,1,93)
spinlock_t DRIVER_SMP_LOCK = SPIN_LOCK_UNLOCKED;
#define NCR_LOCK_DRIVER(flags) spin_lock_irqsave(&DRIVER_SMP_LOCK, flags)
#define NCR_UNLOCK_DRIVER(flags) \
@@ -472,7 +474,7 @@
**==========================================================
*/

-#if LINUX_VERSION_CODE < LinuxVersionCode(2,1,0)
+#if LINUX_VERSION_CODE < KERNEL_VERSION(2,1,0)
#define ioremap vremap
#define iounmap vfree
#endif
@@ -518,7 +520,7 @@
**==========================================================
*/

-#if LINUX_VERSION_CODE >= LinuxVersionCode(2,1,105)
+#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,1,105)
#define UDELAY udelay
#define MDELAY mdelay
#else
@@ -544,7 +546,7 @@
**==========================================================
*/

-#if LINUX_VERSION_CODE >= LinuxVersionCode(2,1,0)
+#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,1,0)
#define __GetFreePages(flags, order) __get_free_pages(flags, order)
#else
#define __GetFreePages(flags, order) __get_free_pages(flags, order, 0)
@@ -2309,7 +2311,7 @@
pci_write_config_word(pdev, PCI_COMMAND, command);
}

-#if LINUX_VERSION_CODE < LinuxVersionCode(2,2,0)
+#if LINUX_VERSION_CODE < KERNEL_VERSION(2,2,0)
if ( is_prep ) {
if (io_port >= 0x10000000) {
printk(NAME53C8XX ": reallocating io_port (Wacky IBM)");
@@ -2335,7 +2337,7 @@

#if defined(__i386__) && !defined(MODULE)
if (!cache_line_size) {
-#if LINUX_VERSION_CODE < LinuxVersionCode(2,1,75)
+#if LINUX_VERSION_CODE < KERNEL_VERSION(2,1,75)
extern char x86;
switch(x86) {
#else
diff -ur linux-2.4.18.org/drivers/scsi/sym53c8xx_defs.h linux/drivers/scsi/sym53c8xx_defs.h
--- linux-2.4.18.org/drivers/scsi/sym53c8xx_defs.h Mon Dec 24 01:01:55 2001
+++ linux/drivers/scsi/sym53c8xx_defs.h Wed Mar 20 00:55:22 2002
@@ -61,13 +61,9 @@
** Check supported Linux versions
*/

-#if !defined(LINUX_VERSION_CODE)
#include <linux/version.h>
-#endif
#include <linux/config.h>

-#define LinuxVersionCode(v, p, s) (((v)<<16)+((p)<<8)+(s))
-
/*
* NCR PQS/PDS special device support.
*/
@@ -175,7 +171,7 @@
#elif defined(__alpha__)
#define SCSI_NCR_IOMAPPED
#elif defined(__powerpc__)
-#if LINUX_VERSION_CODE <= LinuxVersionCode(2,4,3)
+#if LINUX_VERSION_CODE <= KERNEL_VERSION(2,4,3)
#define SCSI_NCR_IOMAPPED
#define SCSI_NCR_PCI_MEM_NOT_SUPPORTED
#endif
@@ -367,7 +363,7 @@

#ifdef __BIG_ENDIAN

-#if LINUX_VERSION_CODE < LinuxVersionCode(2,1,0)
+#if LINUX_VERSION_CODE < KERNEL_VERSION(2,1,0)
#error "BIG ENDIAN byte ordering needs kernel version >= 2.1.0"
#endif

diff -ur linux-2.4.18.org/drivers/scsi/u14-34f.c linux/drivers/scsi/u14-34f.c
--- linux-2.4.18.org/drivers/scsi/u14-34f.c Tue Nov 27 00:27:16 2001
+++ linux/drivers/scsi/u14-34f.c Wed Mar 20 00:47:24 2002
@@ -337,10 +337,6 @@
#include <linux/module.h>
#include <linux/version.h>

-#ifndef LinuxVersionCode
-#define LinuxVersionCode(v, p, s) (((v)<<16)+((p)<<8)+(s))
-#endif
-
#define MAX_INT_PARAM 10

MODULE_PARM(boot_options, "s");
diff -ur linux-2.4.18.org/include/linux/i2c.h linux/include/linux/i2c.h
--- linux-2.4.18.org/include/linux/i2c.h Tue Nov 27 00:27:02 2001
+++ linux/include/linux/i2c.h Wed Mar 20 00:46:23 2002
@@ -43,9 +43,6 @@
/* --- Includes and compatibility declarations ------------------------ */

#include <linux/version.h>
-#ifndef KERNEL_VERSION
-#define KERNEL_VERSION(a,b,c) (((a) << 16) | ((b) << 8) | (c))
-#endif

#include <asm/page.h> /* for 2.2.xx */
#if LINUX_VERSION_CODE < KERNEL_VERSION(2,0,25)
diff -ur linux-2.4.18.org/include/linux/sdladrv.h linux/include/linux/sdladrv.h
--- linux-2.4.18.org/include/linux/sdladrv.h Fri Apr 13 04:11:39 2001
+++ linux/include/linux/sdladrv.h Wed Mar 20 00:46:23 2002
@@ -21,10 +21,6 @@

#include <linux/version.h>

-#ifndef KERNEL_VERSION
- #define KERNEL_VERSION(a,b,c) (((a) << 16) + ((b) << 8) + (c))
-#endif
-
#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,3,0)
#define LINUX_2_4
#elif LINUX_VERSION_CODE >= KERNEL_VERSION(2,1,0)
diff -ur linux-2.4.18.org/include/linux/wanpipe.h linux/include/linux/wanpipe.h
--- linux-2.4.18.org/include/linux/wanpipe.h Wed Aug 15 17:22:17 2001
+++ linux/include/linux/wanpipe.h Wed Mar 20 00:46:23 2002
@@ -41,10 +41,6 @@

#include <linux/version.h>

-#ifndef KERNEL_VERSION
- #define KERNEL_VERSION(a,b,c) (((a) << 16) + ((b) << 8) + (c))
-#endif
-
#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,3,0)

#define LINUX_2_4
diff -ur linux-2.4.18.org/include/linux/wanrouter.h linux/include/linux/wanrouter.h
--- linux-2.4.18.org/include/linux/wanrouter.h Thu Oct 11 15:48:09 2001
+++ linux/include/linux/wanrouter.h Wed Mar 20 00:46:23 2002
@@ -45,10 +45,6 @@
*****************************************************************************/
#include <linux/version.h>

-#ifndef KERNEL_VERSION
- #define KERNEL_VERSION(a,b,c) (((a) << 16) + ((b) << 8) + (c))
-#endif
-
#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,3,0)
#define LINUX_2_4
#define netdevice_t struct net_device
diff -ur linux-2.4.18.org/init/version.c linux/init/version.c
--- linux-2.4.18.org/init/version.c Tue Nov 27 00:27:34 2001
+++ linux/init/version.c Wed Mar 20 00:46:23 2002
@@ -11,11 +11,6 @@
#include <linux/version.h>
#include <linux/compile.h>

-#define version(a) Version_ ## a
-#define version_string(a) version(a)
-
-int version_string(LINUX_VERSION_CODE);
-
struct new_utsname system_utsname = {
UTS_SYSNAME, UTS_NODENAME, UTS_RELEASE, UTS_VERSION,
UTS_MACHINE, UTS_DOMAINNAME


2002-04-03 23:06:59

by Keith Owens

[permalink] [raw]
Subject: Re: [PATCH] cleanup KERNEL_VERSION definition and linux/version.h

On Wed, 03 Apr 2002 23:49:00 +0900,
Hiroyuki Toda <[email protected]> wrote:
>Hi Marcelo,
>
>I send you a patch to clean up KERNEL_VERSION definition and linux/version.h
>generated by linux/Makefile.
>
>Main part of the patch is as follows:
>
>diff -ur linux-2.4.18.org/Makefile linux/Makefile
>--- linux-2.4.18.org/Makefile Wed Feb 27 00:15:58 2002
>+++ linux/Makefile Wed Mar 20 00:46:23 2002
>@@ -325,9 +325,16 @@
> @mv -f .ver $@
>
> include/linux/version.h: ./Makefile
>- @echo \#define UTS_RELEASE \"$(KERNELRELEASE)\" > .ver
>- @echo \#define LINUX_VERSION_CODE `expr $(VERSION) \\* 65536 + $(PATCHLEVEL) \\* 256 + $(SUBLEVEL)` >> .ver
>- @echo '#define KERNEL_VERSION(a,b,c) (((a) << 16) + ((b) << 8) + (c))' >>.ver
>+ @echo "/* this file is generate automaticaly. don\'t edit */" > .ver
>+ @echo '' >> .ver
>+ @echo '#if !defined(_LINUX_VERSION_H_INCLUDED)' >> .ver
>+ @echo '#define _LINUX_VERSION_H_INCLUDED' >> .ver
>+ @echo '' >> .ver
>+ @echo \#define UTS_RELEASE \"$(KERNELRELEASE)\" >> .ver
>+ @echo '#define KERNEL_VERSION(a, b, c) (((a) << 16) | ((b) << 8) | (c))' >>.ver
>+ @echo \#define LINUX_VERSION_CODE KERNEL_VERSION\($(VERSION), $(PATCHLEVEL), $(SUBLEVEL)\) >> .ver
>+ @echo '' >> .ver
>+ @echo '#endif' >> .ver
> @mv -f .ver $@
>
> comma := ,
>

This file will change completely in 2.5 when kbuild 2.5 goes in. Why
does it need to be rearranged in 2.4?

2002-04-04 01:13:03

by Hiroyuki Toda

[permalink] [raw]
Subject: Re: [PATCH] cleanup KERNEL_VERSION definition and linux/version.h


Keith> This file will change completely in 2.5 when kbuild 2.5 goes in. Why
Keith> does it need to be rearranged in 2.4?

Will kbuild 2.5 go in 2.4 tree also?


Hiroyuki Toda

2002-04-04 01:36:38

by Keith Owens

[permalink] [raw]
Subject: Re: [PATCH] cleanup KERNEL_VERSION definition and linux/version.h

On Thu, 04 Apr 2002 10:12:29 +0900,
Hiroyuki Toda <[email protected]> wrote:
>
>Keith> This file will change completely in 2.5 when kbuild 2.5 goes in. Why
>Keith> does it need to be rearranged in 2.4?
>
>Will kbuild 2.5 go in 2.4 tree also?

No, but version.h is working at the moment in 2.4. Why change it?

2002-04-04 04:31:47

by Hiroyuki Toda

[permalink] [raw]
Subject: Re: [PATCH] cleanup KERNEL_VERSION definition and linux/version.h

Keith> >Will kbuild 2.5 go in 2.4 tree also?
Keith>
Keith> No, but version.h is working at the moment in 2.4. Why change it?

Because version.h and its generating code (in linux/Makefile) are not smart.



Hiroyuki Toda

2002-04-05 02:06:11

by Mike Fedyk

[permalink] [raw]
Subject: Re: [PATCH] cleanup KERNEL_VERSION definition and linux/version.h

On Thu, Apr 04, 2002 at 11:36:06AM +1000, Keith Owens wrote:
> On Thu, 04 Apr 2002 10:12:29 +0900,
> Hiroyuki Toda <[email protected]> wrote:
> >
> >Keith> This file will change completely in 2.5 when kbuild 2.5 goes in. Why
> >Keith> does it need to be rearranged in 2.4?
> >
> >Will kbuild 2.5 go in 2.4 tree also?
>
> No, but version.h is working at the moment in 2.4. Why change it?

Why do so many drivers enable options depending on the kernel version?
Shouldn't that be stripped out before a patch is accepted into the kernel?

2002-04-05 02:43:08

by Keith Owens

[permalink] [raw]
Subject: Re: [PATCH] cleanup KERNEL_VERSION definition and linux/version.h

On Thu, 4 Apr 2002 18:07:52 -0800,
Mike Fedyk <[email protected]> wrote:
>On Thu, Apr 04, 2002 at 11:36:06AM +1000, Keith Owens wrote:
>> On Thu, 04 Apr 2002 10:12:29 +0900,
>> Hiroyuki Toda <[email protected]> wrote:
>> >
>> >Keith> This file will change completely in 2.5 when kbuild 2.5 goes in. Why
>> >Keith> does it need to be rearranged in 2.4?
>> >
>> >Will kbuild 2.5 go in 2.4 tree also?
>>
>> No, but version.h is working at the moment in 2.4. Why change it?
>
>Why do so many drivers enable options depending on the kernel version?
>Shouldn't that be stripped out before a patch is accepted into the kernel?

>From kbuild 2.5 top level Makefile.

# FIXME: Current kernel source includes linux/version.h, mainly to get
# KERNEL_VERSION(). version.h also includes UTS_RELEASE which changes every
# time the kernel identifiers change. The presence of UTS_RELEASE in version.h
# causes lots of unnecessary recompilations, very few places actually want
# UTS_RELEASE. The new makefile generates separate linux/version.h and
# linux/uts_release.h, with version.h including utsname.h to avoid compilation
# errors. Find all the source code that needs just UTS_RELEASE and change it to
# include uts_release.h, then remove #include <linux/uts_release.h> from the
# commands below. KAO

Unfortunately this area of kbuild 2.4 is fragile. At the moment,
changes to the top level Makefile indirectly force a rebuild,
Makefile -> version.h -> KERNEL_VERSION() -> almost everything.

Breaking that chain _might_ cause problems in 2.4 because it does not
have a complete dependency chain to pick up changes to the top level
Makefile, it only works at the moment due to the extra recompiles. I
am not willing to change this in 2.4 until I have got it stable in 2.5.

2002-04-05 17:53:40

by Mike Fedyk

[permalink] [raw]
Subject: Re: [PATCH] cleanup KERNEL_VERSION definition and linux/version.h

> >On Thu, Apr 04, 2002 at 11:36:06AM +1000, Keith Owens wrote:
> >> No, but version.h is working at the moment in 2.4. Why change it?
> >

> On Thu, 4 Apr 2002 18:07:52 -0800,
> Mike Fedyk <[email protected]> wrote:
> >Why do so many drivers enable options depending on the kernel version?
> >Shouldn't that be stripped out before a patch is accepted into the kernel?
>

On Fri, Apr 05, 2002 at 12:42:39PM +1000, Keith Owens wrote:
> >From kbuild 2.5 top level Makefile.
>
> # FIXME: Current kernel source includes linux/version.h, mainly to get
> # KERNEL_VERSION(). version.h also includes UTS_RELEASE which changes every
> # time the kernel identifiers change. The presence of UTS_RELEASE in version.h
> # causes lots of unnecessary recompilations, very few places actually want
> # UTS_RELEASE. The new makefile generates separate linux/version.h and
> # linux/uts_release.h, with version.h including utsname.h to avoid compilation
> # errors. Find all the source code that needs just UTS_RELEASE and change it to
> # include uts_release.h, then remove #include <linux/uts_release.h> from the
> # commands below. KAO
>
> Unfortunately this area of kbuild 2.4 is fragile. At the moment,
> changes to the top level Makefile indirectly force a rebuild,
> Makefile -> version.h -> KERNEL_VERSION() -> almost everything.
>
> Breaking that chain _might_ cause problems in 2.4 because it does not
> have a complete dependency chain to pick up changes to the top level
> Makefile, it only works at the moment due to the extra recompiles. I
> am not willing to change this in 2.4 until I have got it stable in 2.5.

Sounds like a good plan to work on 2.5 first.

Hmm. It looks like kbuild 2.5 might be able to be split up into a few
separate parts. Do you think so too?

Do you know where I could find some good documentation on Makefiles?
Especially on dependencies and etc?

2002-04-06 03:42:26

by Keith Owens

[permalink] [raw]
Subject: Re: [PATCH] cleanup KERNEL_VERSION definition and linux/version.h

On Fri, 5 Apr 2002 09:55:27 -0800,
Mike Fedyk <[email protected]> wrote:
>> >On Thu, Apr 04, 2002 at 11:36:06AM +1000, Keith Owens wrote:
>> Breaking that chain _might_ cause problems in 2.4 because it does not
>> have a complete dependency chain to pick up changes to the top level
>> Makefile, it only works at the moment due to the extra recompiles. I
>> am not willing to change this in 2.4 until I have got it stable in 2.5.
>
>Hmm. It looks like kbuild 2.5 might be able to be split up into a few
>separate parts. Do you think so too?

There are some bug fixes to existing makefiles and CML1 that can safely
be fed back to 2.4, I will do them next week. Apart from that, the
design philosophies for kbuild 2.4 and 2.5 are completely different,
there is little from kbuild 2.5 that can safely be extracted and back
ported to kbuild 2.4.

>Do you know where I could find some good documentation on Makefiles?
>Especially on dependencies and etc?

info make.

2002-04-06 16:10:45

by Dan Kegel

[permalink] [raw]
Subject: Re: [PATCH] cleanup KERNEL_VERSION definition and linux/version.h

Mike Fedyk <[email protected]> wrote:

>Do you know where I could find some good documentation on Makefiles?
>Especially on dependencies and etc?

Once you get past the basics of make, here are some threads
about best practice with large projects:

http://www.pcug.org.au/~millerp/rmch/recu-make-cons-harm.html
http://gcc.gnu.org/ml/gcc/2000-11/msg00901.html
http://www.mail-archive.com/[email protected]/msg00249.html

- Dan