Subject: [PATCH] NCR5380: Scsi_Cmnd -> struct scsi_cmnd NCR5380 SCSI core: Replace Scsi_Cmnd by struct scsi_cmnd Signed-off-by: Geert Uytterhoeven --- drivers/scsi/NCR5380.c | 96 +++++++++++++++++++++++++++++-------------------- drivers/scsi/NCR5380.h | 18 +++++---- 2 files changed, 67 insertions(+), 47 deletions(-) --- linux-m68k-2.6.19.orig/drivers/scsi/NCR5380.c +++ linux-m68k-2.6.19/drivers/scsi/NCR5380.c @@ -288,7 +288,7 @@ static void do_reset(struct Scsi_Host *h * Set up the internal fields in the SCSI command. */ -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 @@ -696,8 +696,8 @@ static void NCR5380_print_status(struct #undef SPRINTF #define SPRINTF(args...) do { if(pos < buffer + length-80) pos += sprintf(pos, ## 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 char *lprint_command(unsigned char *cmd, char *pos, char *buffer, int len); static @@ -708,7 +708,7 @@ int NCR5380_proc_info(struct Scsi_Host * { char *pos = buffer; struct NCR5380_hostdata *hostdata; - Scsi_Cmnd *ptr; + struct scsi_cmnd *ptr; hostdata = (struct NCR5380_hostdata *) instance->hostdata; @@ -754,13 +754,16 @@ int NCR5380_proc_info(struct Scsi_Host * if (!hostdata->connected) SPRINTF("scsi%d: no currently connected command\n", instance->host_no); else - pos = lprint_Scsi_Cmnd((Scsi_Cmnd *) hostdata->connected, pos, buffer, length); + pos = lprint_Scsi_Cmnd((struct scsi_cmnd *)hostdata->connected, + pos, buffer, length); SPRINTF("scsi%d: issue_queue\n", instance->host_no); - for (ptr = (Scsi_Cmnd *) hostdata->issue_queue; ptr; ptr = (Scsi_Cmnd *) ptr->host_scribble) + for (ptr = (struct scsi_cmnd *)hostdata->issue_queue; ptr; + ptr = (struct scsi_cmnd *)ptr->host_scribble) pos = lprint_Scsi_Cmnd(ptr, pos, buffer, length); SPRINTF("scsi%d: disconnected_queue\n", instance->host_no); - for (ptr = (Scsi_Cmnd *) hostdata->disconnected_queue; ptr; ptr = (Scsi_Cmnd *) ptr->host_scribble) + for (ptr = (struct scsi_cmnd *)hostdata->disconnected_queue; ptr; + ptr = (struct scsi_cmnd *)ptr->host_scribble) pos = lprint_Scsi_Cmnd(ptr, pos, buffer, length); spin_unlock_irq(instance->host_lock); @@ -772,7 +775,8 @@ int NCR5380_proc_info(struct Scsi_Host * return length; } -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) { SPRINTF("scsi%d : destination target %d, lun %d\n", cmd->device->host->host_no, cmd->device->id, cmd->device->lun); SPRINTF(" command = "); @@ -951,11 +955,12 @@ static void __devexit NCR5380_exit(struc * Locks: host lock taken by caller */ -static int NCR5380_queue_command(Scsi_Cmnd * cmd, void (*done) (Scsi_Cmnd *)) +static int NCR5380_queue_command(struct scsi_cmnd * cmd, + void (*done) (struct scsi_cmnd *)) { struct Scsi_Host *instance = cmd->device->host; struct NCR5380_hostdata *hostdata = (struct NCR5380_hostdata *) instance->hostdata; - Scsi_Cmnd *tmp; + struct scsi_cmnd *tmp; #if (NDEBUG & NDEBUG_NO_WRITE) switch (cmd->cmnd[0]) { @@ -1008,7 +1013,9 @@ static int NCR5380_queue_command(Scsi_Cm cmd->host_scribble = (unsigned char *) hostdata->issue_queue; hostdata->issue_queue = cmd; } else { - for (tmp = (Scsi_Cmnd *) hostdata->issue_queue; tmp->host_scribble; tmp = (Scsi_Cmnd *) tmp->host_scribble); + for (tmp = (struct scsi_cmnd *)hostdata->issue_queue; + tmp->host_scribble; + tmp = (struct scsi_cmnd *)tmp->host_scribble); LIST(cmd, tmp); tmp->host_scribble = (unsigned char *) cmd; } @@ -1037,7 +1044,7 @@ static void NCR5380_main(void *p) { struct NCR5380_hostdata *hostdata = p; struct Scsi_Host *instance = hostdata->host; - Scsi_Cmnd *tmp, *prev; + struct scsi_cmnd *tmp, *prev; int done; spin_lock_irq(instance->host_lock); @@ -1050,7 +1057,9 @@ static void NCR5380_main(void *p) * Search through the issue_queue for a command destined * for a target that's not busy. */ - for (tmp = (Scsi_Cmnd *) hostdata->issue_queue, prev = NULL; tmp; prev = tmp, tmp = (Scsi_Cmnd *) tmp->host_scribble) + for (tmp = (struct scsi_cmnd *)hostdata->issue_queue, prev = NULL; + tmp; + prev = tmp, tmp = (struct scsi_cmnd *)tmp->host_scribble) { if (prev != tmp) dprintk(NDEBUG_LISTS, ("MAIN tmp=%p target=%d busy=%d lun=%d\n", tmp, tmp->target, hostdata->busy[tmp->target], tmp->lun)); @@ -1061,7 +1070,7 @@ static void NCR5380_main(void *p) prev->host_scribble = tmp->host_scribble; } else { REMOVE(-1, hostdata->issue_queue, tmp, tmp->host_scribble); - hostdata->issue_queue = (Scsi_Cmnd *) tmp->host_scribble; + hostdata->issue_queue = (struct scsi_cmnd *)tmp->host_scribble; } tmp->host_scribble = NULL; @@ -1108,7 +1117,7 @@ static void NCR5380_main(void *p) /* exited locked */ } /* if (!hostdata->connected) */ if (hostdata->selecting) { - tmp = (Scsi_Cmnd *) hostdata->selecting; + tmp = (struct scsi_cmnd *)hostdata->selecting; /* Selection will drop and retake the lock */ if (!NCR5380_select(instance, tmp, (tmp->cmnd[0] == REQUEST_SENSE) ? TAG_NONE : TAG_NEXT)) { /* Ok ?? */ @@ -1236,7 +1245,8 @@ static irqreturn_t NCR5380_intr(int irq, * Update the statistical data by parsing the command in question */ -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_STATS switch (cmd->cmnd[0]) { @@ -1258,8 +1268,8 @@ static void collect_stats(struct NCR5380 /* - * 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 @@ -1290,7 +1300,8 @@ static void collect_stats(struct NCR5380 * Locks: caller holds hostdata lock in IRQ mode */ -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) { NCR5380_local_declare(); struct NCR5380_hostdata *hostdata = (struct NCR5380_hostdata *) instance->hostdata; @@ -2098,7 +2109,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; /* RvC: we need to set the end of the polling time */ unsigned long poll_time = jiffies + USLEEP_POLL; @@ -2294,7 +2305,7 @@ static void NCR5380_information_transfer LIST(cmd, hostdata->issue_queue); cmd->host_scribble = (unsigned char *) hostdata->issue_queue; - hostdata->issue_queue = (Scsi_Cmnd *) cmd; + hostdata->issue_queue = (struct scsi_cmnd *)cmd; dprintk(NDEBUG_QUEUES, ("scsi%d : REQUEST SENSE added to head of issue queue\n", instance->host_no)); } else #endif /* def AUTOSENSE */ @@ -2494,10 +2505,10 @@ 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 + * Purpose : does reselection, initializing the instance->connected + * 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. * * Locks: io_request_lock held by caller if IRQ driven @@ -2512,7 +2523,7 @@ static void NCR5380_reselect(struct Scsi int len; unsigned char msg[3]; unsigned char *data; - Scsi_Cmnd *tmp = NULL, *prev; + struct scsi_cmnd *tmp = NULL, *prev; int abort = 0; NCR5380_setup(instance); @@ -2578,7 +2589,9 @@ static void NCR5380_reselect(struct Scsi */ - for (tmp = (Scsi_Cmnd *) hostdata->disconnected_queue, prev = NULL; tmp; prev = tmp, tmp = (Scsi_Cmnd *) tmp->host_scribble) + for (tmp = (struct scsi_cmnd *)hostdata->disconnected_queue, prev = NULL; + tmp; + prev = tmp, tmp = (struct scsi_cmnd *)tmp->host_scribble) if ((target_mask == (1 << tmp->device->id)) && (lun == tmp->device->lun) ) { if (prev) { @@ -2586,7 +2599,7 @@ static void NCR5380_reselect(struct Scsi prev->host_scribble = tmp->host_scribble; } else { REMOVE(-1, hostdata->disconnected_queue, tmp, tmp->host_scribble); - hostdata->disconnected_queue = (Scsi_Cmnd *) tmp->host_scribble; + hostdata->disconnected_queue = (struct scsi_cmnd *)tmp->host_scribble; } tmp->host_scribble = NULL; break; @@ -2617,7 +2630,7 @@ static void NCR5380_reselect(struct Scsi * * Inputs : instance - this instance of the NCR5380. * - * Returns : pointer to the Scsi_Cmnd structure for which the I_T_L + * Returns : pointer to the struct scsi_cmnd structure for which the I_T_L * nexus has been reestablished, on failure NULL is returned. */ @@ -2659,11 +2672,11 @@ static void NCR5380_dma_complete(NCR5380 #endif /* def REAL_DMA */ /* - * 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. * @@ -2677,11 +2690,11 @@ static void NCR5380_dma_complete(NCR5380 * Locks: host lock taken by caller */ -static int NCR5380_abort(Scsi_Cmnd * cmd) { +static int NCR5380_abort(struct scsi_cmnd * cmd) { NCR5380_local_declare(); struct Scsi_Host *instance = cmd->device->host; struct NCR5380_hostdata *hostdata = (struct NCR5380_hostdata *) instance->hostdata; - Scsi_Cmnd *tmp, **prev; + struct scsi_cmnd *tmp, **prev; printk(KERN_WARNING "scsi%d : aborting command\n", instance->host_no); scsi_print_command(cmd); @@ -2730,10 +2743,12 @@ static int NCR5380_abort(Scsi_Cmnd * cmd */ dprintk(NDEBUG_ABORT, ("scsi%d : abort going into loop.\n", instance->host_no)); - for (prev = (Scsi_Cmnd **) & (hostdata->issue_queue), tmp = (Scsi_Cmnd *) hostdata->issue_queue; tmp; prev = (Scsi_Cmnd **) & (tmp->host_scribble), tmp = (Scsi_Cmnd *) tmp->host_scribble) + for (prev = (struct scsi_cmnd **) & (hostdata->issue_queue), tmp = (struct scsi_cmnd *)hostdata->issue_queue; + tmp; + prev = (struct scsi_cmnd **) & (tmp->host_scribble), tmp = (struct scsi_cmnd *)tmp->host_scribble) if (cmd == tmp) { REMOVE(5, *prev, tmp, tmp->host_scribble); - (*prev) = (Scsi_Cmnd *) tmp->host_scribble; + (*prev) = (struct scsi_cmnd *)tmp->host_scribble; tmp->host_scribble = NULL; tmp->result = DID_ABORT << 16; dprintk(NDEBUG_ABORT, ("scsi%d : abort removed command from issue queue.\n", instance->host_no)); @@ -2786,7 +2801,8 @@ static int NCR5380_abort(Scsi_Cmnd * cmd * it from the disconnected queue. */ - for (tmp = (Scsi_Cmnd *) hostdata->disconnected_queue; tmp; tmp = (Scsi_Cmnd *) tmp->host_scribble) + for (tmp = (struct scsi_cmnd *)hostdata->disconnected_queue; tmp; + tmp = (struct scsi_cmnd *)tmp->host_scribble) if (cmd == tmp) { dprintk(NDEBUG_ABORT, ("scsi%d : aborting disconnected command.\n", instance->host_no)); @@ -2796,10 +2812,12 @@ static int NCR5380_abort(Scsi_Cmnd * cmd do_abort(instance); - for (prev = (Scsi_Cmnd **) & (hostdata->disconnected_queue), tmp = (Scsi_Cmnd *) hostdata->disconnected_queue; tmp; prev = (Scsi_Cmnd **) & (tmp->host_scribble), tmp = (Scsi_Cmnd *) tmp->host_scribble) + for (prev = (struct scsi_cmnd **) & (hostdata->disconnected_queue), tmp = (struct scsi_cmnd *)hostdata->disconnected_queue; + tmp; + prev = (struct scsi_cmnd **) & (tmp->host_scribble), tmp = (struct scsi_cmnd *)tmp->host_scribble) if (cmd == tmp) { REMOVE(5, *prev, tmp, tmp->host_scribble); - *prev = (Scsi_Cmnd *) tmp->host_scribble; + *prev = (struct scsi_cmnd *)tmp->host_scribble; tmp->host_scribble = NULL; tmp->result = DID_ABORT << 16; tmp->done(tmp); @@ -2822,7 +2840,7 @@ static int NCR5380_abort(Scsi_Cmnd * cmd /* - * Function : int NCR5380_bus_reset (Scsi_Cmnd *cmd) + * Function : int NCR5380_bus_reset (struct scsi_cmnd *cmd) * * Purpose : reset the SCSI bus. * @@ -2831,7 +2849,7 @@ static int NCR5380_abort(Scsi_Cmnd * cmd * Locks: host lock taken by caller */ -static int NCR5380_bus_reset(Scsi_Cmnd * cmd) +static int NCR5380_bus_reset(struct scsi_cmnd * cmd) { struct Scsi_Host *instance = cmd->device->host; --- linux-m68k-2.6.19.orig/drivers/scsi/NCR5380.h +++ linux-m68k-2.6.19/drivers/scsi/NCR5380.h @@ -260,9 +260,9 @@ struct NCR5380_hostdata { volatile int dma_len; /* requested length of DMA */ #endif volatile unsigned char last_message; /* last message OUT */ - volatile Scsi_Cmnd *connected; /* currently connected command */ - volatile Scsi_Cmnd *issue_queue; /* waiting to be issued */ - volatile Scsi_Cmnd *disconnected_queue; /* waiting for reconnect */ + volatile struct scsi_cmnd *connected; /* currently connected command */ + volatile struct scsi_cmnd *issue_queue; /* waiting to be issued */ + volatile struct scsi_cmnd *disconnected_queue; /* waiting for reconnect */ volatile int restart_select; /* we have disconnected, used to restart NCR5380_select() */ @@ -270,7 +270,7 @@ struct NCR5380_hostdata { int flags; unsigned long time_expires; /* in jiffies, set prior to sleeping */ int select_time; /* timer in select for target response */ - volatile Scsi_Cmnd *selecting; + volatile struct scsi_cmnd *selecting; struct work_struct coroutine; /* our co-routine */ #ifdef NCR5380_STATS unsigned timebase; /* Base for time calcs */ @@ -304,14 +304,16 @@ static void NCR5380_print_options(struct static void NCR5380_print_phase(struct Scsi_Host *instance); static void NCR5380_print(struct Scsi_Host *instance); #endif -static int NCR5380_abort(Scsi_Cmnd * cmd); -static int NCR5380_bus_reset(Scsi_Cmnd * cmd); -static int NCR5380_queue_command(Scsi_Cmnd * cmd, void (*done) (Scsi_Cmnd *)); +static int NCR5380_abort(struct scsi_cmnd * cmd); +static int NCR5380_bus_reset(struct scsi_cmnd * cmd); +static int NCR5380_queue_command(struct scsi_cmnd * cmd, + void (*done) (struct scsi_cmnd *)); static int NCR5380_proc_info(struct Scsi_Host *instance, char *buffer, char **start, off_t offset, int length, int inout); static void NCR5380_reselect(struct Scsi_Host *instance); -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); #if defined(PSEUDO_DMA) || defined(REAL_DMA) || defined(REAL_DMA_POLL) static int NCR5380_transfer_dma(struct Scsi_Host *instance, unsigned char *phase, int *count, unsigned char **data); #endif