aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/scsi
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/scsi')
-rw-r--r--drivers/scsi/aha152x.c6
-rw-r--r--drivers/scsi/aic7xxx/aic7770_osm.c2
-rw-r--r--drivers/scsi/aic7xxx/aic7xxx_osm_pci.c4
-rw-r--r--drivers/scsi/dpt_i2o.c2
-rw-r--r--drivers/scsi/fdomain.c2
-rw-r--r--drivers/scsi/ide-scsi.c38
-rw-r--r--drivers/scsi/megaraid.c6
-rw-r--r--drivers/scsi/mvsas.c4
-rw-r--r--drivers/scsi/ncr53c8xx.c4
-rw-r--r--drivers/scsi/scsi_debug.c2
-rw-r--r--drivers/scsi/scsi_devinfo.c77
-rw-r--r--drivers/scsi/scsi_error.c1
-rw-r--r--drivers/scsi/scsi_lib.c31
-rw-r--r--drivers/scsi/scsi_proc.c4
-rw-r--r--drivers/scsi/scsi_scan.c2
-rw-r--r--drivers/scsi/scsi_transport_sas.c3
-rw-r--r--drivers/scsi/sd.c1
-rw-r--r--drivers/scsi/sg.c12
-rw-r--r--drivers/scsi/sym53c8xx_2/sym_hipd.c6
-rw-r--r--drivers/scsi/ultrastor.c4
20 files changed, 112 insertions, 99 deletions
diff --git a/drivers/scsi/aha152x.c b/drivers/scsi/aha152x.c
index a09b2d3fdf5a..f5215fd4b73d 100644
--- a/drivers/scsi/aha152x.c
+++ b/drivers/scsi/aha152x.c
@@ -994,13 +994,13 @@ static int aha152x_internal_queue(Scsi_Cmnd *SCpnt, struct completion *complete,
994 SCpnt->SCp.sent_command = 0; 994 SCpnt->SCp.sent_command = 0;
995 995
996 if(SCpnt->SCp.phase & (resetting|check_condition)) { 996 if(SCpnt->SCp.phase & (resetting|check_condition)) {
997 if(SCpnt->host_scribble==0 || SCSEM(SCpnt) || SCNEXT(SCpnt)) { 997 if (!SCpnt->host_scribble || SCSEM(SCpnt) || SCNEXT(SCpnt)) {
998 printk(ERR_LEAD "cannot reuse command\n", CMDINFO(SCpnt)); 998 printk(ERR_LEAD "cannot reuse command\n", CMDINFO(SCpnt));
999 return FAILED; 999 return FAILED;
1000 } 1000 }
1001 } else { 1001 } else {
1002 SCpnt->host_scribble = kmalloc(sizeof(struct aha152x_scdata), GFP_ATOMIC); 1002 SCpnt->host_scribble = kmalloc(sizeof(struct aha152x_scdata), GFP_ATOMIC);
1003 if(SCpnt->host_scribble==0) { 1003 if(!SCpnt->host_scribble) {
1004 printk(ERR_LEAD "allocation failed\n", CMDINFO(SCpnt)); 1004 printk(ERR_LEAD "allocation failed\n", CMDINFO(SCpnt));
1005 return FAILED; 1005 return FAILED;
1006 } 1006 }
@@ -1162,7 +1162,7 @@ static int aha152x_device_reset(Scsi_Cmnd * SCpnt)
1162 } 1162 }
1163 1163
1164 DO_LOCK(flags); 1164 DO_LOCK(flags);
1165 issued = remove_SC(&ISSUE_SC, SCpnt)==0; 1165 issued = remove_SC(&ISSUE_SC, SCpnt) == NULL;
1166 disconnected = issued && remove_SC(&DISCONNECTED_SC, SCpnt); 1166 disconnected = issued && remove_SC(&DISCONNECTED_SC, SCpnt);
1167 DO_UNLOCK(flags); 1167 DO_UNLOCK(flags);
1168 1168
diff --git a/drivers/scsi/aic7xxx/aic7770_osm.c b/drivers/scsi/aic7xxx/aic7770_osm.c
index 1ac119733bac..f220e5e436ab 100644
--- a/drivers/scsi/aic7xxx/aic7770_osm.c
+++ b/drivers/scsi/aic7xxx/aic7770_osm.c
@@ -50,7 +50,7 @@ aic7770_map_registers(struct ahc_softc *ahc, u_int port)
50 /* 50 /*
51 * Lock out other contenders for our i/o space. 51 * Lock out other contenders for our i/o space.
52 */ 52 */
53 if (request_region(port, AHC_EISA_IOSIZE, "aic7xxx") == 0) 53 if (!request_region(port, AHC_EISA_IOSIZE, "aic7xxx"))
54 return (ENOMEM); 54 return (ENOMEM);
55 ahc->tag = BUS_SPACE_PIO; 55 ahc->tag = BUS_SPACE_PIO;
56 ahc->bsh.ioport = port; 56 ahc->bsh.ioport = port;
diff --git a/drivers/scsi/aic7xxx/aic7xxx_osm_pci.c b/drivers/scsi/aic7xxx/aic7xxx_osm_pci.c
index 0d7628f1f1ef..00f5b9868574 100644
--- a/drivers/scsi/aic7xxx/aic7xxx_osm_pci.c
+++ b/drivers/scsi/aic7xxx/aic7xxx_osm_pci.c
@@ -352,7 +352,7 @@ ahc_linux_pci_reserve_io_region(struct ahc_softc *ahc, resource_size_t *base)
352 *base = pci_resource_start(ahc->dev_softc, 0); 352 *base = pci_resource_start(ahc->dev_softc, 0);
353 if (*base == 0) 353 if (*base == 0)
354 return (ENOMEM); 354 return (ENOMEM);
355 if (request_region(*base, 256, "aic7xxx") == 0) 355 if (!request_region(*base, 256, "aic7xxx"))
356 return (ENOMEM); 356 return (ENOMEM);
357 return (0); 357 return (0);
358} 358}
@@ -369,7 +369,7 @@ ahc_linux_pci_reserve_mem_region(struct ahc_softc *ahc,
369 start = pci_resource_start(ahc->dev_softc, 1); 369 start = pci_resource_start(ahc->dev_softc, 1);
370 if (start != 0) { 370 if (start != 0) {
371 *bus_addr = start; 371 *bus_addr = start;
372 if (request_mem_region(start, 0x1000, "aic7xxx") == 0) 372 if (!request_mem_region(start, 0x1000, "aic7xxx"))
373 error = ENOMEM; 373 error = ENOMEM;
374 if (error == 0) { 374 if (error == 0) {
375 *maddr = ioremap_nocache(start, 256); 375 *maddr = ioremap_nocache(start, 256);
diff --git a/drivers/scsi/dpt_i2o.c b/drivers/scsi/dpt_i2o.c
index 8939fbf102fc..0fb5bf4c43ac 100644
--- a/drivers/scsi/dpt_i2o.c
+++ b/drivers/scsi/dpt_i2o.c
@@ -164,7 +164,7 @@ static inline u32 dma_low(dma_addr_t addr)
164 164
165static u8 adpt_read_blink_led(adpt_hba* host) 165static u8 adpt_read_blink_led(adpt_hba* host)
166{ 166{
167 if(host->FwDebugBLEDflag_P != 0) { 167 if (host->FwDebugBLEDflag_P) {
168 if( readb(host->FwDebugBLEDflag_P) == 0xbc ){ 168 if( readb(host->FwDebugBLEDflag_P) == 0xbc ){
169 return readb(host->FwDebugBLEDvalue_P); 169 return readb(host->FwDebugBLEDvalue_P);
170 } 170 }
diff --git a/drivers/scsi/fdomain.c b/drivers/scsi/fdomain.c
index 2cd6b4959eb2..c33bcb284df7 100644
--- a/drivers/scsi/fdomain.c
+++ b/drivers/scsi/fdomain.c
@@ -1443,7 +1443,7 @@ static int fdomain_16x0_queue(struct scsi_cmnd *SCpnt,
1443 current_SC->SCp.this_residual = current_SC->SCp.buffer->length; 1443 current_SC->SCp.this_residual = current_SC->SCp.buffer->length;
1444 current_SC->SCp.buffers_residual = scsi_sg_count(current_SC) - 1; 1444 current_SC->SCp.buffers_residual = scsi_sg_count(current_SC) - 1;
1445 } else { 1445 } else {
1446 current_SC->SCp.ptr = 0; 1446 current_SC->SCp.ptr = NULL;
1447 current_SC->SCp.this_residual = 0; 1447 current_SC->SCp.this_residual = 0;
1448 current_SC->SCp.buffer = NULL; 1448 current_SC->SCp.buffer = NULL;
1449 current_SC->SCp.buffers_residual = 0; 1449 current_SC->SCp.buffers_residual = 0;
diff --git a/drivers/scsi/ide-scsi.c b/drivers/scsi/ide-scsi.c
index 32553639aded..44d8d5163a1a 100644
--- a/drivers/scsi/ide-scsi.c
+++ b/drivers/scsi/ide-scsi.c
@@ -134,6 +134,7 @@ static inline idescsi_scsi_t *drive_to_idescsi(ide_drive_t *ide_drive)
134static void idescsi_input_buffers(ide_drive_t *drive, struct ide_atapi_pc *pc, 134static void idescsi_input_buffers(ide_drive_t *drive, struct ide_atapi_pc *pc,
135 unsigned int bcount) 135 unsigned int bcount)
136{ 136{
137 ide_hwif_t *hwif = drive->hwif;
137 int count; 138 int count;
138 char *buf; 139 char *buf;
139 140
@@ -145,14 +146,12 @@ static void idescsi_input_buffers(ide_drive_t *drive, struct ide_atapi_pc *pc,
145 local_irq_save(flags); 146 local_irq_save(flags);
146 buf = kmap_atomic(sg_page(pc->sg), KM_IRQ0) + 147 buf = kmap_atomic(sg_page(pc->sg), KM_IRQ0) +
147 pc->sg->offset; 148 pc->sg->offset;
148 drive->hwif->atapi_input_bytes(drive, 149 hwif->input_data(drive, NULL, buf + pc->b_count, count);
149 buf + pc->b_count, count);
150 kunmap_atomic(buf - pc->sg->offset, KM_IRQ0); 150 kunmap_atomic(buf - pc->sg->offset, KM_IRQ0);
151 local_irq_restore(flags); 151 local_irq_restore(flags);
152 } else { 152 } else {
153 buf = sg_virt(pc->sg); 153 buf = sg_virt(pc->sg);
154 drive->hwif->atapi_input_bytes(drive, 154 hwif->input_data(drive, NULL, buf + pc->b_count, count);
155 buf + pc->b_count, count);
156 } 155 }
157 bcount -= count; pc->b_count += count; 156 bcount -= count; pc->b_count += count;
158 if (pc->b_count == pc->sg->length) { 157 if (pc->b_count == pc->sg->length) {
@@ -165,13 +164,14 @@ static void idescsi_input_buffers(ide_drive_t *drive, struct ide_atapi_pc *pc,
165 164
166 if (bcount) { 165 if (bcount) {
167 printk (KERN_ERR "ide-scsi: scatter gather table too small, discarding data\n"); 166 printk (KERN_ERR "ide-scsi: scatter gather table too small, discarding data\n");
168 ide_atapi_discard_data(drive, bcount); 167 ide_pad_transfer(drive, 0, bcount);
169 } 168 }
170} 169}
171 170
172static void idescsi_output_buffers(ide_drive_t *drive, struct ide_atapi_pc *pc, 171static void idescsi_output_buffers(ide_drive_t *drive, struct ide_atapi_pc *pc,
173 unsigned int bcount) 172 unsigned int bcount)
174{ 173{
174 ide_hwif_t *hwif = drive->hwif;
175 int count; 175 int count;
176 char *buf; 176 char *buf;
177 177
@@ -183,14 +183,12 @@ static void idescsi_output_buffers(ide_drive_t *drive, struct ide_atapi_pc *pc,
183 local_irq_save(flags); 183 local_irq_save(flags);
184 buf = kmap_atomic(sg_page(pc->sg), KM_IRQ0) + 184 buf = kmap_atomic(sg_page(pc->sg), KM_IRQ0) +
185 pc->sg->offset; 185 pc->sg->offset;
186 drive->hwif->atapi_output_bytes(drive, 186 hwif->output_data(drive, NULL, buf + pc->b_count, count);
187 buf + pc->b_count, count);
188 kunmap_atomic(buf - pc->sg->offset, KM_IRQ0); 187 kunmap_atomic(buf - pc->sg->offset, KM_IRQ0);
189 local_irq_restore(flags); 188 local_irq_restore(flags);
190 } else { 189 } else {
191 buf = sg_virt(pc->sg); 190 buf = sg_virt(pc->sg);
192 drive->hwif->atapi_output_bytes(drive, 191 hwif->output_data(drive, NULL, buf + pc->b_count, count);
193 buf + pc->b_count, count);
194 } 192 }
195 bcount -= count; pc->b_count += count; 193 bcount -= count; pc->b_count += count;
196 if (pc->b_count == pc->sg->length) { 194 if (pc->b_count == pc->sg->length) {
@@ -203,7 +201,7 @@ static void idescsi_output_buffers(ide_drive_t *drive, struct ide_atapi_pc *pc,
203 201
204 if (bcount) { 202 if (bcount) {
205 printk (KERN_ERR "ide-scsi: scatter gather table too small, padding with zeros\n"); 203 printk (KERN_ERR "ide-scsi: scatter gather table too small, padding with zeros\n");
206 ide_atapi_write_zeros(drive, bcount); 204 ide_pad_transfer(drive, 1, bcount);
207 } 205 }
208} 206}
209 207
@@ -258,7 +256,8 @@ idescsi_atapi_error(ide_drive_t *drive, struct request *rq, u8 stat, u8 err)
258 256
259 if (ide_read_status(drive) & (BUSY_STAT | DRQ_STAT)) 257 if (ide_read_status(drive) & (BUSY_STAT | DRQ_STAT))
260 /* force an abort */ 258 /* force an abort */
261 hwif->OUTB(WIN_IDLEIMMEDIATE, hwif->io_ports.command_addr); 259 hwif->OUTBSYNC(drive, WIN_IDLEIMMEDIATE,
260 hwif->io_ports.command_addr);
262 261
263 rq->errors++; 262 rq->errors++;
264 263
@@ -431,14 +430,15 @@ static ide_startstop_t idescsi_pc_intr (ide_drive_t *drive)
431 idescsi_input_buffers(drive, pc, 430 idescsi_input_buffers(drive, pc,
432 temp); 431 temp);
433 else 432 else
434 drive->hwif->atapi_input_bytes(drive, pc->cur_pos, temp); 433 hwif->input_data(drive, NULL,
434 pc->cur_pos, temp);
435 printk(KERN_ERR "ide-scsi: transferred" 435 printk(KERN_ERR "ide-scsi: transferred"
436 " %d of %d bytes\n", 436 " %d of %d bytes\n",
437 temp, bcount); 437 temp, bcount);
438 } 438 }
439 pc->xferred += temp; 439 pc->xferred += temp;
440 pc->cur_pos += temp; 440 pc->cur_pos += temp;
441 ide_atapi_discard_data(drive, bcount - temp); 441 ide_pad_transfer(drive, 0, bcount - temp);
442 ide_set_handler(drive, &idescsi_pc_intr, get_timeout(pc), idescsi_expiry); 442 ide_set_handler(drive, &idescsi_pc_intr, get_timeout(pc), idescsi_expiry);
443 return ide_started; 443 return ide_started;
444 } 444 }
@@ -452,15 +452,13 @@ static ide_startstop_t idescsi_pc_intr (ide_drive_t *drive)
452 if (pc->sg) 452 if (pc->sg)
453 idescsi_input_buffers(drive, pc, bcount); 453 idescsi_input_buffers(drive, pc, bcount);
454 else 454 else
455 hwif->atapi_input_bytes(drive, pc->cur_pos, 455 hwif->input_data(drive, NULL, pc->cur_pos, bcount);
456 bcount);
457 } else { 456 } else {
458 pc->flags |= PC_FLAG_WRITING; 457 pc->flags |= PC_FLAG_WRITING;
459 if (pc->sg) 458 if (pc->sg)
460 idescsi_output_buffers(drive, pc, bcount); 459 idescsi_output_buffers(drive, pc, bcount);
461 else 460 else
462 hwif->atapi_output_bytes(drive, pc->cur_pos, 461 hwif->output_data(drive, NULL, pc->cur_pos, bcount);
463 bcount);
464 } 462 }
465 /* Update the current position */ 463 /* Update the current position */
466 pc->xferred += bcount; 464 pc->xferred += bcount;
@@ -493,8 +491,10 @@ static ide_startstop_t idescsi_transfer_pc(ide_drive_t *drive)
493 BUG_ON(HWGROUP(drive)->handler != NULL); 491 BUG_ON(HWGROUP(drive)->handler != NULL);
494 /* Set the interrupt routine */ 492 /* Set the interrupt routine */
495 ide_set_handler(drive, &idescsi_pc_intr, get_timeout(pc), idescsi_expiry); 493 ide_set_handler(drive, &idescsi_pc_intr, get_timeout(pc), idescsi_expiry);
494
496 /* Send the actual packet */ 495 /* Send the actual packet */
497 drive->hwif->atapi_output_bytes(drive, scsi->pc->c, 12); 496 hwif->output_data(drive, NULL, scsi->pc->c, 12);
497
498 if (pc->flags & PC_FLAG_DMA_OK) { 498 if (pc->flags & PC_FLAG_DMA_OK) {
499 pc->flags |= PC_FLAG_DMA_IN_PROGRESS; 499 pc->flags |= PC_FLAG_DMA_IN_PROGRESS;
500 hwif->dma_ops->dma_start(drive); 500 hwif->dma_ops->dma_start(drive);
@@ -574,7 +574,7 @@ static ide_startstop_t idescsi_issue_pc(ide_drive_t *drive,
574 return ide_started; 574 return ide_started;
575 } else { 575 } else {
576 /* Issue the packet command */ 576 /* Issue the packet command */
577 hwif->OUTB(WIN_PACKETCMD, hwif->io_ports.command_addr); 577 ide_execute_pkt_cmd(drive);
578 return idescsi_transfer_pc(drive); 578 return idescsi_transfer_pc(drive);
579 } 579 }
580} 580}
diff --git a/drivers/scsi/megaraid.c b/drivers/scsi/megaraid.c
index b135a1ed4b2c..18551aaf5e09 100644
--- a/drivers/scsi/megaraid.c
+++ b/drivers/scsi/megaraid.c
@@ -4996,7 +4996,7 @@ static int __init megaraid_init(void)
4996 max_mbox_busy_wait = MBOX_BUSY_WAIT; 4996 max_mbox_busy_wait = MBOX_BUSY_WAIT;
4997 4997
4998#ifdef CONFIG_PROC_FS 4998#ifdef CONFIG_PROC_FS
4999 mega_proc_dir_entry = proc_mkdir("megaraid", &proc_root); 4999 mega_proc_dir_entry = proc_mkdir("megaraid", NULL);
5000 if (!mega_proc_dir_entry) { 5000 if (!mega_proc_dir_entry) {
5001 printk(KERN_WARNING 5001 printk(KERN_WARNING
5002 "megaraid: failed to create megaraid root\n"); 5002 "megaraid: failed to create megaraid root\n");
@@ -5005,7 +5005,7 @@ static int __init megaraid_init(void)
5005 error = pci_register_driver(&megaraid_pci_driver); 5005 error = pci_register_driver(&megaraid_pci_driver);
5006 if (error) { 5006 if (error) {
5007#ifdef CONFIG_PROC_FS 5007#ifdef CONFIG_PROC_FS
5008 remove_proc_entry("megaraid", &proc_root); 5008 remove_proc_entry("megaraid", NULL);
5009#endif 5009#endif
5010 return error; 5010 return error;
5011 } 5011 }
@@ -5035,7 +5035,7 @@ static void __exit megaraid_exit(void)
5035 pci_unregister_driver(&megaraid_pci_driver); 5035 pci_unregister_driver(&megaraid_pci_driver);
5036 5036
5037#ifdef CONFIG_PROC_FS 5037#ifdef CONFIG_PROC_FS
5038 remove_proc_entry("megaraid", &proc_root); 5038 remove_proc_entry("megaraid", NULL);
5039#endif 5039#endif
5040} 5040}
5041 5041
diff --git a/drivers/scsi/mvsas.c b/drivers/scsi/mvsas.c
index e55b9037adb2..1dd70d7a4947 100644
--- a/drivers/scsi/mvsas.c
+++ b/drivers/scsi/mvsas.c
@@ -2822,7 +2822,9 @@ static void mvs_update_phyinfo(struct mvs_info *mvi, int i,
2822 dev_printk(KERN_DEBUG, &pdev->dev, 2822 dev_printk(KERN_DEBUG, &pdev->dev,
2823 "phy[%d] Get Attached Address 0x%llX ," 2823 "phy[%d] Get Attached Address 0x%llX ,"
2824 " SAS Address 0x%llX\n", 2824 " SAS Address 0x%llX\n",
2825 i, phy->att_dev_sas_addr, phy->dev_sas_addr); 2825 i,
2826 (unsigned long long)phy->att_dev_sas_addr,
2827 (unsigned long long)phy->dev_sas_addr);
2826 dev_printk(KERN_DEBUG, &pdev->dev, 2828 dev_printk(KERN_DEBUG, &pdev->dev,
2827 "Rate = %x , type = %d\n", 2829 "Rate = %x , type = %d\n",
2828 sas_phy->linkrate, phy->phy_type); 2830 sas_phy->linkrate, phy->phy_type);
diff --git a/drivers/scsi/ncr53c8xx.c b/drivers/scsi/ncr53c8xx.c
index d89289400425..c57c94c0ffd2 100644
--- a/drivers/scsi/ncr53c8xx.c
+++ b/drivers/scsi/ncr53c8xx.c
@@ -8186,7 +8186,7 @@ static void insert_into_waiting_list(struct ncb *np, struct scsi_cmnd *cmd)
8186 cmd->next_wcmd = NULL; 8186 cmd->next_wcmd = NULL;
8187 if (!(wcmd = np->waiting_list)) np->waiting_list = cmd; 8187 if (!(wcmd = np->waiting_list)) np->waiting_list = cmd;
8188 else { 8188 else {
8189 while ((wcmd->next_wcmd) != 0) 8189 while (wcmd->next_wcmd)
8190 wcmd = (struct scsi_cmnd *) wcmd->next_wcmd; 8190 wcmd = (struct scsi_cmnd *) wcmd->next_wcmd;
8191 wcmd->next_wcmd = (char *) cmd; 8191 wcmd->next_wcmd = (char *) cmd;
8192 } 8192 }
@@ -8222,7 +8222,7 @@ static void process_waiting_list(struct ncb *np, int sts)
8222#ifdef DEBUG_WAITING_LIST 8222#ifdef DEBUG_WAITING_LIST
8223 if (waiting_list) printk("%s: waiting_list=%lx processing sts=%d\n", ncr_name(np), (u_long) waiting_list, sts); 8223 if (waiting_list) printk("%s: waiting_list=%lx processing sts=%d\n", ncr_name(np), (u_long) waiting_list, sts);
8224#endif 8224#endif
8225 while ((wcmd = waiting_list) != 0) { 8225 while ((wcmd = waiting_list) != NULL) {
8226 waiting_list = (struct scsi_cmnd *) wcmd->next_wcmd; 8226 waiting_list = (struct scsi_cmnd *) wcmd->next_wcmd;
8227 wcmd->next_wcmd = NULL; 8227 wcmd->next_wcmd = NULL;
8228 if (sts == DID_OK) { 8228 if (sts == DID_OK) {
diff --git a/drivers/scsi/scsi_debug.c b/drivers/scsi/scsi_debug.c
index 07103c399fe0..f6600bfb5bde 100644
--- a/drivers/scsi/scsi_debug.c
+++ b/drivers/scsi/scsi_debug.c
@@ -1773,7 +1773,7 @@ static int scsi_debug_slave_alloc(struct scsi_device *sdp)
1773 if (SCSI_DEBUG_OPT_NOISE & scsi_debug_opts) 1773 if (SCSI_DEBUG_OPT_NOISE & scsi_debug_opts)
1774 printk(KERN_INFO "scsi_debug: slave_alloc <%u %u %u %u>\n", 1774 printk(KERN_INFO "scsi_debug: slave_alloc <%u %u %u %u>\n",
1775 sdp->host->host_no, sdp->channel, sdp->id, sdp->lun); 1775 sdp->host->host_no, sdp->channel, sdp->id, sdp->lun);
1776 set_bit(QUEUE_FLAG_BIDI, &sdp->request_queue->queue_flags); 1776 queue_flag_set_unlocked(QUEUE_FLAG_BIDI, sdp->request_queue);
1777 return 0; 1777 return 0;
1778} 1778}
1779 1779
diff --git a/drivers/scsi/scsi_devinfo.c b/drivers/scsi/scsi_devinfo.c
index b8de041bc0ae..a235802f2981 100644
--- a/drivers/scsi/scsi_devinfo.c
+++ b/drivers/scsi/scsi_devinfo.c
@@ -449,37 +449,40 @@ int scsi_get_device_flags(struct scsi_device *sdev,
449} 449}
450 450
451#ifdef CONFIG_SCSI_PROC_FS 451#ifdef CONFIG_SCSI_PROC_FS
452/* 452static int devinfo_seq_show(struct seq_file *m, void *v)
453 * proc_scsi_dev_info_read: dump the scsi_dev_info_list via
454 * /proc/scsi/device_info
455 */
456static int proc_scsi_devinfo_read(char *buffer, char **start,
457 off_t offset, int length)
458{ 453{
459 struct scsi_dev_info_list *devinfo; 454 struct scsi_dev_info_list *devinfo =
460 int size, len = 0; 455 list_entry(v, struct scsi_dev_info_list, dev_info_list);
461 off_t begin = 0;
462 off_t pos = 0;
463 456
464 list_for_each_entry(devinfo, &scsi_dev_info_list, dev_info_list) { 457 seq_printf(m, "'%.8s' '%.16s' 0x%x\n",
465 size = sprintf(buffer + len, "'%.8s' '%.16s' 0x%x\n",
466 devinfo->vendor, devinfo->model, devinfo->flags); 458 devinfo->vendor, devinfo->model, devinfo->flags);
467 len += size; 459 return 0;
468 pos = begin + len; 460}
469 if (pos < offset) { 461
470 len = 0; 462static void * devinfo_seq_start(struct seq_file *m, loff_t *pos)
471 begin = pos; 463{
472 } 464 return seq_list_start(&scsi_dev_info_list, *pos);
473 if (pos > offset + length) 465}
474 goto stop_output;
475 }
476 466
477stop_output: 467static void * devinfo_seq_next(struct seq_file *m, void *v, loff_t *pos)
478 *start = buffer + (offset - begin); /* Start of wanted data */ 468{
479 len -= (offset - begin); /* Start slop */ 469 return seq_list_next(v, &scsi_dev_info_list, pos);
480 if (len > length) 470}
481 len = length; /* Ending slop */ 471
482 return (len); 472static void devinfo_seq_stop(struct seq_file *m, void *v)
473{
474}
475
476static const struct seq_operations scsi_devinfo_seq_ops = {
477 .start = devinfo_seq_start,
478 .next = devinfo_seq_next,
479 .stop = devinfo_seq_stop,
480 .show = devinfo_seq_show,
481};
482
483static int proc_scsi_devinfo_open(struct inode *inode, struct file *file)
484{
485 return seq_open(file, &scsi_devinfo_seq_ops);
483} 486}
484 487
485/* 488/*
@@ -489,11 +492,12 @@ stop_output:
489 * integer value of flag to the scsi device info list. 492 * integer value of flag to the scsi device info list.
490 * To use, echo "vendor:model:flag" > /proc/scsi/device_info 493 * To use, echo "vendor:model:flag" > /proc/scsi/device_info
491 */ 494 */
492static int proc_scsi_devinfo_write(struct file *file, const char __user *buf, 495static ssize_t proc_scsi_devinfo_write(struct file *file,
493 unsigned long length, void *data) 496 const char __user *buf,
497 size_t length, loff_t *ppos)
494{ 498{
495 char *buffer; 499 char *buffer;
496 int err = length; 500 ssize_t err = length;
497 501
498 if (!buf || length>PAGE_SIZE) 502 if (!buf || length>PAGE_SIZE)
499 return -EINVAL; 503 return -EINVAL;
@@ -517,6 +521,15 @@ out:
517 free_page((unsigned long)buffer); 521 free_page((unsigned long)buffer);
518 return err; 522 return err;
519} 523}
524
525static const struct file_operations scsi_devinfo_proc_fops = {
526 .owner = THIS_MODULE,
527 .open = proc_scsi_devinfo_open,
528 .read = seq_read,
529 .write = proc_scsi_devinfo_write,
530 .llseek = seq_lseek,
531 .release = seq_release,
532};
520#endif /* CONFIG_SCSI_PROC_FS */ 533#endif /* CONFIG_SCSI_PROC_FS */
521 534
522module_param_string(dev_flags, scsi_dev_flags, sizeof(scsi_dev_flags), 0); 535module_param_string(dev_flags, scsi_dev_flags, sizeof(scsi_dev_flags), 0);
@@ -577,15 +590,13 @@ int __init scsi_init_devinfo(void)
577 } 590 }
578 591
579#ifdef CONFIG_SCSI_PROC_FS 592#ifdef CONFIG_SCSI_PROC_FS
580 p = create_proc_entry("scsi/device_info", 0, NULL); 593 p = proc_create("scsi/device_info", 0, NULL, &scsi_devinfo_proc_fops);
581 if (!p) { 594 if (!p) {
582 error = -ENOMEM; 595 error = -ENOMEM;
583 goto out; 596 goto out;
584 } 597 }
585 598
586 p->owner = THIS_MODULE; 599 p->owner = THIS_MODULE;
587 p->get_info = proc_scsi_devinfo_read;
588 p->write_proc = proc_scsi_devinfo_write;
589#endif /* CONFIG_SCSI_PROC_FS */ 600#endif /* CONFIG_SCSI_PROC_FS */
590 601
591 out: 602 out:
diff --git a/drivers/scsi/scsi_error.c b/drivers/scsi/scsi_error.c
index 334244c73955..eaf5a8add1ba 100644
--- a/drivers/scsi/scsi_error.c
+++ b/drivers/scsi/scsi_error.c
@@ -1772,6 +1772,7 @@ scsi_reset_provider(struct scsi_device *dev, int flag)
1772 unsigned long flags; 1772 unsigned long flags;
1773 int rtn; 1773 int rtn;
1774 1774
1775 blk_rq_init(NULL, &req);
1775 scmd->request = &req; 1776 scmd->request = &req;
1776 memset(&scmd->eh_timeout, 0, sizeof(scmd->eh_timeout)); 1777 memset(&scmd->eh_timeout, 0, sizeof(scmd->eh_timeout));
1777 1778
diff --git a/drivers/scsi/scsi_lib.c b/drivers/scsi/scsi_lib.c
index ba7e8ad76d04..a82d2fe80fb5 100644
--- a/drivers/scsi/scsi_lib.c
+++ b/drivers/scsi/scsi_lib.c
@@ -536,6 +536,9 @@ static void scsi_run_queue(struct request_queue *q)
536 !shost->host_blocked && !shost->host_self_blocked && 536 !shost->host_blocked && !shost->host_self_blocked &&
537 !((shost->can_queue > 0) && 537 !((shost->can_queue > 0) &&
538 (shost->host_busy >= shost->can_queue))) { 538 (shost->host_busy >= shost->can_queue))) {
539
540 int flagset;
541
539 /* 542 /*
540 * As long as shost is accepting commands and we have 543 * As long as shost is accepting commands and we have
541 * starved queues, call blk_run_queue. scsi_request_fn 544 * starved queues, call blk_run_queue. scsi_request_fn
@@ -549,19 +552,20 @@ static void scsi_run_queue(struct request_queue *q)
549 sdev = list_entry(shost->starved_list.next, 552 sdev = list_entry(shost->starved_list.next,
550 struct scsi_device, starved_entry); 553 struct scsi_device, starved_entry);
551 list_del_init(&sdev->starved_entry); 554 list_del_init(&sdev->starved_entry);
552 spin_unlock_irqrestore(shost->host_lock, flags); 555 spin_unlock(shost->host_lock);
553 556
557 spin_lock(sdev->request_queue->queue_lock);
558 flagset = test_bit(QUEUE_FLAG_REENTER, &q->queue_flags) &&
559 !test_bit(QUEUE_FLAG_REENTER,
560 &sdev->request_queue->queue_flags);
561 if (flagset)
562 queue_flag_set(QUEUE_FLAG_REENTER, sdev->request_queue);
563 __blk_run_queue(sdev->request_queue);
564 if (flagset)
565 queue_flag_clear(QUEUE_FLAG_REENTER, sdev->request_queue);
566 spin_unlock(sdev->request_queue->queue_lock);
554 567
555 if (test_bit(QUEUE_FLAG_REENTER, &q->queue_flags) && 568 spin_lock(shost->host_lock);
556 !test_and_set_bit(QUEUE_FLAG_REENTER,
557 &sdev->request_queue->queue_flags)) {
558 blk_run_queue(sdev->request_queue);
559 clear_bit(QUEUE_FLAG_REENTER,
560 &sdev->request_queue->queue_flags);
561 } else
562 blk_run_queue(sdev->request_queue);
563
564 spin_lock_irqsave(shost->host_lock, flags);
565 if (unlikely(!list_empty(&sdev->starved_entry))) 569 if (unlikely(!list_empty(&sdev->starved_entry)))
566 /* 570 /*
567 * sdev lost a race, and was put back on the 571 * sdev lost a race, and was put back on the
@@ -1586,8 +1590,9 @@ struct request_queue *__scsi_alloc_queue(struct Scsi_Host *shost,
1586 1590
1587 blk_queue_max_segment_size(q, dma_get_max_seg_size(dev)); 1591 blk_queue_max_segment_size(q, dma_get_max_seg_size(dev));
1588 1592
1593 /* New queue, no concurrency on queue_flags */
1589 if (!shost->use_clustering) 1594 if (!shost->use_clustering)
1590 clear_bit(QUEUE_FLAG_CLUSTER, &q->queue_flags); 1595 queue_flag_clear_unlocked(QUEUE_FLAG_CLUSTER, q);
1591 1596
1592 /* 1597 /*
1593 * set a reasonable default alignment on word boundaries: the 1598 * set a reasonable default alignment on word boundaries: the
diff --git a/drivers/scsi/scsi_proc.c b/drivers/scsi/scsi_proc.c
index 3a1c99d5c775..e4a0d2f9b357 100644
--- a/drivers/scsi/scsi_proc.c
+++ b/drivers/scsi/scsi_proc.c
@@ -413,6 +413,7 @@ static int proc_scsi_open(struct inode *inode, struct file *file)
413} 413}
414 414
415static const struct file_operations proc_scsi_operations = { 415static const struct file_operations proc_scsi_operations = {
416 .owner = THIS_MODULE,
416 .open = proc_scsi_open, 417 .open = proc_scsi_open,
417 .read = seq_read, 418 .read = seq_read,
418 .write = proc_scsi_write, 419 .write = proc_scsi_write,
@@ -431,10 +432,9 @@ int __init scsi_init_procfs(void)
431 if (!proc_scsi) 432 if (!proc_scsi)
432 goto err1; 433 goto err1;
433 434
434 pde = create_proc_entry("scsi/scsi", 0, NULL); 435 pde = proc_create("scsi/scsi", 0, NULL, &proc_scsi_operations);
435 if (!pde) 436 if (!pde)
436 goto err2; 437 goto err2;
437 pde->proc_fops = &proc_scsi_operations;
438 438
439 return 0; 439 return 0;
440 440
diff --git a/drivers/scsi/scsi_scan.c b/drivers/scsi/scsi_scan.c
index fcd7455ffc39..a00eee6f7be9 100644
--- a/drivers/scsi/scsi_scan.c
+++ b/drivers/scsi/scsi_scan.c
@@ -1828,7 +1828,7 @@ void scsi_scan_host(struct Scsi_Host *shost)
1828 } 1828 }
1829 1829
1830 p = kthread_run(do_scan_async, data, "scsi_scan_%d", shost->host_no); 1830 p = kthread_run(do_scan_async, data, "scsi_scan_%d", shost->host_no);
1831 if (unlikely(IS_ERR(p))) 1831 if (IS_ERR(p))
1832 do_scan_async(data); 1832 do_scan_async(data);
1833} 1833}
1834EXPORT_SYMBOL(scsi_scan_host); 1834EXPORT_SYMBOL(scsi_scan_host);
diff --git a/drivers/scsi/scsi_transport_sas.c b/drivers/scsi/scsi_transport_sas.c
index 7899e3dda9bf..f4461d35ffb9 100644
--- a/drivers/scsi/scsi_transport_sas.c
+++ b/drivers/scsi/scsi_transport_sas.c
@@ -248,8 +248,7 @@ static int sas_bsg_initialize(struct Scsi_Host *shost, struct sas_rphy *rphy)
248 else 248 else
249 q->queuedata = shost; 249 q->queuedata = shost;
250 250
251 set_bit(QUEUE_FLAG_BIDI, &q->queue_flags); 251 queue_flag_set_unlocked(QUEUE_FLAG_BIDI, q);
252
253 return 0; 252 return 0;
254} 253}
255 254
diff --git a/drivers/scsi/sd.c b/drivers/scsi/sd.c
index 3cea17dd5dba..01cefbb2d539 100644
--- a/drivers/scsi/sd.c
+++ b/drivers/scsi/sd.c
@@ -860,7 +860,6 @@ static int sd_sync_cache(struct scsi_disk *sdkp)
860 860
861static void sd_prepare_flush(struct request_queue *q, struct request *rq) 861static void sd_prepare_flush(struct request_queue *q, struct request *rq)
862{ 862{
863 memset(rq->cmd, 0, sizeof(rq->cmd));
864 rq->cmd_type = REQ_TYPE_BLOCK_PC; 863 rq->cmd_type = REQ_TYPE_BLOCK_PC;
865 rq->timeout = SD_TIMEOUT; 864 rq->timeout = SD_TIMEOUT;
866 rq->cmd[0] = SYNCHRONIZE_CACHE; 865 rq->cmd[0] = SYNCHRONIZE_CACHE;
diff --git a/drivers/scsi/sg.c b/drivers/scsi/sg.c
index 2029422bc04d..c9d7f721b9e2 100644
--- a/drivers/scsi/sg.c
+++ b/drivers/scsi/sg.c
@@ -2667,7 +2667,6 @@ sg_proc_init(void)
2667{ 2667{
2668 int k, mask; 2668 int k, mask;
2669 int num_leaves = ARRAY_SIZE(sg_proc_leaf_arr); 2669 int num_leaves = ARRAY_SIZE(sg_proc_leaf_arr);
2670 struct proc_dir_entry *pdep;
2671 struct sg_proc_leaf * leaf; 2670 struct sg_proc_leaf * leaf;
2672 2671
2673 sg_proc_sgp = proc_mkdir(sg_proc_sg_dirname, NULL); 2672 sg_proc_sgp = proc_mkdir(sg_proc_sg_dirname, NULL);
@@ -2676,13 +2675,10 @@ sg_proc_init(void)
2676 for (k = 0; k < num_leaves; ++k) { 2675 for (k = 0; k < num_leaves; ++k) {
2677 leaf = &sg_proc_leaf_arr[k]; 2676 leaf = &sg_proc_leaf_arr[k];
2678 mask = leaf->fops->write ? S_IRUGO | S_IWUSR : S_IRUGO; 2677 mask = leaf->fops->write ? S_IRUGO | S_IWUSR : S_IRUGO;
2679 pdep = create_proc_entry(leaf->name, mask, sg_proc_sgp); 2678 leaf->fops->owner = THIS_MODULE;
2680 if (pdep) { 2679 leaf->fops->read = seq_read;
2681 leaf->fops->owner = THIS_MODULE, 2680 leaf->fops->llseek = seq_lseek;
2682 leaf->fops->read = seq_read, 2681 proc_create(leaf->name, mask, sg_proc_sgp, leaf->fops);
2683 leaf->fops->llseek = seq_lseek,
2684 pdep->proc_fops = leaf->fops;
2685 }
2686 } 2682 }
2687 return 0; 2683 return 0;
2688} 2684}
diff --git a/drivers/scsi/sym53c8xx_2/sym_hipd.c b/drivers/scsi/sym53c8xx_2/sym_hipd.c
index 35142b5341b5..22a6aae78699 100644
--- a/drivers/scsi/sym53c8xx_2/sym_hipd.c
+++ b/drivers/scsi/sym53c8xx_2/sym_hipd.c
@@ -1647,7 +1647,7 @@ static void sym_flush_comp_queue(struct sym_hcb *np, int cam_status)
1647 SYM_QUEHEAD *qp; 1647 SYM_QUEHEAD *qp;
1648 struct sym_ccb *cp; 1648 struct sym_ccb *cp;
1649 1649
1650 while ((qp = sym_remque_head(&np->comp_ccbq)) != 0) { 1650 while ((qp = sym_remque_head(&np->comp_ccbq)) != NULL) {
1651 struct scsi_cmnd *cmd; 1651 struct scsi_cmnd *cmd;
1652 cp = sym_que_entry(qp, struct sym_ccb, link_ccbq); 1652 cp = sym_que_entry(qp, struct sym_ccb, link_ccbq);
1653 sym_insque_tail(&cp->link_ccbq, &np->busy_ccbq); 1653 sym_insque_tail(&cp->link_ccbq, &np->busy_ccbq);
@@ -3168,7 +3168,7 @@ int sym_clear_tasks(struct sym_hcb *np, int cam_status, int target, int lun, int
3168 * the COMP queue and put back other ones into 3168 * the COMP queue and put back other ones into
3169 * the BUSY queue. 3169 * the BUSY queue.
3170 */ 3170 */
3171 while ((qp = sym_remque_head(&qtmp)) != 0) { 3171 while ((qp = sym_remque_head(&qtmp)) != NULL) {
3172 struct scsi_cmnd *cmd; 3172 struct scsi_cmnd *cmd;
3173 cp = sym_que_entry(qp, struct sym_ccb, link_ccbq); 3173 cp = sym_que_entry(qp, struct sym_ccb, link_ccbq);
3174 cmd = cp->cmd; 3174 cmd = cp->cmd;
@@ -5729,7 +5729,7 @@ void sym_hcb_free(struct sym_hcb *np)
5729 sym_mfree_dma(np->dqueue, sizeof(u32)*(MAX_QUEUE*2), "DQUEUE"); 5729 sym_mfree_dma(np->dqueue, sizeof(u32)*(MAX_QUEUE*2), "DQUEUE");
5730 5730
5731 if (np->actccbs) { 5731 if (np->actccbs) {
5732 while ((qp = sym_remque_head(&np->free_ccbq)) != 0) { 5732 while ((qp = sym_remque_head(&np->free_ccbq)) != NULL) {
5733 cp = sym_que_entry(qp, struct sym_ccb, link_ccbq); 5733 cp = sym_que_entry(qp, struct sym_ccb, link_ccbq);
5734 sym_mfree_dma(cp, sizeof(*cp), "CCB"); 5734 sym_mfree_dma(cp, sizeof(*cp), "CCB");
5735 } 5735 }
diff --git a/drivers/scsi/ultrastor.c b/drivers/scsi/ultrastor.c
index f385dce8dfbe..27aa40f3980e 100644
--- a/drivers/scsi/ultrastor.c
+++ b/drivers/scsi/ultrastor.c
@@ -951,7 +951,7 @@ static int ultrastor_abort(struct scsi_cmnd *SCpnt)
951 printk("abort: command mismatch, %p != %p\n", 951 printk("abort: command mismatch, %p != %p\n",
952 config.mscp[mscp_index].SCint, SCpnt); 952 config.mscp[mscp_index].SCint, SCpnt);
953#endif 953#endif
954 if (config.mscp[mscp_index].SCint == 0) 954 if (config.mscp[mscp_index].SCint == NULL)
955 return FAILED; 955 return FAILED;
956 956
957 if (config.mscp[mscp_index].SCint != SCpnt) panic("Bad abort"); 957 if (config.mscp[mscp_index].SCint != SCpnt) panic("Bad abort");
@@ -1101,7 +1101,7 @@ static void ultrastor_interrupt(void *dev_id)
1101 SCtmp = mscp->SCint; 1101 SCtmp = mscp->SCint;
1102 mscp->SCint = NULL; 1102 mscp->SCint = NULL;
1103 1103
1104 if (SCtmp == 0) 1104 if (!SCtmp)
1105 { 1105 {
1106#if ULTRASTOR_DEBUG & (UD_ABORT|UD_INTERRUPT) 1106#if ULTRASTOR_DEBUG & (UD_ABORT|UD_INTERRUPT)
1107 printk("MSCP %d (%x): no command\n", mscp_index, (unsigned int) mscp); 1107 printk("MSCP %d (%x): no command\n", mscp_index, (unsigned int) mscp);