scsi: remove LINUX_VERSION_CODE macro usage from gdth
PATCH 1/1 scsi: remove LINUX_VERSION_CODE macro usage from gdth
From: Pekka Enberg <[email protected]>
This patch removes LINUX_VERSION_CODE macro usage from the gdth driver in drivers/scsi/.
Signed-off-by Pekka Enberg <[email protected]>
---
drivers/scsi/gdth.c | 201 ----------------------------------------------- drivers/scsi/gdth.h | 10 -- drivers/scsi/gdth_proc.c | 163 +------------------------------------- drivers/scsi/gdth_proc.h | 6 - 4 files changed, 6 insertions(+), 374 deletions(-)
drivers/scsi/gdth.c +0 -201
@@ -398,12 +398,7 @@#include <asm/io.h> #include <asm/uaccess.h> #include <linux/spinlock.h> -#if LINUX_VERSION_CODE >=KERNEL_VERSION (2 ,6 ,0 )#include <linux/blkdev.h> -#else -#include <linux/blk.h> -#include "sd.h" -#endif #include "scsi.h" #include <scsi/scsi_host.h>
@@ -2135,29 +2130,17 @@ static int __init gdth_search_drives(intprintk ("GDT-HA %d: Vendor: %s Name: %s\n" , hanum,oemstr->text.oem_company_name,ha->binfo.type_string);/* Save the Host Drive inquiry data */ -#if LINUX_VERSION_CODE >=KERNEL_VERSION (2 ,6 ,0 )strlcpy (ha->oem_name,oemstr->text.scsi_host_drive_inquiry_vendor_id,sizeof (ha->oem_name)); -#else -strncpy (ha->oem_name,oemstr->text.scsi_host_drive_inquiry_vendor_id,7 ); - ha->oem_name[7 ] ='\0' ; -#endif }else {/* Old method, based on PCI ID */ TRACE2 (("gdth_search_drives(): CACHE_READ_OEM_STRING_RECORD failed\n" ));printk ("GDT-HA %d: Name: %s\n" , hanum,ha->binfo.type_string); -#if LINUX_VERSION_CODE >=KERNEL_VERSION (2 ,6 ,0 )if (ha->oem_id ==OEM_ID_INTEL )strlcpy (ha->oem_name,"Intel " ,sizeof (ha->oem_name));else strlcpy (ha->oem_name,"ICP " ,sizeof (ha->oem_name)); -#else -if (ha->oem_id ==OEM_ID_INTEL ) -strcpy (ha->oem_name,"Intel " ); -else -strcpy (ha->oem_name,"ICP " ); -#endif }/* scanning for host drives */
@@ -4293,10 +4276,6 @@ static int __init gdth_detect(struct scs hdr_channel = ha->bus_cnt; ha->virt_bus = hdr_channel; -#if LINUX_VERSION_CODE >=KERNEL_VERSION (2 ,4 ,20 ) && \ -LINUX_VERSION_CODE <KERNEL_VERSION (2 ,6 ,0 ) - shp->highmem_io =0 ; -#endif if (ha->cache_feat & ha->raw_feat & ha->screen_feat &GDT_64BIT ) shp->max_cmd_len =16 ;
@@ -4417,10 +4396,6 @@ static int __init gdth_detect(struct scs hdr_channel = ha->bus_cnt; ha->virt_bus = hdr_channel; -#if LINUX_VERSION_CODE >=KERNEL_VERSION (2 ,4 ,20 ) && \ -LINUX_VERSION_CODE <KERNEL_VERSION (2 ,6 ,0 ) - shp->highmem_io =0 ; -#endif if (ha->cache_feat & ha->raw_feat & ha->screen_feat &GDT_64BIT ) shp->max_cmd_len =16 ;
@@ -4520,10 +4495,6 @@ static int __init gdth_detect(struct scs hdr_channel = ha->bus_cnt; ha->virt_bus = hdr_channel; - -#if LINUX_VERSION_CODE <KERNEL_VERSION (2 ,6 ,0 ) -scsi_set_pci_device (shp, pcistr[ctr].pdev); -#endif if (!(ha->cache_feat & ha->raw_feat & ha->screen_feat &GDT_64BIT )||/* 64-bit DMA only supported from FW >= x.43 */ (!ha->dma64_support)) {
@@ -4755,11 +4726,7 @@ static int gdth_eh_bus_reset(Scsi_Cmnd *return SUCCESS ; } -#if LINUX_VERSION_CODE >=KERNEL_VERSION (2 ,6 ,0 )static int gdth_bios_param (struct scsi_device *sdev,struct block_device *bdev,sector_t cap,int *ip) -#else -static int gdth_bios_param(Disk *disk,kdev_t dev,int *ip) -#endif {unchar b, t;int hanum;
@@ -4767,13 +4734,8 @@ static int gdth_bios_param(Disk *disk,kdstruct scsi_device *sd;unsigned capacity; -#if LINUX_VERSION_CODE >=KERNEL_VERSION (2 ,6 ,0 ) sd = sdev; capacity = cap; -#else - sd = disk->device; - capacity = disk->capacity; -#endif hanum =NUMDATA (sd->host)->hanum; b = virt_ctr ?NUMDATA (sd->host)->busnum : sd->channel; t = sd->id;
@@ -4921,11 +4883,7 @@ static int ioc_resetdrv(void __user *arggdth_cmd_str cmd;int hanum;gdth_ha_str *ha; -#if LINUX_VERSION_CODE >=KERNEL_VERSION (2 ,6 ,0 )Scsi_Request *srp; -#else -Scsi_Cmnd *scp; -#endif if (copy_from_user (&res, arg,sizeof (gdth_ioctl_reset)) || res.ionode >= gdth_ctr_count || res.number >=MAX_HDRIVES )
@@ -4942,7 +4900,6 @@ static int ioc_resetdrv(void __user *arg cmd.u.cache64.DeviceNo = res.number; else cmd.u.cache.DeviceNo = res.number; -#if LINUX_VERSION_CODE >=KERNEL_VERSION (2 ,6 ,0 ) srp =scsi_allocate_request (ha->sdev,GFP_KERNEL );if (!srp)return -ENOMEM ;
@@ -4951,16 +4908,6 @@ static int ioc_resetdrv(void __user *arggdth_do_req (srp, &cmd, cmnd,30 ); res.status = (ushort )srp->sr_command->SCp.Status;scsi_release_request (srp); -#else - scp =scsi_allocate_device (ha->sdev,1 , FALSE); -if (!scp) -return -ENOMEM ; - scp->cmd_len =12 ; - scp->use_sg =0 ; -gdth_do_cmd (scp, &cmd, cmnd,30 ); - res.status = (ushort )scp->SCp.Status; -scsi_release_command (scp); -#endif if (copy_to_user (arg, &res,sizeof (gdth_ioctl_reset)))return -EFAULT ;
@@ -4974,11 +4921,7 @@ static int ioc_general(void __user *arg,ulong64 paddr;int hanum;gdth_ha_str *ha; -#if LINUX_VERSION_CODE >=KERNEL_VERSION (2 ,6 ,0 )Scsi_Request *srp; -#else -Scsi_Cmnd *scp; -#endif if (copy_from_user (&gen, arg,sizeof (gdth_ioctl_general)) || gen.ionode >= gdth_ctr_count)
@@ -5070,7 +5013,6 @@ static int ioc_general(void __user *arg, } } -#if LINUX_VERSION_CODE >=KERNEL_VERSION (2 ,6 ,0 ) srp =scsi_allocate_request (ha->sdev,GFP_KERNEL );if (!srp)return -ENOMEM ;
@@ -5080,17 +5022,6 @@ static int ioc_general(void __user *arg, gen.status = srp->sr_command->SCp.Status; gen.info = srp->sr_command->SCp.Message;scsi_release_request (srp); -#else - scp =scsi_allocate_device (ha->sdev,1 , FALSE); -if (!scp) -return -ENOMEM ; - scp->cmd_len =12 ; - scp->use_sg =0 ; -gdth_do_cmd (scp, &gen.command, cmnd, gen.timeout); - gen.status = scp->SCp.Status; - gen.info = scp->SCp.Message; -scsi_release_command (scp); -#endif if (copy_to_user (arg +sizeof (gdth_ioctl_general), buf, gen.data_len + gen.sense_len)) {
@@ -5113,11 +5044,7 @@ static int ioc_hdrlist(void __user *arg,gdth_ha_str *ha;unchar i;int hanum, rc = -ENOMEM ; -#if LINUX_VERSION_CODE >=KERNEL_VERSION (2 ,6 ,0 )Scsi_Request *srp; -#else -Scsi_Cmnd *scp; -#endif rsc =kmalloc (sizeof (*rsc),GFP_KERNEL ); cmd =kmalloc (sizeof (*cmd),GFP_KERNEL );
@@ -5133,19 +5060,11 @@ static int ioc_hdrlist(void __user *arg, ha =HADATA (gdth_ctr_tab[hanum]);memset (cmd,0 ,sizeof (gdth_cmd_str)); -#if LINUX_VERSION_CODE >=KERNEL_VERSION (2 ,6 ,0 ) srp =scsi_allocate_request (ha->sdev,GFP_KERNEL );if (!srp) goto free_fail; srp->sr_cmd_len =12 ; srp->sr_use_sg =0 ; -#else - scp =scsi_allocate_device (ha->sdev,1 , FALSE); -if (!scp) - goto free_fail; - scp->cmd_len =12 ; - scp->use_sg =0 ; -#endif for (i =0 ; i <MAX_HDRIVES ; ++i) {if (!ha->hdr[i].present) {
@@ -5163,22 +5082,12 @@ static int ioc_hdrlist(void __user *arg, cmd->u.cache64.DeviceNo = i; else cmd->u.cache.DeviceNo = i; -#if LINUX_VERSION_CODE >=KERNEL_VERSION (2 ,6 ,0 )gdth_do_req (srp, cmd, cmnd,30 );if (srp->sr_command->SCp.Status ==S_OK ) rsc->hdr_list[i].cluster_type = srp->sr_command->SCp.Message; -#else -gdth_do_cmd (scp, cmd, cmnd,30 ); -if (scp->SCp.Status ==S_OK ) - rsc->hdr_list[i].cluster_type = scp->SCp.Message; -#endif } } -#if LINUX_VERSION_CODE >=KERNEL_VERSION (2 ,6 ,0 )scsi_release_request (srp); -#else -scsi_release_command (scp); -#endif if (copy_to_user (arg, rsc,sizeof (gdth_ioctl_rescan))) rc = -EFAULT ;
@@ -5201,11 +5110,7 @@ static int ioc_rescan(void __user *arg,int rc = -ENOMEM ;ulong flags;gdth_ha_str *ha; -#if LINUX_VERSION_CODE >=KERNEL_VERSION (2 ,6 ,0 )Scsi_Request *srp; -#else -Scsi_Cmnd *scp; -#endif rsc =kmalloc (sizeof (*rsc),GFP_KERNEL ); cmd =kmalloc (sizeof (*cmd),GFP_KERNEL );
@@ -5221,19 +5126,11 @@ static int ioc_rescan(void __user *arg, ha =HADATA (gdth_ctr_tab[hanum]);memset (cmd,0 ,sizeof (gdth_cmd_str)); -#if LINUX_VERSION_CODE >=KERNEL_VERSION (2 ,6 ,0 ) srp =scsi_allocate_request (ha->sdev,GFP_KERNEL );if (!srp) goto free_fail; srp->sr_cmd_len =12 ; srp->sr_use_sg =0 ; -#else - scp =scsi_allocate_device (ha->sdev,1 , FALSE); -if (!scp) - goto free_fail; - scp->cmd_len =12 ; - scp->use_sg =0 ; -#endif if (rsc->flag ==0 ) {/* old method: re-init. cache service */
@@ -5245,19 +5142,9 @@ static int ioc_rescan(void __user *arg, cmd->OpCode =GDT_INIT ; cmd->u.cache.DeviceNo =LINUX_OS ; } -#if LINUX_VERSION_CODE >=KERNEL_VERSION (2 ,6 ,0 )gdth_do_req (srp, cmd, cmnd,30 ); status = (ushort )srp->sr_command->SCp.Status; info = (ulong32 )srp->sr_command->SCp.Message; -#elif LINUX_VERSION_CODE >=KERNEL_VERSION (2 ,4 ,0 ) -gdth_do_cmd (scp, cmd, cmnd,30 ); - status = (ushort )scp->SCp.Status; - info = (ulong32 )scp->SCp.Message; -#else -gdth_do_cmd (&scp, cmd, cmnd,30 ); - status = (ushort )scp.SCp.Status; - info = (ulong32 )scp.SCp.Message; -#endif i =0 ; hdr_cnt = (status ==S_OK ? (ushort )info :0 ); }else {
@@ -5272,15 +5159,9 @@ static int ioc_rescan(void __user *arg, cmd->u.cache64.DeviceNo = i; else cmd->u.cache.DeviceNo = i; -#if LINUX_VERSION_CODE >=KERNEL_VERSION (2 ,6 ,0 )gdth_do_req (srp, cmd, cmnd,30 ); status = (ushort )srp->sr_command->SCp.Status; info = (ulong32 )srp->sr_command->SCp.Message; -#else -gdth_do_cmd (scp, cmd, cmnd,30 ); - status = (ushort )scp->SCp.Status; - info = (ulong32 )scp->SCp.Message; -#endif spin_lock_irqsave (&ha->smp_lock, flags); rsc->hdr_list[i].bus = ha->virt_bus; rsc->hdr_list[i].target = i;
@@ -5312,15 +5193,9 @@ static int ioc_rescan(void __user *arg, cmd->u.cache64.DeviceNo = i; else cmd->u.cache.DeviceNo = i; -#if LINUX_VERSION_CODE >=KERNEL_VERSION (2 ,6 ,0 )gdth_do_req (srp, cmd, cmnd,30 ); status = (ushort )srp->sr_command->SCp.Status; info = (ulong32 )srp->sr_command->SCp.Message; -#else -gdth_do_cmd (scp, cmd, cmnd,30 ); - status = (ushort )scp->SCp.Status; - info = (ulong32 )scp->SCp.Message; -#endif spin_lock_irqsave (&ha->smp_lock, flags); ha->hdr[i].devtype = (status ==S_OK ? (ushort )info :0 );spin_unlock_irqrestore (&ha->smp_lock, flags);
@@ -5331,15 +5206,9 @@ static int ioc_rescan(void __user *arg, cmd->u.cache64.DeviceNo = i; else cmd->u.cache.DeviceNo = i; -#if LINUX_VERSION_CODE >=KERNEL_VERSION (2 ,6 ,0 )gdth_do_req (srp, cmd, cmnd,30 ); status = (ushort )srp->sr_command->SCp.Status; info = (ulong32 )srp->sr_command->SCp.Message; -#else -gdth_do_cmd (scp, cmd, cmnd,30 ); - status = (ushort )scp->SCp.Status; - info = (ulong32 )scp->SCp.Message; -#endif spin_lock_irqsave (&ha->smp_lock, flags); ha->hdr[i].cluster_type = ((status ==S_OK && !shared_access) ? (ushort )info :0 );
@@ -5352,24 +5221,14 @@ static int ioc_rescan(void __user *arg, cmd->u.cache64.DeviceNo = i; else cmd->u.cache.DeviceNo = i; -#if LINUX_VERSION_CODE >=KERNEL_VERSION (2 ,6 ,0 )gdth_do_req (srp, cmd, cmnd,30 ); status = (ushort )srp->sr_command->SCp.Status; info = (ulong32 )srp->sr_command->SCp.Message; -#else -gdth_do_cmd (scp, cmd, cmnd,30 ); - status = (ushort )scp->SCp.Status; - info = (ulong32 )scp->SCp.Message; -#endif spin_lock_irqsave (&ha->smp_lock, flags); ha->hdr[i].rw_attribs = (status ==S_OK ? (ushort )info :0 );spin_unlock_irqrestore (&ha->smp_lock, flags); } -#if LINUX_VERSION_CODE >=KERNEL_VERSION (2 ,6 ,0 )scsi_release_request (srp); -#else -scsi_release_command (scp); -#endif if (copy_to_user (arg, rsc,sizeof (gdth_ioctl_rescan))) rc = -EFAULT ;
@@ -5514,8 +5373,6 @@ static int gdth_ioctl(struct inode *inod hanum = res.ionode; ha =HADATA (gdth_ctr_tab[hanum]); -/* Because we need a Scsi_Cmnd struct., we make a scsi_allocate device also for kernels >=2.6.x */ -#if LINUX_VERSION_CODE >=KERNEL_VERSION (2 ,6 ,0 ) scp =scsi_get_command (ha->sdev,GFP_KERNEL );if (!scp)return -ENOMEM ;
@@ -5525,17 +5382,6 @@ static int gdth_ioctl(struct inode *inod rval =gdth_eh_bus_reset (scp); res.status = (rval ==SUCCESS ?S_OK :S_GENERR );scsi_put_command (scp); -#else - scp =scsi_allocate_device (ha->sdev,1 , FALSE); -if (!scp) -return -ENOMEM ; - scp->cmd_len =12 ; - scp->use_sg =0 ; - scp->channel = virt_ctr ?0 : res.number; - rval =gdth_eh_bus_reset (scp); - res.status = (rval ==SUCCESS ?S_OK :S_GENERR ); -scsi_release_command (scp); -#endif if (copy_to_user (argp, &res,sizeof (gdth_ioctl_reset)))return -EFAULT ;break ;
@@ -5557,11 +5403,7 @@ static void gdth_flush(int hanum)int i;gdth_ha_str *ha;gdth_cmd_str gdtcmd; -#if LINUX_VERSION_CODE >=KERNEL_VERSION (2 ,6 ,0 )Scsi_Request *srp; -#else -Scsi_Cmnd *scp; -#endif struct scsi_device *sdev;char cmnd[MAX_COMMAND_SIZE ];memset (cmnd,0xff ,MAX_COMMAND_SIZE );
@@ -5569,21 +5411,12 @@ static void gdth_flush(int hanum)TRACE2 (("gdth_flush() hanum %d\n" ,hanum)); ha =HADATA (gdth_ctr_tab[hanum]); -#if LINUX_VERSION_CODE >=KERNEL_VERSION (2 ,6 ,0 ) sdev =scsi_get_host_dev (gdth_ctr_tab[hanum]); srp =scsi_allocate_request (sdev,GFP_KERNEL );if (!srp)return ; srp->sr_cmd_len =12 ; srp->sr_use_sg =0 ; -#else - sdev =scsi_get_host_dev (gdth_ctr_tab[hanum]); - scp =scsi_allocate_device (sdev,1 , FALSE); -if (!scp) -return ; - scp->cmd_len =12 ; - scp->use_sg =0 ; -#endif for (i =0 ; i <MAX_HDRIVES ; ++i) {if (ha->hdr[i].present) {
@@ -5600,20 +5433,11 @@ static void gdth_flush(int hanum) gdtcmd.u.cache.sg_canz =0 ; }TRACE2 (("gdth_flush(): flush ha %d drive %d\n" , hanum, i)); -#if LINUX_VERSION_CODE >=KERNEL_VERSION (2 ,6 ,0 )gdth_do_req (srp, &gdtcmd, cmnd,30 ); -#else -gdth_do_cmd (scp, &gdtcmd, cmnd,30 ); -#endif } } -#if LINUX_VERSION_CODE >=KERNEL_VERSION (2 ,6 ,0 )scsi_release_request (srp);scsi_free_host_dev (sdev); -#else -scsi_release_command (scp); -scsi_free_host_dev (sdev); -#endif }/* shutdown routine */
@@ -5622,13 +5446,8 @@ static int gdth_halt(struct notifier_bloint hanum;#ifndef __alpha__gdth_cmd_str gdtcmd; -#if LINUX_VERSION_CODE >=KERNEL_VERSION (2 ,6 ,0 )Scsi_Request *srp;struct scsi_device *sdev; -#else -Scsi_Cmnd *scp; -struct scsi_device *sdev; -#endif char cmnd[MAX_COMMAND_SIZE ];#endif
@@ -5647,7 +5466,6 @@ static int gdth_halt(struct notifier_blo gdtcmd.Service =CACHESERVICE ; gdtcmd.OpCode =GDT_RESET ;TRACE2 (("gdth_halt(): reset controller %d\n" , hanum)); -#if LINUX_VERSION_CODE >=KERNEL_VERSION (2 ,6 ,0 ) sdev =scsi_get_host_dev (gdth_ctr_tab[hanum]); srp =scsi_allocate_request (sdev,GFP_KERNEL );if (!srp) {
@@ -5659,19 +5477,6 @@ static int gdth_halt(struct notifier_blogdth_do_req (srp, &gdtcmd, cmnd,10 );scsi_release_request (srp);scsi_free_host_dev (sdev); -#else - sdev =scsi_get_host_dev (gdth_ctr_tab[hanum]); - scp =scsi_allocate_device (sdev,1 , FALSE); -if (!scp) { -unregister_reboot_notifier (&gdth_notifier); -return NOTIFY_OK ; - } - scp->cmd_len =12 ; - scp->use_sg =0 ; -gdth_do_cmd (scp, &gdtcmd, cmnd,10 ); -scsi_release_command (scp); -scsi_free_host_dev (sdev); -#endif #endif }printk ("Done.\n" );
@@ -5699,12 +5504,6 @@ static struct scsi_host_template driver_ .cmd_per_lun = GDTH_MAXC_P_L, .unchecked_isa_dma = 1, .use_clustering = ENABLE_CLUSTERING, -#if LINUX_VERSION_CODE <KERNEL_VERSION (2 ,6 ,0 ) - .use_new_eh_code = 1, -#if LINUX_VERSION_CODE >=KERNEL_VERSION (2 ,4 ,20 ) - .highmem_io = 1, -#endif -#endif };#include "scsi_module.c"
drivers/scsi/gdth.h +0 -10
@@ -936,18 +936,12 @@ typedef struct {gdth_binfo_str binfo;/* controller info */ gdth_evt_data dvr;/* event structure */ spinlock_t smp_lock; -#if LINUX_VERSION_CODE >=KERNEL_VERSION (2 ,4 ,0 )struct pci_dev *pdev; -#endif char oem_name[8 ];#ifdef GDTH_DMA_STATISTICS ulong dma32_cnt, dma64_cnt;/* statistics: DMA buffer */ #endif -#if LINUX_VERSION_CODE >=KERNEL_VERSION (2 ,4 ,0 )struct scsi_device *sdev; -#else -struct scsi_device sdev; -#endif } gdth_ha_str;/* structure for scsi_register(), SCSI bus != 0 */
@@ -1029,10 +1023,6 @@ typedef struct {/* function prototyping */ -#if LINUX_VERSION_CODE >=KERNEL_VERSION (2 ,6 ,0 )int gdth_proc_info (struct Scsi_Host *,char *,char **,off_t ,int ,int ); -#else -int gdth_proc_info (char *,char **,off_t ,int ,int ,int ); -#endif #endif
drivers/scsi/gdth_proc.c +6 -157
308 lines not on this page · raw message
drivers/scsi/gdth_proc.h +0 -6
@@ -10,15 +10,9 @@ static int gdth_set_info(char *buffer,instatic int gdth_get_info (char *buffer,char **start,off_t offset,int length,struct Scsi_Host *host,int hanum,int busnum); -#if LINUX_VERSION_CODE >=KERNEL_VERSION (2 ,6 ,0 )static void gdth_do_req (Scsi_Request *srp,gdth_cmd_str *cmd,char *cmnd,int timeout);static int gdth_set_asc_info (char *buffer,int length,int hanum,Scsi_Request *scp); -#else -static void gdth_do_cmd (Scsi_Cmnd *scp,gdth_cmd_str *cmd, -char *cmnd,int timeout); -static int gdth_set_asc_info (char *buffer,int length,int hanum,Scsi_Cmnd *scp); -#endif static char *gdth_ioctl_alloc (int hanum,int size,int scratch,ulong64 *paddr);