public inbox for linux-scsi@vger.kernel.org
 help / color / mirror / Atom feed
From: Andrew Vasquez <andrew.vasquez@qlogic.com>
To: Jeremy Higdon <jeremy@sgi.com>
Cc: Linux-SCSI Mailing List <linux-scsi@vger.kernel.org>,
	James Bottomley <James.Bottomley@SteelEye.com>
Subject: Re: PATCH [2/5]  qla2xxx: add remote port codes...
Date: Fri, 20 May 2005 08:15:42 -0700	[thread overview]
Message-ID: <20050520151542.GA17419@plap.qlogic.org> (raw)
In-Reply-To: <20050520061736.GA11551@sgi.com>

On Thu, 19 May 2005, Jeremy Higdon wrote:

> On Tue, Apr 19, 2005 at 12:27:51AM -0700, Andrew Vasquez wrote:
> > On Wed, 13 Apr 2005, Christoph Hellwig wrote:
> > 
> > > >  	atomic_set(&fcport->state, FCS_ONLINE);
> > > > +	if (ha->flags.init_done)
> > > > +		qla2x00_reg_remote_port(ha, fcport);
> > > >  }
> > > 
> > > ...
> > > 
> > > > -		goto probe_failed;
> > > > +		goto probe_alloc_failed;
> > > >  	}
> > > >  
> > > > +	pci_set_drvdata(pdev, ha);
> > > > +	host->this_id = 255;
> > > > +	host->cmd_per_lun = 3;
> > > > +	host->unique_id = ha->instance;
> > > > +	host->max_cmd_len = MAX_CMDSZ;
> > > > +	host->max_channel = ha->ports - 1;
> > > > +	host->max_id = ha->max_targets;
> > > > +	host->max_lun = ha->max_luns;
> > > > +	host->transportt = qla2xxx_transport_template;
> > > > +	if (scsi_add_host(host, &pdev->dev))
> > > > +		goto probe_alloc_failed;
> > > > +
> > > > +	qla2x00_alloc_sysfs_attr(ha);
> > > > +
> > > >  	if (qla2x00_initialize_adapter(ha) &&
> > > >  	    !(ha->device_flags & DFLG_NO_CABLE)) {
> > > 
> > > Now this I don't undersant.  You're moving the host registration earlier,
> > > maybe too earlier but I haven't checked that yet,
> > >
> > 
> > Yeah, that hunk is a residual of some other (trashy) changes I made
> > during early fc_rport integration and really should be reverted back
> > to the original...
> 
> In fact, it seems to break probing for luns other than zero.
> 
> You initialize ha->max_luns in qla2x00_nvram_config(), which is called form
> qla2x00_initialize_adapter().  So we're currently seeing messages like
> this during ISP2312 initialization:
> 
> <4>scsi: host 1 channel 0 id 0 lun1 has a LUN larger than allowed by the host adapter

Jeremy, could you try this patch out.

James, please apply.


[PATCH] 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.

Signed-off-by: Andrew Vasquez <andrew.vasquez@qlogic.com>

drivers/scsi/qla2xxx/qla_os.c: 7f8d747bd5e546e3b753ce06e3568f32d0a0ec07
--- a/drivers/scsi/qla2xxx/qla_os.c
+++ b/drivers/scsi/qla2xxx/qla_os.c
@@ -1106,7 +1106,7 @@ iospace_error_exit:
  */
 int qla2x00_probe_one(struct pci_dev *pdev, struct qla_board_info *brd_info)
 {
-	int	ret;
+	int	ret = -ENODEV;
 	device_reg_t __iomem *reg;
 	struct Scsi_Host *host;
 	scsi_qla_host_t *ha;
@@ -1117,7 +1117,7 @@ int qla2x00_probe_one(struct pci_dev *pd
 	fc_port_t *fcport;
 
 	if (pci_enable_device(pdev))
-		return -1;
+		goto probe_out;
 
 	host = scsi_host_alloc(&qla2x00_driver_template,
 	    sizeof(scsi_qla_host_t));
@@ -1139,9 +1139,8 @@ int qla2x00_probe_one(struct pci_dev *pd
 
 	/* Configure PCI I/O space */
 	ret = qla2x00_iospace_config(ha);
-	if (ret != 0) {
-		goto probe_alloc_failed;
-	}
+	if (ret)
+		goto probe_failed;
 
 	/* Sanitize the information from PCI BIOS. */
 	host->irq = pdev->irq;
@@ -1204,22 +1203,10 @@ int qla2x00_probe_one(struct pci_dev *pd
 		qla_printk(KERN_WARNING, ha,
 		    "[ERROR] Failed to allocate memory for adapter\n");
 
-		goto probe_alloc_failed;
+		ret = -ENOMEM;
+		goto probe_failed;
 	}
 
-	pci_set_drvdata(pdev, ha);
-	host->this_id = 255;
-	host->cmd_per_lun = 3;
-	host->unique_id = ha->instance;
-	host->max_cmd_len = MAX_CMDSZ;
-	host->max_channel = ha->ports - 1;
-	host->max_lun = MAX_LUNS;
-	host->transportt = qla2xxx_transport_template;
-	if (scsi_add_host(host, &pdev->dev))
-		goto probe_alloc_failed;
-
-	qla2x00_alloc_sysfs_attr(ha);
-
 	if (qla2x00_initialize_adapter(ha) &&
 	    !(ha->device_flags & DFLG_NO_CABLE)) {
 
@@ -1230,11 +1217,10 @@ int qla2x00_probe_one(struct pci_dev *pd
 		    "Adapter flags %x.\n",
 		    ha->host_no, ha->device_flags));
 
+		ret = -ENODEV;
 		goto probe_failed;
 	}
 
-	qla2x00_init_host_attr(ha);
-
 	/*
 	 * Startup the kernel thread for this host adapter
 	 */
@@ -1244,17 +1230,26 @@ int qla2x00_probe_one(struct pci_dev *pd
 		qla_printk(KERN_WARNING, ha,
 		    "Unable to start DPC thread!\n");
 
+		ret = -ENODEV;
 		goto probe_failed;
 	}
 	wait_for_completion(&ha->dpc_inited);
 
+	host->this_id = 255;
+	host->cmd_per_lun = 3;
+	host->unique_id = ha->instance;
+	host->max_cmd_len = MAX_CMDSZ;
+	host->max_channel = ha->ports - 1;
+	host->max_lun = MAX_LUNS;
+	host->transportt = qla2xxx_transport_template;
+
 	if (IS_QLA2100(ha) || IS_QLA2200(ha))
 		ret = request_irq(host->irq, qla2100_intr_handler,
 		    SA_INTERRUPT|SA_SHIRQ, ha->brd_info->drv_name, ha);
 	else
 		ret = request_irq(host->irq, qla2300_intr_handler,
 		    SA_INTERRUPT|SA_SHIRQ, ha->brd_info->drv_name, ha);
-	if (ret != 0) {
+	if (ret) {
 		qla_printk(KERN_WARNING, ha,
 		    "Failed to reserve interrupt %d already in use.\n",
 		    host->irq);
@@ -1308,9 +1303,18 @@ int qla2x00_probe_one(struct pci_dev *pd
 		msleep(10);
 	}
 
+	pci_set_drvdata(pdev, ha);
 	ha->flags.init_done = 1;
 	num_hosts++;
 
+	ret = scsi_add_host(host, &pdev->dev);
+	if (ret)
+		goto probe_failed;
+
+	qla2x00_alloc_sysfs_attr(ha);
+
+	qla2x00_init_host_attr(ha);
+
 	qla_printk(KERN_INFO, ha, "\n"
 	    " QLogic Fibre Channel HBA Driver: %s\n"
 	    "  QLogic %s - %s\n"
@@ -1329,9 +1333,6 @@ int qla2x00_probe_one(struct pci_dev *pd
 probe_failed:
 	fc_remove_host(ha->host);
 
-	scsi_remove_host(host);
-
-probe_alloc_failed:
 	qla2x00_free_device(ha);
 
 	scsi_host_put(host);
@@ -1339,7 +1340,8 @@ probe_alloc_failed:
 probe_disable_device:
 	pci_disable_device(pdev);
 
-	return -1;
+probe_out:
+	return ret;
 }
 EXPORT_SYMBOL_GPL(qla2x00_probe_one);
 

  reply	other threads:[~2005-05-20 15:15 UTC|newest]

Thread overview: 25+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2005-04-13 19:15 PATCH [0/5] qla2xxx: remote port rework Andrew Vasquez
2005-04-13 19:18 ` PATCH [1/5] qla2xxx: remove internal queuing Andrew Vasquez
2005-04-13 19:18 ` PATCH [2/5] qla2xxx: add remote port codes Andrew Vasquez
2005-04-13 21:40   ` Christoph Hellwig
2005-04-19  6:33     ` Andrew Vasquez
2005-04-19  7:27     ` Andrew Vasquez
2005-04-19 21:13       ` Christoph Hellwig
2005-05-20  6:17       ` Jeremy Higdon
2005-05-20 15:15         ` Andrew Vasquez [this message]
2005-05-27  7:51           ` Jeremy Higdon
2005-04-17 15:18   ` James Bottomley
2005-04-13 19:18 ` PATCH [3/5] qla2xxx: remove lun discovery codes Andrew Vasquez
2005-04-13 19:19 ` PATCH [4/5] qla2xxx: cleanup DMA mappings Andrew Vasquez
2005-04-13 21:34   ` Christoph Hellwig
2005-04-15 18:06     ` Andrew Vasquez
2005-04-13 19:19 ` PATCH [5/5] qla2xxx: remove /proc interface Andrew Vasquez
2005-04-13 19:42 ` PATCH [0/5] qla2xxx: remote port rework Matthew Wilcox
2005-04-13 20:50 ` PATCH [6/5] qla2xxx: update version :) Andrew Vasquez
2005-04-13 20:57   ` James Bottomley
2005-04-13 21:24     ` Andrew Vasquez
2005-04-19 21:15       ` Christoph Hellwig
2005-04-22  7:22         ` Andrew Vasquez
2005-04-24 10:53           ` Christoph Hellwig
2005-04-13 21:17   ` Christoph Hellwig
2005-04-15 17:38     ` Andrew Vasquez

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20050520151542.GA17419@plap.qlogic.org \
    --to=andrew.vasquez@qlogic.com \
    --cc=James.Bottomley@SteelEye.com \
    --cc=jeremy@sgi.com \
    --cc=linux-scsi@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox