diff options
author | Andrew Vasquez <andrew.vasquez@qlogic.com> | 2005-06-09 20:21:28 -0400 |
---|---|---|
committer | James Bottomley <jejb@mulgrave.(none)> | 2005-06-11 14:06:22 -0400 |
commit | a1541d5af66d02426655b1498f814c52347dd7d3 (patch) | |
tree | 02d041e54ebaec744d30ebf6012e305b9673bec0 | |
parent | 27198d855abbfc82df69e81b6c8d2f333580114c (diff) |
[SCSI] qla2xxx: Pull-down scsi-host-addition to follow board initialization.
Return to previous held-logic of calling scsi_add_host() only
after the board has been completely initialized. Also return
pci_*() error-codes during probe failure paths.
This also corrects an issue where only lun 0 is being scanned for
a given port.
Signed-off-by: Andrew Vasquez <andrew.vasquez@qlogic.com>
Signed-off-by: James Bottomley <James.Bottomley@SteelEye.com>
-rw-r--r-- | drivers/scsi/qla2xxx/qla_os.c | 55 |
1 files changed, 28 insertions, 27 deletions
diff --git a/drivers/scsi/qla2xxx/qla_os.c b/drivers/scsi/qla2xxx/qla_os.c index 3c97aa45772d..d960637fd56a 100644 --- a/drivers/scsi/qla2xxx/qla_os.c +++ b/drivers/scsi/qla2xxx/qla_os.c | |||
@@ -1150,7 +1150,7 @@ iospace_error_exit: | |||
1150 | */ | 1150 | */ |
1151 | int qla2x00_probe_one(struct pci_dev *pdev, struct qla_board_info *brd_info) | 1151 | int qla2x00_probe_one(struct pci_dev *pdev, struct qla_board_info *brd_info) |
1152 | { | 1152 | { |
1153 | int ret; | 1153 | int ret = -ENODEV; |
1154 | device_reg_t __iomem *reg; | 1154 | device_reg_t __iomem *reg; |
1155 | struct Scsi_Host *host; | 1155 | struct Scsi_Host *host; |
1156 | scsi_qla_host_t *ha; | 1156 | scsi_qla_host_t *ha; |
@@ -1161,7 +1161,7 @@ int qla2x00_probe_one(struct pci_dev *pdev, struct qla_board_info *brd_info) | |||
1161 | fc_port_t *fcport; | 1161 | fc_port_t *fcport; |
1162 | 1162 | ||
1163 | if (pci_enable_device(pdev)) | 1163 | if (pci_enable_device(pdev)) |
1164 | return -1; | 1164 | goto probe_out; |
1165 | 1165 | ||
1166 | host = scsi_host_alloc(&qla2x00_driver_template, | 1166 | host = scsi_host_alloc(&qla2x00_driver_template, |
1167 | sizeof(scsi_qla_host_t)); | 1167 | sizeof(scsi_qla_host_t)); |
@@ -1183,9 +1183,8 @@ int qla2x00_probe_one(struct pci_dev *pdev, struct qla_board_info *brd_info) | |||
1183 | 1183 | ||
1184 | /* Configure PCI I/O space */ | 1184 | /* Configure PCI I/O space */ |
1185 | ret = qla2x00_iospace_config(ha); | 1185 | ret = qla2x00_iospace_config(ha); |
1186 | if (ret != 0) { | 1186 | if (ret) |
1187 | goto probe_alloc_failed; | 1187 | goto probe_failed; |
1188 | } | ||
1189 | 1188 | ||
1190 | /* Sanitize the information from PCI BIOS. */ | 1189 | /* Sanitize the information from PCI BIOS. */ |
1191 | host->irq = pdev->irq; | 1190 | host->irq = pdev->irq; |
@@ -1258,23 +1257,10 @@ int qla2x00_probe_one(struct pci_dev *pdev, struct qla_board_info *brd_info) | |||
1258 | qla_printk(KERN_WARNING, ha, | 1257 | qla_printk(KERN_WARNING, ha, |
1259 | "[ERROR] Failed to allocate memory for adapter\n"); | 1258 | "[ERROR] Failed to allocate memory for adapter\n"); |
1260 | 1259 | ||
1261 | goto probe_alloc_failed; | 1260 | ret = -ENOMEM; |
1261 | goto probe_failed; | ||
1262 | } | 1262 | } |
1263 | 1263 | ||
1264 | pci_set_drvdata(pdev, ha); | ||
1265 | host->this_id = 255; | ||
1266 | host->cmd_per_lun = 3; | ||
1267 | host->unique_id = ha->instance; | ||
1268 | host->max_cmd_len = MAX_CMDSZ; | ||
1269 | host->max_channel = ha->ports - 1; | ||
1270 | host->max_id = ha->max_targets; | ||
1271 | host->max_lun = ha->max_luns; | ||
1272 | host->transportt = qla2xxx_transport_template; | ||
1273 | if (scsi_add_host(host, &pdev->dev)) | ||
1274 | goto probe_alloc_failed; | ||
1275 | |||
1276 | qla2x00_alloc_sysfs_attr(ha); | ||
1277 | |||
1278 | if (qla2x00_initialize_adapter(ha) && | 1264 | if (qla2x00_initialize_adapter(ha) && |
1279 | !(ha->device_flags & DFLG_NO_CABLE)) { | 1265 | !(ha->device_flags & DFLG_NO_CABLE)) { |
1280 | 1266 | ||
@@ -1285,11 +1271,10 @@ int qla2x00_probe_one(struct pci_dev *pdev, struct qla_board_info *brd_info) | |||
1285 | "Adapter flags %x.\n", | 1271 | "Adapter flags %x.\n", |
1286 | ha->host_no, ha->device_flags)); | 1272 | ha->host_no, ha->device_flags)); |
1287 | 1273 | ||
1274 | ret = -ENODEV; | ||
1288 | goto probe_failed; | 1275 | goto probe_failed; |
1289 | } | 1276 | } |
1290 | 1277 | ||
1291 | qla2x00_init_host_attr(ha); | ||
1292 | |||
1293 | /* | 1278 | /* |
1294 | * Startup the kernel thread for this host adapter | 1279 | * Startup the kernel thread for this host adapter |
1295 | */ | 1280 | */ |
@@ -1299,17 +1284,26 @@ int qla2x00_probe_one(struct pci_dev *pdev, struct qla_board_info *brd_info) | |||
1299 | qla_printk(KERN_WARNING, ha, | 1284 | qla_printk(KERN_WARNING, ha, |
1300 | "Unable to start DPC thread!\n"); | 1285 | "Unable to start DPC thread!\n"); |
1301 | 1286 | ||
1287 | ret = -ENODEV; | ||
1302 | goto probe_failed; | 1288 | goto probe_failed; |
1303 | } | 1289 | } |
1304 | wait_for_completion(&ha->dpc_inited); | 1290 | wait_for_completion(&ha->dpc_inited); |
1305 | 1291 | ||
1292 | host->this_id = 255; | ||
1293 | host->cmd_per_lun = 3; | ||
1294 | host->unique_id = ha->instance; | ||
1295 | host->max_cmd_len = MAX_CMDSZ; | ||
1296 | host->max_channel = ha->ports - 1; | ||
1297 | host->max_lun = MAX_LUNS; | ||
1298 | host->transportt = qla2xxx_transport_template; | ||
1299 | |||
1306 | if (IS_QLA2100(ha) || IS_QLA2200(ha)) | 1300 | if (IS_QLA2100(ha) || IS_QLA2200(ha)) |
1307 | ret = request_irq(host->irq, qla2100_intr_handler, | 1301 | ret = request_irq(host->irq, qla2100_intr_handler, |
1308 | SA_INTERRUPT|SA_SHIRQ, ha->brd_info->drv_name, ha); | 1302 | SA_INTERRUPT|SA_SHIRQ, ha->brd_info->drv_name, ha); |
1309 | else | 1303 | else |
1310 | ret = request_irq(host->irq, qla2300_intr_handler, | 1304 | ret = request_irq(host->irq, qla2300_intr_handler, |
1311 | SA_INTERRUPT|SA_SHIRQ, ha->brd_info->drv_name, ha); | 1305 | SA_INTERRUPT|SA_SHIRQ, ha->brd_info->drv_name, ha); |
1312 | if (ret != 0) { | 1306 | if (ret) { |
1313 | qla_printk(KERN_WARNING, ha, | 1307 | qla_printk(KERN_WARNING, ha, |
1314 | "Failed to reserve interrupt %d already in use.\n", | 1308 | "Failed to reserve interrupt %d already in use.\n", |
1315 | host->irq); | 1309 | host->irq); |
@@ -1363,9 +1357,18 @@ int qla2x00_probe_one(struct pci_dev *pdev, struct qla_board_info *brd_info) | |||
1363 | msleep(10); | 1357 | msleep(10); |
1364 | } | 1358 | } |
1365 | 1359 | ||
1360 | pci_set_drvdata(pdev, ha); | ||
1366 | ha->flags.init_done = 1; | 1361 | ha->flags.init_done = 1; |
1367 | num_hosts++; | 1362 | num_hosts++; |
1368 | 1363 | ||
1364 | ret = scsi_add_host(host, &pdev->dev); | ||
1365 | if (ret) | ||
1366 | goto probe_failed; | ||
1367 | |||
1368 | qla2x00_alloc_sysfs_attr(ha); | ||
1369 | |||
1370 | qla2x00_init_host_attr(ha); | ||
1371 | |||
1369 | qla_printk(KERN_INFO, ha, "\n" | 1372 | qla_printk(KERN_INFO, ha, "\n" |
1370 | " QLogic Fibre Channel HBA Driver: %s\n" | 1373 | " QLogic Fibre Channel HBA Driver: %s\n" |
1371 | " QLogic %s - %s\n" | 1374 | " QLogic %s - %s\n" |
@@ -1384,9 +1387,6 @@ int qla2x00_probe_one(struct pci_dev *pdev, struct qla_board_info *brd_info) | |||
1384 | probe_failed: | 1387 | probe_failed: |
1385 | fc_remove_host(ha->host); | 1388 | fc_remove_host(ha->host); |
1386 | 1389 | ||
1387 | scsi_remove_host(host); | ||
1388 | |||
1389 | probe_alloc_failed: | ||
1390 | qla2x00_free_device(ha); | 1390 | qla2x00_free_device(ha); |
1391 | 1391 | ||
1392 | scsi_host_put(host); | 1392 | scsi_host_put(host); |
@@ -1394,7 +1394,8 @@ probe_alloc_failed: | |||
1394 | probe_disable_device: | 1394 | probe_disable_device: |
1395 | pci_disable_device(pdev); | 1395 | pci_disable_device(pdev); |
1396 | 1396 | ||
1397 | return -1; | 1397 | probe_out: |
1398 | return ret; | ||
1398 | } | 1399 | } |
1399 | EXPORT_SYMBOL_GPL(qla2x00_probe_one); | 1400 | EXPORT_SYMBOL_GPL(qla2x00_probe_one); |
1400 | 1401 | ||