Commit ff9e1de2 authored by Christoph Hellwig's avatar Christoph Hellwig Committed by Doug Ledford

[PATCH] remove implicit scsi_register()

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.
parent 0b33a176
...@@ -36,7 +36,6 @@ ...@@ -36,7 +36,6 @@
#include <linux/init.h> #include <linux/init.h>
#include <linux/interrupt.h> #include <linux/interrupt.h>
#include <linux/list.h> #include <linux/list.h>
#include <linux/smp_lock.h>
#define __KERNEL_SYSCALLS__ #define __KERNEL_SYSCALLS__
...@@ -50,7 +49,6 @@ static LIST_HEAD(scsi_host_list); ...@@ -50,7 +49,6 @@ static LIST_HEAD(scsi_host_list);
static spinlock_t scsi_host_list_lock = SPIN_LOCK_UNLOCKED; 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_host_next_hn; /* host_no for next new host */
static int scsi_hosts_registered; /* cnt of registered scsi hosts */
static char *scsihosts; static char *scsihosts;
MODULE_PARM(scsihosts, "s"); MODULE_PARM(scsihosts, "s");
...@@ -192,7 +190,7 @@ static void scsi_host_legacy_release(struct Scsi_Host *shost) ...@@ -192,7 +190,7 @@ static void scsi_host_legacy_release(struct Scsi_Host *shost)
static int scsi_remove_legacy_host(struct Scsi_Host *shost) static int scsi_remove_legacy_host(struct Scsi_Host *shost)
{ {
int error, pcount = scsi_hosts_registered; int error;
error = scsi_remove_host(shost); error = scsi_remove_host(shost);
if (error) if (error)
...@@ -203,8 +201,6 @@ static int scsi_remove_legacy_host(struct Scsi_Host *shost) ...@@ -203,8 +201,6 @@ static int scsi_remove_legacy_host(struct Scsi_Host *shost)
else else
scsi_host_legacy_release(shost); scsi_host_legacy_release(shost);
if (pcount == scsi_hosts_registered)
scsi_unregister(shost);
return 0; return 0;
} }
...@@ -335,7 +331,6 @@ void scsi_unregister(struct Scsi_Host *shost) ...@@ -335,7 +331,6 @@ void scsi_unregister(struct Scsi_Host *shost)
shost->eh_notify = NULL; shost->eh_notify = NULL;
} }
scsi_hosts_registered--;
shost->hostt->present--; shost->hostt->present--;
/* Cleanup proc and driverfs */ /* Cleanup proc and driverfs */
...@@ -387,7 +382,6 @@ struct Scsi_Host * scsi_register(Scsi_Host_Template *shost_tp, int xtr_bytes) ...@@ -387,7 +382,6 @@ struct Scsi_Host * scsi_register(Scsi_Host_Template *shost_tp, int xtr_bytes)
memset(shost, 0, sizeof(struct Scsi_Host) + xtr_bytes); memset(shost, 0, sizeof(struct Scsi_Host) + xtr_bytes);
shost->host_no = scsi_alloc_host_num(shost_tp->proc_name); shost->host_no = scsi_alloc_host_num(shost_tp->proc_name);
scsi_hosts_registered++;
spin_lock_init(&shost->default_lock); spin_lock_init(&shost->default_lock);
scsi_assign_lock(shost, &shost->default_lock); scsi_assign_lock(shost, &shost->default_lock);
...@@ -483,7 +477,6 @@ struct Scsi_Host * scsi_register(Scsi_Host_Template *shost_tp, int xtr_bytes) ...@@ -483,7 +477,6 @@ struct Scsi_Host * scsi_register(Scsi_Host_Template *shost_tp, int xtr_bytes)
int scsi_register_host(Scsi_Host_Template *shost_tp) int scsi_register_host(Scsi_Host_Template *shost_tp)
{ {
struct Scsi_Host *shost; struct Scsi_Host *shost;
int cur_cnt;
/* /*
* Check no detect routine. * Check no detect routine.
...@@ -495,8 +488,6 @@ int scsi_register_host(Scsi_Host_Template *shost_tp) ...@@ -495,8 +488,6 @@ int scsi_register_host(Scsi_Host_Template *shost_tp)
if (!shost_tp->max_sectors) if (!shost_tp->max_sectors)
shost_tp->max_sectors = 1024; shost_tp->max_sectors = 1024;
cur_cnt = scsi_hosts_registered;
/* /*
* The detect routine must carefully spinunlock/spinlock if it * The detect routine must carefully spinunlock/spinlock if it
* enables interrupts, since all interrupt handlers do spinlock as * enables interrupts, since all interrupt handlers do spinlock as
...@@ -512,28 +503,6 @@ int scsi_register_host(Scsi_Host_Template *shost_tp) ...@@ -512,28 +503,6 @@ int scsi_register_host(Scsi_Host_Template *shost_tp)
if (!shost_tp->present) if (!shost_tp->present)
return 0; 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 * XXX(hch) use scsi_tp_for_each_host() once it propagates
* error returns properly. * error returns properly.
...@@ -567,20 +536,7 @@ int scsi_register_host(Scsi_Host_Template *shost_tp) ...@@ -567,20 +536,7 @@ int scsi_register_host(Scsi_Host_Template *shost_tp)
**/ **/
int scsi_unregister_host(Scsi_Host_Template *shost_tp) 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); 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; return 0;
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment