diff options
author | 2015-08-04 12:17:53 -0700 | |
---|---|---|
committer | 2015-08-04 15:44:42 -0700 | |
commit | 9ca8dbcc65cfc63d6f5ef3312a33184e1d726e00 (patch) | |
tree | 1c9cafbcd35f783a87880a10f85d1a060db1a563 /kernel/drivers/scsi/scsi_module.c | |
parent | 98260f3884f4a202f9ca5eabed40b1354c489b29 (diff) |
Add the rt linux 4.1.3-rt3 as base
Import the rt linux 4.1.3-rt3 as OPNFV kvm base.
It's from git://git.kernel.org/pub/scm/linux/kernel/git/rt/linux-rt-devel.git linux-4.1.y-rt and
the base is:
commit 0917f823c59692d751951bf5ea699a2d1e2f26a2
Author: Sebastian Andrzej Siewior <bigeasy@linutronix.de>
Date: Sat Jul 25 12:13:34 2015 +0200
Prepare v4.1.3-rt3
Signed-off-by: Sebastian Andrzej Siewior <bigeasy@linutronix.de>
We lose all the git history this way and it's not good. We
should apply another opnfv project repo in future.
Change-Id: I87543d81c9df70d99c5001fbdf646b202c19f423
Signed-off-by: Yunhong Jiang <yunhong.jiang@intel.com>
Diffstat (limited to 'kernel/drivers/scsi/scsi_module.c')
-rw-r--r-- | kernel/drivers/scsi/scsi_module.c | 73 |
1 files changed, 73 insertions, 0 deletions
diff --git a/kernel/drivers/scsi/scsi_module.c b/kernel/drivers/scsi/scsi_module.c new file mode 100644 index 000000000..489175833 --- /dev/null +++ b/kernel/drivers/scsi/scsi_module.c @@ -0,0 +1,73 @@ +/* + * Copyright (C) 2003 Christoph Hellwig. + * Released under GPL v2. + * + * Support for old-style host templates. + * + * NOTE: Do not use this for new drivers ever. + */ + +#include <linux/init.h> +#include <linux/kernel.h> +#include <linux/module.h> + +#include <scsi/scsi_host.h> + + +static int __init init_this_scsi_driver(void) +{ + struct scsi_host_template *sht = &driver_template; + struct Scsi_Host *shost; + struct list_head *l; + int error; + + if (!sht->release) { + printk(KERN_ERR + "scsi HBA driver %s didn't set a release method.\n", + sht->name); + return -EINVAL; + } + + sht->module = THIS_MODULE; + INIT_LIST_HEAD(&sht->legacy_hosts); + + sht->detect(sht); + if (list_empty(&sht->legacy_hosts)) + return -ENODEV; + + list_for_each_entry(shost, &sht->legacy_hosts, sht_legacy_list) { + error = scsi_add_host(shost, NULL); + if (error) + goto fail; + scsi_scan_host(shost); + } + return 0; + fail: + l = &shost->sht_legacy_list; + while ((l = l->prev) != &sht->legacy_hosts) + scsi_remove_host(list_entry(l, struct Scsi_Host, sht_legacy_list)); + return error; +} + +static void __exit exit_this_scsi_driver(void) +{ + struct scsi_host_template *sht = &driver_template; + struct Scsi_Host *shost, *s; + + list_for_each_entry(shost, &sht->legacy_hosts, sht_legacy_list) + scsi_remove_host(shost); + list_for_each_entry_safe(shost, s, &sht->legacy_hosts, sht_legacy_list) + sht->release(shost); + + if (list_empty(&sht->legacy_hosts)) + return; + + printk(KERN_WARNING "%s did not call scsi_unregister\n", sht->name); + dump_stack(); + + list_for_each_entry_safe(shost, s, &sht->legacy_hosts, sht_legacy_list) + scsi_unregister(shost); +} + +module_init(init_this_scsi_driver); +module_exit(exit_this_scsi_driver); |