diff options
Diffstat (limited to 'drivers/scsi')
-rw-r--r-- | drivers/scsi/qla2xxx/qla_os.c | 54 |
1 files changed, 28 insertions, 26 deletions
diff --git a/drivers/scsi/qla2xxx/qla_os.c b/drivers/scsi/qla2xxx/qla_os.c index e6831264f67c..0b12498b7672 100644 --- a/drivers/scsi/qla2xxx/qla_os.c +++ b/drivers/scsi/qla2xxx/qla_os.c | |||
@@ -1092,7 +1092,7 @@ iospace_error_exit: | |||
1092 | */ | 1092 | */ |
1093 | int qla2x00_probe_one(struct pci_dev *pdev, struct qla_board_info *brd_info) | 1093 | int qla2x00_probe_one(struct pci_dev *pdev, struct qla_board_info *brd_info) |
1094 | { | 1094 | { |
1095 | int ret; | 1095 | int ret = -ENODEV; |
1096 | device_reg_t __iomem *reg; | 1096 | device_reg_t __iomem *reg; |
1097 | struct Scsi_Host *host; | 1097 | struct Scsi_Host *host; |
1098 | scsi_qla_host_t *ha; | 1098 | scsi_qla_host_t *ha; |
@@ -1103,7 +1103,7 @@ int qla2x00_probe_one(struct pci_dev *pdev, struct qla_board_info *brd_info) | |||
1103 | fc_port_t *fcport; | 1103 | fc_port_t *fcport; |
1104 | 1104 | ||
1105 | if (pci_enable_device(pdev)) | 1105 | if (pci_enable_device(pdev)) |
1106 | return -1; | 1106 | goto probe_out; |
1107 | 1107 | ||
1108 | host = scsi_host_alloc(&qla2x00_driver_template, | 1108 | host = scsi_host_alloc(&qla2x00_driver_template, |
1109 | sizeof(scsi_qla_host_t)); | 1109 | sizeof(scsi_qla_host_t)); |
@@ -1125,9 +1125,8 @@ int qla2x00_probe_one(struct pci_dev *pdev, struct qla_board_info *brd_info) | |||
1125 | 1125 | ||
1126 | /* Configure PCI I/O space */ | 1126 | /* Configure PCI I/O space */ |
1127 | ret = qla2x00_iospace_config(ha); | 1127 | ret = qla2x00_iospace_config(ha); |
1128 | if (ret != 0) { | 1128 | if (ret) |
1129 | goto probe_alloc_failed; | 1129 | goto probe_failed; |
1130 | } | ||
1131 | 1130 | ||
1132 | /* Sanitize the information from PCI BIOS. */ | 1131 | /* Sanitize the information from PCI BIOS. */ |
1133 | host->irq = pdev->irq; | 1132 | host->irq = pdev->irq; |
@@ -1190,22 +1189,10 @@ int qla2x00_probe_one(struct pci_dev *pdev, struct qla_board_info *brd_info) | |||
1190 | qla_printk(KERN_WARNING, ha, | 1189 | qla_printk(KERN_WARNING, ha, |
1191 | "[ERROR] Failed to allocate memory for adapter\n"); | 1190 | "[ERROR] Failed to allocate memory for adapter\n"); |
1192 | 1191 | ||
1193 | goto probe_alloc_failed; | 1192 | ret = -ENOMEM; |
1193 | goto probe_failed; | ||
1194 | } | 1194 | } |
1195 | 1195 | ||
1196 | pci_set_drvdata(pdev, ha); | ||
1197 | host->this_id = 255; | ||
1198 | host->cmd_per_lun = 3; | ||
1199 | host->unique_id = ha->instance; | ||
1200 | host->max_cmd_len = MAX_CMDSZ; | ||
1201 | host->max_channel = ha->ports - 1; | ||
1202 | host->max_lun = MAX_LUNS; | ||
1203 | host->transportt = qla2xxx_transport_template; | ||
1204 | if (scsi_add_host(host, &pdev->dev)) | ||
1205 | goto probe_alloc_failed; | ||
1206 | |||
1207 | qla2x00_alloc_sysfs_attr(ha); | ||
1208 | |||
1209 | if (qla2x00_initialize_adapter(ha) && | 1196 | if (qla2x00_initialize_adapter(ha) && |
1210 | !(ha->device_flags & DFLG_NO_CABLE)) { | 1197 | !(ha->device_flags & DFLG_NO_CABLE)) { |
1211 | 1198 | ||
@@ -1216,11 +1203,10 @@ int qla2x00_probe_one(struct pci_dev *pdev, struct qla_board_info *brd_info) | |||
1216 | "Adapter flags %x.\n", | 1203 | "Adapter flags %x.\n", |
1217 | ha->host_no, ha->device_flags)); | 1204 | ha->host_no, ha->device_flags)); |
1218 | 1205 | ||
1206 | ret = -ENODEV; | ||
1219 | goto probe_failed; | 1207 | goto probe_failed; |
1220 | } | 1208 | } |
1221 | 1209 | ||
1222 | qla2x00_init_host_attr(ha); | ||
1223 | |||
1224 | /* | 1210 | /* |
1225 | * Startup the kernel thread for this host adapter | 1211 | * Startup the kernel thread for this host adapter |
1226 | */ | 1212 | */ |
@@ -1230,17 +1216,26 @@ int qla2x00_probe_one(struct pci_dev *pdev, struct qla_board_info *brd_info) | |||
1230 | qla_printk(KERN_WARNING, ha, | 1216 | qla_printk(KERN_WARNING, ha, |
1231 | "Unable to start DPC thread!\n"); | 1217 | "Unable to start DPC thread!\n"); |
1232 | 1218 | ||
1219 | ret = -ENODEV; | ||
1233 | goto probe_failed; | 1220 | goto probe_failed; |
1234 | } | 1221 | } |
1235 | wait_for_completion(&ha->dpc_inited); | 1222 | wait_for_completion(&ha->dpc_inited); |
1236 | 1223 | ||
1224 | host->this_id = 255; | ||
1225 | host->cmd_per_lun = 3; | ||
1226 | host->unique_id = ha->instance; | ||
1227 | host->max_cmd_len = MAX_CMDSZ; | ||
1228 | host->max_channel = ha->ports - 1; | ||
1229 | host->max_lun = MAX_LUNS; | ||
1230 | host->transportt = qla2xxx_transport_template; | ||
1231 | |||
1237 | if (IS_QLA2100(ha) || IS_QLA2200(ha)) | 1232 | if (IS_QLA2100(ha) || IS_QLA2200(ha)) |
1238 | ret = request_irq(host->irq, qla2100_intr_handler, | 1233 | ret = request_irq(host->irq, qla2100_intr_handler, |
1239 | SA_INTERRUPT|SA_SHIRQ, ha->brd_info->drv_name, ha); | 1234 | SA_INTERRUPT|SA_SHIRQ, ha->brd_info->drv_name, ha); |
1240 | else | 1235 | else |
1241 | ret = request_irq(host->irq, qla2300_intr_handler, | 1236 | ret = request_irq(host->irq, qla2300_intr_handler, |
1242 | SA_INTERRUPT|SA_SHIRQ, ha->brd_info->drv_name, ha); | 1237 | SA_INTERRUPT|SA_SHIRQ, ha->brd_info->drv_name, ha); |
1243 | if (ret != 0) { | 1238 | if (ret) { |
1244 | qla_printk(KERN_WARNING, ha, | 1239 | qla_printk(KERN_WARNING, ha, |
1245 | "Failed to reserve interrupt %d already in use.\n", | 1240 | "Failed to reserve interrupt %d already in use.\n", |
1246 | host->irq); | 1241 | host->irq); |
@@ -1294,9 +1289,18 @@ int qla2x00_probe_one(struct pci_dev *pdev, struct qla_board_info *brd_info) | |||
1294 | msleep(10); | 1289 | msleep(10); |
1295 | } | 1290 | } |
1296 | 1291 | ||
1292 | pci_set_drvdata(pdev, ha); | ||
1297 | ha->flags.init_done = 1; | 1293 | ha->flags.init_done = 1; |
1298 | num_hosts++; | 1294 | num_hosts++; |
1299 | 1295 | ||
1296 | ret = scsi_add_host(host, &pdev->dev); | ||
1297 | if (ret) | ||
1298 | goto probe_failed; | ||
1299 | |||
1300 | qla2x00_alloc_sysfs_attr(ha); | ||
1301 | |||
1302 | qla2x00_init_host_attr(ha); | ||
1303 | |||
1300 | qla_printk(KERN_INFO, ha, "\n" | 1304 | qla_printk(KERN_INFO, ha, "\n" |
1301 | " QLogic Fibre Channel HBA Driver: %s\n" | 1305 | " QLogic Fibre Channel HBA Driver: %s\n" |
1302 | " QLogic %s - %s\n" | 1306 | " QLogic %s - %s\n" |
@@ -1315,9 +1319,6 @@ int qla2x00_probe_one(struct pci_dev *pdev, struct qla_board_info *brd_info) | |||
1315 | probe_failed: | 1319 | probe_failed: |
1316 | fc_remove_host(ha->host); | 1320 | fc_remove_host(ha->host); |
1317 | 1321 | ||
1318 | scsi_remove_host(host); | ||
1319 | |||
1320 | probe_alloc_failed: | ||
1321 | qla2x00_free_device(ha); | 1322 | qla2x00_free_device(ha); |
1322 | 1323 | ||
1323 | scsi_host_put(host); | 1324 | scsi_host_put(host); |
@@ -1325,7 +1326,8 @@ probe_alloc_failed: | |||
1325 | probe_disable_device: | 1326 | probe_disable_device: |
1326 | pci_disable_device(pdev); | 1327 | pci_disable_device(pdev); |
1327 | 1328 | ||
1328 | return -1; | 1329 | probe_out: |
1330 | return ret; | ||
1329 | } | 1331 | } |
1330 | EXPORT_SYMBOL_GPL(qla2x00_probe_one); | 1332 | EXPORT_SYMBOL_GPL(qla2x00_probe_one); |
1331 | 1333 | ||