Subject: [PATCH] NCR53C9x: Scsi_Cmnd -> struct scsi_cmnd NCR53C9x SCSI core: Replace Scsi_Cmnd by struct scsi_cmnd Signed-off-by: Geert Uytterhoeven --- drivers/scsi/NCR53C9x.c | 119 ++++++++++++++++++++++++------------------------ drivers/scsi/NCR53C9x.h | 24 ++++----- 2 files changed, 73 insertions(+), 70 deletions(-) --- linux-m68k-2.6.19.orig/drivers/scsi/NCR53C9x.c +++ linux-m68k-2.6.19/drivers/scsi/NCR53C9x.c @@ -276,7 +276,7 @@ static char *phase_string(int phase) } #ifdef DEBUG_STATE_MACHINE -static inline void esp_advance_phase(Scsi_Cmnd *s, int newphase) +static inline void esp_advance_phase(struct scsi_cmnd *s, int newphase) { ESPLOG(("<%s>", phase_string(newphase))); s->SCp.sent_command = s->SCp.phase; @@ -321,49 +321,51 @@ static inline void esp_cmd(struct NCR_ES * Note that these are per-ESP queues, not global queues like * the aha152x driver uses. */ -static inline void append_SC(Scsi_Cmnd **SC, Scsi_Cmnd *new_SC) +static inline void append_SC(struct scsi_cmnd **SC, struct scsi_cmnd *new_SC) { - Scsi_Cmnd *end; + struct scsi_cmnd *end; new_SC->host_scribble = (unsigned char *) NULL; if(!*SC) *SC = new_SC; else { - for(end=*SC;end->host_scribble;end=(Scsi_Cmnd *)end->host_scribble) + for(end=*SC; end->host_scribble; + end=(struct scsi_cmnd *)end->host_scribble) ; end->host_scribble = (unsigned char *) new_SC; } } -static inline void prepend_SC(Scsi_Cmnd **SC, Scsi_Cmnd *new_SC) +static inline void prepend_SC(struct scsi_cmnd **SC, struct scsi_cmnd *new_SC) { new_SC->host_scribble = (unsigned char *) *SC; *SC = new_SC; } -static inline Scsi_Cmnd *remove_first_SC(Scsi_Cmnd **SC) +static inline struct scsi_cmnd *remove_first_SC(struct scsi_cmnd **SC) { - Scsi_Cmnd *ptr; + struct scsi_cmnd *ptr; ptr = *SC; if(ptr) - *SC = (Scsi_Cmnd *) (*SC)->host_scribble; + *SC = (struct scsi_cmnd *) (*SC)->host_scribble; return ptr; } -static inline Scsi_Cmnd *remove_SC(Scsi_Cmnd **SC, int target, int lun) +static inline struct scsi_cmnd *remove_SC(struct scsi_cmnd **SC, int target, + int lun) { - Scsi_Cmnd *ptr, *prev; + struct scsi_cmnd *ptr, *prev; for(ptr = *SC, prev = NULL; ptr && ((ptr->device->id != target) || (ptr->device->lun != lun)); - prev = ptr, ptr = (Scsi_Cmnd *) ptr->host_scribble) + prev = ptr, ptr = (struct scsi_cmnd *) ptr->host_scribble) ; if(ptr) { if(prev) prev->host_scribble=ptr->host_scribble; else - *SC=(Scsi_Cmnd *)ptr->host_scribble; + *SC=(struct scsi_cmnd *)ptr->host_scribble; } return ptr; } @@ -899,7 +901,7 @@ int esp_proc_info(struct Scsi_Host *shos return esp_host_info(esp, buffer, offset, length); } -static void esp_get_dmabufs(struct NCR_ESP *esp, Scsi_Cmnd *sp) +static void esp_get_dmabufs(struct NCR_ESP *esp, struct scsi_cmnd *sp) { if(sp->use_sg == 0) { sp->SCp.this_residual = sp->request_bufflen; @@ -922,7 +924,7 @@ static void esp_get_dmabufs(struct NCR_E } } -static void esp_release_dmabufs(struct NCR_ESP *esp, Scsi_Cmnd *sp) +static void esp_release_dmabufs(struct NCR_ESP *esp, struct scsi_cmnd *sp) { if(sp->use_sg == 0) { if (esp->dma_mmu_release_scsi_one) @@ -933,7 +935,7 @@ static void esp_release_dmabufs(struct N } } -static void esp_restore_pointers(struct NCR_ESP *esp, Scsi_Cmnd *sp) +static void esp_restore_pointers(struct NCR_ESP *esp, struct scsi_cmnd *sp) { struct esp_pointers *ep = &esp->data_pointers[scmd_id(sp)]; @@ -943,7 +945,7 @@ static void esp_restore_pointers(struct sp->SCp.buffers_residual = ep->saved_buffers_residual; } -static void esp_save_pointers(struct NCR_ESP *esp, Scsi_Cmnd *sp) +static void esp_save_pointers(struct NCR_ESP *esp, struct scsi_cmnd *sp) { struct esp_pointers *ep = &esp->data_pointers[scmd_id(sp)]; @@ -973,7 +975,7 @@ static void esp_save_pointers(struct NCR * case where we could see an interrupt is where we have disconnected * commands active and they are trying to reselect us. */ -static inline void esp_check_cmd(struct NCR_ESP *esp, Scsi_Cmnd *sp) +static inline void esp_check_cmd(struct NCR_ESP *esp, struct scsi_cmnd *sp) { switch(sp->cmd_len) { case 6: @@ -1004,7 +1006,7 @@ static void esp_exec_cmd(struct NCR_ESP { struct ESP_regs *eregs = esp->eregs; struct esp_device *esp_dev; - Scsi_Cmnd *SCptr; + struct scsi_cmnd *SCptr; struct scsi_device *SDptr; volatile unchar *cmdp = esp->esp_command; unsigned char the_esp_command; @@ -1230,7 +1232,7 @@ do_sync_known: } /* Queue a SCSI command delivered from the mid-level Linux SCSI code. */ -int esp_queue(Scsi_Cmnd *SCpnt, void (*done)(Scsi_Cmnd *)) +int esp_queue(struct scsi_cmnd *SCpnt, void (*done)(struct scsi_cmnd *)) { struct NCR_ESP *esp; @@ -1271,7 +1273,7 @@ int esp_queue(Scsi_Cmnd *SCpnt, void (*d } /* Dump driver state. */ -static void esp_dump_cmd(Scsi_Cmnd *SCptr) +static void esp_dump_cmd(struct scsi_cmnd *SCptr) { ESPLOG(("[tgt<%02x> lun<%02x> " "pphase<%s> cphase<%s>]", @@ -1283,7 +1285,7 @@ static void esp_dump_cmd(Scsi_Cmnd *SCpt static void esp_dump_state(struct NCR_ESP *esp, struct ESP_regs *eregs) { - Scsi_Cmnd *SCptr = esp->current_SC; + struct scsi_cmnd *SCptr = esp->current_SC; #ifdef DEBUG_ESP_CMDS int i; #endif @@ -1328,13 +1330,13 @@ static void esp_dump_state(struct NCR_ES ESPLOG(("esp%d: disconnected ", esp->esp_id)); while(SCptr) { esp_dump_cmd(SCptr); - SCptr = (Scsi_Cmnd *) SCptr->host_scribble; + SCptr = (struct scsi_cmnd *) SCptr->host_scribble; } ESPLOG(("\n")); } /* Abort a command. The host_lock is acquired by caller. */ -int esp_abort(Scsi_Cmnd *SCptr) +int esp_abort(struct scsi_cmnd *SCptr) { struct NCR_ESP *esp = (struct NCR_ESP *) SCptr->device->host->hostdata; struct ESP_regs *eregs = esp->eregs; @@ -1366,13 +1368,13 @@ int esp_abort(Scsi_Cmnd *SCptr) synchronize_irq(esp->irq); } if(esp->issue_SC) { - Scsi_Cmnd **prev, *this; + struct scsi_cmnd **prev, *this; for(prev = (&esp->issue_SC), this = esp->issue_SC; this; - prev = (Scsi_Cmnd **) &(this->host_scribble), - this = (Scsi_Cmnd *) this->host_scribble) { + prev = (struct scsi_cmnd **) &(this->host_scribble), + this = (struct scsi_cmnd *) this->host_scribble) { if(this == SCptr) { - *prev = (Scsi_Cmnd *) this->host_scribble; + *prev = (struct scsi_cmnd *) this->host_scribble; this->host_scribble = NULL; esp_release_dmabufs(esp, this); this->result = DID_ABORT << 16; @@ -1415,7 +1417,7 @@ int esp_abort(Scsi_Cmnd *SCptr) static int esp_finish_reset(struct NCR_ESP *esp, struct ESP_regs *eregs) { - Scsi_Cmnd *sp = esp->current_SC; + struct scsi_cmnd *sp = esp->current_SC; /* Clean up currently executing command, if any. */ if (sp != NULL) { @@ -1462,7 +1464,7 @@ static int esp_do_resetbus(struct NCR_ES * * The host_lock is acquired by caller. */ -int esp_reset(Scsi_Cmnd *SCptr) +int esp_reset(struct scsi_cmnd *SCptr) { struct NCR_ESP *esp = (struct NCR_ESP *) SCptr->device->host->hostdata; @@ -1478,7 +1480,7 @@ int esp_reset(Scsi_Cmnd *SCptr) /* Internal ESP done function. */ static void esp_done(struct NCR_ESP *esp, int error) { - Scsi_Cmnd *done_SC; + struct scsi_cmnd *done_SC; if(esp->current_SC) { done_SC = esp->current_SC; @@ -1519,7 +1521,8 @@ static int esp_do_cmdbegin(struct NCR_ES * has gotten far enough yet. Hence the following. */ static inline int skipahead1(struct NCR_ESP *esp, struct ESP_regs *eregs, - Scsi_Cmnd *scp, int prev_phase, int new_phase) + struct scsi_cmnd *scp, int prev_phase, + int new_phase) { if(scp->SCp.sent_command != prev_phase) return 0; @@ -1538,10 +1541,9 @@ static inline int skipahead1(struct NCR_ return do_intr_end; } -static inline int skipahead2(struct NCR_ESP *esp, - struct ESP_regs *eregs, - Scsi_Cmnd *scp, int prev_phase1, int prev_phase2, - int new_phase) +static inline int skipahead2(struct NCR_ESP *esp, struct ESP_regs *eregs, + struct scsi_cmnd *scp, int prev_phase1, + int prev_phase2, int new_phase) { if(scp->SCp.sent_command != prev_phase1 && scp->SCp.sent_command != prev_phase2) @@ -1594,8 +1596,9 @@ static inline int skipahead2(struct NCR_ * tell the ESP to eat the extraneous byte so that we can proceed * to the next phase. */ -static inline int esp100_sync_hwbug(struct NCR_ESP *esp, struct ESP_regs *eregs, - Scsi_Cmnd *sp, int fifocnt) +static inline int esp100_sync_hwbug(struct NCR_ESP *esp, + struct ESP_regs *eregs, + struct scsi_cmnd *sp, int fifocnt) { /* Do not touch this piece of code. */ if((!(esp->erev == esp100)) || @@ -1684,7 +1687,7 @@ static inline int reconnect_lun(struct N * is being continued due to reselection. */ static inline void esp_connect(struct NCR_ESP *esp, struct ESP_regs *eregs, - Scsi_Cmnd *sp) + struct scsi_cmnd *sp) { struct scsi_device *dp = sp->device; struct esp_device *esp_dev = dp->hostdata; @@ -1708,7 +1711,7 @@ static inline void esp_connect(struct NC /* This will place the current working command back into the issue queue * if we are to receive a reselection amidst a selection attempt. */ -static inline void esp_reconnect(struct NCR_ESP *esp, Scsi_Cmnd *sp) +static inline void esp_reconnect(struct NCR_ESP *esp, struct scsi_cmnd *sp) { if(!esp->disconnected_SC) ESPLOG(("esp%d: Weird, being reselected but disconnected " @@ -1731,7 +1734,7 @@ static int esp_do_msgin(struct NCR_ESP * return do_work_bus; } -static inline void advance_sg(struct NCR_ESP *esp, Scsi_Cmnd *sp) +static inline void advance_sg(struct NCR_ESP *esp, struct scsi_cmnd *sp) { ++sp->SCp.buffer; --sp->SCp.buffers_residual; @@ -1763,7 +1766,7 @@ static inline void advance_sg(struct NCR */ static int esp_do_data(struct NCR_ESP *esp, struct ESP_regs *eregs) { - Scsi_Cmnd *SCptr = esp->current_SC; + struct scsi_cmnd *SCptr = esp->current_SC; int thisphase, hmuch; ESPDATA(("esp_do_data: ")); @@ -1976,7 +1979,7 @@ static int esp_do_data(struct NCR_ESP *e static int esp_do_data_finale(struct NCR_ESP *esp, struct ESP_regs *eregs) { - Scsi_Cmnd *SCptr = esp->current_SC; + struct scsi_cmnd *SCptr = esp->current_SC; struct esp_device *esp_dev = SCptr->device->hostdata; int bogus_data = 0, bytes_sent = 0, fifocnt, ecount = 0; @@ -2150,7 +2153,7 @@ static int esp_do_data_finale(struct NCR * a tape, we don't want to go into a loop re-negotiating * synchronous capabilities over and over. */ -static int esp_should_clear_sync(Scsi_Cmnd *sp) +static int esp_should_clear_sync(struct scsi_cmnd *sp) { unchar cmd = sp->cmnd[0]; @@ -2178,7 +2181,7 @@ static int esp_should_clear_sync(Scsi_Cm */ static int esp_do_freebus(struct NCR_ESP *esp, struct ESP_regs *eregs) { - Scsi_Cmnd *SCptr = esp->current_SC; + struct scsi_cmnd *SCptr = esp->current_SC; int rval; rval = skipahead2(esp, eregs, SCptr, in_status, in_msgindone, in_freeing); @@ -2249,7 +2252,7 @@ static int esp_do_freebus(struct NCR_ESP */ static int esp_bad_reconnect(struct NCR_ESP *esp) { - Scsi_Cmnd *sp; + struct scsi_cmnd *sp; ESPLOG(("esp%d: Eieeee, reconnecting unknown command!\n", esp->esp_id)); @@ -2258,21 +2261,21 @@ static int esp_bad_reconnect(struct NCR_ ESPLOG(("esp%d: issue_SC[", esp->esp_id)); while(sp) { ESPLOG(("<%02x,%02x>", sp->device->id, sp->device->lun)); - sp = (Scsi_Cmnd *) sp->host_scribble; + sp = (struct scsi_cmnd *) sp->host_scribble; } ESPLOG(("]\n")); sp = esp->current_SC; ESPLOG(("esp%d: current_SC[", esp->esp_id)); while(sp) { ESPLOG(("<%02x,%02x>", sp->device->id, sp->device->lun)); - sp = (Scsi_Cmnd *) sp->host_scribble; + sp = (struct scsi_cmnd *) sp->host_scribble; } ESPLOG(("]\n")); sp = esp->disconnected_SC; ESPLOG(("esp%d: disconnected_SC[", esp->esp_id)); while(sp) { ESPLOG(("<%02x,%02x>", sp->device->id, sp->device->lun)); - sp = (Scsi_Cmnd *) sp->host_scribble; + sp = (struct scsi_cmnd *) sp->host_scribble; } ESPLOG(("]\n")); return do_reset_bus; @@ -2283,7 +2286,7 @@ static int esp_do_reconnect(struct NCR_E struct ESP_regs *eregs) { int lun, target; - Scsi_Cmnd *SCptr; + struct scsi_cmnd *SCptr; /* Check for all bogus conditions first. */ target = reconnect_target(esp, eregs); @@ -2325,7 +2328,7 @@ static int esp_do_reconnect(struct NCR_E */ static int esp_do_status(struct NCR_ESP *esp, struct ESP_regs *eregs) { - Scsi_Cmnd *SCptr = esp->current_SC; + struct scsi_cmnd *SCptr = esp->current_SC; int intr, rval; rval = skipahead1(esp, eregs, SCptr, in_the_dark, in_status); @@ -2466,7 +2469,7 @@ static int esp_enter_status(struct NCR_E static int esp_disconnect_amidst_phases(struct NCR_ESP *esp, struct ESP_regs *eregs) { - Scsi_Cmnd *sp = esp->current_SC; + struct scsi_cmnd *sp = esp->current_SC; struct esp_device *esp_dev = sp->device->hostdata; /* This means real problems if we see this @@ -2565,7 +2568,7 @@ static int esp_do_phase_determine(struct /* First interrupt after exec'ing a cmd comes here. */ static int esp_select_complete(struct NCR_ESP *esp, struct ESP_regs *eregs) { - Scsi_Cmnd *SCptr = esp->current_SC; + struct scsi_cmnd *SCptr = esp->current_SC; struct esp_device *esp_dev = SCptr->device->hostdata; int cmd_bytes_sent, fcnt; @@ -2919,7 +2922,7 @@ static int check_singlebyte_msg(struct N * this because so many initiators cannot cope with this occurring. */ static int target_with_ants_in_pants(struct NCR_ESP *esp, - Scsi_Cmnd *SCptr, + struct scsi_cmnd *SCptr, struct esp_device *esp_dev) { if(esp_dev->sync || SCptr->device->borken) { @@ -2974,7 +2977,7 @@ static void sync_report(struct NCR_ESP * static int check_multibyte_msg(struct NCR_ESP *esp, struct ESP_regs *eregs) { - Scsi_Cmnd *SCptr = esp->current_SC; + struct scsi_cmnd *SCptr = esp->current_SC; struct esp_device *esp_dev = SCptr->device->hostdata; unchar regval = 0; int message_out = 0; @@ -3112,7 +3115,7 @@ static int check_multibyte_msg(struct NC static int esp_do_msgindone(struct NCR_ESP *esp, struct ESP_regs *eregs) { - Scsi_Cmnd *SCptr = esp->current_SC; + struct scsi_cmnd *SCptr = esp->current_SC; int message_out = 0, it = 0, rval; rval = skipahead1(esp, eregs, SCptr, in_msgin, in_msgindone); @@ -3187,7 +3190,7 @@ static int esp_do_msgindone(struct NCR_E static int esp_do_cmdbegin(struct NCR_ESP *esp, struct ESP_regs *eregs) { unsigned char tmp; - Scsi_Cmnd *SCptr = esp->current_SC; + struct scsi_cmnd *SCptr = esp->current_SC; esp_advance_phase(SCptr, in_cmdend); esp_cmd(esp, eregs, ESP_CMD_FLUSH); @@ -3359,7 +3362,7 @@ static espfunc_t bus_vector[] = { /* This is the second tier in our dual-level SCSI state machine. */ static int esp_work_bus(struct NCR_ESP *esp, struct ESP_regs *eregs) { - Scsi_Cmnd *SCptr = esp->current_SC; + struct scsi_cmnd *SCptr = esp->current_SC; unsigned int phase; ESPBUS(("esp_work_bus: ")); @@ -3388,7 +3391,7 @@ static espfunc_t isvc_vector[] = { void esp_handle(struct NCR_ESP *esp) { struct ESP_regs *eregs; - Scsi_Cmnd *SCptr; + struct scsi_cmnd *SCptr; int what_next = do_intr_end; eregs = esp->eregs; SCptr = esp->current_SC; --- linux-m68k-2.6.19.orig/drivers/scsi/NCR53C9x.h +++ linux-m68k-2.6.19/drivers/scsi/NCR53C9x.h @@ -392,9 +392,9 @@ struct NCR_ESP { int slot; /* Slot the adapter occupies */ /* Our command queues, only one cmd lives in the current_SC queue. */ - Scsi_Cmnd *issue_SC; /* Commands to be issued */ - Scsi_Cmnd *current_SC; /* Who is currently working the bus */ - Scsi_Cmnd *disconnected_SC; /* Commands disconnected from the bus */ + struct scsi_cmnd *issue_SC; /* Commands to be issued */ + struct scsi_cmnd *current_SC; /* Who is currently working the bus */ + struct scsi_cmnd *disconnected_SC; /* Commands disconnected from the bus */ /* Message goo */ unchar cur_msgout[16]; @@ -418,7 +418,7 @@ struct NCR_ESP { */ /* Required functions */ int (*dma_bytes_sent)(struct NCR_ESP *, int); - int (*dma_can_transfer)(struct NCR_ESP *, Scsi_Cmnd *); + int (*dma_can_transfer)(struct NCR_ESP *, struct scsi_cmnd *); void (*dma_dump_state)(struct NCR_ESP *); void (*dma_init_read)(struct NCR_ESP *, __u32, int); void (*dma_init_write)(struct NCR_ESP *, __u32, int); @@ -440,11 +440,11 @@ struct NCR_ESP { void (*dma_reset)(struct NCR_ESP *); /* Optional virtual DMA functions */ - void (*dma_mmu_get_scsi_one)(struct NCR_ESP *, Scsi_Cmnd *); - void (*dma_mmu_get_scsi_sgl)(struct NCR_ESP *, Scsi_Cmnd *); - void (*dma_mmu_release_scsi_one)(struct NCR_ESP *, Scsi_Cmnd *); - void (*dma_mmu_release_scsi_sgl)(struct NCR_ESP *, Scsi_Cmnd *); - void (*dma_advance_sg)(Scsi_Cmnd *); + void (*dma_mmu_get_scsi_one)(struct NCR_ESP *, struct scsi_cmnd *); + void (*dma_mmu_get_scsi_sgl)(struct NCR_ESP *, struct scsi_cmnd *); + void (*dma_mmu_release_scsi_one)(struct NCR_ESP *, struct scsi_cmnd *); + void (*dma_mmu_release_scsi_sgl)(struct NCR_ESP *, struct scsi_cmnd *); + void (*dma_advance_sg)(struct scsi_cmnd *); }; /* Bitfield meanings for the above registers. */ @@ -658,9 +658,9 @@ extern void esp_release(void); extern void esp_initialize(struct NCR_ESP *); extern irqreturn_t esp_intr(int, void *); extern const char *esp_info(struct Scsi_Host *); -extern int esp_queue(Scsi_Cmnd *, void (*done)(Scsi_Cmnd *)); -extern int esp_abort(Scsi_Cmnd *); -extern int esp_reset(Scsi_Cmnd *); +extern int esp_queue(struct scsi_cmnd *, void (*done)(struct scsi_cmnd *)); +extern int esp_abort(struct scsi_cmnd *); +extern int esp_reset(struct scsi_cmnd *); extern int esp_proc_info(struct Scsi_Host *shost, char *buffer, char **start, off_t offset, int length, int inout); extern int esp_slave_alloc(struct scsi_device *);