diff options
author | Roland Dreier <roland@purestorage.com> | 2012-01-12 13:41:18 -0500 |
---|---|---|
committer | Nicholas Bellinger <nab@linux-iscsi.org> | 2012-02-25 17:37:46 -0500 |
commit | d0f474e501929acdbd116cca39ef083012f70f25 (patch) | |
tree | ce4db92ff234d82c3b61ff05404ed4ae41551770 /drivers/target/target_core_configfs.c | |
parent | d5b4a21b3dc116b477c1b1b493233a73aacbb440 (diff) |
target: Use LIST_HEAD()/DEFINE_MUTEX() for static objects
Instead of
static struct list_head foo;
static struct mutex bar;
...
INIT_LIST_HEAD(&foo);
mutex_init(&bar);
just do
static LIST_HEAD(foo);
static DEFINE_MUTEX(bar);
Also remove some superfluous struct list_head and spinlock_t
initialization calls where the variables are already defined using
macros that initialize them.
This saves a decent amount of compiled code too:
add/remove: 0/0 grow/shrink: 0/3 up/down: 0/-178 (-178)
function old new delta
target_core_init_configfs 898 850 -48
core_scsi3_emulate_pro_preempt 1742 1683 -59
iscsi_thread_set_init 159 88 -71
Signed-off-by: Roland Dreier <roland@purestorage.com>
Signed-off-by: Nicholas Bellinger <nab@linux-iscsi.org>
Diffstat (limited to 'drivers/target/target_core_configfs.c')
-rw-r--r-- | drivers/target/target_core_configfs.c | 6 |
1 files changed, 2 insertions, 4 deletions
diff --git a/drivers/target/target_core_configfs.c b/drivers/target/target_core_configfs.c index 6e043eeb1db9..0700d3b3d1c0 100644 --- a/drivers/target/target_core_configfs.c +++ b/drivers/target/target_core_configfs.c | |||
@@ -52,8 +52,8 @@ | |||
52 | 52 | ||
53 | extern struct t10_alua_lu_gp *default_lu_gp; | 53 | extern struct t10_alua_lu_gp *default_lu_gp; |
54 | 54 | ||
55 | static struct list_head g_tf_list; | 55 | static LIST_HEAD(g_tf_list); |
56 | static struct mutex g_tf_lock; | 56 | static DEFINE_MUTEX(g_tf_lock); |
57 | 57 | ||
58 | struct target_core_configfs_attribute { | 58 | struct target_core_configfs_attribute { |
59 | struct configfs_attribute attr; | 59 | struct configfs_attribute attr; |
@@ -3117,8 +3117,6 @@ static int __init target_core_init_configfs(void) | |||
3117 | config_group_init(&subsys->su_group); | 3117 | config_group_init(&subsys->su_group); |
3118 | mutex_init(&subsys->su_mutex); | 3118 | mutex_init(&subsys->su_mutex); |
3119 | 3119 | ||
3120 | INIT_LIST_HEAD(&g_tf_list); | ||
3121 | mutex_init(&g_tf_lock); | ||
3122 | ret = init_se_kmem_caches(); | 3120 | ret = init_se_kmem_caches(); |
3123 | if (ret < 0) | 3121 | if (ret < 0) |
3124 | return ret; | 3122 | return ret; |