aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/scsi
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/scsi')
-rw-r--r--drivers/scsi/aacraid/linit.c2
-rw-r--r--drivers/scsi/aic7xxx/aic7xxx_osm.c2
-rw-r--r--drivers/scsi/aic7xxx/aic7xxx_osm.h6
-rw-r--r--drivers/scsi/qla2xxx/qla_attr.c8
-rw-r--r--drivers/scsi/qla2xxx/qla_gbl.h4
-rw-r--r--drivers/scsi/qla2xxx/qla_os.c3
-rw-r--r--drivers/scsi/scsi.c2
-rw-r--r--drivers/scsi/scsi_transport_spi.c49
-rw-r--r--drivers/scsi/sr_ioctl.c3
-rw-r--r--drivers/scsi/sym53c8xx_2/sym_glue.c5
10 files changed, 47 insertions, 37 deletions
diff --git a/drivers/scsi/aacraid/linit.c b/drivers/scsi/aacraid/linit.c
index c9b82687ba1a..242fa77513f5 100644
--- a/drivers/scsi/aacraid/linit.c
+++ b/drivers/scsi/aacraid/linit.c
@@ -450,7 +450,7 @@ static int aac_cfg_open(struct inode *inode, struct file *file)
450 } 450 }
451 } 451 }
452 452
453 return 0; 453 return err;
454} 454}
455 455
456/** 456/**
diff --git a/drivers/scsi/aic7xxx/aic7xxx_osm.c b/drivers/scsi/aic7xxx/aic7xxx_osm.c
index e60f9338e44a..d978e4a3e973 100644
--- a/drivers/scsi/aic7xxx/aic7xxx_osm.c
+++ b/drivers/scsi/aic7xxx/aic7xxx_osm.c
@@ -2335,8 +2335,6 @@ ahc_linux_free_target(struct ahc_softc *ahc, struct ahc_linux_target *targ)
2335 AHC_TRANS_GOAL, /*paused*/FALSE); 2335 AHC_TRANS_GOAL, /*paused*/FALSE);
2336 ahc_update_neg_request(ahc, &devinfo, tstate, tinfo, AHC_NEG_ALWAYS); 2336 ahc_update_neg_request(ahc, &devinfo, tstate, tinfo, AHC_NEG_ALWAYS);
2337 ahc->platform_data->targets[target_offset] = NULL; 2337 ahc->platform_data->targets[target_offset] = NULL;
2338 if (targ->inq_data != NULL)
2339 free(targ->inq_data, M_DEVBUF);
2340 free(targ, M_DEVBUF); 2338 free(targ, M_DEVBUF);
2341} 2339}
2342 2340
diff --git a/drivers/scsi/aic7xxx/aic7xxx_osm.h b/drivers/scsi/aic7xxx/aic7xxx_osm.h
index c401537067b6..ed9027bd8a40 100644
--- a/drivers/scsi/aic7xxx/aic7xxx_osm.h
+++ b/drivers/scsi/aic7xxx/aic7xxx_osm.h
@@ -423,10 +423,6 @@ struct ahc_linux_device {
423 struct ahc_linux_target *target; 423 struct ahc_linux_target *target;
424}; 424};
425 425
426typedef enum {
427 AHC_INQ_VALID = 0x02,
428} ahc_linux_targ_flags;
429
430struct ahc_linux_target { 426struct ahc_linux_target {
431 struct ahc_linux_device *devices[AHC_NUM_LUNS]; 427 struct ahc_linux_device *devices[AHC_NUM_LUNS];
432 int channel; 428 int channel;
@@ -434,8 +430,6 @@ struct ahc_linux_target {
434 int refcount; 430 int refcount;
435 struct ahc_transinfo last_tinfo; 431 struct ahc_transinfo last_tinfo;
436 struct ahc_softc *ahc; 432 struct ahc_softc *ahc;
437 ahc_linux_targ_flags flags;
438 struct scsi_inquiry_data *inq_data;
439}; 433};
440 434
441/********************* Definitions Required by the Core ***********************/ 435/********************* Definitions Required by the Core ***********************/
diff --git a/drivers/scsi/qla2xxx/qla_attr.c b/drivers/scsi/qla2xxx/qla_attr.c
index 2240a0cde583..9bc1f153f7ea 100644
--- a/drivers/scsi/qla2xxx/qla_attr.c
+++ b/drivers/scsi/qla2xxx/qla_attr.c
@@ -300,7 +300,7 @@ qla2x00_set_rport_loss_tmo(struct fc_rport *rport, uint32_t timeout)
300 rport->dev_loss_tmo = ha->port_down_retry_count + 5; 300 rport->dev_loss_tmo = ha->port_down_retry_count + 5;
301} 301}
302 302
303static struct fc_function_template qla2xxx_transport_functions = { 303struct fc_function_template qla2xxx_transport_functions = {
304 304
305 .show_host_node_name = 1, 305 .show_host_node_name = 1,
306 .show_host_port_name = 1, 306 .show_host_port_name = 1,
@@ -322,12 +322,6 @@ static struct fc_function_template qla2xxx_transport_functions = {
322 322
323}; 323};
324 324
325struct scsi_transport_template *
326qla2x00_alloc_transport_tmpl(void)
327{
328 return (fc_attach_transport(&qla2xxx_transport_functions));
329}
330
331void 325void
332qla2x00_init_host_attr(scsi_qla_host_t *ha) 326qla2x00_init_host_attr(scsi_qla_host_t *ha)
333{ 327{
diff --git a/drivers/scsi/qla2xxx/qla_gbl.h b/drivers/scsi/qla2xxx/qla_gbl.h
index e4bfe4d5bbe4..2efec6c24d60 100644
--- a/drivers/scsi/qla2xxx/qla_gbl.h
+++ b/drivers/scsi/qla2xxx/qla_gbl.h
@@ -24,7 +24,6 @@
24#define __QLA_GBL_H 24#define __QLA_GBL_H
25 25
26#include <linux/interrupt.h> 26#include <linux/interrupt.h>
27#include <scsi/scsi_transport.h>
28 27
29extern void qla2x00_remove_one(struct pci_dev *); 28extern void qla2x00_remove_one(struct pci_dev *);
30extern int qla2x00_probe_one(struct pci_dev *, struct qla_board_info *); 29extern int qla2x00_probe_one(struct pci_dev *, struct qla_board_info *);
@@ -248,9 +247,10 @@ extern void qla2x00_cancel_io_descriptors(scsi_qla_host_t *);
248/* 247/*
249 * Global Function Prototypes in qla_attr.c source file. 248 * Global Function Prototypes in qla_attr.c source file.
250 */ 249 */
250struct fc_function_template;
251extern struct fc_function_template qla2xxx_transport_functions;
251extern void qla2x00_alloc_sysfs_attr(scsi_qla_host_t *); 252extern void qla2x00_alloc_sysfs_attr(scsi_qla_host_t *);
252extern void qla2x00_free_sysfs_attr(scsi_qla_host_t *); 253extern void qla2x00_free_sysfs_attr(scsi_qla_host_t *);
253extern struct scsi_transport_template *qla2x00_alloc_transport_tmpl(void);
254extern void qla2x00_init_host_attr(scsi_qla_host_t *); 254extern void qla2x00_init_host_attr(scsi_qla_host_t *);
255extern void qla2x00_alloc_sysfs_attr(scsi_qla_host_t *); 255extern void qla2x00_alloc_sysfs_attr(scsi_qla_host_t *);
256extern void qla2x00_free_sysfs_attr(scsi_qla_host_t *); 256extern void qla2x00_free_sysfs_attr(scsi_qla_host_t *);
diff --git a/drivers/scsi/qla2xxx/qla_os.c b/drivers/scsi/qla2xxx/qla_os.c
index 84db911318c6..579448222d69 100644
--- a/drivers/scsi/qla2xxx/qla_os.c
+++ b/drivers/scsi/qla2xxx/qla_os.c
@@ -2350,7 +2350,8 @@ qla2x00_module_init(void)
2350#if DEBUG_QLA2100 2350#if DEBUG_QLA2100
2351 strcat(qla2x00_version_str, "-debug"); 2351 strcat(qla2x00_version_str, "-debug");
2352#endif 2352#endif
2353 qla2xxx_transport_template = qla2x00_alloc_transport_tmpl(); 2353 qla2xxx_transport_template =
2354 fc_attach_transport(&qla2xxx_transport_functions);
2354 if (!qla2xxx_transport_template) 2355 if (!qla2xxx_transport_template)
2355 return -ENODEV; 2356 return -ENODEV;
2356 2357
diff --git a/drivers/scsi/scsi.c b/drivers/scsi/scsi.c
index 05d2bd075fd4..184bcaeaf812 100644
--- a/drivers/scsi/scsi.c
+++ b/drivers/scsi/scsi.c
@@ -542,7 +542,7 @@ int scsi_dispatch_cmd(struct scsi_cmnd *cmd)
542 * that the device is no longer present */ 542 * that the device is no longer present */
543 cmd->result = DID_NO_CONNECT << 16; 543 cmd->result = DID_NO_CONNECT << 16;
544 atomic_inc(&cmd->device->iorequest_cnt); 544 atomic_inc(&cmd->device->iorequest_cnt);
545 scsi_done(cmd); 545 __scsi_done(cmd);
546 /* return 0 (because the command has been processed) */ 546 /* return 0 (because the command has been processed) */
547 goto out; 547 goto out;
548 } 548 }
diff --git a/drivers/scsi/scsi_transport_spi.c b/drivers/scsi/scsi_transport_spi.c
index 303d7656f710..28966d05435c 100644
--- a/drivers/scsi/scsi_transport_spi.c
+++ b/drivers/scsi/scsi_transport_spi.c
@@ -22,6 +22,7 @@
22#include <linux/init.h> 22#include <linux/init.h>
23#include <linux/module.h> 23#include <linux/module.h>
24#include <linux/workqueue.h> 24#include <linux/workqueue.h>
25#include <linux/blkdev.h>
25#include <asm/semaphore.h> 26#include <asm/semaphore.h>
26#include <scsi/scsi.h> 27#include <scsi/scsi.h>
27#include "scsi_priv.h" 28#include "scsi_priv.h"
@@ -41,6 +42,11 @@
41 42
42#define SPI_MAX_ECHO_BUFFER_SIZE 4096 43#define SPI_MAX_ECHO_BUFFER_SIZE 4096
43 44
45#define DV_LOOPS 3
46#define DV_TIMEOUT (10*HZ)
47#define DV_RETRIES 3 /* should only need at most
48 * two cc/ua clears */
49
44/* Private data accessors (keep these out of the header file) */ 50/* Private data accessors (keep these out of the header file) */
45#define spi_dv_pending(x) (((struct spi_transport_attrs *)&(x)->starget_data)->dv_pending) 51#define spi_dv_pending(x) (((struct spi_transport_attrs *)&(x)->starget_data)->dv_pending)
46#define spi_dv_sem(x) (((struct spi_transport_attrs *)&(x)->starget_data)->dv_sem) 52#define spi_dv_sem(x) (((struct spi_transport_attrs *)&(x)->starget_data)->dv_sem)
@@ -100,6 +106,29 @@ static int sprint_frac(char *dest, int value, int denom)
100 return result; 106 return result;
101} 107}
102 108
109/* Modification of scsi_wait_req that will clear UNIT ATTENTION conditions
110 * resulting from (likely) bus and device resets */
111static void spi_wait_req(struct scsi_request *sreq, const void *cmd,
112 void *buffer, unsigned bufflen)
113{
114 int i;
115
116 for(i = 0; i < DV_RETRIES; i++) {
117 sreq->sr_request->flags |= REQ_FAILFAST;
118
119 scsi_wait_req(sreq, cmd, buffer, bufflen,
120 DV_TIMEOUT, /* retries */ 1);
121 if (sreq->sr_result & DRIVER_SENSE) {
122 struct scsi_sense_hdr sshdr;
123
124 if (scsi_request_normalize_sense(sreq, &sshdr)
125 && sshdr.sense_key == UNIT_ATTENTION)
126 continue;
127 }
128 break;
129 }
130}
131
103static struct { 132static struct {
104 enum spi_signal_type value; 133 enum spi_signal_type value;
105 char *name; 134 char *name;
@@ -378,11 +407,6 @@ static CLASS_DEVICE_ATTR(signalling, S_IRUGO | S_IWUSR,
378 if(i->f->set_##x) \ 407 if(i->f->set_##x) \
379 i->f->set_##x(sdev->sdev_target, y) 408 i->f->set_##x(sdev->sdev_target, y)
380 409
381#define DV_LOOPS 3
382#define DV_TIMEOUT (10*HZ)
383#define DV_RETRIES 3 /* should only need at most
384 * two cc/ua clears */
385
386enum spi_compare_returns { 410enum spi_compare_returns {
387 SPI_COMPARE_SUCCESS, 411 SPI_COMPARE_SUCCESS,
388 SPI_COMPARE_FAILURE, 412 SPI_COMPARE_FAILURE,
@@ -446,8 +470,7 @@ spi_dv_device_echo_buffer(struct scsi_request *sreq, u8 *buffer,
446 for (r = 0; r < retries; r++) { 470 for (r = 0; r < retries; r++) {
447 sreq->sr_cmd_len = 0; /* wait_req to fill in */ 471 sreq->sr_cmd_len = 0; /* wait_req to fill in */
448 sreq->sr_data_direction = DMA_TO_DEVICE; 472 sreq->sr_data_direction = DMA_TO_DEVICE;
449 scsi_wait_req(sreq, spi_write_buffer, buffer, len, 473 spi_wait_req(sreq, spi_write_buffer, buffer, len);
450 DV_TIMEOUT, DV_RETRIES);
451 if(sreq->sr_result || !scsi_device_online(sdev)) { 474 if(sreq->sr_result || !scsi_device_online(sdev)) {
452 struct scsi_sense_hdr sshdr; 475 struct scsi_sense_hdr sshdr;
453 476
@@ -471,8 +494,7 @@ spi_dv_device_echo_buffer(struct scsi_request *sreq, u8 *buffer,
471 memset(ptr, 0, len); 494 memset(ptr, 0, len);
472 sreq->sr_cmd_len = 0; /* wait_req to fill in */ 495 sreq->sr_cmd_len = 0; /* wait_req to fill in */
473 sreq->sr_data_direction = DMA_FROM_DEVICE; 496 sreq->sr_data_direction = DMA_FROM_DEVICE;
474 scsi_wait_req(sreq, spi_read_buffer, ptr, len, 497 spi_wait_req(sreq, spi_read_buffer, ptr, len);
475 DV_TIMEOUT, DV_RETRIES);
476 scsi_device_set_state(sdev, SDEV_QUIESCE); 498 scsi_device_set_state(sdev, SDEV_QUIESCE);
477 499
478 if (memcmp(buffer, ptr, len) != 0) 500 if (memcmp(buffer, ptr, len) != 0)
@@ -500,8 +522,7 @@ spi_dv_device_compare_inquiry(struct scsi_request *sreq, u8 *buffer,
500 522
501 memset(ptr, 0, len); 523 memset(ptr, 0, len);
502 524
503 scsi_wait_req(sreq, spi_inquiry, ptr, len, 525 spi_wait_req(sreq, spi_inquiry, ptr, len);
504 DV_TIMEOUT, DV_RETRIES);
505 526
506 if(sreq->sr_result || !scsi_device_online(sdev)) { 527 if(sreq->sr_result || !scsi_device_online(sdev)) {
507 scsi_device_set_state(sdev, SDEV_QUIESCE); 528 scsi_device_set_state(sdev, SDEV_QUIESCE);
@@ -593,8 +614,7 @@ spi_dv_device_get_echo_buffer(struct scsi_request *sreq, u8 *buffer)
593 * (reservation conflict, device not ready, etc) just 614 * (reservation conflict, device not ready, etc) just
594 * skip the write tests */ 615 * skip the write tests */
595 for (l = 0; ; l++) { 616 for (l = 0; ; l++) {
596 scsi_wait_req(sreq, spi_test_unit_ready, NULL, 0, 617 spi_wait_req(sreq, spi_test_unit_ready, NULL, 0);
597 DV_TIMEOUT, DV_RETRIES);
598 618
599 if(sreq->sr_result) { 619 if(sreq->sr_result) {
600 if(l >= 3) 620 if(l >= 3)
@@ -608,8 +628,7 @@ spi_dv_device_get_echo_buffer(struct scsi_request *sreq, u8 *buffer)
608 sreq->sr_cmd_len = 0; 628 sreq->sr_cmd_len = 0;
609 sreq->sr_data_direction = DMA_FROM_DEVICE; 629 sreq->sr_data_direction = DMA_FROM_DEVICE;
610 630
611 scsi_wait_req(sreq, spi_read_buffer_descriptor, buffer, 4, 631 spi_wait_req(sreq, spi_read_buffer_descriptor, buffer, 4);
612 DV_TIMEOUT, DV_RETRIES);
613 632
614 if (sreq->sr_result) 633 if (sreq->sr_result)
615 /* Device has no echo buffer */ 634 /* Device has no echo buffer */
diff --git a/drivers/scsi/sr_ioctl.c b/drivers/scsi/sr_ioctl.c
index 3471be05779a..82d68fdb1548 100644
--- a/drivers/scsi/sr_ioctl.c
+++ b/drivers/scsi/sr_ioctl.c
@@ -281,6 +281,9 @@ int sr_get_mcn(struct cdrom_device_info *cdi, struct cdrom_mcn *mcn)
281 char *buffer = kmalloc(32, GFP_KERNEL | SR_GFP_DMA(cd)); 281 char *buffer = kmalloc(32, GFP_KERNEL | SR_GFP_DMA(cd));
282 int result; 282 int result;
283 283
284 if (!buffer)
285 return -ENOMEM;
286
284 memset(&cgc, 0, sizeof(struct packet_command)); 287 memset(&cgc, 0, sizeof(struct packet_command));
285 cgc.cmd[0] = GPCMD_READ_SUBCHANNEL; 288 cgc.cmd[0] = GPCMD_READ_SUBCHANNEL;
286 cgc.cmd[2] = 0x40; /* I do want the subchannel info */ 289 cgc.cmd[2] = 0x40; /* I do want the subchannel info */
diff --git a/drivers/scsi/sym53c8xx_2/sym_glue.c b/drivers/scsi/sym53c8xx_2/sym_glue.c
index 5ff83d214f12..5b07c6ec3ecc 100644
--- a/drivers/scsi/sym53c8xx_2/sym_glue.c
+++ b/drivers/scsi/sym53c8xx_2/sym_glue.c
@@ -2038,8 +2038,9 @@ static void sym2_set_period(struct scsi_target *starget, int period)
2038 struct sym_hcb *np = sym_get_hcb(shost); 2038 struct sym_hcb *np = sym_get_hcb(shost);
2039 struct sym_tcb *tp = &np->target[starget->id]; 2039 struct sym_tcb *tp = &np->target[starget->id];
2040 2040
2041 /* have to have DT for these transfers */ 2041 /* have to have DT for these transfers, but DT will also
2042 if (period <= np->minsync) 2042 * set width, so check that this is allowed */
2043 if (period <= np->minsync && spi_width(starget))
2043 tp->tgoal.dt = 1; 2044 tp->tgoal.dt = 1;
2044 2045
2045 tp->tgoal.period = period; 2046 tp->tgoal.period = period;