aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/scsi
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/scsi')
-rw-r--r--drivers/scsi/dpt_i2o.c135
-rw-r--r--drivers/scsi/dpti.h9
-rw-r--r--drivers/scsi/esp_scsi.c4
-rw-r--r--drivers/scsi/ide-scsi.c17
-rw-r--r--drivers/scsi/initio.c2
-rw-r--r--drivers/scsi/scsi.c31
-rw-r--r--drivers/scsi/st.c1
-rw-r--r--drivers/scsi/sym53c8xx_2/sym_glue.c2
-rw-r--r--drivers/scsi/sym53c8xx_2/sym_hipd.c2
9 files changed, 114 insertions, 89 deletions
diff --git a/drivers/scsi/dpt_i2o.c b/drivers/scsi/dpt_i2o.c
index 8258506ba7d7..b31d1c95c9fb 100644
--- a/drivers/scsi/dpt_i2o.c
+++ b/drivers/scsi/dpt_i2o.c
@@ -173,20 +173,20 @@ static struct pci_device_id dptids[] = {
173}; 173};
174MODULE_DEVICE_TABLE(pci,dptids); 174MODULE_DEVICE_TABLE(pci,dptids);
175 175
176static void adpt_exit(void); 176static int adpt_detect(struct scsi_host_template* sht)
177
178static int adpt_detect(void)
179{ 177{
180 struct pci_dev *pDev = NULL; 178 struct pci_dev *pDev = NULL;
181 adpt_hba* pHba; 179 adpt_hba* pHba;
182 180
181 adpt_init();
182
183 PINFO("Detecting Adaptec I2O RAID controllers...\n"); 183 PINFO("Detecting Adaptec I2O RAID controllers...\n");
184 184
185 /* search for all Adatpec I2O RAID cards */ 185 /* search for all Adatpec I2O RAID cards */
186 while ((pDev = pci_get_device( PCI_DPT_VENDOR_ID, PCI_ANY_ID, pDev))) { 186 while ((pDev = pci_get_device( PCI_DPT_VENDOR_ID, PCI_ANY_ID, pDev))) {
187 if(pDev->device == PCI_DPT_DEVICE_ID || 187 if(pDev->device == PCI_DPT_DEVICE_ID ||
188 pDev->device == PCI_DPT_RAPTOR_DEVICE_ID){ 188 pDev->device == PCI_DPT_RAPTOR_DEVICE_ID){
189 if(adpt_install_hba(pDev) ){ 189 if(adpt_install_hba(sht, pDev) ){
190 PERROR("Could not Init an I2O RAID device\n"); 190 PERROR("Could not Init an I2O RAID device\n");
191 PERROR("Will not try to detect others.\n"); 191 PERROR("Will not try to detect others.\n");
192 return hba_count-1; 192 return hba_count-1;
@@ -248,33 +248,34 @@ rebuild_sys_tab:
248 } 248 }
249 249
250 for (pHba = hba_chain; pHba; pHba = pHba->next) { 250 for (pHba = hba_chain; pHba; pHba = pHba->next) {
251 if (adpt_scsi_register(pHba) < 0) { 251 if( adpt_scsi_register(pHba,sht) < 0){
252 adpt_i2o_delete_hba(pHba); 252 adpt_i2o_delete_hba(pHba);
253 continue; 253 continue;
254 } 254 }
255 pHba->initialized = TRUE; 255 pHba->initialized = TRUE;
256 pHba->state &= ~DPTI_STATE_RESET; 256 pHba->state &= ~DPTI_STATE_RESET;
257 scsi_scan_host(pHba->host);
258 } 257 }
259 258
260 // Register our control device node 259 // Register our control device node
261 // nodes will need to be created in /dev to access this 260 // nodes will need to be created in /dev to access this
262 // the nodes can not be created from within the driver 261 // the nodes can not be created from within the driver
263 if (hba_count && register_chrdev(DPTI_I2O_MAJOR, DPT_DRIVER, &adpt_fops)) { 262 if (hba_count && register_chrdev(DPTI_I2O_MAJOR, DPT_DRIVER, &adpt_fops)) {
264 adpt_exit(); 263 adpt_i2o_sys_shutdown();
265 return 0; 264 return 0;
266 } 265 }
267 return hba_count; 266 return hba_count;
268} 267}
269 268
270 269
271static int adpt_release(adpt_hba *pHba) 270/*
271 * scsi_unregister will be called AFTER we return.
272 */
273static int adpt_release(struct Scsi_Host *host)
272{ 274{
273 struct Scsi_Host *shost = pHba->host; 275 adpt_hba* pHba = (adpt_hba*) host->hostdata[0];
274 scsi_remove_host(shost);
275// adpt_i2o_quiesce_hba(pHba); 276// adpt_i2o_quiesce_hba(pHba);
276 adpt_i2o_delete_hba(pHba); 277 adpt_i2o_delete_hba(pHba);
277 scsi_host_put(shost); 278 scsi_unregister(host);
278 return 0; 279 return 0;
279} 280}
280 281
@@ -881,7 +882,7 @@ static int adpt_reboot_event(struct notifier_block *n, ulong code, void *p)
881#endif 882#endif
882 883
883 884
884static int adpt_install_hba(struct pci_dev* pDev) 885static int adpt_install_hba(struct scsi_host_template* sht, struct pci_dev* pDev)
885{ 886{
886 887
887 adpt_hba* pHba = NULL; 888 adpt_hba* pHba = NULL;
@@ -905,8 +906,7 @@ static int adpt_install_hba(struct pci_dev* pDev)
905 } 906 }
906 907
907 pci_set_master(pDev); 908 pci_set_master(pDev);
908 if (pci_set_dma_mask(pDev, DMA_64BIT_MASK) && 909 if (pci_set_dma_mask(pDev, DMA_32BIT_MASK))
909 pci_set_dma_mask(pDev, DMA_32BIT_MASK))
910 return -EINVAL; 910 return -EINVAL;
911 911
912 base_addr0_phys = pci_resource_start(pDev,0); 912 base_addr0_phys = pci_resource_start(pDev,0);
@@ -1028,6 +1028,8 @@ static void adpt_i2o_delete_hba(adpt_hba* pHba)
1028 1028
1029 1029
1030 mutex_lock(&adpt_configuration_lock); 1030 mutex_lock(&adpt_configuration_lock);
1031 // scsi_unregister calls our adpt_release which
1032 // does a quiese
1031 if(pHba->host){ 1033 if(pHba->host){
1032 free_irq(pHba->host->irq, pHba); 1034 free_irq(pHba->host->irq, pHba);
1033 } 1035 }
@@ -1079,6 +1081,17 @@ static void adpt_i2o_delete_hba(adpt_hba* pHba)
1079} 1081}
1080 1082
1081 1083
1084static int adpt_init(void)
1085{
1086 printk("Loading Adaptec I2O RAID: Version " DPT_I2O_VERSION "\n");
1087#ifdef REBOOT_NOTIFIER
1088 register_reboot_notifier(&adpt_reboot_notifier);
1089#endif
1090
1091 return 0;
1092}
1093
1094
1082static struct adpt_device* adpt_find_device(adpt_hba* pHba, u32 chan, u32 id, u32 lun) 1095static struct adpt_device* adpt_find_device(adpt_hba* pHba, u32 chan, u32 id, u32 lun)
1083{ 1096{
1084 struct adpt_device* d; 1097 struct adpt_device* d;
@@ -2164,6 +2177,37 @@ static s32 adpt_scsi_to_i2o(adpt_hba* pHba, struct scsi_cmnd* cmd, struct adpt_d
2164} 2177}
2165 2178
2166 2179
2180static s32 adpt_scsi_register(adpt_hba* pHba,struct scsi_host_template * sht)
2181{
2182 struct Scsi_Host *host = NULL;
2183
2184 host = scsi_register(sht, sizeof(adpt_hba*));
2185 if (host == NULL) {
2186 printk ("%s: scsi_register returned NULL\n",pHba->name);
2187 return -1;
2188 }
2189 host->hostdata[0] = (unsigned long)pHba;
2190 pHba->host = host;
2191
2192 host->irq = pHba->pDev->irq;
2193 /* no IO ports, so don't have to set host->io_port and
2194 * host->n_io_port
2195 */
2196 host->io_port = 0;
2197 host->n_io_port = 0;
2198 /* see comments in scsi_host.h */
2199 host->max_id = 16;
2200 host->max_lun = 256;
2201 host->max_channel = pHba->top_scsi_channel + 1;
2202 host->cmd_per_lun = 1;
2203 host->unique_id = (uint) pHba;
2204 host->sg_tablesize = pHba->sg_tablesize;
2205 host->can_queue = pHba->post_fifo_size;
2206
2207 return 0;
2208}
2209
2210
2167static s32 adpt_i2o_to_scsi(void __iomem *reply, struct scsi_cmnd* cmd) 2211static s32 adpt_i2o_to_scsi(void __iomem *reply, struct scsi_cmnd* cmd)
2168{ 2212{
2169 adpt_hba* pHba; 2213 adpt_hba* pHba;
@@ -3279,10 +3323,12 @@ static static void adpt_delay(int millisec)
3279 3323
3280#endif 3324#endif
3281 3325
3282static struct scsi_host_template adpt_template = { 3326static struct scsi_host_template driver_template = {
3283 .name = "dpt_i2o", 3327 .name = "dpt_i2o",
3284 .proc_name = "dpt_i2o", 3328 .proc_name = "dpt_i2o",
3285 .proc_info = adpt_proc_info, 3329 .proc_info = adpt_proc_info,
3330 .detect = adpt_detect,
3331 .release = adpt_release,
3286 .info = adpt_info, 3332 .info = adpt_info,
3287 .queuecommand = adpt_queue, 3333 .queuecommand = adpt_queue,
3288 .eh_abort_handler = adpt_abort, 3334 .eh_abort_handler = adpt_abort,
@@ -3297,62 +3343,5 @@ static struct scsi_host_template adpt_template = {
3297 .use_clustering = ENABLE_CLUSTERING, 3343 .use_clustering = ENABLE_CLUSTERING,
3298 .use_sg_chaining = ENABLE_SG_CHAINING, 3344 .use_sg_chaining = ENABLE_SG_CHAINING,
3299}; 3345};
3300 3346#include "scsi_module.c"
3301static s32 adpt_scsi_register(adpt_hba* pHba)
3302{
3303 struct Scsi_Host *host;
3304
3305 host = scsi_host_alloc(&adpt_template, sizeof(adpt_hba*));
3306 if (host == NULL) {
3307 printk ("%s: scsi_host_alloc returned NULL\n",pHba->name);
3308 return -1;
3309 }
3310 host->hostdata[0] = (unsigned long)pHba;
3311 pHba->host = host;
3312
3313 host->irq = pHba->pDev->irq;
3314 /* no IO ports, so don't have to set host->io_port and
3315 * host->n_io_port
3316 */
3317 host->io_port = 0;
3318 host->n_io_port = 0;
3319 /* see comments in scsi_host.h */
3320 host->max_id = 16;
3321 host->max_lun = 256;
3322 host->max_channel = pHba->top_scsi_channel + 1;
3323 host->cmd_per_lun = 1;
3324 host->unique_id = (uint) pHba;
3325 host->sg_tablesize = pHba->sg_tablesize;
3326 host->can_queue = pHba->post_fifo_size;
3327
3328 if (scsi_add_host(host, &pHba->pDev->dev)) {
3329 scsi_host_put(host);
3330 return -1;
3331 }
3332
3333 return 0;
3334}
3335
3336static int __init adpt_init(void)
3337{
3338 int count;
3339
3340 printk("Loading Adaptec I2O RAID: Version " DPT_I2O_VERSION "\n");
3341#ifdef REBOOT_NOTIFIER
3342 register_reboot_notifier(&adpt_reboot_notifier);
3343#endif
3344
3345 count = adpt_detect();
3346
3347 return count > 0 ? 0 : -ENODEV;
3348}
3349
3350static void adpt_exit(void)
3351{
3352 while (hba_chain)
3353 adpt_release(hba_chain);
3354}
3355
3356module_init(adpt_init);
3357module_exit(adpt_exit);
3358MODULE_LICENSE("GPL"); 3347MODULE_LICENSE("GPL");
diff --git a/drivers/scsi/dpti.h b/drivers/scsi/dpti.h
index 0892f6c70319..fd79068c5869 100644
--- a/drivers/scsi/dpti.h
+++ b/drivers/scsi/dpti.h
@@ -28,9 +28,11 @@
28 * SCSI interface function Prototypes 28 * SCSI interface function Prototypes
29 */ 29 */
30 30
31static int adpt_detect(struct scsi_host_template * sht);
31static int adpt_queue(struct scsi_cmnd * cmd, void (*cmdcomplete) (struct scsi_cmnd *)); 32static int adpt_queue(struct scsi_cmnd * cmd, void (*cmdcomplete) (struct scsi_cmnd *));
32static int adpt_abort(struct scsi_cmnd * cmd); 33static int adpt_abort(struct scsi_cmnd * cmd);
33static int adpt_reset(struct scsi_cmnd* cmd); 34static int adpt_reset(struct scsi_cmnd* cmd);
35static int adpt_release(struct Scsi_Host *host);
34static int adpt_slave_configure(struct scsi_device *); 36static int adpt_slave_configure(struct scsi_device *);
35 37
36static const char *adpt_info(struct Scsi_Host *pSHost); 38static const char *adpt_info(struct Scsi_Host *pSHost);
@@ -47,6 +49,8 @@ static int adpt_device_reset(struct scsi_cmnd* cmd);
47 49
48#define DPT_DRIVER_NAME "Adaptec I2O RAID" 50#define DPT_DRIVER_NAME "Adaptec I2O RAID"
49 51
52#ifndef HOSTS_C
53
50#include "dpt/sys_info.h" 54#include "dpt/sys_info.h"
51#include <linux/wait.h> 55#include <linux/wait.h>
52#include "dpt/dpti_i2o.h" 56#include "dpt/dpti_i2o.h"
@@ -285,7 +289,7 @@ static s32 adpt_i2o_init_outbound_q(adpt_hba* pHba);
285static s32 adpt_i2o_hrt_get(adpt_hba* pHba); 289static s32 adpt_i2o_hrt_get(adpt_hba* pHba);
286static s32 adpt_scsi_to_i2o(adpt_hba* pHba, struct scsi_cmnd* cmd, struct adpt_device* dptdevice); 290static s32 adpt_scsi_to_i2o(adpt_hba* pHba, struct scsi_cmnd* cmd, struct adpt_device* dptdevice);
287static s32 adpt_i2o_to_scsi(void __iomem *reply, struct scsi_cmnd* cmd); 291static s32 adpt_i2o_to_scsi(void __iomem *reply, struct scsi_cmnd* cmd);
288static s32 adpt_scsi_register(adpt_hba* pHba); 292static s32 adpt_scsi_register(adpt_hba* pHba,struct scsi_host_template * sht);
289static s32 adpt_hba_reset(adpt_hba* pHba); 293static s32 adpt_hba_reset(adpt_hba* pHba);
290static s32 adpt_i2o_reset_hba(adpt_hba* pHba); 294static s32 adpt_i2o_reset_hba(adpt_hba* pHba);
291static s32 adpt_rescan(adpt_hba* pHba); 295static s32 adpt_rescan(adpt_hba* pHba);
@@ -295,7 +299,7 @@ static void adpt_i2o_delete_hba(adpt_hba* pHba);
295static void adpt_inquiry(adpt_hba* pHba); 299static void adpt_inquiry(adpt_hba* pHba);
296static void adpt_fail_posted_scbs(adpt_hba* pHba); 300static void adpt_fail_posted_scbs(adpt_hba* pHba);
297static struct adpt_device* adpt_find_device(adpt_hba* pHba, u32 chan, u32 id, u32 lun); 301static struct adpt_device* adpt_find_device(adpt_hba* pHba, u32 chan, u32 id, u32 lun);
298static int adpt_install_hba(struct pci_dev* pDev) ; 302static int adpt_install_hba(struct scsi_host_template* sht, struct pci_dev* pDev) ;
299static int adpt_i2o_online_hba(adpt_hba* pHba); 303static int adpt_i2o_online_hba(adpt_hba* pHba);
300static void adpt_i2o_post_wait_complete(u32, int); 304static void adpt_i2o_post_wait_complete(u32, int);
301static int adpt_i2o_systab_send(adpt_hba* pHba); 305static int adpt_i2o_systab_send(adpt_hba* pHba);
@@ -339,4 +343,5 @@ static void adpt_i386_info(sysInfo_S* si);
339#define FW_DEBUG_BLED_OFFSET 8 343#define FW_DEBUG_BLED_OFFSET 8
340 344
341#define FW_DEBUG_FLAGS_NO_HEADERS_B 0x01 345#define FW_DEBUG_FLAGS_NO_HEADERS_B 0x01
346#endif /* !HOSTS_C */
342#endif /* _DPT_H */ 347#endif /* _DPT_H */
diff --git a/drivers/scsi/esp_scsi.c b/drivers/scsi/esp_scsi.c
index 4ed3a5297066..bfdee5968892 100644
--- a/drivers/scsi/esp_scsi.c
+++ b/drivers/scsi/esp_scsi.c
@@ -2026,8 +2026,8 @@ static void esp_reset_cleanup(struct esp *esp)
2026 tp->flags |= ESP_TGT_CHECK_NEGO; 2026 tp->flags |= ESP_TGT_CHECK_NEGO;
2027 2027
2028 if (tp->starget) 2028 if (tp->starget)
2029 starget_for_each_device(tp->starget, NULL, 2029 __starget_for_each_device(tp->starget, NULL,
2030 esp_clear_hold); 2030 esp_clear_hold);
2031 } 2031 }
2032 esp->flags &= ~ESP_FLAG_RESETTING; 2032 esp->flags &= ~ESP_FLAG_RESETTING;
2033} 2033}
diff --git a/drivers/scsi/ide-scsi.c b/drivers/scsi/ide-scsi.c
index 7a835a35f21d..9706de9d98d5 100644
--- a/drivers/scsi/ide-scsi.c
+++ b/drivers/scsi/ide-scsi.c
@@ -242,6 +242,11 @@ static void idescsi_output_buffers (ide_drive_t *drive, idescsi_pc_t *pc, unsign
242 } 242 }
243} 243}
244 244
245static void ide_scsi_hex_dump(u8 *data, int len)
246{
247 print_hex_dump(KERN_CONT, "", DUMP_PREFIX_NONE, 16, 1, data, len, 0);
248}
249
245static int idescsi_check_condition(ide_drive_t *drive, struct request *failed_command) 250static int idescsi_check_condition(ide_drive_t *drive, struct request *failed_command)
246{ 251{
247 idescsi_scsi_t *scsi = drive_to_idescsi(drive); 252 idescsi_scsi_t *scsi = drive_to_idescsi(drive);
@@ -272,8 +277,7 @@ static int idescsi_check_condition(ide_drive_t *drive, struct request *failed_co
272 pc->scsi_cmd = ((idescsi_pc_t *) failed_command->special)->scsi_cmd; 277 pc->scsi_cmd = ((idescsi_pc_t *) failed_command->special)->scsi_cmd;
273 if (test_bit(IDESCSI_LOG_CMD, &scsi->log)) { 278 if (test_bit(IDESCSI_LOG_CMD, &scsi->log)) {
274 printk ("ide-scsi: %s: queue cmd = ", drive->name); 279 printk ("ide-scsi: %s: queue cmd = ", drive->name);
275 print_hex_dump(KERN_CONT, "", DUMP_PREFIX_NONE, 16, 1, pc->c, 280 ide_scsi_hex_dump(pc->c, 6);
276 6, 0);
277 } 281 }
278 rq->rq_disk = scsi->disk; 282 rq->rq_disk = scsi->disk;
279 return ide_do_drive_cmd(drive, rq, ide_preempt); 283 return ide_do_drive_cmd(drive, rq, ide_preempt);
@@ -328,8 +332,7 @@ static int idescsi_end_request (ide_drive_t *drive, int uptodate, int nrsecs)
328 idescsi_pc_t *opc = (idescsi_pc_t *) rq->buffer; 332 idescsi_pc_t *opc = (idescsi_pc_t *) rq->buffer;
329 if (log) { 333 if (log) {
330 printk ("ide-scsi: %s: wrap up check %lu, rst = ", drive->name, opc->scsi_cmd->serial_number); 334 printk ("ide-scsi: %s: wrap up check %lu, rst = ", drive->name, opc->scsi_cmd->serial_number);
331 print_hex_dump(KERN_CONT, "", DUMP_PREFIX_NONE, 16, 1, 335 ide_scsi_hex_dump(pc->buffer, 16);
332 pc->buffer, 16, 0);
333 } 336 }
334 memcpy((void *) opc->scsi_cmd->sense_buffer, pc->buffer, SCSI_SENSE_BUFFERSIZE); 337 memcpy((void *) opc->scsi_cmd->sense_buffer, pc->buffer, SCSI_SENSE_BUFFERSIZE);
335 kfree(pc->buffer); 338 kfree(pc->buffer);
@@ -808,12 +811,10 @@ static int idescsi_queue (struct scsi_cmnd *cmd,
808 811
809 if (test_bit(IDESCSI_LOG_CMD, &scsi->log)) { 812 if (test_bit(IDESCSI_LOG_CMD, &scsi->log)) {
810 printk ("ide-scsi: %s: que %lu, cmd = ", drive->name, cmd->serial_number); 813 printk ("ide-scsi: %s: que %lu, cmd = ", drive->name, cmd->serial_number);
811 print_hex_dump(KERN_CONT, "", DUMP_PREFIX_NONE, 16, 1, 814 ide_scsi_hex_dump(cmd->cmnd, cmd->cmd_len);
812 cmd->cmnd, cmd->cmd_len, 0);
813 if (memcmp(pc->c, cmd->cmnd, cmd->cmd_len)) { 815 if (memcmp(pc->c, cmd->cmnd, cmd->cmd_len)) {
814 printk ("ide-scsi: %s: que %lu, tsl = ", drive->name, cmd->serial_number); 816 printk ("ide-scsi: %s: que %lu, tsl = ", drive->name, cmd->serial_number);
815 print_hex_dump(KERN_CONT, "", DUMP_PREFIX_NONE, 16, 1, 817 ide_scsi_hex_dump(pc->c, 12);
816 pc->c, 12, 0);
817 } 818 }
818 } 819 }
819 820
diff --git a/drivers/scsi/initio.c b/drivers/scsi/initio.c
index 4c4465d39a1d..01bf0189367d 100644
--- a/drivers/scsi/initio.c
+++ b/drivers/scsi/initio.c
@@ -2616,6 +2616,7 @@ static void initio_build_scb(struct initio_host * host, struct scsi_ctrl_blk * c
2616 scsi_for_each_sg(cmnd, sglist, cblk->sglen, i) { 2616 scsi_for_each_sg(cmnd, sglist, cblk->sglen, i) {
2617 sg->data = cpu_to_le32((u32)sg_dma_address(sglist)); 2617 sg->data = cpu_to_le32((u32)sg_dma_address(sglist));
2618 total_len += sg->len = cpu_to_le32((u32)sg_dma_len(sglist)); 2618 total_len += sg->len = cpu_to_le32((u32)sg_dma_len(sglist));
2619 ++sg;
2619 } 2620 }
2620 2621
2621 cblk->buflen = (scsi_bufflen(cmnd) > total_len) ? 2622 cblk->buflen = (scsi_bufflen(cmnd) > total_len) ?
@@ -2867,6 +2868,7 @@ static int initio_probe_one(struct pci_dev *pdev,
2867 } 2868 }
2868 host = (struct initio_host *)shost->hostdata; 2869 host = (struct initio_host *)shost->hostdata;
2869 memset(host, 0, sizeof(struct initio_host)); 2870 memset(host, 0, sizeof(struct initio_host));
2871 host->addr = pci_resource_start(pdev, 0);
2870 2872
2871 if (!request_region(host->addr, 256, "i91u")) { 2873 if (!request_region(host->addr, 256, "i91u")) {
2872 printk(KERN_WARNING "initio: I/O port range 0x%x is busy.\n", host->addr); 2874 printk(KERN_WARNING "initio: I/O port range 0x%x is busy.\n", host->addr);
diff --git a/drivers/scsi/scsi.c b/drivers/scsi/scsi.c
index 192948822455..0fb1709ce5e3 100644
--- a/drivers/scsi/scsi.c
+++ b/drivers/scsi/scsi.c
@@ -896,11 +896,11 @@ EXPORT_SYMBOL(__scsi_iterate_devices);
896 * starget_for_each_device - helper to walk all devices of a target 896 * starget_for_each_device - helper to walk all devices of a target
897 * @starget: target whose devices we want to iterate over. 897 * @starget: target whose devices we want to iterate over.
898 * 898 *
899 * This traverses over each devices of @shost. The devices have 899 * This traverses over each device of @starget. The devices have
900 * a reference that must be released by scsi_host_put when breaking 900 * a reference that must be released by scsi_host_put when breaking
901 * out of the loop. 901 * out of the loop.
902 */ 902 */
903void starget_for_each_device(struct scsi_target *starget, void * data, 903void starget_for_each_device(struct scsi_target *starget, void *data,
904 void (*fn)(struct scsi_device *, void *)) 904 void (*fn)(struct scsi_device *, void *))
905{ 905{
906 struct Scsi_Host *shost = dev_to_shost(starget->dev.parent); 906 struct Scsi_Host *shost = dev_to_shost(starget->dev.parent);
@@ -915,6 +915,33 @@ void starget_for_each_device(struct scsi_target *starget, void * data,
915EXPORT_SYMBOL(starget_for_each_device); 915EXPORT_SYMBOL(starget_for_each_device);
916 916
917/** 917/**
918 * __starget_for_each_device - helper to walk all devices of a target
919 * (UNLOCKED)
920 * @starget: target whose devices we want to iterate over.
921 *
922 * This traverses over each device of @starget. It does _not_
923 * take a reference on the scsi_device, so the whole loop must be
924 * protected by shost->host_lock.
925 *
926 * Note: The only reason why drivers would want to use this is because
927 * they need to access the device list in irq context. Otherwise you
928 * really want to use starget_for_each_device instead.
929 **/
930void __starget_for_each_device(struct scsi_target *starget, void *data,
931 void (*fn)(struct scsi_device *, void *))
932{
933 struct Scsi_Host *shost = dev_to_shost(starget->dev.parent);
934 struct scsi_device *sdev;
935
936 __shost_for_each_device(sdev, shost) {
937 if ((sdev->channel == starget->channel) &&
938 (sdev->id == starget->id))
939 fn(sdev, data);
940 }
941}
942EXPORT_SYMBOL(__starget_for_each_device);
943
944/**
918 * __scsi_device_lookup_by_target - find a device given the target (UNLOCKED) 945 * __scsi_device_lookup_by_target - find a device given the target (UNLOCKED)
919 * @starget: SCSI target pointer 946 * @starget: SCSI target pointer
920 * @lun: SCSI Logical Unit Number 947 * @lun: SCSI Logical Unit Number
diff --git a/drivers/scsi/st.c b/drivers/scsi/st.c
index 98dfd6ea209c..328c47c6aeb1 100644
--- a/drivers/scsi/st.c
+++ b/drivers/scsi/st.c
@@ -3611,6 +3611,7 @@ static struct st_buffer *
3611 3611
3612 tb->dma = need_dma; 3612 tb->dma = need_dma;
3613 tb->buffer_size = got; 3613 tb->buffer_size = got;
3614 sg_init_table(tb->sg, max_sg);
3614 3615
3615 return tb; 3616 return tb;
3616} 3617}
diff --git a/drivers/scsi/sym53c8xx_2/sym_glue.c b/drivers/scsi/sym53c8xx_2/sym_glue.c
index 0f74aba5b237..9e0908d1981a 100644
--- a/drivers/scsi/sym53c8xx_2/sym_glue.c
+++ b/drivers/scsi/sym53c8xx_2/sym_glue.c
@@ -1243,7 +1243,7 @@ static void sym_free_resources(struct sym_hcb *np, struct pci_dev *pdev)
1243 * Free O/S specific resources. 1243 * Free O/S specific resources.
1244 */ 1244 */
1245 if (pdev->irq) 1245 if (pdev->irq)
1246 free_irq(pdev->irq, np); 1246 free_irq(pdev->irq, np->s.host);
1247 if (np->s.ioaddr) 1247 if (np->s.ioaddr)
1248 pci_iounmap(pdev, np->s.ioaddr); 1248 pci_iounmap(pdev, np->s.ioaddr);
1249 if (np->s.ramaddr) 1249 if (np->s.ramaddr)
diff --git a/drivers/scsi/sym53c8xx_2/sym_hipd.c b/drivers/scsi/sym53c8xx_2/sym_hipd.c
index 463f119f20e9..254bdaeb35ff 100644
--- a/drivers/scsi/sym53c8xx_2/sym_hipd.c
+++ b/drivers/scsi/sym53c8xx_2/sym_hipd.c
@@ -2791,7 +2791,7 @@ irqreturn_t sym_interrupt(struct Scsi_Host *shost)
2791 istat = INB(np, nc_istat); 2791 istat = INB(np, nc_istat);
2792 if (istat & INTF) { 2792 if (istat & INTF) {
2793 OUTB(np, nc_istat, (istat & SIGP) | INTF | np->istat_sem); 2793 OUTB(np, nc_istat, (istat & SIGP) | INTF | np->istat_sem);
2794 istat = INB(np, nc_istat); /* DUMMY READ */ 2794 istat |= INB(np, nc_istat); /* DUMMY READ */
2795 if (DEBUG_FLAGS & DEBUG_TINY) printf ("F "); 2795 if (DEBUG_FLAGS & DEBUG_TINY) printf ("F ");
2796 sym_wakeup_done(np); 2796 sym_wakeup_done(np);
2797 } 2797 }