Merge my recent changes into the 2.0.0.x branch ...

git-svn-id: http://svn.code.sf.net/p/scst/svn/branches/2.0.0.x@2123 d57e44dd-8a1f-0410-8b47-8ef2f437770f
This commit is contained in:
Richard Sharpe
2010-09-14 03:49:07 +00:00
parent 9fe06dd3fa
commit e937b00307

View File

@@ -43,10 +43,6 @@
#include <scst_debug.h>
#endif
#if (LINUX_VERSION_CODE < KERNEL_VERSION(2, 6, 25))
#define SG_MAX_SINGLE_ALLOC (PAGE_SIZE / sizeof(struct scatterlist))
#endif
#ifndef INSIDE_KERNEL_TREE
#if defined(CONFIG_HIGHMEM4G) || defined(CONFIG_HIGHMEM64G)
#warning "HIGHMEM kernel configurations are not supported by this module,\
@@ -97,14 +93,14 @@ static atomic_t num_aborts = ATOMIC_INIT(0);
static atomic_t num_dev_resets = ATOMIC_INIT(0);
static atomic_t num_target_resets = ATOMIC_INIT(0);
#if LINUX_VERSION_CODE <= KERNEL_VERSION(2, 6, 27) \
#if LINUX_VERSION_CODE < KERNEL_VERSION(2, 6, 31) \
|| defined(RHEL_MAJOR) && RHEL_MAJOR -0 <= 5
static int scst_local_add_default_tgt;
#else
static bool scst_local_add_default_tgt;
#endif
module_param_named(add_default_tgt, scst_local_add_default_tgt, bool, S_IRUGO);
MODULE_PARM_DESC(add_default_host, "add or not (default) on start default "
MODULE_PARM_DESC(add_default_tgt, "add or not (default) on start default "
"target scst_local_tgt with default session scst_local_host");
struct scst_aen_work_item {
@@ -1382,7 +1378,7 @@ static struct scsi_host_template scst_lcl_ini_driver_template = {
* LLD Bus and functions
*/
static int scst_local_lld_driver_probe(struct device *dev)
static int scst_local_driver_probe(struct device *dev)
{
int ret;
struct scst_local_sess *sess;
@@ -1403,6 +1399,7 @@ static int scst_local_lld_driver_probe(struct device *dev)
sess->shost = hpnt;
hpnt->max_id = 0; /* Don't want more than one id */
hpnt->max_lun = 0xFFFF;
/*
@@ -1435,7 +1432,7 @@ out:
return ret;
}
static int scst_local_lld_driver_remove(struct device *dev)
static int scst_local_driver_remove(struct device *dev)
{
struct scst_local_sess *sess;
@@ -1454,7 +1451,7 @@ static int scst_local_lld_driver_remove(struct device *dev)
return 0;
}
static int scst_local_lld_bus_match(struct device *dev,
static int scst_local_bus_match(struct device *dev,
struct device_driver *dev_driver)
{
TRACE_ENTRY();
@@ -1465,9 +1462,9 @@ static int scst_local_lld_bus_match(struct device *dev,
static struct bus_type scst_local_lld_bus = {
.name = "scst_local_bus",
.match = scst_local_lld_bus_match,
.probe = scst_local_lld_driver_probe,
.remove = scst_local_lld_driver_remove,
.match = scst_local_bus_match,
.probe = scst_local_driver_probe,
.remove = scst_local_driver_remove,
};
static struct device_driver scst_local_driver = {
@@ -1475,6 +1472,7 @@ static struct device_driver scst_local_driver = {
.bus = &scst_local_lld_bus,
};
#if LINUX_VERSION_CODE < KERNEL_VERSION(2, 6, 29)
static void scst_local_root_release(struct device *dev)
{
TRACE_ENTRY();
@@ -1491,6 +1489,9 @@ static struct device scst_local_root = {
#endif
.release = scst_local_root_release,
};
#else
static struct device *scst_local_root;
#endif
static void scst_local_release_adapter(struct device *dev)
{
@@ -1556,7 +1557,11 @@ static int __scst_local_add_adapter(struct scst_local_tgt *tgt,
}
sess->dev.bus = &scst_local_lld_bus;
#if (LINUX_VERSION_CODE < KERNEL_VERSION(2, 6, 29))
sess->dev.parent = &scst_local_root;
#else
sess->dev.parent = scst_local_root;
#endif
sess->dev.release = &scst_local_release_adapter;
#if LINUX_VERSION_CODE < KERNEL_VERSION(2, 6, 30)
snprintf(sess->dev.bus_id, sizeof(sess->dev.bus_id), initiator_name);
@@ -1745,6 +1750,7 @@ static int __init scst_local_init(void)
}
#endif
#if (LINUX_VERSION_CODE < KERNEL_VERSION(2, 6, 29))
ret = device_register(&scst_local_root);
if (ret < 0) {
PRINT_ERROR("Root device_register() error: %d", ret);
@@ -1754,6 +1760,13 @@ static int __init scst_local_init(void)
goto out;
#endif
}
#else
scst_local_root = root_device_register(SCST_LOCAL_NAME);
if (IS_ERR(scst_local_root)) {
ret = PTR_ERR(scst_local_root);
goto out;
}
#endif
ret = bus_register(&scst_local_lld_bus);
if (ret < 0) {
@@ -1773,8 +1786,16 @@ static int __init scst_local_init(void)
goto driver_unreg;
}
#ifndef CONFIG_SCST_PROC
/*
* If we are using sysfs, then don't add a default target unless
* we are told to do so. When using procfs, we always add a default
* target because that was what the earliest versions did. Just
* remove the preprocessor directives when no longer needed.
*/
if (!scst_local_add_default_tgt)
goto out;
#endif
ret = scst_local_add_target("scst_local_tgt", &tgt);
if (ret != 0)
@@ -1801,7 +1822,11 @@ bus_unreg:
bus_unregister(&scst_local_lld_bus);
dev_unreg:
#if (LINUX_VERSION_CODE < KERNEL_VERSION(2, 6, 29))
device_unregister(&scst_local_root);
#else
root_device_unregister(scst_local_root);
#endif
#if (LINUX_VERSION_CODE < KERNEL_VERSION(2, 6, 25))
destroy_kmem:
@@ -1827,7 +1852,11 @@ static void __exit scst_local_exit(void)
driver_unregister(&scst_local_driver);
bus_unregister(&scst_local_lld_bus);
#if (LINUX_VERSION_CODE < KERNEL_VERSION(2, 6, 29))
device_unregister(&scst_local_root);
#else
root_device_unregister(scst_local_root);
#endif
/* Now unregister the target template */
scst_unregister_target_template(&scst_local_targ_tmpl);