Commit 4bf76b4a authored by Corey Minyard's avatar Corey Minyard Committed by Linus Torvalds

[PATCH] Cleanups for the IPMI driver

This patch removes some unneeded cruft that Adrian found, and also turns
off the shutdown of the timer when removing the module.  Since the timer is
shutdown when the driver is closed (unless no way out is specified) this is
unnecessary and defeats the no way out option.

- remove some completely unused code
- make some needlessly global code static
- removal of some EXPORT_SYMBOL'ed code with zero users.
- Removal of the timer shutdown on module removal
Signed-off-by: default avatarAdrian Bunk <bunk@stusta.de>
Signed-off-by: default avatarCorey Minyard <minyard@acm.org>
Signed-off-by: default avatarAndrew Morton <akpm@osdl.org>
Signed-off-by: default avatarLinus Torvalds <torvalds@osdl.org>
parent eb8c6834
......@@ -49,7 +49,7 @@
#define PFX "IPMI message handler: "
#define IPMI_MSGHANDLER_VERSION "v33"
struct ipmi_recv_msg *ipmi_alloc_recv_msg(void);
static struct ipmi_recv_msg *ipmi_alloc_recv_msg(void);
static int ipmi_init_msghandler(void);
static int initialized = 0;
......@@ -294,44 +294,6 @@ struct ipmi_smi
unsigned int events;
};
int
ipmi_register_all_cmd_rcvr(ipmi_user_t user)
{
unsigned long flags;
int rv = -EBUSY;
write_lock_irqsave(&(user->intf->users_lock), flags);
write_lock(&(user->intf->cmd_rcvr_lock));
if ((user->intf->all_cmd_rcvr == NULL)
&& (list_empty(&(user->intf->cmd_rcvrs))))
{
user->intf->all_cmd_rcvr = user;
rv = 0;
}
write_unlock(&(user->intf->cmd_rcvr_lock));
write_unlock_irqrestore(&(user->intf->users_lock), flags);
return rv;
}
int
ipmi_unregister_all_cmd_rcvr(ipmi_user_t user)
{
unsigned long flags;
int rv = -EINVAL;
write_lock_irqsave(&(user->intf->users_lock), flags);
write_lock(&(user->intf->cmd_rcvr_lock));
if (user->intf->all_cmd_rcvr == user)
{
user->intf->all_cmd_rcvr = NULL;
rv = 0;
}
write_unlock(&(user->intf->cmd_rcvr_lock));
write_unlock_irqrestore(&(user->intf->users_lock), flags);
return rv;
}
#define MAX_IPMI_INTERFACES 4
static ipmi_smi_t ipmi_interfaces[MAX_IPMI_INTERFACES];
......@@ -389,7 +351,7 @@ call_smi_watchers(int i)
up_read(&smi_watchers_sem);
}
int
static int
ipmi_addr_equal(struct ipmi_addr *addr1, struct ipmi_addr *addr2)
{
if (addr1->addr_type != addr2->addr_type)
......@@ -1360,26 +1322,6 @@ static inline int i_ipmi_request(ipmi_user_t user,
return rv;
}
int ipmi_request(ipmi_user_t user,
struct ipmi_addr *addr,
long msgid,
struct kernel_ipmi_msg *msg,
void *user_msg_data,
int priority)
{
return i_ipmi_request(user,
user->intf,
addr,
msgid,
msg,
user_msg_data,
NULL, NULL,
priority,
user->intf->my_address,
user->intf->my_lun,
-1, 0);
}
int ipmi_request_settime(ipmi_user_t user,
struct ipmi_addr *addr,
long msgid,
......@@ -1426,28 +1368,6 @@ int ipmi_request_supply_msgs(ipmi_user_t user,
-1, 0);
}
int ipmi_request_with_source(ipmi_user_t user,
struct ipmi_addr *addr,
long msgid,
struct kernel_ipmi_msg *msg,
void *user_msg_data,
int priority,
unsigned char source_address,
unsigned char source_lun)
{
return i_ipmi_request(user,
user->intf,
addr,
msgid,
msg,
user_msg_data,
NULL, NULL,
priority,
source_address,
source_lun,
-1, 0);
}
static int ipmb_file_read_proc(char *page, char **start, off_t off,
int count, int *eof, void *data)
{
......@@ -1702,14 +1622,6 @@ channel_handler(ipmi_smi_t intf, struct ipmi_smi_msg *msg)
return;
}
void ipmi_poll_interface(ipmi_user_t user)
{
ipmi_smi_t intf = user->intf;
if (intf->handlers->poll)
intf->handlers->poll(intf->send_info);
}
int ipmi_register_smi(struct ipmi_smi_handlers *handlers,
void *send_info,
unsigned char version_major,
......@@ -3211,15 +3123,11 @@ module_exit(cleanup_ipmi);
module_init(ipmi_init_msghandler_mod);
MODULE_LICENSE("GPL");
EXPORT_SYMBOL(ipmi_alloc_recv_msg);
EXPORT_SYMBOL(ipmi_create_user);
EXPORT_SYMBOL(ipmi_destroy_user);
EXPORT_SYMBOL(ipmi_get_version);
EXPORT_SYMBOL(ipmi_request);
EXPORT_SYMBOL(ipmi_request_settime);
EXPORT_SYMBOL(ipmi_request_supply_msgs);
EXPORT_SYMBOL(ipmi_request_with_source);
EXPORT_SYMBOL(ipmi_poll_interface);
EXPORT_SYMBOL(ipmi_register_smi);
EXPORT_SYMBOL(ipmi_unregister_smi);
EXPORT_SYMBOL(ipmi_register_for_cmd);
......@@ -3227,12 +3135,9 @@ EXPORT_SYMBOL(ipmi_unregister_for_cmd);
EXPORT_SYMBOL(ipmi_smi_msg_received);
EXPORT_SYMBOL(ipmi_smi_watchdog_pretimeout);
EXPORT_SYMBOL(ipmi_alloc_smi_msg);
EXPORT_SYMBOL(ipmi_register_all_cmd_rcvr);
EXPORT_SYMBOL(ipmi_unregister_all_cmd_rcvr);
EXPORT_SYMBOL(ipmi_addr_length);
EXPORT_SYMBOL(ipmi_validate_addr);
EXPORT_SYMBOL(ipmi_set_gets_events);
EXPORT_SYMBOL(ipmi_addr_equal);
EXPORT_SYMBOL(ipmi_smi_watcher_register);
EXPORT_SYMBOL(ipmi_smi_watcher_unregister);
EXPORT_SYMBOL(ipmi_set_my_address);
......
......@@ -45,9 +45,9 @@
extern void (*pm_power_off)(void);
/* Stuff from the get device id command. */
unsigned int mfg_id;
unsigned int prod_id;
unsigned char capabilities;
static unsigned int mfg_id;
static unsigned int prod_id;
static unsigned char capabilities;
/* We use our own messages for this operation, we don't let the system
allocate them, since we may be in a panic situation. The whole
......
......@@ -1331,7 +1331,7 @@ static int try_init_mem(int intf_num, struct smi_info **new_info)
static int acpi_failure = 0;
/* For GPE-type interrupts. */
u32 ipmi_acpi_gpe(void *context)
static u32 ipmi_acpi_gpe(void *context)
{
struct smi_info *smi_info = context;
unsigned long flags;
......@@ -2253,7 +2253,7 @@ static __init int init_ipmi_si(void)
}
module_init(init_ipmi_si);
void __exit cleanup_one_si(struct smi_info *to_clean)
static void __exit cleanup_one_si(struct smi_info *to_clean)
{
int rv;
unsigned long flags;
......
......@@ -366,20 +366,6 @@ static void panic_halt_ipmi_set_timeout(void)
}
}
/* Do a delayed shutdown, with the delay in milliseconds. If power_off is
false, do a reset. If power_off is true, do a power down. This is
primarily for the IMB code's shutdown. */
void ipmi_delayed_shutdown(long delay, int power_off)
{
ipmi_ignore_heartbeat = 1;
if (power_off)
ipmi_watchdog_state = WDOG_TIMEOUT_POWER_DOWN;
else
ipmi_watchdog_state = WDOG_TIMEOUT_RESET;
timeout = delay;
ipmi_set_timeout(IPMI_SET_TIMEOUT_HB_IF_NECESSARY);
}
/* We use a semaphore to make sure that only one thing can send a
heartbeat at one time, because we only have one copy of the data.
The semaphore is claimed when the set_timeout is sent and freed
......@@ -1054,10 +1040,6 @@ static __exit void ipmi_unregister_watchdog(void)
/* Make sure no one can call us any more. */
misc_deregister(&ipmi_wdog_miscdev);
/* Disable the timer. */
ipmi_watchdog_state = WDOG_TIMEOUT_NONE;
ipmi_set_timeout(IPMI_SET_TIMEOUT_NO_HB);
/* Wait to make sure the message makes it out. The lower layer has
pointers to our buffers, we want to make sure they are done before
we release our memory. */
......@@ -1084,8 +1066,5 @@ static void __exit ipmi_wdog_exit(void)
ipmi_unregister_watchdog();
}
module_exit(ipmi_wdog_exit);
EXPORT_SYMBOL(ipmi_delayed_shutdown);
module_init(ipmi_wdog_init);
MODULE_LICENSE("GPL");
......@@ -253,7 +253,6 @@ static inline void ipmi_free_recv_msg(struct ipmi_recv_msg *msg)
{
msg->done(msg);
}
struct ipmi_recv_msg *ipmi_alloc_recv_msg(void);
struct ipmi_user_hndl
{
......@@ -302,32 +301,6 @@ void ipmi_set_my_LUN(ipmi_user_t user,
unsigned char LUN);
unsigned char ipmi_get_my_LUN(ipmi_user_t user);
/*
* Send a command request from the given user. The address is the
* proper address for the channel type. If this is a command, then
* the message response comes back, the receive handler for this user
* will be called with the given msgid value in the recv msg. If this
* is a response to a command, then the msgid will be used as the
* sequence number for the response (truncated if necessary), so when
* sending a response you should use the sequence number you received
* in the msgid field of the received command. If the priority is >
* 0, the message will go into a high-priority queue and be sent
* first. Otherwise, it goes into a normal-priority queue.
* The user_msg_data field will be returned in any response to this
* message.
*
* Note that if you send a response (with the netfn lower bit set),
* you *will* get back a SEND_MSG response telling you what happened
* when the response was sent. You will not get back a response to
* the message itself.
*/
int ipmi_request(ipmi_user_t user,
struct ipmi_addr *addr,
long msgid,
struct kernel_ipmi_msg *msg,
void *user_msg_data,
int priority);
/*
* Like ipmi_request, but lets you specify the number of retries and
* the retry time. The retries is the number of times the message
......@@ -350,18 +323,6 @@ int ipmi_request_settime(ipmi_user_t user,
int max_retries,
unsigned int retry_time_ms);
/*
* Like ipmi_request, but lets you specify the slave return address.
*/
int ipmi_request_with_source(ipmi_user_t user,
struct ipmi_addr *addr,
long msgid,
struct kernel_ipmi_msg *msg,
void *user_msg_data,
int priority,
unsigned char source_address,
unsigned char source_lun);
/*
* Like ipmi_request, but with messages supplied. This will not
* allocate any memory, and the messages may be statically allocated
......@@ -380,16 +341,6 @@ int ipmi_request_supply_msgs(ipmi_user_t user,
struct ipmi_recv_msg *supplied_recv,
int priority);
/*
* Do polling on the IPMI interface the user is attached to. This
* causes the IPMI code to do an immediate check for information from
* the driver and handle anything that is immediately pending. This
* will not block in anyway. This is useful if you need to implement
* polling from the user like you need to send periodic watchdog pings
* from a crash dump, or something like that.
*/
void ipmi_poll_interface(ipmi_user_t user);
/*
* When commands come in to the SMS, the user can register to receive
* them. Only one user can be listening on a specific netfn/cmd pair
......@@ -419,17 +370,6 @@ void ipmi_user_set_run_to_completion(ipmi_user_t user, int val);
*/
int ipmi_set_gets_events(ipmi_user_t user, int val);
/*
* Register the given user to handle all received IPMI commands. This
* will fail if anyone is registered as a command receiver or if
* another is already registered to receive all commands. NOTE THAT
* THIS IS FOR EMULATION USERS ONLY, DO NOT USER THIS FOR NORMAL
* STUFF.
*/
int ipmi_register_all_cmd_rcvr(ipmi_user_t user);
int ipmi_unregister_all_cmd_rcvr(ipmi_user_t user);
/*
* Called when a new SMI is registered. This will also be called on
* every existing interface when a new watcher is registered with
......@@ -463,9 +403,6 @@ unsigned int ipmi_addr_length(int addr_type);
/* Validate that the given IPMI address is valid. */
int ipmi_validate_addr(struct ipmi_addr *addr, int len);
/* Return 1 if the given addresses are equal, 0 if not. */
int ipmi_addr_equal(struct ipmi_addr *addr1, struct ipmi_addr *addr2);
#endif /* __KERNEL__ */
......
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