Skip to content

Commit 3bc54ab

Browse files
committed
ipmi: Rename "user_data" to "recv_msg" in an SMI message
It's only used to hold the corresponding receive message, so fix the name to make that clear and the type so nothing else can be accidentally assigned to it. Signed-off-by: Corey Minyard <corey@minyard.net>
1 parent 9cf93a8 commit 3bc54ab

2 files changed

Lines changed: 15 additions & 14 deletions

File tree

drivers/char/ipmi/ipmi_msghandler.c

Lines changed: 13 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1959,7 +1959,7 @@ static int i_ipmi_req_sysintf(struct ipmi_smi *intf,
19591959
smi_msg->data[0] = (msg->netfn << 2) | (smi_addr->lun & 0x3);
19601960
smi_msg->data[1] = msg->cmd;
19611961
smi_msg->msgid = msgid;
1962-
smi_msg->user_data = recv_msg;
1962+
smi_msg->recv_msg = recv_msg;
19631963
if (msg->data_len > 0)
19641964
memcpy(&smi_msg->data[2], msg->data, msg->data_len);
19651965
smi_msg->data_size = msg->data_len + 2;
@@ -2040,7 +2040,7 @@ static int i_ipmi_req_ipmb(struct ipmi_smi *intf,
20402040
* Save the receive message so we can use it
20412041
* to deliver the response.
20422042
*/
2043-
smi_msg->user_data = recv_msg;
2043+
smi_msg->recv_msg = recv_msg;
20442044
} else {
20452045
mutex_lock(&intf->seq_lock);
20462046

@@ -2153,7 +2153,7 @@ static int i_ipmi_req_ipmb_direct(struct ipmi_smi *intf,
21532153
memcpy(smi_msg->data + 4, msg->data, msg->data_len);
21542154
smi_msg->data_size = msg->data_len + 4;
21552155

2156-
smi_msg->user_data = recv_msg;
2156+
smi_msg->recv_msg = recv_msg;
21572157

21582158
return 0;
21592159
}
@@ -2216,7 +2216,7 @@ static int i_ipmi_req_lan(struct ipmi_smi *intf,
22162216
* Save the receive message so we can use it
22172217
* to deliver the response.
22182218
*/
2219-
smi_msg->user_data = recv_msg;
2219+
smi_msg->recv_msg = recv_msg;
22202220
} else {
22212221
mutex_lock(&intf->seq_lock);
22222222

@@ -4066,7 +4066,7 @@ static int handle_ipmb_direct_rcv_rsp(struct ipmi_smi *intf,
40664066
struct ipmi_recv_msg *recv_msg;
40674067
struct ipmi_ipmb_direct_addr *daddr;
40684068

4069-
recv_msg = msg->user_data;
4069+
recv_msg = msg->recv_msg;
40704070
if (recv_msg == NULL) {
40714071
dev_warn(intf->si_dev,
40724072
"IPMI direct message received with no owner. This could be because of a malformed message, or because of a hardware error. Contact your hardware vendor for assistance.\n");
@@ -4489,7 +4489,7 @@ static int handle_bmc_rsp(struct ipmi_smi *intf,
44894489
struct ipmi_recv_msg *recv_msg;
44904490
struct ipmi_system_interface_addr *smi_addr;
44914491

4492-
recv_msg = msg->user_data;
4492+
recv_msg = msg->recv_msg;
44934493
if (recv_msg == NULL) {
44944494
dev_warn(intf->si_dev,
44954495
"IPMI SMI message received with no owner. This could be because of a malformed message, or because of a hardware error. Contact your hardware vendor for assistance.\n");
@@ -4563,14 +4563,14 @@ static int handle_one_recv_msg(struct ipmi_smi *intf,
45634563
} else if ((msg->data_size >= 2)
45644564
&& (msg->data[0] == (IPMI_NETFN_APP_REQUEST << 2))
45654565
&& (msg->data[1] == IPMI_SEND_MSG_CMD)
4566-
&& (msg->user_data == NULL)) {
4566+
&& (msg->recv_msg == NULL)) {
45674567

45684568
if (intf->in_shutdown || intf->run_to_completion)
45694569
goto out;
45704570

45714571
/*
45724572
* This is the local response to a command send, start
4573-
* the timer for these. The user_data will not be
4573+
* the timer for these. The recv_msg will not be
45744574
* NULL if this is a response send, and we will let
45754575
* response sends just go through.
45764576
*/
@@ -4630,7 +4630,7 @@ static int handle_one_recv_msg(struct ipmi_smi *intf,
46304630
requeue = handle_ipmb_direct_rcv_rsp(intf, msg);
46314631
} else if ((msg->rsp[0] == ((IPMI_NETFN_APP_REQUEST|1) << 2))
46324632
&& (msg->rsp[1] == IPMI_SEND_MSG_CMD)
4633-
&& (msg->user_data != NULL)) {
4633+
&& (msg->recv_msg != NULL)) {
46344634
/*
46354635
* It's a response to a response we sent. For this we
46364636
* deliver a send message response to the user.
@@ -4647,7 +4647,7 @@ static int handle_one_recv_msg(struct ipmi_smi *intf,
46474647
cc = msg->rsp[2];
46484648

46494649
process_response_response:
4650-
recv_msg = msg->user_data;
4650+
recv_msg = msg->recv_msg;
46514651

46524652
requeue = 0;
46534653
if (!recv_msg)
@@ -4836,9 +4836,9 @@ static void smi_work(struct work_struct *t)
48364836
if (newmsg) {
48374837
cc = intf->handlers->sender(intf->send_info, newmsg);
48384838
if (cc) {
4839-
if (newmsg->user_data)
4839+
if (newmsg->recv_msg)
48404840
deliver_err_response(intf,
4841-
newmsg->user_data, cc);
4841+
newmsg->recv_msg, cc);
48424842
else
48434843
ipmi_free_smi_msg(newmsg);
48444844
goto restart;
@@ -5185,7 +5185,7 @@ struct ipmi_smi_msg *ipmi_alloc_smi_msg(void)
51855185
rv = kmalloc(sizeof(struct ipmi_smi_msg), GFP_ATOMIC);
51865186
if (rv) {
51875187
rv->done = free_smi_msg;
5188-
rv->user_data = NULL;
5188+
rv->recv_msg = NULL;
51895189
rv->type = IPMI_SMI_MSG_TYPE_NORMAL;
51905190
atomic_inc(&smi_msg_inuse_count);
51915191
}

include/linux/ipmi_smi.h

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -110,7 +110,8 @@ struct ipmi_smi_msg {
110110
enum ipmi_smi_msg_type type;
111111

112112
long msgid;
113-
void *user_data;
113+
/* Response to this message, will be NULL if not from a user request. */
114+
struct ipmi_recv_msg *recv_msg;
114115

115116
int data_size;
116117
unsigned char data[IPMI_MAX_MSG_LENGTH];

0 commit comments

Comments
 (0)