Commit dedd8310 authored by Christoph Hellwig's avatar Christoph Hellwig Committed by James Bottomley

[SCSI] aic7xxx: remove Linux 2.4 ifdefs

There's not much sense in sharing code anymore now that aic7xxx uses
various transport class facilities.
Signed-off-by: default avatarJames Bottomley <James.Bottomley@SteelEye.com>
parent c06716fe
...@@ -41,7 +41,6 @@ ...@@ -41,7 +41,6 @@
#include "aic7xxx_osm.h" #include "aic7xxx_osm.h"
#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,5,0)
#include <linux/device.h> #include <linux/device.h>
#include <linux/eisa.h> #include <linux/eisa.h>
...@@ -62,13 +61,6 @@ static struct eisa_driver aic7770_driver = { ...@@ -62,13 +61,6 @@ static struct eisa_driver aic7770_driver = {
}; };
typedef struct device *aic7770_dev_t; typedef struct device *aic7770_dev_t;
#else
#define MINSLOT 1
#define NUMSLOTS 16
#define IDOFFSET 0x80
typedef void *aic7770_dev_t;
#endif
static int aic7770_linux_config(struct aic7770_identity *entry, static int aic7770_linux_config(struct aic7770_identity *entry,
aic7770_dev_t dev, u_int eisaBase); aic7770_dev_t dev, u_int eisaBase);
...@@ -76,7 +68,6 @@ static int aic7770_linux_config(struct aic7770_identity *entry, ...@@ -76,7 +68,6 @@ static int aic7770_linux_config(struct aic7770_identity *entry,
int int
ahc_linux_eisa_init(void) ahc_linux_eisa_init(void)
{ {
#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,5,0)
struct eisa_device_id *eid; struct eisa_device_id *eid;
struct aic7770_identity *id; struct aic7770_identity *id;
int i; int i;
...@@ -110,44 +101,6 @@ ahc_linux_eisa_init(void) ...@@ -110,44 +101,6 @@ ahc_linux_eisa_init(void)
eid->sig[0] = 0; eid->sig[0] = 0;
return eisa_driver_register(&aic7770_driver); return eisa_driver_register(&aic7770_driver);
#else /* LINUX_VERSION_CODE < KERNEL_VERSION(2,5,0) */
struct aic7770_identity *entry;
u_int slot;
u_int eisaBase;
u_int i;
int ret = -ENODEV;
if (aic7xxx_probe_eisa_vl == 0)
return ret;
eisaBase = 0x1000 + AHC_EISA_SLOT_OFFSET;
for (slot = 1; slot < NUMSLOTS; eisaBase+=0x1000, slot++) {
uint32_t eisa_id;
size_t id_size;
if (request_region(eisaBase, AHC_EISA_IOSIZE, "aic7xxx") == 0)
continue;
eisa_id = 0;
id_size = sizeof(eisa_id);
for (i = 0; i < 4; i++) {
/* VLcards require priming*/
outb(0x80 + i, eisaBase + IDOFFSET);
eisa_id |= inb(eisaBase + IDOFFSET + i)
<< ((id_size-i-1) * 8);
}
release_region(eisaBase, AHC_EISA_IOSIZE);
if (eisa_id & 0x80000000)
continue; /* no EISA card in slot */
entry = aic7770_find_device(eisa_id);
if (entry != NULL) {
aic7770_linux_config(entry, NULL, eisaBase);
ret = 0;
}
}
return ret;
#endif
} }
void void
...@@ -187,11 +140,10 @@ aic7770_linux_config(struct aic7770_identity *entry, aic7770_dev_t dev, ...@@ -187,11 +140,10 @@ aic7770_linux_config(struct aic7770_identity *entry, aic7770_dev_t dev,
ahc_free(ahc); ahc_free(ahc);
return (error); return (error);
} }
#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,5,0)
dev->driver_data = (void *)ahc; dev->driver_data = (void *)ahc;
if (aic7xxx_detect_complete) if (aic7xxx_detect_complete)
error = ahc_linux_register_host(ahc, &aic7xxx_driver_template); error = ahc_linux_register_host(ahc, &aic7xxx_driver_template);
#endif
return (error); return (error);
} }
...@@ -225,7 +177,6 @@ aic7770_map_int(struct ahc_softc *ahc, u_int irq) ...@@ -225,7 +177,6 @@ aic7770_map_int(struct ahc_softc *ahc, u_int irq)
return (-error); return (-error);
} }
#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,5,0)
static int static int
aic7770_eisa_dev_probe(struct device *dev) aic7770_eisa_dev_probe(struct device *dev)
{ {
...@@ -261,4 +212,3 @@ aic7770_eisa_dev_remove(struct device *dev) ...@@ -261,4 +212,3 @@ aic7770_eisa_dev_remove(struct device *dev)
return (0); return (0);
} }
#endif
This diff is collapsed.
...@@ -281,12 +281,6 @@ ahc_scb_timer_reset(struct scb *scb, u_int usec) ...@@ -281,12 +281,6 @@ ahc_scb_timer_reset(struct scb *scb, u_int usec)
/***************************** SMP support ************************************/ /***************************** SMP support ************************************/
#include <linux/spinlock.h> #include <linux/spinlock.h>
#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,5,0) || defined(SCSI_HAS_HOST_LOCK))
#define AHC_SCSI_HAS_HOST_LOCK 1
#else
#define AHC_SCSI_HAS_HOST_LOCK 0
#endif
#define AIC7XXX_DRIVER_VERSION "6.2.36" #define AIC7XXX_DRIVER_VERSION "6.2.36"
/**************************** Front End Queues ********************************/ /**************************** Front End Queues ********************************/
...@@ -438,18 +432,7 @@ struct ahc_linux_target { ...@@ -438,18 +432,7 @@ struct ahc_linux_target {
* manner and are allocated below 4GB, the number of S/G segments is * manner and are allocated below 4GB, the number of S/G segments is
* unrestricted. * unrestricted.
*/ */
#if LINUX_VERSION_CODE < KERNEL_VERSION(2,5,0)
/*
* We dynamically adjust the number of segments in pre-2.5 kernels to
* avoid fragmentation issues in the SCSI mid-layer's private memory
* allocator. See aic7xxx_osm.c ahc_linux_size_nseg() for details.
*/
extern u_int ahc_linux_nseg;
#define AHC_NSEG ahc_linux_nseg
#define AHC_LINUX_MIN_NSEG 64
#else
#define AHC_NSEG 128 #define AHC_NSEG 128
#endif
/* /*
* Per-SCB OSM storage. * Per-SCB OSM storage.
...@@ -607,17 +590,6 @@ static __inline void ahc_lockinit(struct ahc_softc *); ...@@ -607,17 +590,6 @@ static __inline void ahc_lockinit(struct ahc_softc *);
static __inline void ahc_lock(struct ahc_softc *, unsigned long *flags); static __inline void ahc_lock(struct ahc_softc *, unsigned long *flags);
static __inline void ahc_unlock(struct ahc_softc *, unsigned long *flags); static __inline void ahc_unlock(struct ahc_softc *, unsigned long *flags);
/* Lock acquisition and release of the above lock in midlayer entry points. */
static __inline void ahc_midlayer_entrypoint_lock(struct ahc_softc *,
unsigned long *flags);
static __inline void ahc_midlayer_entrypoint_unlock(struct ahc_softc *,
unsigned long *flags);
/* Lock held during command compeletion to the upper layer */
static __inline void ahc_done_lockinit(struct ahc_softc *);
static __inline void ahc_done_lock(struct ahc_softc *, unsigned long *flags);
static __inline void ahc_done_unlock(struct ahc_softc *, unsigned long *flags);
/* Lock held during ahc_list manipulation and ahc softc frees */ /* Lock held during ahc_list manipulation and ahc softc frees */
extern spinlock_t ahc_list_spinlock; extern spinlock_t ahc_list_spinlock;
static __inline void ahc_list_lockinit(void); static __inline void ahc_list_lockinit(void);
...@@ -642,57 +614,6 @@ ahc_unlock(struct ahc_softc *ahc, unsigned long *flags) ...@@ -642,57 +614,6 @@ ahc_unlock(struct ahc_softc *ahc, unsigned long *flags)
spin_unlock_irqrestore(&ahc->platform_data->spin_lock, *flags); spin_unlock_irqrestore(&ahc->platform_data->spin_lock, *flags);
} }
static __inline void
ahc_midlayer_entrypoint_lock(struct ahc_softc *ahc, unsigned long *flags)
{
/*
* In 2.5.X and some 2.4.X versions, the midlayer takes our
* lock just before calling us, so we avoid locking again.
* For other kernel versions, the io_request_lock is taken
* just before our entry point is called. In this case, we
* trade the io_request_lock for our per-softc lock.
*/
#if AHC_SCSI_HAS_HOST_LOCK == 0
spin_unlock(&io_request_lock);
spin_lock(&ahc->platform_data->spin_lock);
#endif
}
static __inline void
ahc_midlayer_entrypoint_unlock(struct ahc_softc *ahc, unsigned long *flags)
{
#if AHC_SCSI_HAS_HOST_LOCK == 0
spin_unlock(&ahc->platform_data->spin_lock);
spin_lock(&io_request_lock);
#endif
}
static __inline void
ahc_done_lockinit(struct ahc_softc *ahc)
{
/*
* In 2.5.X, our own lock is held during completions.
* In previous versions, the io_request_lock is used.
* In either case, we can't initialize this lock again.
*/
}
static __inline void
ahc_done_lock(struct ahc_softc *ahc, unsigned long *flags)
{
#if AHC_SCSI_HAS_HOST_LOCK == 0
spin_lock_irqsave(&io_request_lock, *flags);
#endif
}
static __inline void
ahc_done_unlock(struct ahc_softc *ahc, unsigned long *flags)
{
#if AHC_SCSI_HAS_HOST_LOCK == 0
spin_unlock_irqrestore(&io_request_lock, *flags);
#endif
}
static __inline void static __inline void
ahc_list_lockinit(void) ahc_list_lockinit(void)
{ {
...@@ -759,12 +680,6 @@ typedef enum ...@@ -759,12 +680,6 @@ typedef enum
} ahc_power_state; } ahc_power_state;
/**************************** VL/EISA Routines ********************************/ /**************************** VL/EISA Routines ********************************/
#if (LINUX_VERSION_CODE < KERNEL_VERSION(2,5,0) \
&& (defined(__i386__) || defined(__alpha__)) \
&& (!defined(CONFIG_EISA)))
#define CONFIG_EISA
#endif
#ifdef CONFIG_EISA #ifdef CONFIG_EISA
extern uint32_t aic7xxx_probe_eisa_vl; extern uint32_t aic7xxx_probe_eisa_vl;
int ahc_linux_eisa_init(void); int ahc_linux_eisa_init(void);
...@@ -880,12 +795,8 @@ ahc_flush_device_writes(struct ahc_softc *ahc) ...@@ -880,12 +795,8 @@ ahc_flush_device_writes(struct ahc_softc *ahc)
} }
/**************************** Proc FS Support *********************************/ /**************************** Proc FS Support *********************************/
#if LINUX_VERSION_CODE < KERNEL_VERSION(2,5,0)
int ahc_linux_proc_info(char *, char **, off_t, int, int, int);
#else
int ahc_linux_proc_info(struct Scsi_Host *, char *, char **, int ahc_linux_proc_info(struct Scsi_Host *, char *, char **,
off_t, int, int); off_t, int, int);
#endif
/*************************** Domain Validation ********************************/ /*************************** Domain Validation ********************************/
/*********************** Transaction Access Wrappers *************************/ /*********************** Transaction Access Wrappers *************************/
......
...@@ -236,15 +236,8 @@ ahc_linux_pci_dev_probe(struct pci_dev *pdev, const struct pci_device_id *ent) ...@@ -236,15 +236,8 @@ ahc_linux_pci_dev_probe(struct pci_dev *pdev, const struct pci_device_id *ent)
return (-error); return (-error);
} }
pci_set_drvdata(pdev, ahc); pci_set_drvdata(pdev, ahc);
if (aic7xxx_detect_complete) { if (aic7xxx_detect_complete)
#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,5,0)
ahc_linux_register_host(ahc, &aic7xxx_driver_template); ahc_linux_register_host(ahc, &aic7xxx_driver_template);
#else
printf("aic7xxx: ignoring PCI device found after "
"initialization\n");
return (-ENODEV);
#endif
}
return (0); return (0);
} }
......
...@@ -289,13 +289,8 @@ ahc_proc_write_seeprom(struct ahc_softc *ahc, char *buffer, int length) ...@@ -289,13 +289,8 @@ ahc_proc_write_seeprom(struct ahc_softc *ahc, char *buffer, int length)
* Return information to handle /proc support for the driver. * Return information to handle /proc support for the driver.
*/ */
int int
#if LINUX_VERSION_CODE < KERNEL_VERSION(2,5,0)
ahc_linux_proc_info(char *buffer, char **start, off_t offset,
int length, int hostno, int inout)
#else
ahc_linux_proc_info(struct Scsi_Host *shost, char *buffer, char **start, ahc_linux_proc_info(struct Scsi_Host *shost, char *buffer, char **start,
off_t offset, int length, int inout) off_t offset, int length, int inout)
#endif
{ {
struct ahc_softc *ahc; struct ahc_softc *ahc;
struct info_str info; struct info_str info;
...@@ -307,15 +302,7 @@ ahc_linux_proc_info(struct Scsi_Host *shost, char *buffer, char **start, ...@@ -307,15 +302,7 @@ ahc_linux_proc_info(struct Scsi_Host *shost, char *buffer, char **start,
retval = -EINVAL; retval = -EINVAL;
ahc_list_lock(&s); ahc_list_lock(&s);
#if LINUX_VERSION_CODE < KERNEL_VERSION(2,5,0)
TAILQ_FOREACH(ahc, &ahc_tailq, links) {
if (ahc->platform_data->host->host_no == hostno)
break;
}
#else
ahc = ahc_find_softc(*(struct ahc_softc **)shost->hostdata); ahc = ahc_find_softc(*(struct ahc_softc **)shost->hostdata);
#endif
if (ahc == NULL) if (ahc == NULL)
goto done; goto done;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment