Skip to content

Commit f214549

Browse files
committed
ipmi: Add an intializer for ipmi_recv_msg struct
Don't hand-initialize the struct here, create a macro to initialize it so new fields added don't get forgotten in places. Signed-off-by: Corey Minyard <cminyard@mvista.com>
1 parent 9824117 commit f214549

3 files changed

Lines changed: 11 additions & 12 deletions

File tree

drivers/char/ipmi/ipmi_poweroff.c

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -95,9 +95,7 @@ static void dummy_recv_free(struct ipmi_recv_msg *msg)
9595
atomic_dec(&dummy_count);
9696
}
9797
static struct ipmi_smi_msg halt_smi_msg = INIT_IPMI_SMI_MSG(dummy_smi_free);
98-
static struct ipmi_recv_msg halt_recv_msg = {
99-
.done = dummy_recv_free
100-
};
98+
static struct ipmi_recv_msg halt_recv_msg = INIT_IPMI_RECV_MSG(dummy_recv_free);
10199

102100

103101
/*

drivers/char/ipmi/ipmi_watchdog.c

Lines changed: 5 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -355,9 +355,7 @@ static void msg_free_recv(struct ipmi_recv_msg *msg)
355355
}
356356
}
357357
static struct ipmi_smi_msg smi_msg = INIT_IPMI_SMI_MSG(msg_free_smi);
358-
static struct ipmi_recv_msg recv_msg = {
359-
.done = msg_free_recv
360-
};
358+
static struct ipmi_recv_msg recv_msg = INIT_IPMI_RECV_MSG(msg_free_recv);
361359

362360
static int __ipmi_set_timeout(struct ipmi_smi_msg *smi_msg,
363361
struct ipmi_recv_msg *recv_msg,
@@ -475,9 +473,8 @@ static void panic_recv_free(struct ipmi_recv_msg *msg)
475473

476474
static struct ipmi_smi_msg panic_halt_heartbeat_smi_msg =
477475
INIT_IPMI_SMI_MSG(panic_smi_free);
478-
static struct ipmi_recv_msg panic_halt_heartbeat_recv_msg = {
479-
.done = panic_recv_free
480-
};
476+
static struct ipmi_recv_msg panic_halt_heartbeat_recv_msg =
477+
INIT_IPMI_RECV_MSG(panic_recv_free);
481478

482479
static void panic_halt_ipmi_heartbeat(void)
483480
{
@@ -515,9 +512,8 @@ static void panic_halt_ipmi_heartbeat(void)
515512

516513
static struct ipmi_smi_msg panic_halt_smi_msg =
517514
INIT_IPMI_SMI_MSG(panic_smi_free);
518-
static struct ipmi_recv_msg panic_halt_recv_msg = {
519-
.done = panic_recv_free
520-
};
515+
static struct ipmi_recv_msg panic_halt_recv_msg =
516+
INIT_IPMI_RECV_MSG(panic_recv_free);
521517

522518
/*
523519
* Special call, doesn't claim any locks. This is only to be called

include/linux/ipmi.h

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -72,6 +72,11 @@ struct ipmi_recv_msg {
7272
unsigned char msg_data[IPMI_MAX_MSG_LENGTH];
7373
};
7474

75+
#define INIT_IPMI_RECV_MSG(done_handler) \
76+
{ \
77+
.done = done_handler \
78+
}
79+
7580
/* Allocate and free the receive message. */
7681
void ipmi_free_recv_msg(struct ipmi_recv_msg *msg);
7782

0 commit comments

Comments
 (0)