Skip to content

Commit bed9759

Browse files
crquanLinus Torvalds
authored andcommitted
drivers/char: use LIST_HEAD instead of LIST_HEAD_INIT
single list_head variable initialized with LIST_HEAD_INIT could almost always can be replaced with LIST_HEAD declaration, this shrinks the code and looks better. Signed-off-by: Denis Cheng <crquan@gmail.com> Cc: Paul Mackerras <paulus@samba.org> Cc: Benjamin Herrenschmidt <benh@kernel.crashing.org> Cc: Corey Minyard <minyard@acm.org> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
1 parent a18b630 commit bed9759

3 files changed

Lines changed: 4 additions & 4 deletions

File tree

‎drivers/char/hvc_console.c‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -93,7 +93,7 @@ struct hvc_struct {
9393
};
9494

9595
/* dynamic list of hvc_struct instances */
96-
static struct list_head hvc_structs = LIST_HEAD_INIT(hvc_structs);
96+
static LIST_HEAD(hvc_structs);
9797

9898
/*
9999
* Protect the list of hvc_struct instances from inserts and removals during

‎drivers/char/hvcs.c‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -306,7 +306,7 @@ struct hvcs_struct {
306306
/* Required to back map a kref to its containing object */
307307
#define from_kref(k) container_of(k, struct hvcs_struct, kref)
308308

309-
static struct list_head hvcs_structs = LIST_HEAD_INIT(hvcs_structs);
309+
static LIST_HEAD(hvcs_structs);
310310
static DEFINE_SPINLOCK(hvcs_structs_lock);
311311

312312
static void hvcs_unthrottle(struct tty_struct *tty);

‎drivers/char/ipmi/ipmi_msghandler.c‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -365,12 +365,12 @@ static struct device_driver ipmidriver = {
365365
};
366366
static DEFINE_MUTEX(ipmidriver_mutex);
367367

368-
static struct list_head ipmi_interfaces = LIST_HEAD_INIT(ipmi_interfaces);
368+
static LIST_HEAD(ipmi_interfaces);
369369
static DEFINE_MUTEX(ipmi_interfaces_mutex);
370370

371371
/* List of watchers that want to know when smi's are added and
372372
deleted. */
373-
static struct list_head smi_watchers = LIST_HEAD_INIT(smi_watchers);
373+
static LIST_HEAD(smi_watchers);
374374
static DEFINE_MUTEX(smi_watchers_mutex);
375375

376376

0 commit comments

Comments
 (0)