ipmi: Add an intializer for ipmi_recv_msg struct
authorCorey Minyard <cminyard@mvista.com>
Tue, 12 Apr 2022 20:49:47 +0000 (15:49 -0500)
committerCorey Minyard <cminyard@mvista.com>
Thu, 12 May 2022 15:00:03 +0000 (10:00 -0500)
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>
drivers/char/ipmi/ipmi_poweroff.c
drivers/char/ipmi/ipmi_watchdog.c
include/linux/ipmi.h

index 62e71c46ac5f72576f2cab9123516a3c70377cc8..163ec9749e557c67ef95a3a6c293d286ea026314 100644 (file)
@@ -95,9 +95,7 @@ static void dummy_recv_free(struct ipmi_recv_msg *msg)
        atomic_dec(&dummy_count);
 }
 static struct ipmi_smi_msg halt_smi_msg = INIT_IPMI_SMI_MSG(dummy_smi_free);
-static struct ipmi_recv_msg halt_recv_msg = {
-       .done = dummy_recv_free
-};
+static struct ipmi_recv_msg halt_recv_msg = INIT_IPMI_RECV_MSG(dummy_recv_free);
 
 
 /*
index 4c1e9663ea479aba5907cf9b11ca8901ce5d688a..5b4e677929cabaaa8256e34427226941b581f1fd 100644 (file)
@@ -355,9 +355,7 @@ static void msg_free_recv(struct ipmi_recv_msg *msg)
        }
 }
 static struct ipmi_smi_msg smi_msg = INIT_IPMI_SMI_MSG(msg_free_smi);
-static struct ipmi_recv_msg recv_msg = {
-       .done = msg_free_recv
-};
+static struct ipmi_recv_msg recv_msg = INIT_IPMI_RECV_MSG(msg_free_recv);
 
 static int __ipmi_set_timeout(struct ipmi_smi_msg  *smi_msg,
                              struct ipmi_recv_msg *recv_msg,
@@ -475,9 +473,8 @@ static void panic_recv_free(struct ipmi_recv_msg *msg)
 
 static struct ipmi_smi_msg panic_halt_heartbeat_smi_msg =
        INIT_IPMI_SMI_MSG(panic_smi_free);
-static struct ipmi_recv_msg panic_halt_heartbeat_recv_msg = {
-       .done = panic_recv_free
-};
+static struct ipmi_recv_msg panic_halt_heartbeat_recv_msg =
+       INIT_IPMI_RECV_MSG(panic_recv_free);
 
 static void panic_halt_ipmi_heartbeat(void)
 {
@@ -515,9 +512,8 @@ static void panic_halt_ipmi_heartbeat(void)
 
 static struct ipmi_smi_msg panic_halt_smi_msg =
        INIT_IPMI_SMI_MSG(panic_smi_free);
-static struct ipmi_recv_msg panic_halt_recv_msg = {
-       .done = panic_recv_free
-};
+static struct ipmi_recv_msg panic_halt_recv_msg =
+       INIT_IPMI_RECV_MSG(panic_recv_free);
 
 /*
  * Special call, doesn't claim any locks.  This is only to be called
index 163831a087ef1c8a1c411dc037e10a532217cdb9..a1c9c0d48ebf65248f161a5e39ee065d4e929910 100644 (file)
@@ -72,6 +72,11 @@ struct ipmi_recv_msg {
        unsigned char   msg_data[IPMI_MAX_MSG_LENGTH];
 };
 
+#define INIT_IPMI_RECV_MSG(done_handler) \
+{                                      \
+       .done = done_handler            \
+}
+
 /* Allocate and free the receive message. */
 void ipmi_free_recv_msg(struct ipmi_recv_msg *msg);