* [PATCH] complain about missing host template initializations
@ 2002-11-30 0:03 Christoph Hellwig
0 siblings, 0 replies; only message in thread
From: Christoph Hellwig @ 2002-11-30 0:03 UTC (permalink / raw)
To: James.Bottomley; +Cc: linux-scsi
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;
^ permalink raw reply [flat|nested] only message in thread
only message in thread, other threads:[~2002-11-30 0:03 UTC | newest]
Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2002-11-30 0:03 [PATCH] complain about missing host template initializations Christoph Hellwig
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.