* [PATCH] remove implicit scsi_register()
@ 2002-11-23 2:14 Christoph Hellwig
0 siblings, 0 replies; only message in thread
From: Christoph Hellwig @ 2002-11-23 2:14 UTC (permalink / raw)
To: James.Bottomley; +Cc: linux-scsi
hosts.c has some crufty old code to implicitly do scsi_register/
scsi_unregister for drivers that don't do it. This seems to be
a left-over from the very early days and apparently no driver
in the tree uses it (at least according to some grepping).
This patch removes it.
--- 1.35/drivers/scsi/hosts.c Fri Nov 22 12:59:03 2002
+++ edited/drivers/scsi/hosts.c Sat Nov 23 02:12:54 2002
@@ -36,7 +36,6 @@
#include <linux/init.h>
#include <linux/interrupt.h>
#include <linux/list.h>
-#include <linux/smp_lock.h>
#define __KERNEL_SYSCALLS__
@@ -50,7 +49,6 @@
static spinlock_t scsi_host_list_lock = SPIN_LOCK_UNLOCKED;
static int scsi_host_next_hn; /* host_no for next new host */
-static int scsi_hosts_registered; /* cnt of registered scsi hosts */
static char *scsihosts;
MODULE_PARM(scsihosts, "s");
@@ -192,7 +190,7 @@
static int scsi_remove_legacy_host(struct Scsi_Host *shost)
{
- int error, pcount = scsi_hosts_registered;
+ int error;
error = scsi_remove_host(shost);
if (error)
@@ -203,8 +201,6 @@
else
scsi_host_legacy_release(shost);
- if (pcount == scsi_hosts_registered)
- scsi_unregister(shost);
return 0;
}
@@ -343,7 +331,6 @@
shost->eh_notify = NULL;
}
- scsi_hosts_registered--;
shost->hostt->present--;
/* Cleanup proc and driverfs */
@@ -395,7 +382,6 @@
memset(shost, 0, sizeof(struct Scsi_Host) + xtr_bytes);
shost->host_no = scsi_alloc_host_num(shost_tp->proc_name);
- scsi_hosts_registered++;
spin_lock_init(&shost->default_lock);
scsi_assign_lock(shost, &shost->default_lock);
@@ -491,7 +477,6 @@
int scsi_register_host(Scsi_Host_Template *shost_tp)
{
struct Scsi_Host *shost;
- int cur_cnt;
/*
* Check no detect routine.
@@ -503,8 +488,6 @@
if (!shost_tp->max_sectors)
shost_tp->max_sectors = 1024;
- cur_cnt = scsi_hosts_registered;
-
/*
* The detect routine must carefully spinunlock/spinlock if it
* enables interrupts, since all interrupt handlers do spinlock as
@@ -520,28 +503,6 @@
if (!shost_tp->present)
return 0;
- if (cur_cnt == scsi_hosts_registered) {
- if (shost_tp->present > 1) {
- printk(KERN_ERR "scsi: Failure to register"
- "low-level scsi driver");
- scsi_unregister_host(shost_tp);
- return 1;
- }
-
- /*
- * The low-level driver failed to register a driver.
- * We can do this now.
- *
- * XXX Who needs manual registration and why???
- */
- if (!scsi_register(shost_tp, 0)) {
- printk(KERN_ERR "scsi: register failed.\n");
- scsi_unregister_host(shost_tp);
- return 1;
- }
- }
-
-
/*
* XXX(hch) use scsi_tp_for_each_host() once it propagates
* error returns properly.
@@ -575,20 +536,7 @@
**/
int scsi_unregister_host(Scsi_Host_Template *shost_tp)
{
- int pcount;
-
- /* get the big kernel lock, so we don't race with open() */
- lock_kernel();
-
- pcount = scsi_hosts_registered;
-
scsi_tp_for_each_host(shost_tp, scsi_remove_legacy_host);
-
- if (pcount != scsi_hosts_registered)
- printk(KERN_INFO "scsi : %d host%s left.\n", scsi_hosts_registered,
- (scsi_hosts_registered == 1) ? "" : "s");
-
- unlock_kernel();
return 0;
}
^ permalink raw reply [flat|nested] only message in thread
only message in thread, other threads:[~2002-11-23 2:14 UTC | newest]
Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2002-11-23 2:14 [PATCH] remove implicit scsi_register() 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.