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/aic79xx_osm.c2
-rw-r--r--drivers/scsi/aic7xxx/aic7xxx_osm.c2
-rw-r--r--drivers/scsi/libata-scsi.c9
-rw-r--r--drivers/scsi/scsi_lib.c9
-rw-r--r--drivers/scsi/scsi_transport_spi.c28
-rw-r--r--drivers/scsi/sg.c6
-rw-r--r--drivers/scsi/st.c3
-rw-r--r--drivers/scsi/sym53c8xx_2/sym_glue.c5
9 files changed, 39 insertions, 27 deletions
diff --git a/drivers/scsi/aacraid/linit.c b/drivers/scsi/aacraid/linit.c
index ab383d1f59e2..3cb68af90456 100644
--- a/drivers/scsi/aacraid/linit.c
+++ b/drivers/scsi/aacraid/linit.c
@@ -325,6 +325,8 @@ static int aac_biosparm(struct scsi_device *sdev, struct block_device *bdev,
325 * translations ( 64/32, 128/32, 255/63 ). 325 * translations ( 64/32, 128/32, 255/63 ).
326 */ 326 */
327 buf = scsi_bios_ptable(bdev); 327 buf = scsi_bios_ptable(bdev);
328 if (!buf)
329 return 0;
328 if(*(__le16 *)(buf + 0x40) == cpu_to_le16(0xaa55)) { 330 if(*(__le16 *)(buf + 0x40) == cpu_to_le16(0xaa55)) {
329 struct partition *first = (struct partition * )buf; 331 struct partition *first = (struct partition * )buf;
330 struct partition *entry = first; 332 struct partition *entry = first;
diff --git a/drivers/scsi/aic7xxx/aic79xx_osm.c b/drivers/scsi/aic7xxx/aic79xx_osm.c
index 31e9f40e79a2..6aab9dacdeea 100644
--- a/drivers/scsi/aic7xxx/aic79xx_osm.c
+++ b/drivers/scsi/aic7xxx/aic79xx_osm.c
@@ -2105,7 +2105,7 @@ ahd_linux_queue_recovery_cmd(struct scsi_cmnd *cmd, scb_flag flag)
2105 scmd_id(cmd), 2105 scmd_id(cmd),
2106 scmd_channel(cmd) + 'A', 2106 scmd_channel(cmd) + 'A',
2107 CAM_LUN_WILDCARD, 2107 CAM_LUN_WILDCARD,
2108 SCB_LIST_NULL, ROLE_INITIATOR) == 0) 2108 SCB_LIST_NULL, ROLE_INITIATOR))
2109 break; 2109 break;
2110 } 2110 }
2111 } 2111 }
diff --git a/drivers/scsi/aic7xxx/aic7xxx_osm.c b/drivers/scsi/aic7xxx/aic7xxx_osm.c
index 7fc6454068e4..d866213f42b8 100644
--- a/drivers/scsi/aic7xxx/aic7xxx_osm.c
+++ b/drivers/scsi/aic7xxx/aic7xxx_osm.c
@@ -2169,7 +2169,7 @@ ahc_linux_queue_recovery_cmd(struct scsi_cmnd *cmd, scb_flag flag)
2169 if (ahc_match_scb(ahc, pending_scb, scmd_id(cmd), 2169 if (ahc_match_scb(ahc, pending_scb, scmd_id(cmd),
2170 scmd_channel(cmd) + 'A', 2170 scmd_channel(cmd) + 'A',
2171 CAM_LUN_WILDCARD, 2171 CAM_LUN_WILDCARD,
2172 SCB_LIST_NULL, ROLE_INITIATOR) == 0) 2172 SCB_LIST_NULL, ROLE_INITIATOR))
2173 break; 2173 break;
2174 } 2174 }
2175 } 2175 }
diff --git a/drivers/scsi/libata-scsi.c b/drivers/scsi/libata-scsi.c
index 3b4ca55a3332..379e87089764 100644
--- a/drivers/scsi/libata-scsi.c
+++ b/drivers/scsi/libata-scsi.c
@@ -2239,7 +2239,7 @@ ata_scsi_pass_thru(struct ata_queued_cmd *qc, const u8 *scsicmd)
2239 struct scsi_cmnd *cmd = qc->scsicmd; 2239 struct scsi_cmnd *cmd = qc->scsicmd;
2240 2240
2241 if ((tf->protocol = ata_scsi_map_proto(scsicmd[1])) == ATA_PROT_UNKNOWN) 2241 if ((tf->protocol = ata_scsi_map_proto(scsicmd[1])) == ATA_PROT_UNKNOWN)
2242 return 1; 2242 goto invalid_fld;
2243 2243
2244 /* 2244 /*
2245 * 12 and 16 byte CDBs use different offsets to 2245 * 12 and 16 byte CDBs use different offsets to
@@ -2301,7 +2301,7 @@ ata_scsi_pass_thru(struct ata_queued_cmd *qc, const u8 *scsicmd)
2301 */ 2301 */
2302 if ((tf->command == ATA_CMD_SET_FEATURES) 2302 if ((tf->command == ATA_CMD_SET_FEATURES)
2303 && (tf->feature == SETFEATURES_XFER)) 2303 && (tf->feature == SETFEATURES_XFER))
2304 return 1; 2304 goto invalid_fld;
2305 2305
2306 /* 2306 /*
2307 * Set flags so that all registers will be written, 2307 * Set flags so that all registers will be written,
@@ -2322,6 +2322,11 @@ ata_scsi_pass_thru(struct ata_queued_cmd *qc, const u8 *scsicmd)
2322 qc->nsect = cmd->bufflen / ATA_SECT_SIZE; 2322 qc->nsect = cmd->bufflen / ATA_SECT_SIZE;
2323 2323
2324 return 0; 2324 return 0;
2325
2326 invalid_fld:
2327 ata_scsi_set_sense(qc->scsicmd, ILLEGAL_REQUEST, 0x24, 0x00);
2328 /* "Invalid field in cdb" */
2329 return 1;
2325} 2330}
2326 2331
2327/** 2332/**
diff --git a/drivers/scsi/scsi_lib.c b/drivers/scsi/scsi_lib.c
index ce9d73a292e2..4afef5cdcb17 100644
--- a/drivers/scsi/scsi_lib.c
+++ b/drivers/scsi/scsi_lib.c
@@ -542,17 +542,10 @@ static void scsi_requeue_command(struct request_queue *q, struct scsi_cmnd *cmd)
542 542
543void scsi_next_command(struct scsi_cmnd *cmd) 543void scsi_next_command(struct scsi_cmnd *cmd)
544{ 544{
545 struct scsi_device *sdev = cmd->device; 545 struct request_queue *q = cmd->device->request_queue;
546 struct request_queue *q = sdev->request_queue;
547
548 /* need to hold a reference on the device before we let go of the cmd */
549 get_device(&sdev->sdev_gendev);
550 546
551 scsi_put_command(cmd); 547 scsi_put_command(cmd);
552 scsi_run_queue(q); 548 scsi_run_queue(q);
553
554 /* ok to remove device now */
555 put_device(&sdev->sdev_gendev);
556} 549}
557 550
558void scsi_run_host_queues(struct Scsi_Host *shost) 551void scsi_run_host_queues(struct Scsi_Host *shost)
diff --git a/drivers/scsi/scsi_transport_spi.c b/drivers/scsi/scsi_transport_spi.c
index 718a2bc4ed5e..38a53b5f9e9a 100644
--- a/drivers/scsi/scsi_transport_spi.c
+++ b/drivers/scsi/scsi_transport_spi.c
@@ -812,12 +812,10 @@ spi_dv_device_internal(struct scsi_device *sdev, u8 *buffer)
812 if (!scsi_device_sync(sdev) && !scsi_device_dt(sdev)) 812 if (!scsi_device_sync(sdev) && !scsi_device_dt(sdev))
813 return; 813 return;
814 814
815 /* see if the device has an echo buffer. If it does we can 815 /* len == -1 is the signal that we need to ascertain the
816 * do the SPI pattern write tests */ 816 * presence of an echo buffer before trying to use it. len ==
817 817 * 0 means we don't have an echo buffer */
818 len = 0; 818 len = -1;
819 if (scsi_device_dt(sdev))
820 len = spi_dv_device_get_echo_buffer(sdev, buffer);
821 819
822 retry: 820 retry:
823 821
@@ -840,11 +838,23 @@ spi_dv_device_internal(struct scsi_device *sdev, u8 *buffer)
840 if (spi_min_period(starget) == 8) 838 if (spi_min_period(starget) == 8)
841 DV_SET(pcomp_en, 1); 839 DV_SET(pcomp_en, 1);
842 } 840 }
841 /* Do the read only INQUIRY tests */
842 spi_dv_retrain(sdev, buffer, buffer + sdev->inquiry_len,
843 spi_dv_device_compare_inquiry);
844 /* See if we actually managed to negotiate and sustain DT */
845 if (i->f->get_dt)
846 i->f->get_dt(starget);
847
848 /* see if the device has an echo buffer. If it does we can do
849 * the SPI pattern write tests. Because of some broken
850 * devices, we *only* try this on a device that has actually
851 * negotiated DT */
852
853 if (len == -1 && spi_dt(starget))
854 len = spi_dv_device_get_echo_buffer(sdev, buffer);
843 855
844 if (len == 0) { 856 if (len <= 0) {
845 starget_printk(KERN_INFO, starget, "Domain Validation skipping write tests\n"); 857 starget_printk(KERN_INFO, starget, "Domain Validation skipping write tests\n");
846 spi_dv_retrain(sdev, buffer, buffer + len,
847 spi_dv_device_compare_inquiry);
848 return; 858 return;
849 } 859 }
850 860
diff --git a/drivers/scsi/sg.c b/drivers/scsi/sg.c
index 72ec59456e69..b55c2a8a547c 100644
--- a/drivers/scsi/sg.c
+++ b/drivers/scsi/sg.c
@@ -1860,9 +1860,11 @@ st_map_user_pages(struct scatterlist *sgl, const unsigned int max_pages,
1860 unlock_page(pages[j]); */ 1860 unlock_page(pages[j]); */
1861 res = 0; 1861 res = 0;
1862 out_unmap: 1862 out_unmap:
1863 if (res > 0) 1863 if (res > 0) {
1864 for (j=0; j < res; j++) 1864 for (j=0; j < res; j++)
1865 page_cache_release(pages[j]); 1865 page_cache_release(pages[j]);
1866 res = 0;
1867 }
1866 kfree(pages); 1868 kfree(pages);
1867 return res; 1869 return res;
1868} 1870}
@@ -1878,8 +1880,6 @@ st_unmap_user_pages(struct scatterlist *sgl, const unsigned int nr_pages,
1878 for (i=0; i < nr_pages; i++) { 1880 for (i=0; i < nr_pages; i++) {
1879 struct page *page = sgl[i].page; 1881 struct page *page = sgl[i].page;
1880 1882
1881 /* XXX: just for debug. Remove when PageReserved is removed */
1882 BUG_ON(PageReserved(page));
1883 if (dirtied) 1883 if (dirtied)
1884 SetPageDirty(page); 1884 SetPageDirty(page);
1885 /* unlock_page(page); */ 1885 /* unlock_page(page); */
diff --git a/drivers/scsi/st.c b/drivers/scsi/st.c
index 770c4324f3d5..7ac6ea141fff 100644
--- a/drivers/scsi/st.c
+++ b/drivers/scsi/st.c
@@ -4509,6 +4509,7 @@ static int sgl_map_user_pages(struct scatterlist *sgl, const unsigned int max_pa
4509 if (res > 0) { 4509 if (res > 0) {
4510 for (j=0; j < res; j++) 4510 for (j=0; j < res; j++)
4511 page_cache_release(pages[j]); 4511 page_cache_release(pages[j]);
4512 res = 0;
4512 } 4513 }
4513 kfree(pages); 4514 kfree(pages);
4514 return res; 4515 return res;
@@ -4524,8 +4525,6 @@ static int sgl_unmap_user_pages(struct scatterlist *sgl, const unsigned int nr_p
4524 for (i=0; i < nr_pages; i++) { 4525 for (i=0; i < nr_pages; i++) {
4525 struct page *page = sgl[i].page; 4526 struct page *page = sgl[i].page;
4526 4527
4527 /* XXX: just for debug. Remove when PageReserved is removed */
4528 BUG_ON(PageReserved(page));
4529 if (dirtied) 4528 if (dirtied)
4530 SetPageDirty(page); 4529 SetPageDirty(page);
4531 /* FIXME: cache flush missing for rw==READ 4530 /* FIXME: cache flush missing for rw==READ
diff --git a/drivers/scsi/sym53c8xx_2/sym_glue.c b/drivers/scsi/sym53c8xx_2/sym_glue.c
index d76766c3ce16..7fc0b97173e1 100644
--- a/drivers/scsi/sym53c8xx_2/sym_glue.c
+++ b/drivers/scsi/sym53c8xx_2/sym_glue.c
@@ -2086,6 +2086,7 @@ static void sym2_set_dt(struct scsi_target *starget, int dt)
2086 tp->tgoal.check_nego = 1; 2086 tp->tgoal.check_nego = 1;
2087} 2087}
2088 2088
2089#if 0
2089static void sym2_set_iu(struct scsi_target *starget, int iu) 2090static void sym2_set_iu(struct scsi_target *starget, int iu)
2090{ 2091{
2091 struct Scsi_Host *shost = dev_to_shost(starget->dev.parent); 2092 struct Scsi_Host *shost = dev_to_shost(starget->dev.parent);
@@ -2111,7 +2112,7 @@ static void sym2_set_qas(struct scsi_target *starget, int qas)
2111 tp->tgoal.qas = 0; 2112 tp->tgoal.qas = 0;
2112 tp->tgoal.check_nego = 1; 2113 tp->tgoal.check_nego = 1;
2113} 2114}
2114 2115#endif
2115 2116
2116static struct spi_function_template sym2_transport_functions = { 2117static struct spi_function_template sym2_transport_functions = {
2117 .set_offset = sym2_set_offset, 2118 .set_offset = sym2_set_offset,
@@ -2122,10 +2123,12 @@ static struct spi_function_template sym2_transport_functions = {
2122 .show_width = 1, 2123 .show_width = 1,
2123 .set_dt = sym2_set_dt, 2124 .set_dt = sym2_set_dt,
2124 .show_dt = 1, 2125 .show_dt = 1,
2126#if 0
2125 .set_iu = sym2_set_iu, 2127 .set_iu = sym2_set_iu,
2126 .show_iu = 1, 2128 .show_iu = 1,
2127 .set_qas = sym2_set_qas, 2129 .set_qas = sym2_set_qas,
2128 .show_qas = 1, 2130 .show_qas = 1,
2131#endif
2129 .get_signalling = sym2_get_signalling, 2132 .get_signalling = sym2_get_signalling,
2130}; 2133};
2131 2134