Skip to content

Commit

Permalink
scsi: core: remove Scsi_Cmnd typedef
Browse files Browse the repository at this point in the history
This will make subsequent refactoring easier to handle.

Note: this patch is nowhere checkpatch clean.

Signed-off-by: Johannes Thumshirn <jthumshirn@suse.de>
Reviewed-by: Bart Van Assche <bart.vanassche@wdc.com>
Reviewed-by: Christoph Hellwig <hch@lst.de>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
  • Loading branch information
Johannes Thumshirn authored and martinkpetersen committed Jun 20, 2018
1 parent aa154ea commit 91ebc1f
Show file tree
Hide file tree
Showing 16 changed files with 114 additions and 109 deletions.
2 changes: 1 addition & 1 deletion drivers/scsi/3w-xxxx.c
Original file line number Diff line number Diff line change
Expand Up @@ -1925,7 +1925,7 @@ static int tw_scsi_queue_lck(struct scsi_cmnd *SCpnt, void (*done)(struct scsi_c
if (test_bit(TW_IN_RESET, &tw_dev->flags))
return SCSI_MLQUEUE_HOST_BUSY;

/* Save done function into Scsi_Cmnd struct */
/* Save done function into struct scsi_cmnd */
SCpnt->scsi_done = done;

/* Queue the command and get a request id */
Expand Down
2 changes: 1 addition & 1 deletion drivers/scsi/advansys.c
Original file line number Diff line number Diff line change
Expand Up @@ -8466,7 +8466,7 @@ static int AdvExeScsiQueue(ADV_DVC_VAR *asc_dvc, adv_req_t *reqp)
}

/*
* Execute a single 'Scsi_Cmnd'.
* Execute a single 'struct scsi_cmnd'.
*/
static int asc_execute_scsi_cmnd(struct scsi_cmnd *scp)
{
Expand Down
71 changes: 38 additions & 33 deletions drivers/scsi/aha152x.c
Original file line number Diff line number Diff line change
Expand Up @@ -422,16 +422,16 @@ enum aha152x_state {
*
*/
struct aha152x_hostdata {
Scsi_Cmnd *issue_SC;
struct scsi_cmnd *issue_SC;
/* pending commands to issue */

Scsi_Cmnd *current_SC;
struct scsi_cmnd *current_SC;
/* current command on the bus */

Scsi_Cmnd *disconnected_SC;
struct scsi_cmnd *disconnected_SC;
/* commands that disconnected */

Scsi_Cmnd *done_SC;
struct scsi_cmnd *done_SC;
/* command that was completed */

spinlock_t lock;
Expand Down Expand Up @@ -510,7 +510,7 @@ struct aha152x_hostdata {
*
*/
struct aha152x_scdata {
Scsi_Cmnd *next; /* next sc in queue */
struct scsi_cmnd *next; /* next sc in queue */
struct completion *done;/* semaphore to block on */
struct scsi_eh_save ses;
};
Expand Down Expand Up @@ -633,7 +633,7 @@ static void aha152x_error(struct Scsi_Host *shpnt, char *msg);
static void done(struct Scsi_Host *shpnt, int error);

/* diagnostics */
static void show_command(Scsi_Cmnd * ptr);
static void show_command(struct scsi_cmnd * ptr);
static void show_queues(struct Scsi_Host *shpnt);
static void disp_enintr(struct Scsi_Host *shpnt);

Expand All @@ -642,9 +642,9 @@ static void disp_enintr(struct Scsi_Host *shpnt);
* queue services:
*
*/
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;

SCNEXT(new_SC) = NULL;
if (!*SC)
Expand All @@ -656,9 +656,9 @@ static inline void append_SC(Scsi_Cmnd **SC, Scsi_Cmnd *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) {
Expand All @@ -668,9 +668,10 @@ static inline Scsi_Cmnd *remove_first_SC(Scsi_Cmnd ** SC)
return ptr;
}

static inline Scsi_Cmnd *remove_lun_SC(Scsi_Cmnd ** SC, int target, int lun)
static inline struct scsi_cmnd *remove_lun_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));
Expand All @@ -689,9 +690,10 @@ static inline Scsi_Cmnd *remove_lun_SC(Scsi_Cmnd ** SC, int target, int lun)
return ptr;
}

static inline Scsi_Cmnd *remove_SC(Scsi_Cmnd **SC, Scsi_Cmnd *SCp)
static inline struct scsi_cmnd *remove_SC(struct scsi_cmnd **SC,
struct scsi_cmnd *SCp)
{
Scsi_Cmnd *ptr, *prev;
struct scsi_cmnd *ptr, *prev;

for (ptr = *SC, prev = NULL;
ptr && SCp!=ptr;
Expand Down Expand Up @@ -912,8 +914,9 @@ static int setup_expected_interrupts(struct Scsi_Host *shpnt)
/*
* Queue a command and setup interrupts for a free bus.
*/
static int aha152x_internal_queue(Scsi_Cmnd *SCpnt, struct completion *complete,
int phase, void (*done)(Scsi_Cmnd *))
static int aha152x_internal_queue(struct scsi_cmnd *SCpnt,
struct completion *complete,
int phase, void (*done)(struct scsi_cmnd *))
{
struct Scsi_Host *shpnt = SCpnt->device->host;
unsigned long flags;
Expand Down Expand Up @@ -987,7 +990,8 @@ static int aha152x_internal_queue(Scsi_Cmnd *SCpnt, struct completion *complete,
* queue a command
*
*/
static int aha152x_queue_lck(Scsi_Cmnd *SCpnt, void (*done)(Scsi_Cmnd *))
static int aha152x_queue_lck(struct scsi_cmnd *SCpnt,
void (*done)(struct scsi_cmnd *))
{
return aha152x_internal_queue(SCpnt, NULL, 0, done);
}
Expand All @@ -998,7 +1002,7 @@ static DEF_SCSI_QCMD(aha152x_queue)
/*
*
*/
static void reset_done(Scsi_Cmnd *SCpnt)
static void reset_done(struct scsi_cmnd *SCpnt)
{
if(SCSEM(SCpnt)) {
complete(SCSEM(SCpnt));
Expand All @@ -1011,10 +1015,10 @@ static void reset_done(Scsi_Cmnd *SCpnt)
* Abort a command
*
*/
static int aha152x_abort(Scsi_Cmnd *SCpnt)
static int aha152x_abort(struct scsi_cmnd *SCpnt)
{
struct Scsi_Host *shpnt = SCpnt->device->host;
Scsi_Cmnd *ptr;
struct scsi_cmnd *ptr;
unsigned long flags;

DO_LOCK(flags);
Expand Down Expand Up @@ -1052,7 +1056,7 @@ static int aha152x_abort(Scsi_Cmnd *SCpnt)
* Reset a device
*
*/
static int aha152x_device_reset(Scsi_Cmnd * SCpnt)
static int aha152x_device_reset(struct scsi_cmnd * SCpnt)
{
struct Scsi_Host *shpnt = SCpnt->device->host;
DECLARE_COMPLETION(done);
Expand Down Expand Up @@ -1110,13 +1114,14 @@ static int aha152x_device_reset(Scsi_Cmnd * SCpnt)
return ret;
}

static void free_hard_reset_SCs(struct Scsi_Host *shpnt, Scsi_Cmnd **SCs)
static void free_hard_reset_SCs(struct Scsi_Host *shpnt,
struct scsi_cmnd **SCs)
{
Scsi_Cmnd *ptr;
struct scsi_cmnd *ptr;

ptr=*SCs;
while(ptr) {
Scsi_Cmnd *next;
struct scsi_cmnd *next;

if(SCDATA(ptr)) {
next = SCNEXT(ptr);
Expand Down Expand Up @@ -1171,7 +1176,7 @@ static int aha152x_bus_reset_host(struct Scsi_Host *shpnt)
* Reset the bus
*
*/
static int aha152x_bus_reset(Scsi_Cmnd *SCpnt)
static int aha152x_bus_reset(struct scsi_cmnd *SCpnt)
{
return aha152x_bus_reset_host(SCpnt->device->host);
}
Expand Down Expand Up @@ -1436,7 +1441,7 @@ static void busfree_run(struct Scsi_Host *shpnt)

if(!(DONE_SC->SCp.phase & not_issued)) {
struct aha152x_scdata *sc;
Scsi_Cmnd *ptr = DONE_SC;
struct scsi_cmnd *ptr = DONE_SC;
DONE_SC=NULL;

sc = SCDATA(ptr);
Expand All @@ -1451,7 +1456,7 @@ static void busfree_run(struct Scsi_Host *shpnt)
}

if(DONE_SC && DONE_SC->scsi_done) {
Scsi_Cmnd *ptr = DONE_SC;
struct scsi_cmnd *ptr = DONE_SC;
DONE_SC=NULL;

/* turn led off, when no commands are in the driver */
Expand Down Expand Up @@ -2247,13 +2252,13 @@ static void parerr_run(struct Scsi_Host *shpnt)
*/
static void rsti_run(struct Scsi_Host *shpnt)
{
Scsi_Cmnd *ptr;
struct scsi_cmnd *ptr;

shost_printk(KERN_NOTICE, shpnt, "scsi reset in\n");

ptr=DISCONNECTED_SC;
while(ptr) {
Scsi_Cmnd *next = SCNEXT(ptr);
struct scsi_cmnd *next = SCNEXT(ptr);

if (!ptr->device->soft_reset) {
remove_SC(&DISCONNECTED_SC, ptr);
Expand Down Expand Up @@ -2438,7 +2443,7 @@ static void disp_enintr(struct Scsi_Host *shpnt)
/*
* Show the command data of a command
*/
static void show_command(Scsi_Cmnd *ptr)
static void show_command(struct scsi_cmnd *ptr)
{
scsi_print_command(ptr);
scmd_printk(KERN_DEBUG, ptr,
Expand All @@ -2462,7 +2467,7 @@ static void show_command(Scsi_Cmnd *ptr)
*/
static void show_queues(struct Scsi_Host *shpnt)
{
Scsi_Cmnd *ptr;
struct scsi_cmnd *ptr;
unsigned long flags;

DO_LOCK(flags);
Expand All @@ -2484,7 +2489,7 @@ static void show_queues(struct Scsi_Host *shpnt)
disp_enintr(shpnt);
}

static void get_command(struct seq_file *m, Scsi_Cmnd * ptr)
static void get_command(struct seq_file *m, struct scsi_cmnd * ptr)
{
int i;

Expand Down Expand Up @@ -2813,7 +2818,7 @@ static int aha152x_set_info(struct Scsi_Host *shpnt, char *buffer, int length)
static int aha152x_show_info(struct seq_file *m, struct Scsi_Host *shpnt)
{
int i;
Scsi_Cmnd *ptr;
struct scsi_cmnd *ptr;
unsigned long flags;

seq_puts(m, AHA152X_REVID "\n");
Expand Down
9 changes: 5 additions & 4 deletions drivers/scsi/aha1740.c
Original file line number Diff line number Diff line change
Expand Up @@ -207,11 +207,11 @@ static int aha1740_test_port(unsigned int base)
static irqreturn_t aha1740_intr_handle(int irq, void *dev_id)
{
struct Scsi_Host *host = (struct Scsi_Host *) dev_id;
void (*my_done)(Scsi_Cmnd *);
void (*my_done)(struct scsi_cmnd *);
int errstatus, adapstat;
int number_serviced;
struct ecb *ecbptr;
Scsi_Cmnd *SCtmp;
struct scsi_cmnd *SCtmp;
unsigned int base;
unsigned long flags;
int handled = 0;
Expand Down Expand Up @@ -311,7 +311,8 @@ static irqreturn_t aha1740_intr_handle(int irq, void *dev_id)
return IRQ_RETVAL(handled);
}

static int aha1740_queuecommand_lck(Scsi_Cmnd * SCpnt, void (*done)(Scsi_Cmnd *))
static int aha1740_queuecommand_lck(struct scsi_cmnd * SCpnt,
void (*done)(struct scsi_cmnd *))
{
unchar direction;
unchar *cmd = (unchar *) SCpnt->cmnd;
Expand Down Expand Up @@ -520,7 +521,7 @@ static int aha1740_biosparam(struct scsi_device *sdev,
return 0;
}

static int aha1740_eh_abort_handler (Scsi_Cmnd *dummy)
static int aha1740_eh_abort_handler (struct scsi_cmnd *dummy)
{
/*
* From Alan Cox :
Expand Down
4 changes: 2 additions & 2 deletions drivers/scsi/aha1740.h
Original file line number Diff line number Diff line change
Expand Up @@ -135,8 +135,8 @@ struct ecb { /* Enhanced Control Block 6.1 */
/* Hardware defined portion ends here, rest is driver defined */
u8 sense[MAX_SENSE]; /* Sense area */
u8 status[MAX_STATUS]; /* Status area */
Scsi_Cmnd *SCpnt; /* Link to the SCSI Command Block */
void (*done) (Scsi_Cmnd *); /* Completion Function */
struct scsi_cmnd *SCpnt; /* Link to the SCSI Command Block */
void (*done) (struct scsi_cmnd *); /* Completion Function */
};

#define AHA1740CMD_NOP 0x00 /* No OP */
Expand Down
Loading

0 comments on commit 91ebc1f

Please sign in to comment.