Commit cddeea3c authored by Alexander Viro's avatar Alexander Viro Committed by Linus Torvalds

[PATCH] impi annotation

drivers/char/ipmi/* annotated, structure shared between kernel and
userland (ioctls) split in two.
ACPI callback in the same code used to have wrong type - it should've been
void (...), not u32 (...).  Fixed.
Signed-off-by: default avatarLinus Torvalds <torvalds@osdl.org>
parent b303d8d3
...@@ -174,7 +174,7 @@ static int handle_send_req(ipmi_user_t user, ...@@ -174,7 +174,7 @@ static int handle_send_req(ipmi_user_t user,
{ {
int rv; int rv;
struct ipmi_addr addr; struct ipmi_addr addr;
unsigned char *msgdata; struct kernel_ipmi_msg msg;
if (req->addr_len > sizeof(struct ipmi_addr)) if (req->addr_len > sizeof(struct ipmi_addr))
return -EINVAL; return -EINVAL;
...@@ -182,8 +182,11 @@ static int handle_send_req(ipmi_user_t user, ...@@ -182,8 +182,11 @@ static int handle_send_req(ipmi_user_t user,
if (copy_from_user(&addr, req->addr, req->addr_len)) if (copy_from_user(&addr, req->addr, req->addr_len))
return -EFAULT; return -EFAULT;
msgdata = kmalloc(IPMI_MAX_MSG_LENGTH, GFP_KERNEL); msg.netfn = req->msg.netfn;
if (!msgdata) msg.cmd = req->msg.cmd;
msg.data_len = req->msg.data_len;
msg.data = kmalloc(IPMI_MAX_MSG_LENGTH, GFP_KERNEL);
if (!msg.data)
return -ENOMEM; return -ENOMEM;
/* From here out we cannot return, we must jump to "out" for /* From here out we cannot return, we must jump to "out" for
...@@ -199,7 +202,7 @@ static int handle_send_req(ipmi_user_t user, ...@@ -199,7 +202,7 @@ static int handle_send_req(ipmi_user_t user,
goto out; goto out;
} }
if (copy_from_user(msgdata, if (copy_from_user(msg.data,
req->msg.data, req->msg.data,
req->msg.data_len)) req->msg.data_len))
{ {
...@@ -207,20 +210,19 @@ static int handle_send_req(ipmi_user_t user, ...@@ -207,20 +210,19 @@ static int handle_send_req(ipmi_user_t user,
goto out; goto out;
} }
} else { } else {
req->msg.data_len = 0; msg.data_len = 0;
} }
req->msg.data = msgdata;
rv = ipmi_request_settime(user, rv = ipmi_request_settime(user,
&addr, &addr,
req->msgid, req->msgid,
&(req->msg), &msg,
NULL, NULL,
0, 0,
retries, retries,
retry_time_ms); retry_time_ms);
out: out:
kfree(msgdata); kfree(msg.data);
return rv; return rv;
} }
......
...@@ -907,7 +907,7 @@ ipmb_checksum(unsigned char *data, int size) ...@@ -907,7 +907,7 @@ ipmb_checksum(unsigned char *data, int size)
} }
static inline void format_ipmb_msg(struct ipmi_smi_msg *smi_msg, static inline void format_ipmb_msg(struct ipmi_smi_msg *smi_msg,
struct ipmi_msg *msg, struct kernel_ipmi_msg *msg,
struct ipmi_ipmb_addr *ipmb_addr, struct ipmi_ipmb_addr *ipmb_addr,
long msgid, long msgid,
unsigned char ipmb_seq, unsigned char ipmb_seq,
...@@ -949,7 +949,7 @@ static inline void format_ipmb_msg(struct ipmi_smi_msg *smi_msg, ...@@ -949,7 +949,7 @@ static inline void format_ipmb_msg(struct ipmi_smi_msg *smi_msg,
} }
static inline void format_lan_msg(struct ipmi_smi_msg *smi_msg, static inline void format_lan_msg(struct ipmi_smi_msg *smi_msg,
struct ipmi_msg *msg, struct kernel_ipmi_msg *msg,
struct ipmi_lan_addr *lan_addr, struct ipmi_lan_addr *lan_addr,
long msgid, long msgid,
unsigned char ipmb_seq, unsigned char ipmb_seq,
...@@ -993,7 +993,7 @@ static inline int i_ipmi_request(ipmi_user_t user, ...@@ -993,7 +993,7 @@ static inline int i_ipmi_request(ipmi_user_t user,
ipmi_smi_t intf, ipmi_smi_t intf,
struct ipmi_addr *addr, struct ipmi_addr *addr,
long msgid, long msgid,
struct ipmi_msg *msg, struct kernel_ipmi_msg *msg,
void *user_msg_data, void *user_msg_data,
void *supplied_smi, void *supplied_smi,
struct ipmi_recv_msg *supplied_recv, struct ipmi_recv_msg *supplied_recv,
...@@ -1335,7 +1335,7 @@ static inline int i_ipmi_request(ipmi_user_t user, ...@@ -1335,7 +1335,7 @@ static inline int i_ipmi_request(ipmi_user_t user,
goto out_err; goto out_err;
} }
#if DEBUG_MSGING #ifdef DEBUG_MSGING
{ {
int m; int m;
for (m=0; m<smi_msg->data_size; m++) for (m=0; m<smi_msg->data_size; m++)
...@@ -1356,7 +1356,7 @@ static inline int i_ipmi_request(ipmi_user_t user, ...@@ -1356,7 +1356,7 @@ static inline int i_ipmi_request(ipmi_user_t user,
int ipmi_request(ipmi_user_t user, int ipmi_request(ipmi_user_t user,
struct ipmi_addr *addr, struct ipmi_addr *addr,
long msgid, long msgid,
struct ipmi_msg *msg, struct kernel_ipmi_msg *msg,
void *user_msg_data, void *user_msg_data,
int priority) int priority)
{ {
...@@ -1376,7 +1376,7 @@ int ipmi_request(ipmi_user_t user, ...@@ -1376,7 +1376,7 @@ int ipmi_request(ipmi_user_t user,
int ipmi_request_settime(ipmi_user_t user, int ipmi_request_settime(ipmi_user_t user,
struct ipmi_addr *addr, struct ipmi_addr *addr,
long msgid, long msgid,
struct ipmi_msg *msg, struct kernel_ipmi_msg *msg,
void *user_msg_data, void *user_msg_data,
int priority, int priority,
int retries, int retries,
...@@ -1399,7 +1399,7 @@ int ipmi_request_settime(ipmi_user_t user, ...@@ -1399,7 +1399,7 @@ int ipmi_request_settime(ipmi_user_t user,
int ipmi_request_supply_msgs(ipmi_user_t user, int ipmi_request_supply_msgs(ipmi_user_t user,
struct ipmi_addr *addr, struct ipmi_addr *addr,
long msgid, long msgid,
struct ipmi_msg *msg, struct kernel_ipmi_msg *msg,
void *user_msg_data, void *user_msg_data,
void *supplied_smi, void *supplied_smi,
struct ipmi_recv_msg *supplied_recv, struct ipmi_recv_msg *supplied_recv,
...@@ -1422,7 +1422,7 @@ int ipmi_request_supply_msgs(ipmi_user_t user, ...@@ -1422,7 +1422,7 @@ int ipmi_request_supply_msgs(ipmi_user_t user,
int ipmi_request_with_source(ipmi_user_t user, int ipmi_request_with_source(ipmi_user_t user,
struct ipmi_addr *addr, struct ipmi_addr *addr,
long msgid, long msgid,
struct ipmi_msg *msg, struct kernel_ipmi_msg *msg,
void *user_msg_data, void *user_msg_data,
int priority, int priority,
unsigned char source_address, unsigned char source_address,
...@@ -1609,7 +1609,7 @@ static void remove_proc_entries(ipmi_smi_t smi) ...@@ -1609,7 +1609,7 @@ static void remove_proc_entries(ipmi_smi_t smi)
static int static int
send_channel_info_cmd(ipmi_smi_t intf, int chan) send_channel_info_cmd(ipmi_smi_t intf, int chan)
{ {
struct ipmi_msg msg; struct kernel_ipmi_msg msg;
unsigned char data[1]; unsigned char data[1];
struct ipmi_system_interface_addr si; struct ipmi_system_interface_addr si;
...@@ -2033,7 +2033,7 @@ static int handle_ipmb_get_msg_cmd(ipmi_smi_t intf, ...@@ -2033,7 +2033,7 @@ static int handle_ipmb_get_msg_cmd(ipmi_smi_t intf,
msg->data[10] = ipmb_checksum(&(msg->data[6]), 4); msg->data[10] = ipmb_checksum(&(msg->data[6]), 4);
msg->data_size = 11; msg->data_size = 11;
#if DEBUG_MSGING #ifdef DEBUG_MSGING
{ {
int m; int m;
printk("Invalid command:"); printk("Invalid command:");
...@@ -2424,7 +2424,7 @@ static int handle_new_recv_msg(ipmi_smi_t intf, ...@@ -2424,7 +2424,7 @@ static int handle_new_recv_msg(ipmi_smi_t intf,
int requeue; int requeue;
int chan; int chan;
#if DEBUG_MSGING #ifdef DEBUG_MSGING
int m; int m;
printk("Recv:"); printk("Recv:");
for (m=0; m<msg->rsp_size; m++) for (m=0; m<msg->rsp_size; m++)
...@@ -2639,7 +2639,7 @@ send_from_recv_msg(ipmi_smi_t intf, struct ipmi_recv_msg *recv_msg, ...@@ -2639,7 +2639,7 @@ send_from_recv_msg(ipmi_smi_t intf, struct ipmi_recv_msg *recv_msg,
MC, which don't get resent. */ MC, which don't get resent. */
intf->handlers->sender(intf->send_info, smi_msg, 0); intf->handlers->sender(intf->send_info, smi_msg, 0);
#if DEBUG_MSGING #ifdef DEBUG_MSGING
{ {
int m; int m;
printk("Resend: "); printk("Resend: ");
...@@ -2873,7 +2873,7 @@ static void device_id_fetcher(ipmi_smi_t intf, struct ipmi_smi_msg *msg) ...@@ -2873,7 +2873,7 @@ static void device_id_fetcher(ipmi_smi_t intf, struct ipmi_smi_msg *msg)
static void send_panic_events(char *str) static void send_panic_events(char *str)
{ {
struct ipmi_msg msg; struct kernel_ipmi_msg msg;
ipmi_smi_t intf; ipmi_smi_t intf;
unsigned char data[16]; unsigned char data[16];
int i; int i;
......
...@@ -1132,7 +1132,7 @@ static int try_init_mem(int intf_num, struct smi_info **new_info) ...@@ -1132,7 +1132,7 @@ static int try_init_mem(int intf_num, struct smi_info **new_info)
static int acpi_failure = 0; static int acpi_failure = 0;
/* For GPE-type interrupts. */ /* For GPE-type interrupts. */
u32 ipmi_acpi_gpe(void *context) void ipmi_acpi_gpe(void *context)
{ {
struct smi_info *smi_info = context; struct smi_info *smi_info = context;
unsigned long flags; unsigned long flags;
...@@ -1156,7 +1156,6 @@ u32 ipmi_acpi_gpe(void *context) ...@@ -1156,7 +1156,6 @@ u32 ipmi_acpi_gpe(void *context)
smi_event_handler(smi_info, 0); smi_event_handler(smi_info, 0);
out: out:
spin_unlock_irqrestore(&(smi_info->si_lock), flags); spin_unlock_irqrestore(&(smi_info->si_lock), flags);
return 0;
} }
static int acpi_gpe_irq_setup(struct smi_info *info) static int acpi_gpe_irq_setup(struct smi_info *info)
......
...@@ -229,7 +229,7 @@ static int i_ipmi_set_timeout(struct ipmi_smi_msg *smi_msg, ...@@ -229,7 +229,7 @@ static int i_ipmi_set_timeout(struct ipmi_smi_msg *smi_msg,
struct ipmi_recv_msg *recv_msg, struct ipmi_recv_msg *recv_msg,
int *send_heartbeat_now) int *send_heartbeat_now)
{ {
struct ipmi_msg msg; struct kernel_ipmi_msg msg;
unsigned char data[6]; unsigned char data[6];
int rv; int rv;
struct ipmi_system_interface_addr addr; struct ipmi_system_interface_addr addr;
...@@ -406,7 +406,7 @@ static struct ipmi_recv_msg panic_halt_heartbeat_recv_msg = ...@@ -406,7 +406,7 @@ static struct ipmi_recv_msg panic_halt_heartbeat_recv_msg =
static int ipmi_heartbeat(void) static int ipmi_heartbeat(void)
{ {
struct ipmi_msg msg; struct kernel_ipmi_msg msg;
int rv; int rv;
struct ipmi_system_interface_addr addr; struct ipmi_system_interface_addr addr;
...@@ -478,7 +478,7 @@ static int ipmi_heartbeat(void) ...@@ -478,7 +478,7 @@ static int ipmi_heartbeat(void)
static void panic_halt_ipmi_heartbeat(void) static void panic_halt_ipmi_heartbeat(void)
{ {
struct ipmi_msg msg; struct kernel_ipmi_msg msg;
struct ipmi_system_interface_addr addr; struct ipmi_system_interface_addr addr;
......
...@@ -155,6 +155,14 @@ struct ipmi_lan_addr ...@@ -155,6 +155,14 @@ struct ipmi_lan_addr
* out). * out).
*/ */
struct ipmi_msg struct ipmi_msg
{
unsigned char netfn;
unsigned char cmd;
unsigned short data_len;
unsigned char __user *data;
};
struct kernel_ipmi_msg
{ {
unsigned char netfn; unsigned char netfn;
unsigned char cmd; unsigned char cmd;
...@@ -223,7 +231,7 @@ struct ipmi_recv_msg ...@@ -223,7 +231,7 @@ struct ipmi_recv_msg
ipmi_user_t user; ipmi_user_t user;
struct ipmi_addr addr; struct ipmi_addr addr;
long msgid; long msgid;
struct ipmi_msg msg; struct kernel_ipmi_msg msg;
/* The user_msg_data is the data supplied when a message was /* The user_msg_data is the data supplied when a message was
sent, if this is a response to a sent message. If this is sent, if this is a response to a sent message. If this is
...@@ -316,7 +324,7 @@ unsigned char ipmi_get_my_LUN(ipmi_user_t user); ...@@ -316,7 +324,7 @@ unsigned char ipmi_get_my_LUN(ipmi_user_t user);
int ipmi_request(ipmi_user_t user, int ipmi_request(ipmi_user_t user,
struct ipmi_addr *addr, struct ipmi_addr *addr,
long msgid, long msgid,
struct ipmi_msg *msg, struct kernel_ipmi_msg *msg,
void *user_msg_data, void *user_msg_data,
int priority); int priority);
...@@ -336,7 +344,7 @@ int ipmi_request(ipmi_user_t user, ...@@ -336,7 +344,7 @@ int ipmi_request(ipmi_user_t user,
int ipmi_request_settime(ipmi_user_t user, int ipmi_request_settime(ipmi_user_t user,
struct ipmi_addr *addr, struct ipmi_addr *addr,
long msgid, long msgid,
struct ipmi_msg *msg, struct kernel_ipmi_msg *msg,
void *user_msg_data, void *user_msg_data,
int priority, int priority,
int max_retries, int max_retries,
...@@ -348,7 +356,7 @@ int ipmi_request_settime(ipmi_user_t user, ...@@ -348,7 +356,7 @@ int ipmi_request_settime(ipmi_user_t user,
int ipmi_request_with_source(ipmi_user_t user, int ipmi_request_with_source(ipmi_user_t user,
struct ipmi_addr *addr, struct ipmi_addr *addr,
long msgid, long msgid,
struct ipmi_msg *msg, struct kernel_ipmi_msg *msg,
void *user_msg_data, void *user_msg_data,
int priority, int priority,
unsigned char source_address, unsigned char source_address,
...@@ -366,7 +374,7 @@ int ipmi_request_with_source(ipmi_user_t user, ...@@ -366,7 +374,7 @@ int ipmi_request_with_source(ipmi_user_t user,
int ipmi_request_supply_msgs(ipmi_user_t user, int ipmi_request_supply_msgs(ipmi_user_t user,
struct ipmi_addr *addr, struct ipmi_addr *addr,
long msgid, long msgid,
struct ipmi_msg *msg, struct kernel_ipmi_msg *msg,
void *user_msg_data, void *user_msg_data,
void *supplied_smi, void *supplied_smi,
struct ipmi_recv_msg *supplied_recv, struct ipmi_recv_msg *supplied_recv,
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment