small cleanup for drivers/scsi/*53c8xx*
PATCH 1/1 small cleanup for drivers/scsi/*53c8xx*
The patch below does the following cleanups in drivers/scsi/*53c8xx*:
- remove #if'd code foer kernels < 2.4.4
- remove MIN/MAX
diffstat output:
ncr53c8xx.c | 89 ++------------- ncr53c8xx.h | 19 --- sym53c8xx.c | 319 +++++-------------------------------------------------- sym53c8xx_comm.h | 234 +--------------------------------------- sym53c8xx_defs.h | 18 --- 5 files changed, 56 insertions(+), 623 deletions(-)
cu
Adrian
drivers/scsi/sym53c8xx_comm.h renamed from drivers/scsi/sym53c8xx_comm.h.old +11 -223
@@ -62,21 +62,7 @@** driver includes this file. */ -#define MIN (a,b) (((a) < (b)) ? (a) : (b)) -#define MAX (a,b) (((a) > (b)) ? (a) : (b)) - -/*========================================================== -** -** Hmmm... What complex some PCI-HOST bridges actually -** are, despite the fact that the PCI specifications -** are looking so smart and simple! ;-) -** -**========================================================== -*/ - -#if LINUX_VERSION_CODE >=LinuxVersionCode (2 ,3 ,47 )#define SCSI_NCR_DYNAMIC_DMA_MAPPING -#endif /*========================================================== **
@@ -262,8 +248,6 @@**========================================================== */ -#if LINUX_VERSION_CODE >=LinuxVersionCode (2 ,2 ,0 ) -typedef struct pci_dev *pcidev_t ;typedef struct device *device_t ;#define PCIDEV_NULL (0)
@@ -278,15 +262,7 @@ {u_long base; -#if LINUX_VERSION_CODE >LinuxVersionCode (2 ,3 ,12 ) base = pdev->resource[index].start; -#else - base = pdev->base_address[index]; -#if BITS_PER_LONG >32 -if ((base &0x7 ) ==0x4 ) - *base |= (((u_long )pdev->base_address[++index]) <<32 ); -#endif -#endif return (base & ~0x7ul ); }
@@ -310,104 +286,6 @@#undef PCI_BAR_OFFSET } -#else /* Incomplete emulation of current PCI code for pre-2.2 kernels */ - -typedef unsigned int pcidev_t ; -typedef unsinged int device_t; -#define PCIDEV_NULL (~0u) -#define PciBusNumber (d) ((d)>>8) -#define PciDeviceFn (d) ((d)&0xff) -#define __PciDev (busn, devfn) (((busn)<<8)+(devfn)) - -#define pci_present pcibios_present - -#define pci_read_config_byte (d, w, v) \ - pcibios_read_config_byte(PciBusNumber(d), PciDeviceFn(d), w, v) -#define pci_read_config_word (d, w, v) \ - pcibios_read_config_word(PciBusNumber(d), PciDeviceFn(d), w, v) -#define pci_read_config_dword (d, w, v) \ - pcibios_read_config_dword(PciBusNumber(d), PciDeviceFn(d), w, v) - -#define pci_write_config_byte (d, w, v) \ - pcibios_write_config_byte(PciBusNumber(d), PciDeviceFn(d), w, v) -#define pci_write_config_word (d, w, v) \ - pcibios_write_config_word(PciBusNumber(d), PciDeviceFn(d), w, v) -#define pci_write_config_dword (d, w, v) \ - pcibios_write_config_dword(PciBusNumber(d), PciDeviceFn(d), w, v) - -static pcidev_t __init -pci_find_device (unsigned int vendor,unsigned int device,pcidev_t prev) -{ -static unsigned short pci_index; -int retv; -unsigned char bus_number, device_fn; - -if (prev ==PCIDEV_NULL ) - pci_index =0 ; -else - ++pci_index; - retv =pcibios_find_device (vendor, device, pci_index, - &bus_number, &device_fn); -return retv ?PCIDEV_NULL :__PciDev (bus_number, device_fn); -} - -static u_short __init PciVendorId (pcidev_t dev) -{ -u_short vendor_id; -pci_read_config_word (dev,PCI_VENDOR_ID , &vendor_id); -return vendor_id; -} - -static u_short __init PciDeviceId (pcidev_t dev) -{ -u_short device_id; -pci_read_config_word (dev,PCI_DEVICE_ID , &device_id); -return device_id; -} - -static u_int __init PciIrqLine (pcidev_t dev) -{ -u_char irq; -pci_read_config_byte (dev,PCI_INTERRUPT_LINE , &irq); -return irq; -} - -static int __init -pci_get_base_address (pcidev_t dev,int offset,u_long *base) -{ -u_int32 tmp; - -pci_read_config_dword (dev,PCI_BASE_ADDRESS_0 + offset, &tmp); - *base = tmp; - offset +=sizeof (u_int32); -if ((tmp &0x7 ) ==0x4 ) { -#if BITS_PER_LONG >32 -pci_read_config_dword (dev,PCI_BASE_ADDRESS_0 + offset, &tmp); - *base |= (((u_long )tmp) <<32 ); -#endif - offset +=sizeof (u_int32); - } -return offset; -} -static u_long __init -pci_get_base_cookie (struct pci_dev *pdev,int offset) -{ -u_long base; - - (void )pci_get_base_address (dev, offset, &base); - -return base; -} - -#endif /* LINUX_VERSION_CODE >= LinuxVersionCode(2,2,0) */ - -/* Does not make sense in earlier kernels */ -#if LINUX_VERSION_CODE <LinuxVersionCode (2 ,4 ,0 ) -#define pci_enable_device (pdev) (0) -#endif -#if LINUX_VERSION_CODE <LinuxVersionCode (2 ,4 ,4 ) -#define scsi_set_pci_device (inst, pdev) (0) -#endif /*========================================================== **
@@ -430,7 +308,6 @@**========================================================== */ -#if LINUX_VERSION_CODE >=LinuxVersionCode (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) \
@@ -445,49 +322,14 @@#define NCR_UNLOCK_SCSI_DONE (host, flags) \ spin_unlock_irqrestore(((host)->host_lock), flags) -#else - -#define NCR_LOCK_DRIVER (flags) do { save_flags(flags); cli(); } while (0) -#define NCR_UNLOCK_DRIVER (flags) do { restore_flags(flags); } while (0) - -#define NCR_INIT_LOCK_NCB (np) do { } while (0) -#define NCR_LOCK_NCB (np, flags) do { save_flags(flags); cli(); } while (0) -#define NCR_UNLOCK_NCB (np, flags) do { restore_flags(flags); } while (0) - -#define NCR_LOCK_SCSI_DONE (host, flags) do {;} while (0) -#define NCR_UNLOCK_SCSI_DONE (host, flags) do {;} while (0) - -#endif - -/*========================================================== -** -** Memory mapped IO -** -** Since linux-2.1, we must use ioremap() to map the io -** memory space and iounmap() to unmap it. This allows -** portability. Linux 1.3.X and 2.0.X allow to remap -** physical pages addresses greater than the highest -** physical memory address to kernel virtual pages with -** vremap() / vfree(). That was not portable but worked -** with i386 architecture. -** -**========================================================== -*/ - -#if LINUX_VERSION_CODE <LinuxVersionCode (2 ,1 ,0 ) -#define ioremap vremap -#define iounmap vfree -#endif #ifdef __sparc__# include <asm/irq.h> -# define memcpy_to_pci (a, b, c) memcpy_toio((a), (b), (c)) -#elif defined(__alpha__) -# define memcpy_to_pci (a, b, c) memcpy_toio((a), (b), (c)) -#else /* others */ -# define memcpy_to_pci (a, b, c) memcpy_toio((a), (b), (c))#endif +#define memcpy_to_pci (a, b, c) memcpy_toio((a), (b), (c)) + +#ifndef SCSI_NCR_PCI_MEM_NOT_SUPPORTED static u_long __init remap_pci_mem (u_long base,u_long size) {
@@ -506,27 +348,6 @@#endif /* not def SCSI_NCR_PCI_MEM_NOT_SUPPORTED */ -/*========================================================== -** -** Insert a delay in micro-seconds and milli-seconds. -** -** Under Linux, udelay() is restricted to delay < -** 1 milli-second. In fact, it generally works for up -** to 1 second delay. Since 2.1.105, the mdelay() function -** is provided for delays in milli-seconds. -** Under 2.0 kernels, udelay() is an inline function -** that is very inaccurate on Pentium processors. -** -**========================================================== -*/ - -#if LINUX_VERSION_CODE >=LinuxVersionCode (2 ,1 ,105 ) -#define UDELAY udelay -#define MDELAY mdelay -#else -static void UDELAY (long us) {udelay (us); } -static void MDELAY (long ms) {while (ms--)UDELAY (1000 ); } -#endif /*========================================================== **
@@ -546,12 +367,6 @@**========================================================== */ -#if LINUX_VERSION_CODE >=LinuxVersionCode (2 ,1 ,0 ) -#define __GetFreePages (flags, order) __get_free_pages(flags, order) -#else -#define __GetFreePages (flags, order) __get_free_pages(flags, order, 0) -#endif -#define MEMO_SHIFT 4/* 16 bytes minimum memory chunk */ #if PAGE_SIZE >=8192 #define MEMO_PAGE_ORDER 0/* 1 PAGE maximum */
@@ -592,13 +407,13 @@void (*freep)(struct m_pool *,m_addr_t );#define M_GETP () mp->getp(mp)#define M_FREEP (p) mp->freep(mp, p) -#define GetPages () __GetFreePages(MEMO_GFP_FLAGS, MEMO_PAGE_ORDER) +#define GetPages () __get_free_pages(MEMO_GFP_FLAGS, MEMO_PAGE_ORDER)#define FreePages (p) free_pages(p, MEMO_PAGE_ORDER)int nump; m_vtob_s *(vtob[VTOB_HASH_SIZE ]);struct m_pool *next;#else -#define M_GETP () __GetFreePages(MEMO_GFP_FLAGS, MEMO_PAGE_ORDER) +#define M_GETP () __get_free_pages(MEMO_GFP_FLAGS, MEMO_PAGE_ORDER)#define M_FREEP (p) free_pages(p, MEMO_PAGE_ORDER)#endif /* SCSI_NCR_DYNAMIC_DMA_MAPPING */ struct m_link h[PAGE_SHIFT -MEMO_SHIFT +MEMO_PAGE_ORDER +1 ];
@@ -1191,7 +1006,7 @@static void __init S24C16_set_bit (ncr_slot *np,u_char write_bit,u_char *gpreg,int bit_mode) { -UDELAY (5 ); +udelay (5 );switch (bit_mode){case SET_BIT : *gpreg |= write_bit;
@@ -1208,7 +1023,7 @@ }OUTB (nc_gpreg, *gpreg); -UDELAY (5 ); +udelay (5 ); }/*
@@ -1433,7 +1248,7 @@static void __init T93C46_Clk (ncr_slot *np,u_char *gpreg) {OUTB (nc_gpreg, *gpreg |0x04 ); -UDELAY (2 ); +udelay (2 );OUTB (nc_gpreg, *gpreg); }
@@ -1442,7 +1257,7 @@*/ static void __init T93C46_Read_Bit (ncr_slot *np,u_char *read_bit,u_char *gpreg) { -UDELAY (2 ); +udelay (2 );T93C46_Clk (np, gpreg); *read_bit =INB (nc_gpreg); }
@@ -1460,7 +1275,7 @@ *gpreg |=0x10 ;OUTB (nc_gpreg, *gpreg); -UDELAY (2 ); +udelay (2 );T93C46_Clk (np, gpreg); }
@@ -1472,7 +1287,7 @@ { *gpreg &=0xef ;OUTB (nc_gpreg, *gpreg); -UDELAY (2 ); +udelay (2 );T93C46_Clk (np, gpreg); }
@@ -2316,38 +2131,11 @@pci_write_config_word (pdev,PCI_COMMAND , command); } -#if LINUX_VERSION_CODE <LinuxVersionCode (2 ,2 ,0 ) -if ( is_prep ) { -if (io_port >=0x10000000 ) { -printk (NAME53C8XX ": reallocating io_port (Wacky IBM)" ); - io_port = (io_port &0x00FFFFFF ) |0x01000000 ; -pci_write_config_dword (pdev, -PCI_BASE_ADDRESS_0 , io_port); - } -if (base >=0x10000000 ) { -printk (NAME53C8XX ": reallocating base (Wacky IBM)" ); - base = (base &0x00FFFFFF ) |0x01000000 ; -pci_write_config_dword (pdev, -PCI_BASE_ADDRESS_1 , base); - } -if (base_2 >=0x10000000 ) { -printk (NAME53C8XX ": reallocating base2 (Wacky IBM)" ); - base_2 = (base_2 &0x00FFFFFF ) |0x01000000 ; -pci_write_config_dword (pdev, -PCI_BASE_ADDRESS_2 , base_2); - } - } -#endif #endif /* __powerpc__ */ #if defined(__i386__) && !defined(MODULE )if (!cache_line_size) { -#if LINUX_VERSION_CODE <LinuxVersionCode (2 ,1 ,75 ) -extern char x86; -switch (x86) { -#else switch (boot_cpu_data.x86) { -#endif case 4 : suggested_cache_line_size =4 ;break ;case 6 :case 5 : suggested_cache_line_size =8 ;break ;
drivers/scsi/ncr53c8xx.h renamed from drivers/scsi/ncr53c8xx.h.old +0 -19
@@ -50,8 +50,6 @@** Used by hosts.c and ncr53c8xx.c with module configuration. */ -#if (LINUX_VERSION_CODE >=0x020400 ) || defined(HOSTS_C ) || defined(MODULE ) -#include <scsi/scsicam.h> int ncr53c8xx_abort (Scsi_Cmnd *);
@@ -68,8 +66,6 @@#endif -#if LINUX_VERSION_CODE >=LinuxVersionCode (2 ,1 ,75 ) -#define NCR53C8XX { .name = "", \ .detect = ncr53c8xx_detect, \ .release = ncr53c8xx_release, \
@@ -84,19 +80,4 @@ .cmd_per_lun = SCSI_NCR_CMD_PER_LUN, \ .use_clustering = DISABLE_CLUSTERING} -#else - -#define NCR53C8XX { NULL, NULL, NULL, NULL, \ - NULL, ncr53c8xx_detect, \ - ncr53c8xx_release, ncr53c8xx_info, NULL, \ - ncr53c8xx_queue_command,ncr53c8xx_abort, \ - ncr53c8xx_reset, NULL, scsicam_bios_param, \ - SCSI_NCR_CAN_QUEUE, 7, \ - SCSI_NCR_SG_TABLESIZE, SCSI_NCR_CMD_PER_LUN, \ - 0, 0, DISABLE_CLUSTERING} - -#endif /* LINUX_VERSION_CODE */ - -#endif /* defined(HOSTS_C) || defined(MODULE) */ -#endif /* NCR53C8XX_H */
drivers/scsi/ncr53c8xx.c renamed from drivers/scsi/ncr53c8xx.c.old +16 -73
243 lines not on this page · raw message
drivers/scsi/sym53c8xx_defs.h renamed from drivers/scsi/sym53c8xx_defs.h.old +0 -18
@@ -64,17 +64,8 @@#ifndef SYM53C8XX_DEFS_H #define SYM53C8XX_DEFS_H -/* -** 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. */
@@ -183,11 +174,6 @@#define SCSI_NCR_IOMAPPED #elif defined(__alpha__)#define SCSI_NCR_IOMAPPED -#elif defined(__powerpc__) -#if LINUX_VERSION_CODE <=LinuxVersionCode (2 ,4 ,3 ) -#define SCSI_NCR_IOMAPPED -#define SCSI_NCR_PCI_MEM_NOT_SUPPORTED -#endif #elif defined(__sparc__)#undef SCSI_NCR_IOMAPPED#elif defined(__hppa__) && defined(ENABLE_SCSI_ZALON )
@@ -378,10 +364,6 @@#ifdef __BIG_ENDIAN -#if LINUX_VERSION_CODE <LinuxVersionCode (2 ,1 ,0 ) -#error "BIG ENDIAN byte ordering needs kernel version >= 2.1.0" -#endif -#define inw_l2b inw#define inl_l2b inl#define outw_b2l outw
drivers/scsi/sym53c8xx.c renamed from drivers/scsi/sym53c8xx.c.old +29 -290
609 lines not on this page · raw message