From 12413197eef2a29e0b9fb0fa541f5cbaeb1d3f3f Mon Sep 17 00:00:00 2001 From: Christoph Hellwig Date: Sat, 11 Jun 2005 01:05:01 +0200 Subject: [SCSI] remove scsi_set_device scsi_add_host is the proper place to set the device, but people copy the scsi_set_device usage from older drivers again and again. note that this leaves some legacy drivers like qlogicisp/qlogicfc without pci association in sysfs, but they're scheduled to go away soon anyway. Signed-off-by: James Bottomley --- include/scsi/scsi_host.h | 6 ------ 1 file changed, 6 deletions(-) (limited to 'include') diff --git a/include/scsi/scsi_host.h b/include/scsi/scsi_host.h index db9914adeac9..81d5234f6771 100644 --- a/include/scsi/scsi_host.h +++ b/include/scsi/scsi_host.h @@ -641,12 +641,6 @@ static inline void scsi_assign_lock(struct Scsi_Host *shost, spinlock_t *lock) shost->host_lock = lock; } -static inline void scsi_set_device(struct Scsi_Host *shost, - struct device *dev) -{ - shost->shost_gendev.parent = dev; -} - static inline struct device *scsi_get_device(struct Scsi_Host *shost) { return shost->shost_gendev.parent; -- cgit v1.2.3 From a4c8f6285165a7089edb2010dbd894148ca95d57 Mon Sep 17 00:00:00 2001 From: Christoph Hellwig Date: Sun, 19 Jun 2005 13:39:23 +0200 Subject: [SCSI] remove scsi_cmnd.eh_state it's never set to anything, and just three broken drivers are looking at it and doing odd things. Signed-off-by: James Bottomley --- drivers/scsi/dpt_i2o.c | 5 ----- drivers/scsi/eata.c | 10 ---------- drivers/scsi/u14-34f.c | 9 --------- include/scsi/scsi_cmnd.h | 1 - 4 files changed, 25 deletions(-) (limited to 'include') diff --git a/drivers/scsi/dpt_i2o.c b/drivers/scsi/dpt_i2o.c index bbe346bd3cb8..c2604e88d3b0 100644 --- a/drivers/scsi/dpt_i2o.c +++ b/drivers/scsi/dpt_i2o.c @@ -418,11 +418,6 @@ static int adpt_queue(struct scsi_cmnd * cmd, void (*done) (struct scsi_cmnd *)) return 1; } - if(cmd->eh_state != SCSI_STATE_QUEUED){ - // If we are not doing error recovery - mod_timer(&cmd->eh_timeout, timeout); - } - // TODO if the cmd->device if offline then I may need to issue a bus rescan // followed by a get_lct to see if the device is there anymore if((pDev = (struct adpt_device*) (cmd->device->hostdata)) == NULL) { diff --git a/drivers/scsi/eata.c b/drivers/scsi/eata.c index 1bb8727eea3e..c10e45b94b62 100644 --- a/drivers/scsi/eata.c +++ b/drivers/scsi/eata.c @@ -1899,16 +1899,6 @@ static int eata2x_eh_abort(struct scsi_cmnd *SCarg) printk("%s: abort, mbox %d, interrupt pending.\n", ha->board_name, i); - if (SCarg->eh_state == SCSI_STATE_TIMEOUT) { - unmap_dma(i, ha); - SCarg->host_scribble = NULL; - ha->cp_stat[i] = FREE; - printk - ("%s, abort, mbox %d, eh_state timeout, pid %ld.\n", - ha->board_name, i, SCarg->pid); - return SUCCESS; - } - return FAILED; } diff --git a/drivers/scsi/u14-34f.c b/drivers/scsi/u14-34f.c index 98369ce09283..b0b6cdf02cbd 100644 --- a/drivers/scsi/u14-34f.c +++ b/drivers/scsi/u14-34f.c @@ -1372,15 +1372,6 @@ static int u14_34f_eh_abort(struct scsi_cmnd *SCarg) { if (inb(sh[j]->io_port + REG_SYS_INTR) & IRQ_ASSERTED) printk("%s: abort, mbox %d, interrupt pending.\n", BN(j), i); - if (SCarg->eh_state == SCSI_STATE_TIMEOUT) { - unmap_dma(i, j); - SCarg->host_scribble = NULL; - HD(j)->cp_stat[i] = FREE; - printk("%s, abort, mbox %d, eh_state timeout, pid %ld.\n", - BN(j), i, SCarg->pid); - return SUCCESS; - } - return FAILED; } diff --git a/include/scsi/scsi_cmnd.h b/include/scsi/scsi_cmnd.h index 07f5c699eaa7..715cc84c751e 100644 --- a/include/scsi/scsi_cmnd.h +++ b/include/scsi/scsi_cmnd.h @@ -38,7 +38,6 @@ struct scsi_cmnd { struct list_head list; /* scsi_cmnd participates in queue lists */ struct list_head eh_entry; /* entry for the host eh_cmd_q */ - int eh_state; /* Used for state tracking in error handlr */ int eh_eflags; /* Used by error handlr */ void (*done) (struct scsi_cmnd *); /* Mid-level done function */ -- cgit v1.2.3 From f5ad56145d43cdb68760bba3e14655ff6ae726aa Mon Sep 17 00:00:00 2001 From: Christoph Hellwig Date: Sun, 19 Jun 2005 13:40:08 +0200 Subject: [SCSI] remove scsi_cmnd->abort_reason Never used for anything but printing it out in debug routines. Signed-off-by: James Bottomley --- drivers/scsi/advansys.c | 4 ++-- drivers/scsi/eata_pio.c | 4 ++-- drivers/scsi/scsi.c | 1 - drivers/scsi/scsi_error.c | 1 - drivers/scsi/scsi_lib.c | 2 -- include/scsi/scsi_cmnd.h | 2 -- 6 files changed, 4 insertions(+), 10 deletions(-) (limited to 'include') diff --git a/drivers/scsi/advansys.c b/drivers/scsi/advansys.c index a53d43352d99..0fb93363eb22 100644 --- a/drivers/scsi/advansys.c +++ b/drivers/scsi/advansys.c @@ -9192,8 +9192,8 @@ asc_prt_scsi_cmnd(struct scsi_cmnd *s) s->sc_data_direction, s->resid); printk( -" use_sg %u, sglist_len %u, abort_reason 0x%x\n", - s->use_sg, s->sglist_len, s->abort_reason); +" use_sg %u, sglist_len %u\n", + s->use_sg, s->sglist_len); printk( " serial_number 0x%x, retries %d, allowed %d\n", diff --git a/drivers/scsi/eata_pio.c b/drivers/scsi/eata_pio.c index 04a06b71a5e2..42c6e35f801c 100644 --- a/drivers/scsi/eata_pio.c +++ b/drivers/scsi/eata_pio.c @@ -449,7 +449,7 @@ static int eata_pio_abort(struct scsi_cmnd *cmd) { uint loop = HZ; - DBG(DBG_ABNORM, printk(KERN_WARNING "eata_pio_abort called pid: %ld " "target: %x lun: %x reason %x\n", cmd->pid, cmd->device->id, cmd->device->lun, cmd->abort_reason)); + DBG(DBG_ABNORM, printk(KERN_WARNING "eata_pio_abort called pid: %ld " "target: %x lun: %x\n", cmd->pid, cmd->device->id, cmd->device->lun)); while (inb(cmd->device->host->base + HA_RAUXSTAT) & HA_ABUSY) @@ -484,7 +484,7 @@ static int eata_pio_host_reset(struct scsi_cmnd *cmd) struct scsi_cmnd *sp; struct Scsi_Host *host = cmd->device->host; - DBG(DBG_ABNORM, printk(KERN_WARNING "eata_pio_reset called pid:%ld target:" " %x lun: %x reason %x\n", cmd->pid, cmd->device->id, cmd->device->lun, cmd->abort_reason)); + DBG(DBG_ABNORM, printk(KERN_WARNING "eata_pio_reset called pid:%ld target:" " %x lun: %x\n", cmd->pid, cmd->device->id, cmd->device->lun)); spin_lock_irq(host->host_lock); diff --git a/drivers/scsi/scsi.c b/drivers/scsi/scsi.c index 1cb5f7d4f278..5add683804e5 100644 --- a/drivers/scsi/scsi.c +++ b/drivers/scsi/scsi.c @@ -719,7 +719,6 @@ void scsi_init_cmd_from_req(struct scsi_cmnd *cmd, struct scsi_request *sreq) /* * Start the timer ticking. */ - cmd->abort_reason = 0; cmd->result = 0; SCSI_LOG_MLQUEUE(3, printk("Leaving scsi_init_cmd_from_req()\n")); diff --git a/drivers/scsi/scsi_error.c b/drivers/scsi/scsi_error.c index ceb4e0c99b37..af61f989896e 100644 --- a/drivers/scsi/scsi_error.c +++ b/drivers/scsi/scsi_error.c @@ -1829,7 +1829,6 @@ scsi_reset_provider(struct scsi_device *dev, int flag) scmd->bufflen = 0; scmd->request_buffer = NULL; scmd->request_bufflen = 0; - scmd->abort_reason = DID_ABORT; scmd->cmd_len = 0; diff --git a/drivers/scsi/scsi_lib.c b/drivers/scsi/scsi_lib.c index 621dee8b8cb2..b4f320854d66 100644 --- a/drivers/scsi/scsi_lib.c +++ b/drivers/scsi/scsi_lib.c @@ -301,7 +301,6 @@ static int scsi_init_cmd_errh(struct scsi_cmnd *cmd) { cmd->owner = SCSI_OWNER_MIDLEVEL; cmd->serial_number = 0; - cmd->abort_reason = 0; memset(cmd->sense_buffer, 0, sizeof cmd->sense_buffer); @@ -322,7 +321,6 @@ static int scsi_init_cmd_errh(struct scsi_cmnd *cmd) memcpy(cmd->data_cmnd, cmd->cmnd, sizeof(cmd->cmnd)); cmd->buffer = cmd->request_buffer; cmd->bufflen = cmd->request_bufflen; - cmd->abort_reason = 0; return 1; } diff --git a/include/scsi/scsi_cmnd.h b/include/scsi/scsi_cmnd.h index 715cc84c751e..5f8c907c32e8 100644 --- a/include/scsi/scsi_cmnd.h +++ b/include/scsi/scsi_cmnd.h @@ -79,8 +79,6 @@ struct scsi_cmnd { * sense info */ unsigned short use_sg; /* Number of pieces of scatter-gather */ unsigned short sglist_len; /* size of malloc'd scatter-gather list */ - unsigned short abort_reason; /* If the mid-level code requests an - * abort, this is the reason. */ unsigned bufflen; /* Size of data buffer */ void *buffer; /* Data buffer */ -- cgit v1.2.3 From b4edcbcafdecc80ef5356ff6452768b1b926ea76 Mon Sep 17 00:00:00 2001 From: Christoph Hellwig Date: Sun, 19 Jun 2005 13:40:52 +0200 Subject: [SCSI] remove scsi_cmnd->owner never checked anywhere Signed-off-by: James Bottomley --- drivers/scsi/scsi.c | 5 ----- drivers/scsi/scsi_error.c | 18 +----------------- drivers/scsi/scsi_lib.c | 2 -- drivers/scsi/scsi_priv.h | 11 ----------- include/scsi/scsi_cmnd.h | 1 - 5 files changed, 1 insertion(+), 36 deletions(-) (limited to 'include') diff --git a/drivers/scsi/scsi.c b/drivers/scsi/scsi.c index 5add683804e5..b25e5e531eb9 100644 --- a/drivers/scsi/scsi.c +++ b/drivers/scsi/scsi.c @@ -260,7 +260,6 @@ struct scsi_cmnd *scsi_get_command(struct scsi_device *dev, int gfp_mask) memset(cmd, 0, sizeof(*cmd)); cmd->device = dev; cmd->state = SCSI_STATE_UNUSED; - cmd->owner = SCSI_OWNER_NOBODY; init_timer(&cmd->eh_timeout); INIT_LIST_HEAD(&cmd->list); spin_lock_irqsave(&dev->list_lock, flags); @@ -612,7 +611,6 @@ int scsi_dispatch_cmd(struct scsi_cmnd *cmd) */ cmd->state = SCSI_STATE_QUEUED; - cmd->owner = SCSI_OWNER_LOWLEVEL; atomic_inc(&cmd->device->iorequest_cnt); @@ -683,7 +681,6 @@ void scsi_init_cmd_from_req(struct scsi_cmnd *cmd, struct scsi_request *sreq) { sreq->sr_command = cmd; - cmd->owner = SCSI_OWNER_MIDLEVEL; cmd->cmd_len = sreq->sr_cmd_len; cmd->use_sg = sreq->sr_use_sg; @@ -768,7 +765,6 @@ void __scsi_done(struct scsi_cmnd *cmd) */ cmd->serial_number = 0; cmd->state = SCSI_STATE_BHQUEUE; - cmd->owner = SCSI_OWNER_BH_HANDLER; atomic_inc(&cmd->device->iodone_cnt); if (cmd->result) @@ -889,7 +885,6 @@ void scsi_finish_command(struct scsi_cmnd *cmd) SCSI_LOG_MLCOMPLETE(4, printk("Notifying upper driver of completion " "for device %d %x\n", sdev->id, cmd->result)); - cmd->owner = SCSI_OWNER_HIGHLEVEL; cmd->state = SCSI_STATE_FINISHED; /* diff --git a/drivers/scsi/scsi_error.c b/drivers/scsi/scsi_error.c index af61f989896e..0df8615732c1 100644 --- a/drivers/scsi/scsi_error.c +++ b/drivers/scsi/scsi_error.c @@ -77,7 +77,6 @@ int scsi_eh_scmd_add(struct scsi_cmnd *scmd, int eh_flag) /* * FIXME: Can we stop setting owner and state. */ - scmd->owner = SCSI_OWNER_ERROR_HANDLER; scmd->state = SCSI_STATE_FAILED; list_add_tail(&scmd->eh_entry, &shost->eh_cmd_q); set_bit(SHOST_RECOVERY, &shost->shost_state); @@ -451,7 +450,6 @@ static void scsi_eh_done(struct scsi_cmnd *scmd) */ if (del_timer(&scmd->eh_timeout)) { scmd->request->rq_status = RQ_SCSI_DONE; - scmd->owner = SCSI_OWNER_ERROR_HANDLER; SCSI_LOG_ERROR_RECOVERY(3, printk("%s scmd: %p result: %x\n", __FUNCTION__, scmd, scmd->result)); @@ -484,8 +482,6 @@ static int scsi_send_eh_cmnd(struct scsi_cmnd *scmd, int timeout) * we will use a queued command if possible, otherwise we will * emulate the queuing and calling of completion function ourselves. */ - scmd->owner = SCSI_OWNER_LOWLEVEL; - if (sdev->scsi_level <= SCSI_2) scmd->cmnd[1] = (scmd->cmnd[1] & 0x1f) | (sdev->lun << 5 & 0xe0); @@ -514,7 +510,6 @@ static int scsi_send_eh_cmnd(struct scsi_cmnd *scmd, int timeout) */ if (scsi_eh_eflags_chk(scmd, SCSI_EH_REC_TIMEOUT)) { scsi_eh_eflags_clr(scmd, SCSI_EH_REC_TIMEOUT); - scmd->owner = SCSI_OWNER_LOWLEVEL; /* * as far as the low level driver is @@ -530,8 +525,6 @@ static int scsi_send_eh_cmnd(struct scsi_cmnd *scmd, int timeout) shost->hostt->eh_abort_handler(scmd); scmd->request->rq_status = RQ_SCSI_DONE; - scmd->owner = SCSI_OWNER_ERROR_HANDLER; - rtn = FAILED; } @@ -742,9 +735,6 @@ static int scsi_try_to_abort_cmd(struct scsi_cmnd *scmd) */ if (scmd->serial_number == 0) return SUCCESS; - - scmd->owner = SCSI_OWNER_LOWLEVEL; - return scmd->device->host->hostt->eh_abort_handler(scmd); } @@ -862,10 +852,7 @@ static int scsi_try_bus_device_reset(struct scsi_cmnd *scmd) if (!scmd->device->host->hostt->eh_device_reset_handler) return FAILED; - scmd->owner = SCSI_OWNER_LOWLEVEL; - rtn = scmd->device->host->hostt->eh_device_reset_handler(scmd); - if (rtn == SUCCESS) { scmd->device->was_reset = 1; scmd->device->expecting_cc_ua = 1; @@ -1048,7 +1035,6 @@ static int scsi_try_bus_reset(struct scsi_cmnd *scmd) SCSI_LOG_ERROR_RECOVERY(3, printk("%s: Snd Bus RST\n", __FUNCTION__)); - scmd->owner = SCSI_OWNER_LOWLEVEL; if (!scmd->device->host->hostt->eh_bus_reset_handler) return FAILED; @@ -1077,7 +1063,6 @@ static int scsi_try_host_reset(struct scsi_cmnd *scmd) SCSI_LOG_ERROR_RECOVERY(3, printk("%s: Snd Host RST\n", __FUNCTION__)); - scmd->owner = SCSI_OWNER_LOWLEVEL; if (!scmd->device->host->hostt->eh_host_reset_handler) return FAILED; @@ -1819,8 +1804,7 @@ scsi_reset_provider(struct scsi_device *dev, int flag) memset(&scmd->eh_timeout, 0, sizeof(scmd->eh_timeout)); scmd->request->rq_status = RQ_SCSI_BUSY; scmd->state = SCSI_STATE_INITIALIZING; - scmd->owner = SCSI_OWNER_MIDLEVEL; - + memset(&scmd->cmnd, '\0', sizeof(scmd->cmnd)); scmd->scsi_done = scsi_reset_provider_done_command; diff --git a/drivers/scsi/scsi_lib.c b/drivers/scsi/scsi_lib.c index b4f320854d66..912cea081119 100644 --- a/drivers/scsi/scsi_lib.c +++ b/drivers/scsi/scsi_lib.c @@ -149,7 +149,6 @@ int scsi_queue_insert(struct scsi_cmnd *cmd, int reason) * Register the fact that we own the thing for now. */ cmd->state = SCSI_STATE_MLQUEUE; - cmd->owner = SCSI_OWNER_MIDLEVEL; /* * Decrement the counters, since these commands are no longer @@ -299,7 +298,6 @@ EXPORT_SYMBOL(scsi_wait_req); */ static int scsi_init_cmd_errh(struct scsi_cmnd *cmd) { - cmd->owner = SCSI_OWNER_MIDLEVEL; cmd->serial_number = 0; memset(cmd->sense_buffer, 0, sizeof cmd->sense_buffer); diff --git a/drivers/scsi/scsi_priv.h b/drivers/scsi/scsi_priv.h index 96d4f745975c..e0f5b5d4582d 100644 --- a/drivers/scsi/scsi_priv.h +++ b/drivers/scsi/scsi_priv.h @@ -12,17 +12,6 @@ struct scsi_request; struct Scsi_Host; -/* - * These are the values that the owner field can take. - * They are used as an indication of who the command belongs to. - */ -#define SCSI_OWNER_HIGHLEVEL 0x100 -#define SCSI_OWNER_MIDLEVEL 0x101 -#define SCSI_OWNER_LOWLEVEL 0x102 -#define SCSI_OWNER_ERROR_HANDLER 0x103 -#define SCSI_OWNER_BH_HANDLER 0x104 -#define SCSI_OWNER_NOBODY 0x105 - /* * Magic values for certain scsi structs. Shouldn't ever be used. */ diff --git a/include/scsi/scsi_cmnd.h b/include/scsi/scsi_cmnd.h index 5f8c907c32e8..0c149219caf9 100644 --- a/include/scsi/scsi_cmnd.h +++ b/include/scsi/scsi_cmnd.h @@ -32,7 +32,6 @@ struct scsi_cmnd { struct scsi_device *device; unsigned short state; - unsigned short owner; struct scsi_request *sc_request; struct list_head list; /* scsi_cmnd participates in queue lists */ -- cgit v1.2.3 From 8d115f845a0bd59cd263e791f739964f42b7b0e8 Mon Sep 17 00:00:00 2001 From: Christoph Hellwig Date: Sun, 19 Jun 2005 13:42:05 +0200 Subject: [SCSI] remove scsi_cmnd->state We never look at it except for the old megaraid driver that abuses it for sending internal commands. That usage can be fixed easily because those internal commands are single-threaded by a mutex and we can easily use a completion there. Signed-off-by: James Bottomley --- drivers/scsi/megaraid.c | 26 ++++---------------------- drivers/scsi/megaraid.h | 2 +- drivers/scsi/scsi.c | 7 ------- drivers/scsi/scsi_error.c | 7 ------- drivers/scsi/scsi_lib.c | 5 ----- include/scsi/scsi_cmnd.h | 1 - 6 files changed, 5 insertions(+), 43 deletions(-) (limited to 'include') diff --git a/drivers/scsi/megaraid.c b/drivers/scsi/megaraid.c index 6ee88c59953e..6fe884a2d00d 100644 --- a/drivers/scsi/megaraid.c +++ b/drivers/scsi/megaraid.c @@ -35,6 +35,7 @@ #include #include #include +#include #include #include #include @@ -4477,8 +4478,6 @@ mega_internal_command(adapter_t *adapter, lockscope_t ls, megacmd_t *mc, scb->idx = CMDID_INT_CMDS; - scmd->state = 0; - /* * Get the lock only if the caller has not acquired it already */ @@ -4488,15 +4487,7 @@ mega_internal_command(adapter_t *adapter, lockscope_t ls, megacmd_t *mc, if( ls == LOCK_INT ) spin_unlock_irqrestore(&adapter->lock, flags); - /* - * Wait till this command finishes. Do not use - * wait_event_interruptible(). It causes panic if CTRL-C is hit when - * dumping e.g., physical disk information through /proc interface. - */ -#if 0 - wait_event_interruptible(adapter->int_waitq, scmd->state); -#endif - wait_event(adapter->int_waitq, scmd->state); + wait_for_completion(&adapter->int_waitq); rval = scmd->result; mc->status = scmd->result; @@ -4530,16 +4521,7 @@ mega_internal_done(Scsi_Cmnd *scmd) adapter = (adapter_t *)scmd->device->host->hostdata; - scmd->state = 1; /* thread waiting for its command to complete */ - - /* - * See comment in mega_internal_command() routine for - * wait_event_interruptible() - */ -#if 0 - wake_up_interruptible(&adapter->int_waitq); -#endif - wake_up(&adapter->int_waitq); + complete(&adapter->int_waitq); } @@ -4861,7 +4843,7 @@ megaraid_probe_one(struct pci_dev *pdev, const struct pci_device_id *id) } init_MUTEX(&adapter->int_mtx); - init_waitqueue_head(&adapter->int_waitq); + init_completion(&adapter->int_waitq); adapter->this_id = DEFAULT_INITIATOR_ID; adapter->host->this_id = DEFAULT_INITIATOR_ID; diff --git a/drivers/scsi/megaraid.h b/drivers/scsi/megaraid.h index e25c4de9edd9..4facf557cd19 100644 --- a/drivers/scsi/megaraid.h +++ b/drivers/scsi/megaraid.h @@ -891,7 +891,7 @@ typedef struct { Scsi_Cmnd int_scmd; struct semaphore int_mtx; /* To synchronize the internal commands */ - wait_queue_head_t int_waitq; /* wait queue for internal + struct completion int_waitq; /* wait queue for internal cmds */ int has_cluster; /* cluster support on this HBA */ diff --git a/drivers/scsi/scsi.c b/drivers/scsi/scsi.c index b25e5e531eb9..1afe1e592af4 100644 --- a/drivers/scsi/scsi.c +++ b/drivers/scsi/scsi.c @@ -259,7 +259,6 @@ struct scsi_cmnd *scsi_get_command(struct scsi_device *dev, int gfp_mask) memset(cmd, 0, sizeof(*cmd)); cmd->device = dev; - cmd->state = SCSI_STATE_UNUSED; init_timer(&cmd->eh_timeout); INIT_LIST_HEAD(&cmd->list); spin_lock_irqsave(&dev->list_lock, flags); @@ -609,9 +608,6 @@ int scsi_dispatch_cmd(struct scsi_cmnd *cmd) * We will use a queued command if possible, otherwise we will * emulate the queuing and calling of completion function ourselves. */ - - cmd->state = SCSI_STATE_QUEUED; - atomic_inc(&cmd->device->iorequest_cnt); /* @@ -764,7 +760,6 @@ void __scsi_done(struct scsi_cmnd *cmd) * Set the serial numbers back to zero */ cmd->serial_number = 0; - cmd->state = SCSI_STATE_BHQUEUE; atomic_inc(&cmd->device->iodone_cnt); if (cmd->result) @@ -885,8 +880,6 @@ void scsi_finish_command(struct scsi_cmnd *cmd) SCSI_LOG_MLCOMPLETE(4, printk("Notifying upper driver of completion " "for device %d %x\n", sdev->id, cmd->result)); - cmd->state = SCSI_STATE_FINISHED; - /* * We can get here with use_sg=0, causing a panic in the upper level */ diff --git a/drivers/scsi/scsi_error.c b/drivers/scsi/scsi_error.c index 0df8615732c1..4f312da021f1 100644 --- a/drivers/scsi/scsi_error.c +++ b/drivers/scsi/scsi_error.c @@ -74,10 +74,6 @@ int scsi_eh_scmd_add(struct scsi_cmnd *scmd, int eh_flag) spin_lock_irqsave(shost->host_lock, flags); scsi_eh_eflags_set(scmd, eh_flag); - /* - * FIXME: Can we stop setting owner and state. - */ - scmd->state = SCSI_STATE_FAILED; list_add_tail(&scmd->eh_entry, &shost->eh_cmd_q); set_bit(SHOST_RECOVERY, &shost->shost_state); shost->host_failed++; @@ -634,8 +630,6 @@ static void scsi_eh_finish_cmd(struct scsi_cmnd *scmd, struct list_head *done_q) { scmd->device->host->host_failed--; - scmd->state = SCSI_STATE_BHQUEUE; - scsi_eh_eflags_clr_all(scmd); /* @@ -1803,7 +1797,6 @@ scsi_reset_provider(struct scsi_device *dev, int flag) scmd->request = &req; memset(&scmd->eh_timeout, 0, sizeof(scmd->eh_timeout)); scmd->request->rq_status = RQ_SCSI_BUSY; - scmd->state = SCSI_STATE_INITIALIZING; memset(&scmd->cmnd, '\0', sizeof(scmd->cmnd)); diff --git a/drivers/scsi/scsi_lib.c b/drivers/scsi/scsi_lib.c index 912cea081119..58dcb0534a26 100644 --- a/drivers/scsi/scsi_lib.c +++ b/drivers/scsi/scsi_lib.c @@ -145,11 +145,6 @@ int scsi_queue_insert(struct scsi_cmnd *cmd, int reason) else if (reason == SCSI_MLQUEUE_DEVICE_BUSY) device->device_blocked = device->max_device_blocked; - /* - * Register the fact that we own the thing for now. - */ - cmd->state = SCSI_STATE_MLQUEUE; - /* * Decrement the counters, since these commands are no longer * active on the host/device. diff --git a/include/scsi/scsi_cmnd.h b/include/scsi/scsi_cmnd.h index 0c149219caf9..9957f16dcc5d 100644 --- a/include/scsi/scsi_cmnd.h +++ b/include/scsi/scsi_cmnd.h @@ -31,7 +31,6 @@ struct scsi_cmnd { int sc_magic; struct scsi_device *device; - unsigned short state; struct scsi_request *sc_request; struct list_head list; /* scsi_cmnd participates in queue lists */ -- cgit v1.2.3 From 7f602c53939fdb1bca12151a28f9b90cde046fb1 Mon Sep 17 00:00:00 2001 From: James Bottomley Date: Sat, 21 May 2005 10:24:37 -0500 Subject: [SCSI] add TYPE_RBC to our type table Here's a tiny update that means we print the correct ASCII type information Signed-off-by: James Bottomley --- drivers/scsi/scsi.c | 1 + include/scsi/scsi.h | 4 ++-- 2 files changed, 3 insertions(+), 2 deletions(-) (limited to 'include') diff --git a/drivers/scsi/scsi.c b/drivers/scsi/scsi.c index 1afe1e592af4..d14523d7e449 100644 --- a/drivers/scsi/scsi.c +++ b/drivers/scsi/scsi.c @@ -113,6 +113,7 @@ const char *const scsi_device_types[MAX_SCSI_DEVICE_CODE] = { "Unknown ", "RAID ", "Enclosure ", + "Direct-Access-RBC", }; EXPORT_SYMBOL(scsi_device_types); diff --git a/include/scsi/scsi.h b/include/scsi/scsi.h index 1fb233741513..b361172b576c 100644 --- a/include/scsi/scsi.h +++ b/include/scsi/scsi.h @@ -28,7 +28,7 @@ extern const unsigned char scsi_command_size[8]; * SCSI device types */ -#define MAX_SCSI_DEVICE_CODE 14 +#define MAX_SCSI_DEVICE_CODE 15 extern const char *const scsi_device_types[MAX_SCSI_DEVICE_CODE]; /* @@ -211,8 +211,8 @@ static inline int scsi_status_is_good(int status) * - treated as TYPE_DISK */ #define TYPE_MEDIUM_CHANGER 0x08 #define TYPE_COMM 0x09 /* Communications device */ -#define TYPE_ENCLOSURE 0x0d /* Enclosure Services Device */ #define TYPE_RAID 0x0c +#define TYPE_ENCLOSURE 0x0d /* Enclosure Services Device */ #define TYPE_RBC 0x0e #define TYPE_NO_LUN 0x7f -- cgit v1.2.3 From ac96202ba096f8fc1ccaf45a2f159a52639ece29 Mon Sep 17 00:00:00 2001 From: Andrew Vasquez Date: Wed, 6 Jul 2005 10:30:16 -0700 Subject: [SCSI] qla2xxx: Add pci ids for new ISP types. Add pci ids for new ISP types. Move old definitions in local qla_def.h file to pci_ids.h as well. Signed-off-by: Andrew Vasquez Signed-off-by: James Bottomley --- drivers/scsi/qla2xxx/qla_def.h | 21 --------------------- include/linux/pci_ids.h | 9 +++++++++ 2 files changed, 9 insertions(+), 21 deletions(-) (limited to 'include') diff --git a/drivers/scsi/qla2xxx/qla_def.h b/drivers/scsi/qla2xxx/qla_def.h index 24e22dc2fe57..13901c24b9a0 100644 --- a/drivers/scsi/qla2xxx/qla_def.h +++ b/drivers/scsi/qla2xxx/qla_def.h @@ -41,27 +41,6 @@ #include #include -/* XXX(hch): move to pci_ids.h */ -#ifndef PCI_DEVICE_ID_QLOGIC_ISP2300 -#define PCI_DEVICE_ID_QLOGIC_ISP2300 0x2300 -#endif - -#ifndef PCI_DEVICE_ID_QLOGIC_ISP2312 -#define PCI_DEVICE_ID_QLOGIC_ISP2312 0x2312 -#endif - -#ifndef PCI_DEVICE_ID_QLOGIC_ISP2322 -#define PCI_DEVICE_ID_QLOGIC_ISP2322 0x2322 -#endif - -#ifndef PCI_DEVICE_ID_QLOGIC_ISP6312 -#define PCI_DEVICE_ID_QLOGIC_ISP6312 0x6312 -#endif - -#ifndef PCI_DEVICE_ID_QLOGIC_ISP6322 -#define PCI_DEVICE_ID_QLOGIC_ISP6322 0x6322 -#endif - #if defined(CONFIG_SCSI_QLA21XX) || defined(CONFIG_SCSI_QLA21XX_MODULE) #define IS_QLA2100(ha) ((ha)->pdev->device == PCI_DEVICE_ID_QLOGIC_ISP2100) #else diff --git a/include/linux/pci_ids.h b/include/linux/pci_ids.h index bf608808a60c..f4c2c393797d 100644 --- a/include/linux/pci_ids.h +++ b/include/linux/pci_ids.h @@ -908,6 +908,15 @@ #define PCI_DEVICE_ID_QLOGIC_ISP1022 0x1022 #define PCI_DEVICE_ID_QLOGIC_ISP2100 0x2100 #define PCI_DEVICE_ID_QLOGIC_ISP2200 0x2200 +#define PCI_DEVICE_ID_QLOGIC_ISP2300 0x2300 +#define PCI_DEVICE_ID_QLOGIC_ISP2312 0x2312 +#define PCI_DEVICE_ID_QLOGIC_ISP2322 0x2322 +#define PCI_DEVICE_ID_QLOGIC_ISP6312 0x6312 +#define PCI_DEVICE_ID_QLOGIC_ISP6322 0x6322 +#define PCI_DEVICE_ID_QLOGIC_ISP2422 0x2422 +#define PCI_DEVICE_ID_QLOGIC_ISP2432 0x2432 +#define PCI_DEVICE_ID_QLOGIC_ISP2512 0x2512 +#define PCI_DEVICE_ID_QLOGIC_ISP2522 0x2522 #define PCI_VENDOR_ID_CYRIX 0x1078 #define PCI_DEVICE_ID_CYRIX_5510 0x0000 -- cgit v1.2.3 From 2f4701d8274c8663f5c50323dc72fefa24b55091 Mon Sep 17 00:00:00 2001 From: "James.Smart@Emulex.Com" Date: Wed, 13 Jul 2005 22:05:03 -0400 Subject: [SCSI] add int_to_scsilun() function One of the issues we had was reverting the midlayers lun value into the 8byte lun value that we wanted to send to the device. Historically, there's been some combination of byte swapping, setting high/low, etc. There's also been no common thread between how our driver did it and others. I also got very confused as to why byteswap routines were being used. Anyway, this patch is a LLDD-callable function that reverts the midlayer's lun value, stored in an int, to the 8-byte quantity (note: this is not the real 8byte quantity, just the same amount that scsilun_to_int() was able to convert and store originally). This also solves the dilemma of the thread: http://marc.theaimsgroup.com/?l=linux-kernel&m=112116767118981&w=2 A patch for the lpfc driver to use this function will be along in a few days (batched with other patches). Signed-off-by: James Bottomley --- drivers/scsi/scsi_scan.c | 32 ++++++++++++++++++++++++++++++++ include/scsi/scsi_device.h | 1 + 2 files changed, 33 insertions(+) (limited to 'include') diff --git a/drivers/scsi/scsi_scan.c b/drivers/scsi/scsi_scan.c index 9fa209097e3b..ad3a5b142468 100644 --- a/drivers/scsi/scsi_scan.c +++ b/drivers/scsi/scsi_scan.c @@ -999,6 +999,38 @@ static int scsilun_to_int(struct scsi_lun *scsilun) return lun; } +/** + * int_to_scsilun: reverts an int into a scsi_lun + * @int: integer to be reverted + * @scsilun: struct scsi_lun to be set. + * + * Description: + * Reverts the functionality of the scsilun_to_int, which packed + * an 8-byte lun value into an int. This routine unpacks the int + * back into the lun value. + * Note: the scsilun_to_int() routine does not truly handle all + * 8bytes of the lun value. This functions restores only as much + * as was set by the routine. + * + * Notes: + * Given an integer : 0x0b030a04, this function returns a + * scsi_lun of : struct scsi_lun of: 0a 04 0b 03 00 00 00 00 + * + **/ +void int_to_scsilun(unsigned int lun, struct scsi_lun *scsilun) +{ + int i; + + memset(scsilun->scsi_lun, 0, sizeof(scsilun->scsi_lun)); + + for (i = 0; i < sizeof(lun); i += 2) { + scsilun->scsi_lun[i] = (lun >> 8) & 0xFF; + scsilun->scsi_lun[i+1] = lun & 0xFF; + lun = lun >> 16; + } +} +EXPORT_SYMBOL(int_to_scsilun); + /** * scsi_report_lun_scan - Scan using SCSI REPORT LUN results * @sdevscan: scan the host, channel, and id of this Scsi_Device diff --git a/include/scsi/scsi_device.h b/include/scsi/scsi_device.h index 63c91dd85ca1..223f92f4d2cb 100644 --- a/include/scsi/scsi_device.h +++ b/include/scsi/scsi_device.h @@ -243,6 +243,7 @@ extern void scsi_target_reap(struct scsi_target *); extern void scsi_target_block(struct device *); extern void scsi_target_unblock(struct device *); extern void scsi_remove_target(struct device *); +extern void int_to_scsilun(unsigned int, struct scsi_lun *); extern const char *scsi_device_state_name(enum scsi_device_state); extern int scsi_is_sdev_device(const struct device *); extern int scsi_is_target_device(const struct device *); -- cgit v1.2.3 From e10fb91c4dc81a4ae47caf0828df152f600f2546 Mon Sep 17 00:00:00 2001 From: James Bottomley Date: Thu, 14 Jul 2005 11:54:17 -0500 Subject: [SCSI] fix function prototype warning int_to_scsilun() takes a pointer to a struct scsi_lun in it's prototype, so add this structure to scsi_device.h to avoid declaration inside function prototype warnings. Signed-off-by: James Bottomley --- include/scsi/scsi_device.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'include') diff --git a/include/scsi/scsi_device.h b/include/scsi/scsi_device.h index 223f92f4d2cb..835af8ecbb7c 100644 --- a/include/scsi/scsi_device.h +++ b/include/scsi/scsi_device.h @@ -9,7 +9,7 @@ struct request_queue; struct scsi_cmnd; struct scsi_mode_data; - +struct scsi_lun; /* * sdev state: If you alter this, you also need to alter scsi_sysfs.c -- cgit v1.2.3