Skip to contentSkip to conversation

ifdefs:

PATCH In review Domen Puncer 2 participants 4 messages May 8, 2004 – May 16, 2004

Subsystems (3)
lore
Share & tools
lore
#0 lore raw

PATCH 7/16 ifdefs:

KERNEL_VERSION is defined in 2.2.20, so it's no more needed.

drivers/scsi/aic7xxx/aic79xx_osm.h +0 -67
@@ -53,17 +53,9 @@
 #include <asm/byteorder.h>
 #include <asm/io.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/interrupt.h> /* For tasklet support. */
 #include <linux/config.h>
 #include <linux/slab.h>
-#else
-#include <linux/malloc.h>
-#endif
 
 /* Core SCSI definitions */
 #define AIC_LIB_PREFIX ahd
@@ -144,11 +136,7 @@
 
 /***************************** Bus Space/DMA **********************************/
 
-#if LINUX_VERSION_CODE > KERNEL_VERSION(2,2,17)
 typedef dma_addr_t bus_addr_t;
-#else
-typedef uint32_t bus_addr_t;
-#endif
 typedef uint32_t bus_size_t;
 
 typedef enum {
@@ -280,11 +268,7 @@
 }
 
 /***************************** SMP support ************************************/
-#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,3,17)
 #include <linux/spinlock.h>
-#elif LINUX_VERSION_CODE >= KERNEL_VERSION(2,1,93)
-#include <linux/smp.h>
-#endif
 
 #if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,5,0) || defined(SCSI_HAS_HOST_LOCK))
 #define AHD_SCSI_HAS_HOST_LOCK 1
@@ -511,9 +495,6 @@
 	struct ahd_linux_device	*dev;
 	bus_addr_t		 buf_busaddr;
 	uint32_t		 xfer_len;
-#if LINUX_VERSION_CODE < KERNEL_VERSION(2,3,0)
-	uint32_t		 resid;		/* Transfer residual */
-#endif
 	uint32_t		 sense_resid;	/* Auto-Sense residual */
 	ahd_linux_scb_flags	 flags;
 };
@@ -543,9 +524,7 @@
 	struct ahd_completeq	 completeq;
 
 	spinlock_t		 spin_lock;
-#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,4,0)
 	struct tasklet_struct	 runq_tasklet;
-#endif
 	u_int			 qfrozen;
 	pid_t			 dv_pid;
 	struct timer_list	 completeq_timer;
@@ -859,9 +838,7 @@
 #define PCIXM_STATUS_MAXCRDS	0x1C00	/* Maximum Cumulative Read Size */
 #define PCIXM_STATUS_RCVDSCEM	0x2000	/* Received a Split Comp w/Error msg */
 
-#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,4,0)
 extern struct pci_driver aic79xx_pci_driver;
-#endif
 
 typedef enum
 {
@@ -965,25 +942,7 @@
 	ahd_inb(ahd, INTSTAT);
 }
 
-#if LINUX_VERSION_CODE <= KERNEL_VERSION(2,3,0)
-#define pci_map_sg(pdev, sg_list, nseg, direction) (nseg)
-#define pci_unmap_sg(pdev, sg_list, nseg, direction)
-#define sg_dma_address(sg) (VIRT_TO_BUS((sg)->address))
-#define sg_dma_len(sg) ((sg)->length)
-#define pci_map_single(pdev, buffer, bufflen, direction) \
-	(VIRT_TO_BUS(buffer))
-#define pci_unmap_single(pdev, buffer, buflen, direction)
-#endif
-
-#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,4,3)
 #define ahd_pci_set_dma_mask pci_set_dma_mask
-#else
-/*
- * Always "return" 0 for success.
- */
-#define ahd_pci_set_dma_mask(dev_softc, mask)	\
-	(((dev_softc)->dma_mask = mask) && 0)
-#endif
 /**************************** Proc FS Support *********************************/
 #if LINUX_VERSION_CODE < KERNEL_VERSION(2,5,0)
 int	ahd_linux_proc_info(char *, char **, off_t, int, int, int);
@@ -1091,35 +1050,13 @@
 static __inline
 int ahd_get_transfer_dir(struct scb *scb)
 {
-#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,3,40)
 	return (scb->io_ctx->sc_data_direction);
-#else
-	if (scb->io_ctx->bufflen == 0)
-		return (CAM_DIR_NONE);
-
-	switch(scb->io_ctx->cmnd[0]) {
-	case 0x08:  /* READ(6)  */
-	case 0x28:  /* READ(10) */
-	case 0xA8:  /* READ(12) */
-		return (CAM_DIR_IN);
-        case 0x0A:  /* WRITE(6)  */
-        case 0x2A:  /* WRITE(10) */
-        case 0xAA:  /* WRITE(12) */
-		return (CAM_DIR_OUT);
-        default:
-		return (CAM_DIR_NONE);
-        }
-#endif
 }
 
 static __inline
 void ahd_set_residual(struct scb *scb, u_long resid)
 {
-#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,3,0)
 	scb->io_ctx->resid = resid;
-#else
-	scb->platform_data->resid = resid;
-#endif
 }
 
 static __inline
@@ -1131,11 +1068,7 @@
 static __inline
 u_long ahd_get_residual(struct scb *scb)
 {
-#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,3,0)
 	return (scb->io_ctx->resid);
-#else
-	return (scb->platform_data->resid);
-#endif
 }
 
 static __inline

_______________________________________________
Kernel-janitors mailing list
[email protected]
http://lists.osdl.org/mailman/listinfo/kernel-janitors

#1 lore raw
Quoted 5 lines · Domen Puncer

...

drivers/scsi/aic7xxx/aic79xx_osm.h +0 -1
...
-#if LINUX_VERSION_CODE > KERNEL_VERSION(2,2,17)

drivers/scsi/aic7xxx/aic79xx_osm.h

Quoted 10 lines
drivers/scsi/aic7xxx/aic79xx_osm.h +0 -5
 typedef dma_addr_t bus_addr_t;
-#else
-typedef uint32_t bus_addr_t;
-#endif
 typedef uint32_t bus_size_t;
...
-#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,4,3)
 #define ahd_pci_set_dma_mask pci_set_dma_mask
-#else
...

In these cases, it's possible to replace it in the whole code and kill the typedef or #define, resp.

The same is true for your patch #12 .

cu
Adrian

Signature · 4 lines
       "Is there not promise of rain?" Ling Tan asked suddenly out
        of the darkness. There had been need of rain for many days.
       "Only a promise," Lao Er said.
                                       Pearl S. Buck - Dragon Seed

_______________________________________________
Kernel-janitors mailing list
[email protected]
http://lists.osdl.org/mailman/listinfo/kernel-janitors

#2 lore raw
In reply to Domen Puncer
Quoted 11 lines · Adrian Bunk
Quoted 10 lines · Domen Puncer

...

drivers/scsi/aic7xxx/aic79xx_osm.h +0 -4
...
-#if LINUX_VERSION_CODE > KERNEL_VERSION(2,2,17)
 typedef dma_addr_t bus_addr_t;
-#else
-typedef uint32_t bus_addr_t;
-#endif
 typedef uint32_t bus_size_t;
Quoted 8 lines

drivers/scsi/aic7xxx/aic79xx_osm.h line 980

Quoted 5 lines

...

drivers/scsi/aic7xxx/aic79xx_osm.h +0 -2
-#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,4,3)
 #define ahd_pci_set_dma_mask pci_set_dma_mask
-#else
...

In these cases, it's possible to replace it in the whole code and kill the typedef or #define, resp.

Ok, that typedef kill intruduced 5 new patches.
Updated patches:
http://coderock.org/kernel/janitor/old_ifdefs-take3/

Quoted 1 line

The same is true for your patch #12 .

You mean some other patch?

Quoted 11 lines

cu
Adrian

Signature · 4 lines
       "Is there not promise of rain?" Ling Tan asked suddenly out
        of the darkness. There had been need of rain for many days.
       "Only a promise," Lao Er said.
                                       Pearl S. Buck - Dragon Seed

_______________________________________________
Kernel-janitors mailing list
[email protected]
http://lists.osdl.org/mailman/listinfo/kernel-janitors

#3 lore raw
In reply to Domen Puncer
Quoted 21 lines · Domen Puncer
Quoted 11 lines · Adrian Bunk
Quoted 10 lines · Domen Puncer

...

drivers/scsi/aic7xxx/aic79xx_osm.h +0 -4
...
-#if LINUX_VERSION_CODE > KERNEL_VERSION(2,2,17)
 typedef dma_addr_t bus_addr_t;
-#else
-typedef uint32_t bus_addr_t;
-#endif
 typedef uint32_t bus_size_t;
Quoted 8 lines

drivers/scsi/aic7xxx/aic79xx_osm.h line 980

Quoted 5 lines

...

drivers/scsi/aic7xxx/aic79xx_osm.h +0 -2
-#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,4,3)
 #define ahd_pci_set_dma_mask pci_set_dma_mask
-#else
...

In these cases, it's possible to replace it in the whole code and kill the typedef or #define, resp.

Quoted 8 lines

Ok, that typedef kill intruduced 5 new patches.
Updated patches:
http://coderock.org/kernel/janitor/old_ifdefs-take3/

Quoted 1 line

The same is true for your patch #12 .

You mean some other patch?

Yes, sorry.

I meant #10 (which you've already changed).

cu
Adrian

Signature · 4 lines
       "Is there not promise of rain?" Ling Tan asked suddenly out
        of the darkness. There had been need of rain for many days.
       "Only a promise," Lao Er said.
                                       Pearl S. Buck - Dragon Seed

_______________________________________________
Kernel-janitors mailing list
[email protected]
http://lists.osdl.org/mailman/listinfo/kernel-janitors