Subject: [PATCH] Atari NCR5380: Scsi_Cmnd -> struct scsi_cmnd Atari NCR5380 SCSI: Replace Scsi_Cmnd by struct scsi_cmnd Signed-off-by: Geert Uytterhoeven --- drivers/scsi/atari_NCR5380.c | 106 ++++++++++++++++++++++--------------------- drivers/scsi/atari_scsi.c | 19 ++++--- drivers/scsi/atari_scsi.h | 2 3 files changed, 66 insertions(+), 61 deletions(-) --- linux-2.6.19.orig/drivers/scsi/atari_NCR5380.c +++ linux-2.6.19/drivers/scsi/atari_NCR5380.c @@ -264,8 +264,8 @@ static struct scsi_host_template *the_te (struct NCR5380_hostdata *)(in)->hostdata #define HOSTDATA(in) ((struct NCR5380_hostdata *)(in)->hostdata) -#define NEXT(cmd) ((Scsi_Cmnd *)((cmd)->host_scribble)) -#define NEXTADDR(cmd) ((Scsi_Cmnd **)&((cmd)->host_scribble)) +#define NEXT(cmd) ((struct scsi_cmnd *)((cmd)->host_scribble)) +#define NEXTADDR(cmd) ((struct scsi_cmnd **)&((cmd)->host_scribble)) #define HOSTNO instance->host_no #define H_NO(cmd) (cmd)->device->host->host_no @@ -350,7 +350,7 @@ static void __init init_tags( void ) * conditions. */ -static int is_lun_busy( Scsi_Cmnd *cmd, int should_be_tagged ) +static int is_lun_busy( struct scsi_cmnd *cmd, int should_be_tagged ) { SETUP_HOSTDATA(cmd->device->host); @@ -374,7 +374,7 @@ static int is_lun_busy( Scsi_Cmnd *cmd, * untagged. */ -static void cmd_get_tag( Scsi_Cmnd *cmd, int should_be_tagged ) +static void cmd_get_tag( struct scsi_cmnd *cmd, int should_be_tagged ) { SETUP_HOSTDATA(cmd->device->host); @@ -406,7 +406,7 @@ static void cmd_get_tag( Scsi_Cmnd *cmd, * unlock the LUN. */ -static void cmd_free_tag( Scsi_Cmnd *cmd ) +static void cmd_free_tag( struct scsi_cmnd *cmd ) { SETUP_HOSTDATA(cmd->device->host); @@ -450,18 +450,18 @@ static void free_all_tags( void ) /* - * Function: void merge_contiguous_buffers( Scsi_Cmnd *cmd ) + * Function: void merge_contiguous_buffers( struct scsi_cmnd *cmd ) * * Purpose: Try to merge several scatter-gather requests into one DMA * transfer. This is possible if the scatter buffers lie on * physical contiguous addresses. * - * Parameters: Scsi_Cmnd *cmd + * Parameters: struct scsi_cmnd *cmd * The command to work on. The first scatter buffer's data are * assumed to be already transfered into ptr/this_residual. */ -static void merge_contiguous_buffers( Scsi_Cmnd *cmd ) +static void merge_contiguous_buffers( struct scsi_cmnd *cmd ) { unsigned long endaddr; #if (NDEBUG & NDEBUG_MERGING) @@ -491,15 +491,15 @@ static void merge_contiguous_buffers( Sc } /* - * Function : void initialize_SCp(Scsi_Cmnd *cmd) + * Function : void initialize_SCp(struct scsi_cmnd *cmd) * * Purpose : initialize the saved data pointers for cmd to point to the * start of the buffer. * - * Inputs : cmd - Scsi_Cmnd structure to have pointers reset. + * Inputs : cmd - struct scsi_cmnd structure to have pointers reset. */ -static __inline__ void initialize_SCp(Scsi_Cmnd *cmd) +static __inline__ void initialize_SCp(struct scsi_cmnd *cmd) { /* * Initialize the Scsi Pointer field so that all of the commands in the @@ -741,8 +741,8 @@ static void NCR5380_print_status (struct #define SPRINTF(fmt,args...) \ do { if (pos + strlen(fmt) + 20 /* slop */ < buffer + length) \ pos += sprintf(pos, fmt , ## args); } while(0) -static -char *lprint_Scsi_Cmnd (Scsi_Cmnd *cmd, char *pos, char *buffer, int length); +static char *lprint_Scsi_Cmnd(struct scsi_cmnd *cmd, char *pos, char *buffer, + int length); static int NCR5380_proc_info (struct Scsi_Host *instance, char *buffer, char **start, off_t offset, @@ -750,7 +750,7 @@ int NCR5380_proc_info (struct Scsi_Host { char *pos = buffer; struct NCR5380_hostdata *hostdata; - Scsi_Cmnd *ptr; + struct scsi_cmnd *ptr; unsigned long flags; off_t begin = 0; #define check_offset() \ @@ -774,18 +774,19 @@ int NCR5380_proc_info (struct Scsi_Host if (!hostdata->connected) SPRINTF("scsi%d: no currently connected command\n", HOSTNO); else - pos = lprint_Scsi_Cmnd ((Scsi_Cmnd *) hostdata->connected, + pos = lprint_Scsi_Cmnd ((struct scsi_cmnd *) hostdata->connected, pos, buffer, length); SPRINTF("scsi%d: issue_queue\n", HOSTNO); check_offset(); - for (ptr = (Scsi_Cmnd *) hostdata->issue_queue; ptr; ptr = NEXT(ptr)) { + for (ptr = (struct scsi_cmnd *) hostdata->issue_queue; ptr; + ptr = NEXT(ptr)) { pos = lprint_Scsi_Cmnd (ptr, pos, buffer, length); check_offset(); } SPRINTF("scsi%d: disconnected_queue\n", HOSTNO); check_offset(); - for (ptr = (Scsi_Cmnd *) hostdata->disconnected_queue; ptr; + for (ptr = (struct scsi_cmnd *) hostdata->disconnected_queue; ptr; ptr = NEXT(ptr)) { pos = lprint_Scsi_Cmnd (ptr, pos, buffer, length); check_offset(); @@ -801,7 +802,7 @@ int NCR5380_proc_info (struct Scsi_Host } static char * -lprint_Scsi_Cmnd (Scsi_Cmnd *cmd, char *pos, char *buffer, int length) +lprint_Scsi_Cmnd (struct scsi_cmnd *cmd, char *pos, char *buffer, int length) { int i, s; unsigned char *command; @@ -888,7 +889,7 @@ static int NCR5380_init (struct Scsi_Hos * set the timer, we want to take this value into account. */ -int atari_scsi_update_timeout(Scsi_Cmnd * SCset, int timeout) +int atari_scsi_update_timeout(struct scsi_cmnd * SCset, int timeout) { int rtn; @@ -918,8 +919,8 @@ int atari_scsi_update_timeout(Scsi_Cmnd } /* - * Function : int NCR5380_queue_command (Scsi_Cmnd *cmd, - * void (*done)(Scsi_Cmnd *)) + * Function : int NCR5380_queue_command (struct scsi_cmnd *cmd, + * void (*done)(struct scsi_cmnd *)) * * Purpose : enqueues a SCSI command * @@ -936,13 +937,14 @@ int atari_scsi_update_timeout(Scsi_Cmnd */ static -int NCR5380_queue_command (Scsi_Cmnd *cmd, void (*done)(Scsi_Cmnd *)) +int NCR5380_queue_command(struct scsi_cmnd *cmd, + void (*done)(struct scsi_cmnd *)) { SETUP_HOSTDATA(cmd->device->host); - Scsi_Cmnd *tmp; + struct scsi_cmnd *tmp; int oldto; unsigned long flags; - // extern int update_timeout(Scsi_Cmnd * SCset, int timeout); + // extern int update_timeout(struct scsi_cmnd * SCset, int timeout); #if (NDEBUG & NDEBUG_NO_WRITE) switch (cmd->cmnd[0]) { @@ -1027,7 +1029,7 @@ int NCR5380_queue_command (Scsi_Cmnd *cm NEXT(cmd) = hostdata->issue_queue; hostdata->issue_queue = cmd; } else { - for (tmp = (Scsi_Cmnd *)hostdata->issue_queue; + for (tmp = (struct scsi_cmnd *)hostdata->issue_queue; NEXT(tmp); tmp = NEXT(tmp)) ; LIST(cmd, tmp); @@ -1066,7 +1068,7 @@ int NCR5380_queue_command (Scsi_Cmnd *cm static void NCR5380_main (void *bl) { - Scsi_Cmnd *tmp, *prev; + struct scsi_cmnd *tmp, *prev; struct Scsi_Host *instance = first_instance; struct NCR5380_hostdata *hostdata = HOSTDATA(instance); int done; @@ -1109,13 +1111,13 @@ static void NCR5380_main (void *bl) * for a target that's not busy. */ #if (NDEBUG & NDEBUG_LISTS) - for (tmp = (Scsi_Cmnd *) hostdata->issue_queue, prev = NULL; + for (tmp = (struct scsi_cmnd *) hostdata->issue_queue, prev = NULL; tmp && (tmp != prev); prev = tmp, tmp = NEXT(tmp)) ; /*printk("%p ", tmp);*/ if ((tmp == prev) && tmp) printk(" LOOP\n");/* else printk("\n");*/ #endif - for (tmp = (Scsi_Cmnd *) hostdata->issue_queue, + for (tmp = (struct scsi_cmnd *) hostdata->issue_queue, prev = NULL; tmp; prev = tmp, tmp = NEXT(tmp) ) { #if (NDEBUG & NDEBUG_LISTS) @@ -1382,7 +1384,8 @@ static irqreturn_t NCR5380_intr (int irq } #ifdef NCR5380_STATS -static void collect_stats(struct NCR5380_hostdata* hostdata, Scsi_Cmnd* cmd) +static void collect_stats(struct NCR5380_hostdata* hostdata, + struct scsi_cmnd* cmd) { # ifdef NCR5380_STAT_LIMIT if (cmd->request_bufflen > NCR5380_STAT_LIMIT) @@ -1408,8 +1411,8 @@ static void collect_stats(struct NCR5380 #endif /* - * Function : int NCR5380_select (struct Scsi_Host *instance, Scsi_Cmnd *cmd, - * int tag); + * Function : int NCR5380_select(struct Scsi_Host *instance, + * struct scsi_cmnd *cmd, int tag); * * Purpose : establishes I_T_L or I_T_L_Q nexus for new or existing command, * including ARBITRATION, SELECTION, and initial message out for @@ -1438,7 +1441,8 @@ static void collect_stats(struct NCR5380 * cmd->result host byte set to DID_BAD_TARGET. */ -static int NCR5380_select (struct Scsi_Host *instance, Scsi_Cmnd *cmd, int tag) +static int NCR5380_select(struct Scsi_Host *instance, struct scsi_cmnd *cmd, + int tag) { SETUP_HOSTDATA(instance); unsigned char tmp[3], phase; @@ -2037,7 +2041,7 @@ static void NCR5380_information_transfer #endif unsigned char *data; unsigned char phase, tmp, extended_msg[10], old_phase=0xff; - Scsi_Cmnd *cmd = (Scsi_Cmnd *) hostdata->connected; + struct scsi_cmnd *cmd = (struct scsi_cmnd *) hostdata->connected; while (1) { tmp = NCR5380_read(STATUS_REG); @@ -2286,7 +2290,7 @@ static void NCR5380_information_transfer local_irq_save(flags); LIST(cmd,hostdata->issue_queue); NEXT(cmd) = hostdata->issue_queue; - hostdata->issue_queue = (Scsi_Cmnd *) cmd; + hostdata->issue_queue = (struct scsi_cmnd *) cmd; local_irq_restore(flags); QU_PRINTK("scsi%d: REQUEST SENSE added to head of " "issue queue\n", H_NO(cmd)); @@ -2520,7 +2524,7 @@ static void NCR5380_information_transfer * Function : void NCR5380_reselect (struct Scsi_Host *instance) * * Purpose : does reselection, initializing the instance->connected - * field to point to the Scsi_Cmnd for which the I_T_L or I_T_L_Q + * field to point to the struct scsi_cmnd for which the I_T_L or I_T_L_Q * nexus has been reestablished, * * Inputs : instance - this instance of the NCR5380. @@ -2539,7 +2543,7 @@ static void NCR5380_reselect (struct Scs #endif unsigned char msg[3]; unsigned char *data; - Scsi_Cmnd *tmp = NULL, *prev; + struct scsi_cmnd *tmp = NULL, *prev; /* unsigned long flags; */ /* @@ -2611,7 +2615,7 @@ static void NCR5380_reselect (struct Scs * just reestablished, and remove it from the disconnected queue. */ - for (tmp = (Scsi_Cmnd *) hostdata->disconnected_queue, prev = NULL; + for (tmp = (struct scsi_cmnd *) hostdata->disconnected_queue, prev = NULL; tmp; prev = tmp, tmp = NEXT(tmp) ) { if ((target_mask == (1 << tmp->device->id)) && (lun == tmp->device->lun) #ifdef SUPPORT_TAGS @@ -2662,11 +2666,11 @@ static void NCR5380_reselect (struct Scs /* - * Function : int NCR5380_abort (Scsi_Cmnd *cmd) + * Function : int NCR5380_abort (struct scsi_cmnd *cmd) * * Purpose : abort a command * - * Inputs : cmd - the Scsi_Cmnd to abort, code - code to set the + * Inputs : cmd - the struct scsi_cmnd to abort, code - code to set the * host byte of the result field to, if zero DID_ABORTED is * used. * @@ -2679,11 +2683,11 @@ static void NCR5380_reselect (struct Scs */ static -int NCR5380_abort (Scsi_Cmnd *cmd) +int NCR5380_abort (struct scsi_cmnd *cmd) { struct Scsi_Host *instance = cmd->device->host; SETUP_HOSTDATA(instance); - Scsi_Cmnd *tmp, **prev; + struct scsi_cmnd *tmp, **prev; unsigned long flags; printk(KERN_NOTICE "scsi%d: aborting command\n", HOSTNO); @@ -2753,8 +2757,8 @@ int NCR5380_abort (Scsi_Cmnd *cmd) * Case 2 : If the command hasn't been issued yet, we simply remove it * from the issue queue. */ - for (prev = (Scsi_Cmnd **) &(hostdata->issue_queue), - tmp = (Scsi_Cmnd *) hostdata->issue_queue; + for (prev = (struct scsi_cmnd **) &(hostdata->issue_queue), + tmp = (struct scsi_cmnd *) hostdata->issue_queue; tmp; prev = NEXTADDR(tmp), tmp = NEXT(tmp) ) if (cmd == tmp) { REMOVE(5, *prev, tmp, NEXT(tmp)); @@ -2813,7 +2817,7 @@ int NCR5380_abort (Scsi_Cmnd *cmd) * it from the disconnected queue. */ - for (tmp = (Scsi_Cmnd *) hostdata->disconnected_queue; tmp; + for (tmp = (struct scsi_cmnd *) hostdata->disconnected_queue; tmp; tmp = NEXT(tmp)) if (cmd == tmp) { local_irq_restore(flags); @@ -2827,8 +2831,8 @@ int NCR5380_abort (Scsi_Cmnd *cmd) do_abort (instance); local_irq_save(flags); - for (prev = (Scsi_Cmnd **) &(hostdata->disconnected_queue), - tmp = (Scsi_Cmnd *) hostdata->disconnected_queue; + for (prev = (struct scsi_cmnd **) &(hostdata->disconnected_queue), + tmp = (struct scsi_cmnd *) hostdata->disconnected_queue; tmp; prev = NEXTADDR(tmp), tmp = NEXT(tmp) ) if (cmd == tmp) { REMOVE(5, *prev, tmp, NEXT(tmp)); @@ -2876,7 +2880,7 @@ int NCR5380_abort (Scsi_Cmnd *cmd) /* - * Function : int NCR5380_reset (Scsi_Cmnd *cmd) + * Function : int NCR5380_reset (struct scsi_cmnd *cmd) * * Purpose : reset the SCSI bus. * @@ -2884,13 +2888,13 @@ int NCR5380_abort (Scsi_Cmnd *cmd) * */ -static int NCR5380_bus_reset( Scsi_Cmnd *cmd) +static int NCR5380_bus_reset( struct scsi_cmnd *cmd) { SETUP_HOSTDATA(cmd->device->host); int i; unsigned long flags; #if 1 - Scsi_Cmnd *connected, *disconnected_queue; + struct scsi_cmnd *connected, *disconnected_queue; #endif if (!IS_A_TT() && !falcon_got_lock) @@ -2925,9 +2929,9 @@ static int NCR5380_bus_reset( Scsi_Cmnd * remembered in local variables first. */ local_irq_save(flags); - connected = (Scsi_Cmnd *)hostdata->connected; + connected = (struct scsi_cmnd *)hostdata->connected; hostdata->connected = NULL; - disconnected_queue = (Scsi_Cmnd *)hostdata->disconnected_queue; + disconnected_queue = (struct scsi_cmnd *)hostdata->disconnected_queue; hostdata->disconnected_queue = NULL; #ifdef SUPPORT_TAGS free_all_tags(); --- linux-2.6.19.orig/drivers/scsi/atari_scsi.c +++ linux-2.6.19/drivers/scsi/atari_scsi.c @@ -190,9 +190,9 @@ static inline void DISABLE_IRQ(void) static int scsi_dma_is_ignored_buserr( unsigned char dma_stat ); static void atari_scsi_fetch_restbytes( void ); static long atari_scsi_dma_residual( struct Scsi_Host *instance ); -static int falcon_classify_cmd( Scsi_Cmnd *cmd ); -static unsigned long atari_dma_xfer_len( unsigned long wanted_len, - Scsi_Cmnd *cmd, int write_flag ); +static int falcon_classify_cmd( struct scsi_cmnd *cmd ); +static unsigned long atari_dma_xfer_len(unsigned long wanted_len, + struct scsi_cmnd *cmd, int write_flag); #endif static irqreturn_t scsi_tt_intr( int irq, void *dummy); static irqreturn_t scsi_falcon_intr( int irq, void *dummy); @@ -588,7 +588,8 @@ static void falcon_get_lock( void ) */ #if 0 -int atari_queue_command (Scsi_Cmnd *cmd, void (*done)(Scsi_Cmnd *)) +int atari_queue_command(struct scsi_cmnd *cmd, + void (*done)(struct scsi_cmnd *)) { /* falcon_get_lock(); * ++guenther: moved to NCR5380_queue_command() to prevent @@ -818,7 +819,7 @@ void __init atari_scsi_setup(char *str, #endif } -int atari_scsi_bus_reset(Scsi_Cmnd *cmd) +int atari_scsi_bus_reset(struct scsi_cmnd *cmd) { int rv; struct NCR5380_hostdata *hostdata = @@ -981,7 +982,7 @@ static long atari_scsi_dma_residual( str #define CMD_SURELY_BYTE_MODE 1 #define CMD_MODE_UNKNOWN 2 -static int falcon_classify_cmd( Scsi_Cmnd *cmd ) +static int falcon_classify_cmd( struct scsi_cmnd *cmd ) { unsigned char opcode = cmd->cmnd[0]; @@ -1013,9 +1014,9 @@ static int falcon_classify_cmd( Scsi_Cmn * the overrun problem, so this question is academic :-) */ -static unsigned long atari_dma_xfer_len( unsigned long wanted_len, - Scsi_Cmnd *cmd, - int write_flag ) +static unsigned long atari_dma_xfer_len(unsigned long wanted_len, + struct scsi_cmnd *cmd, + int write_flag) { unsigned long possible_len, limit; #ifndef CONFIG_TT_DMA_EMUL --- linux-2.6.19.orig/drivers/scsi/atari_scsi.h +++ linux-2.6.19/drivers/scsi/atari_scsi.h @@ -20,7 +20,7 @@ #ifndef ASM int atari_scsi_detect (struct scsi_host_template *); const char *atari_scsi_info (struct Scsi_Host *); -int atari_scsi_reset (Scsi_Cmnd *, unsigned int); +int atari_scsi_reset (struct scsi_cmnd *, unsigned int); int atari_scsi_release (struct Scsi_Host *); /* The values for CMD_PER_LUN and CAN_QUEUE are somehow arbitrary. Higher