All of lore.kernel.org
 help / color / mirror / Atom feed
From: Christoph Hellwig <hch@lst.de>
To: James.Bottomley@steeleye.com
Cc: linux-scsi@vger.kernel.org
Subject: [PATCH] complain about missing host template initializations
Date: Sat, 30 Nov 2002 01:03:47 +0100	[thread overview]
Message-ID: <20021130010347.A14052@lst.de> (raw)

Currently scsi_register_host silently fixes up missing initializations
of max_sectors and release.  Add some printks complaining about this
so we can get rid of it sooner or later.


--- 1.38/drivers/scsi/hosts.c	Thu Nov 28 02:02:19 2002
+++ edited/drivers/scsi/hosts.c	Fri Nov 29 23:56:41 2002
@@ -171,14 +171,14 @@
 }
 
 /**
- * scsi_host_generic_release - default release function for hosts
+ * scsi_host_legacy_release - default release function for hosts
  * @shost: 
  * 
  * Description:
  * 	This is the default case for the release function.  Its completely
  *	useless for anything but old ISA adapters
  **/
-static void scsi_host_legacy_release(struct Scsi_Host *shost)
+static int scsi_host_legacy_release(struct Scsi_Host *shost)
 {
 	if (shost->irq)
 		free_irq(shost->irq, NULL);
@@ -186,6 +186,8 @@
 		free_dma(shost->dma_channel);
 	if (shost->io_port && shost->n_io_port)
 		release_region(shost->io_port, shost->n_io_port);
+
+	return 0;
 }
 
 static int scsi_remove_legacy_host(struct Scsi_Host *shost)
@@ -193,14 +195,8 @@
 	int error;
 
 	error = scsi_remove_host(shost);
-	if (error)
-		return error;
-
-	if (shost->hostt->release)
+	if (!error)
 		(*shost->hostt->release)(shost);
-	else
-		scsi_host_legacy_release(shost);
-
 	return 0;
 }
 
@@ -487,27 +483,22 @@
 {
 	struct Scsi_Host *shost;
 
-	/*
-	 * Check no detect routine.
-	 */
-	if (!shost_tp->detect)
-		return 1;
+	BUG_ON(!shost_tp->detect);
 
-	/* If max_sectors isn't set, default to max */
-	if (!shost_tp->max_sectors)
+	if (!shost_tp->max_sectors) {
+		printk(KERN_WARNING
+		    "scsi HBA driver %s didn't set max_sectors, "
+		    "please fix the template", shost_tp->name);
 		shost_tp->max_sectors = 1024;
+	}
 
-	/*
-	 * The detect routine must carefully spinunlock/spinlock if it
-	 * enables interrupts, since all interrupt handlers do spinlock as
-	 * well.
-	 */
+	if (!shost_tp->release) {
+		printk(KERN_WARNING
+		    "scsi HBA driver %s didn't set a release method, "
+		    "please fix the template", shost_tp->name);
+		shost_tp->release = &scsi_host_legacy_release;
+	}
 
-	/*
-	 * detect should do its own locking
-	 * FIXME present is now set is scsi_register which breaks manual
-	 * registration code below.
-	 */
 	shost_tp->detect(shost_tp);
 	if (!shost_tp->present)
 		return 0;

                 reply	other threads:[~2002-11-30  0:03 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

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=20021130010347.A14052@lst.de \
    --to=hch@lst.de \
    --cc=James.Bottomley@steeleye.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.