Commit 55f91cb6 authored by Corey Minyard's avatar Corey Minyard

ipmi: Make the IPMI proc interface configurable

So we can remove it later.
Signed-off-by: default avatarCorey Minyard <cminyard@mvista.com>
parent ac2673d5
...@@ -22,6 +22,14 @@ config IPMI_DMI_DECODE ...@@ -22,6 +22,14 @@ config IPMI_DMI_DECODE
if IPMI_HANDLER if IPMI_HANDLER
config IPMI_PROC_INTERFACE
bool 'Provide an interface for IPMI stats in /proc (deprecated)'
depends on PROC_FS
default y
help
Do not use this any more, use sysfs for this info. It will be
removed in future kernel versions.
config IPMI_PANIC_EVENT config IPMI_PANIC_EVENT
bool 'Generate a panic event to all BMCs on a panic' bool 'Generate a panic event to all BMCs on a panic'
help help
......
...@@ -132,9 +132,9 @@ module_param_cb(panic_op, &panic_op_ops, NULL, 0600); ...@@ -132,9 +132,9 @@ module_param_cb(panic_op, &panic_op_ops, NULL, 0600);
MODULE_PARM_DESC(panic_op, "Sets if the IPMI driver will attempt to store panic information in the event log in the event of a panic. Set to 'none' for no, 'event' for a single event, or 'string' for a generic event and the panic string in IPMI OEM events."); MODULE_PARM_DESC(panic_op, "Sets if the IPMI driver will attempt to store panic information in the event log in the event of a panic. Set to 'none' for no, 'event' for a single event, or 'string' for a generic event and the panic string in IPMI OEM events.");
#ifdef CONFIG_PROC_FS #ifdef CONFIG_IPMI_PROC_INTERFACE
static struct proc_dir_entry *proc_ipmi_root; static struct proc_dir_entry *proc_ipmi_root;
#endif /* CONFIG_PROC_FS */ #endif /* CONFIG_IPMI_PROC_INTERFACE */
/* Remain in auto-maintenance mode for this amount of time (in ms). */ /* Remain in auto-maintenance mode for this amount of time (in ms). */
#define IPMI_MAINTENANCE_MODE_TIMEOUT 30000 #define IPMI_MAINTENANCE_MODE_TIMEOUT 30000
...@@ -267,7 +267,7 @@ struct ipmi_my_addrinfo { ...@@ -267,7 +267,7 @@ struct ipmi_my_addrinfo {
unsigned char lun; unsigned char lun;
}; };
#ifdef CONFIG_PROC_FS #ifdef CONFIG_IPMI_PROC_INTERFACE
struct ipmi_proc_entry { struct ipmi_proc_entry {
char *name; char *name;
struct ipmi_proc_entry *next; struct ipmi_proc_entry *next;
...@@ -449,10 +449,13 @@ struct ipmi_smi { ...@@ -449,10 +449,13 @@ struct ipmi_smi {
const struct ipmi_smi_handlers *handlers; const struct ipmi_smi_handlers *handlers;
void *send_info; void *send_info;
#ifdef CONFIG_PROC_FS #ifdef CONFIG_IPMI_PROC_INTERFACE
/* A list of proc entries for this interface. */ /* A list of proc entries for this interface. */
struct mutex proc_entry_lock; struct mutex proc_entry_lock;
struct ipmi_proc_entry *proc_entries; struct ipmi_proc_entry *proc_entries;
struct proc_dir_entry *proc_dir;
char proc_dir_name[10];
#endif #endif
/* Driver-model device for the system interface. */ /* Driver-model device for the system interface. */
...@@ -542,10 +545,6 @@ struct ipmi_smi { ...@@ -542,10 +545,6 @@ struct ipmi_smi {
struct ipmi_my_addrinfo addrinfo[IPMI_MAX_CHANNELS]; struct ipmi_my_addrinfo addrinfo[IPMI_MAX_CHANNELS];
bool channels_ready; bool channels_ready;
/* Proc FS stuff. */
struct proc_dir_entry *proc_dir;
char proc_dir_name[10];
atomic_t stats[IPMI_NUM_STATS]; atomic_t stats[IPMI_NUM_STATS];
/* /*
...@@ -2363,7 +2362,7 @@ static int bmc_get_device_id(ipmi_smi_t intf, struct bmc_device *bmc, ...@@ -2363,7 +2362,7 @@ static int bmc_get_device_id(ipmi_smi_t intf, struct bmc_device *bmc,
return __bmc_get_device_id(intf, bmc, id, guid_set, guid, -1); return __bmc_get_device_id(intf, bmc, id, guid_set, guid, -1);
} }
#ifdef CONFIG_PROC_FS #ifdef CONFIG_IPMI_PROC_INTERFACE
static int smi_ipmb_proc_show(struct seq_file *m, void *v) static int smi_ipmb_proc_show(struct seq_file *m, void *v)
{ {
ipmi_smi_t intf = m->private; ipmi_smi_t intf = m->private;
...@@ -2492,14 +2491,12 @@ static const struct file_operations smi_stats_proc_ops = { ...@@ -2492,14 +2491,12 @@ static const struct file_operations smi_stats_proc_ops = {
.llseek = seq_lseek, .llseek = seq_lseek,
.release = single_release, .release = single_release,
}; };
#endif /* CONFIG_PROC_FS */
int ipmi_smi_add_proc_entry(ipmi_smi_t smi, char *name, int ipmi_smi_add_proc_entry(ipmi_smi_t smi, char *name,
const struct file_operations *proc_ops, const struct file_operations *proc_ops,
void *data) void *data)
{ {
int rv = 0; int rv = 0;
#ifdef CONFIG_PROC_FS
struct proc_dir_entry *file; struct proc_dir_entry *file;
struct ipmi_proc_entry *entry; struct ipmi_proc_entry *entry;
...@@ -2525,7 +2522,6 @@ int ipmi_smi_add_proc_entry(ipmi_smi_t smi, char *name, ...@@ -2525,7 +2522,6 @@ int ipmi_smi_add_proc_entry(ipmi_smi_t smi, char *name,
smi->proc_entries = entry; smi->proc_entries = entry;
mutex_unlock(&smi->proc_entry_lock); mutex_unlock(&smi->proc_entry_lock);
} }
#endif /* CONFIG_PROC_FS */
return rv; return rv;
} }
...@@ -2535,7 +2531,6 @@ static int add_proc_entries(ipmi_smi_t smi, int num) ...@@ -2535,7 +2531,6 @@ static int add_proc_entries(ipmi_smi_t smi, int num)
{ {
int rv = 0; int rv = 0;
#ifdef CONFIG_PROC_FS
sprintf(smi->proc_dir_name, "%d", num); sprintf(smi->proc_dir_name, "%d", num);
smi->proc_dir = proc_mkdir(smi->proc_dir_name, proc_ipmi_root); smi->proc_dir = proc_mkdir(smi->proc_dir_name, proc_ipmi_root);
if (!smi->proc_dir) if (!smi->proc_dir)
...@@ -2555,14 +2550,12 @@ static int add_proc_entries(ipmi_smi_t smi, int num) ...@@ -2555,14 +2550,12 @@ static int add_proc_entries(ipmi_smi_t smi, int num)
rv = ipmi_smi_add_proc_entry(smi, "version", rv = ipmi_smi_add_proc_entry(smi, "version",
&smi_version_proc_ops, &smi_version_proc_ops,
smi); smi);
#endif /* CONFIG_PROC_FS */
return rv; return rv;
} }
static void remove_proc_entries(ipmi_smi_t smi) static void remove_proc_entries(ipmi_smi_t smi)
{ {
#ifdef CONFIG_PROC_FS
struct ipmi_proc_entry *entry; struct ipmi_proc_entry *entry;
mutex_lock(&smi->proc_entry_lock); mutex_lock(&smi->proc_entry_lock);
...@@ -2576,8 +2569,8 @@ static void remove_proc_entries(ipmi_smi_t smi) ...@@ -2576,8 +2569,8 @@ static void remove_proc_entries(ipmi_smi_t smi)
} }
mutex_unlock(&smi->proc_entry_lock); mutex_unlock(&smi->proc_entry_lock);
remove_proc_entry(smi->proc_dir_name, proc_ipmi_root); remove_proc_entry(smi->proc_dir_name, proc_ipmi_root);
#endif /* CONFIG_PROC_FS */
} }
#endif /* CONFIG_IPMI_PROC_INTERFACE */
static ssize_t device_id_show(struct device *dev, static ssize_t device_id_show(struct device *dev,
struct device_attribute *attr, struct device_attribute *attr,
...@@ -3419,7 +3412,7 @@ int ipmi_register_smi(const struct ipmi_smi_handlers *handlers, ...@@ -3419,7 +3412,7 @@ int ipmi_register_smi(const struct ipmi_smi_handlers *handlers,
intf->seq_table[j].seqid = 0; intf->seq_table[j].seqid = 0;
} }
intf->curr_seq = 0; intf->curr_seq = 0;
#ifdef CONFIG_PROC_FS #ifdef CONFIG_IPMI_PROC_INTERFACE
mutex_init(&intf->proc_entry_lock); mutex_init(&intf->proc_entry_lock);
#endif #endif
spin_lock_init(&intf->waiting_rcv_msgs_lock); spin_lock_init(&intf->waiting_rcv_msgs_lock);
...@@ -3443,7 +3436,9 @@ int ipmi_register_smi(const struct ipmi_smi_handlers *handlers, ...@@ -3443,7 +3436,9 @@ int ipmi_register_smi(const struct ipmi_smi_handlers *handlers,
for (i = 0; i < IPMI_NUM_STATS; i++) for (i = 0; i < IPMI_NUM_STATS; i++)
atomic_set(&intf->stats[i], 0); atomic_set(&intf->stats[i], 0);
#ifdef CONFIG_IPMI_PROC_INTERFACE
intf->proc_dir = NULL; intf->proc_dir = NULL;
#endif
mutex_lock(&smi_watchers_mutex); mutex_lock(&smi_watchers_mutex);
mutex_lock(&ipmi_interfaces_mutex); mutex_lock(&ipmi_interfaces_mutex);
...@@ -3479,13 +3474,17 @@ int ipmi_register_smi(const struct ipmi_smi_handlers *handlers, ...@@ -3479,13 +3474,17 @@ int ipmi_register_smi(const struct ipmi_smi_handlers *handlers,
if (rv) if (rv)
goto out; goto out;
#ifdef CONFIG_IPMI_PROC_INTERFACE
rv = add_proc_entries(intf, i); rv = add_proc_entries(intf, i);
#endif
out: out:
if (rv) { if (rv) {
ipmi_bmc_unregister(intf); ipmi_bmc_unregister(intf);
#ifdef CONFIG_IPMI_PROC_INTERFACE
if (intf->proc_dir) if (intf->proc_dir)
remove_proc_entries(intf); remove_proc_entries(intf);
#endif
intf->handlers = NULL; intf->handlers = NULL;
list_del_rcu(&intf->link); list_del_rcu(&intf->link);
mutex_unlock(&ipmi_interfaces_mutex); mutex_unlock(&ipmi_interfaces_mutex);
...@@ -3590,7 +3589,9 @@ int ipmi_unregister_smi(ipmi_smi_t intf) ...@@ -3590,7 +3589,9 @@ int ipmi_unregister_smi(ipmi_smi_t intf)
intf->handlers = NULL; intf->handlers = NULL;
mutex_unlock(&ipmi_interfaces_mutex); mutex_unlock(&ipmi_interfaces_mutex);
#ifdef CONFIG_IPMI_PROC_INTERFACE
remove_proc_entries(intf); remove_proc_entries(intf);
#endif
ipmi_bmc_unregister(intf); ipmi_bmc_unregister(intf);
/* /*
...@@ -5170,7 +5171,7 @@ static int ipmi_init_msghandler(void) ...@@ -5170,7 +5171,7 @@ static int ipmi_init_msghandler(void)
printk(KERN_INFO "ipmi message handler version " printk(KERN_INFO "ipmi message handler version "
IPMI_DRIVER_VERSION "\n"); IPMI_DRIVER_VERSION "\n");
#ifdef CONFIG_PROC_FS #ifdef CONFIG_IPMI_PROC_INTERFACE
proc_ipmi_root = proc_mkdir("ipmi", NULL); proc_ipmi_root = proc_mkdir("ipmi", NULL);
if (!proc_ipmi_root) { if (!proc_ipmi_root) {
printk(KERN_ERR PFX "Unable to create IPMI proc dir"); printk(KERN_ERR PFX "Unable to create IPMI proc dir");
...@@ -5178,7 +5179,7 @@ static int ipmi_init_msghandler(void) ...@@ -5178,7 +5179,7 @@ static int ipmi_init_msghandler(void)
return -ENOMEM; return -ENOMEM;
} }
#endif /* CONFIG_PROC_FS */ #endif /* CONFIG_IPMI_PROC_INTERFACE */
setup_timer(&ipmi_timer, ipmi_timeout, 0); setup_timer(&ipmi_timer, ipmi_timeout, 0);
mod_timer(&ipmi_timer, jiffies + IPMI_TIMEOUT_JIFFIES); mod_timer(&ipmi_timer, jiffies + IPMI_TIMEOUT_JIFFIES);
...@@ -5218,9 +5219,9 @@ static void __exit cleanup_ipmi(void) ...@@ -5218,9 +5219,9 @@ static void __exit cleanup_ipmi(void)
atomic_inc(&stop_operation); atomic_inc(&stop_operation);
del_timer_sync(&ipmi_timer); del_timer_sync(&ipmi_timer);
#ifdef CONFIG_PROC_FS #ifdef CONFIG_IPMI_PROC_INTERFACE
proc_remove(proc_ipmi_root); proc_remove(proc_ipmi_root);
#endif /* CONFIG_PROC_FS */ #endif /* CONFIG_IPMI_PROC_INTERFACE */
driver_unregister(&ipmidriver.driver); driver_unregister(&ipmidriver.driver);
......
...@@ -1605,6 +1605,7 @@ static int try_enable_event_buffer(struct smi_info *smi_info) ...@@ -1605,6 +1605,7 @@ static int try_enable_event_buffer(struct smi_info *smi_info)
return rv; return rv;
} }
#ifdef CONFIG_IPMI_PROC_INTERFACE
static int smi_type_proc_show(struct seq_file *m, void *v) static int smi_type_proc_show(struct seq_file *m, void *v)
{ {
struct smi_info *smi = m->private; struct smi_info *smi = m->private;
...@@ -1698,6 +1699,7 @@ static const struct file_operations smi_params_proc_ops = { ...@@ -1698,6 +1699,7 @@ static const struct file_operations smi_params_proc_ops = {
.llseek = seq_lseek, .llseek = seq_lseek,
.release = single_release, .release = single_release,
}; };
#endif
#define IPMI_SI_ATTR(name) \ #define IPMI_SI_ATTR(name) \
static ssize_t ipmi_##name##_show(struct device *dev, \ static ssize_t ipmi_##name##_show(struct device *dev, \
...@@ -2191,6 +2193,7 @@ static int try_smi_init(struct smi_info *new_smi) ...@@ -2191,6 +2193,7 @@ static int try_smi_init(struct smi_info *new_smi)
goto out_err_remove_attrs; goto out_err_remove_attrs;
} }
#ifdef CONFIG_IPMI_PROC_INTERFACE
rv = ipmi_smi_add_proc_entry(new_smi->intf, "type", rv = ipmi_smi_add_proc_entry(new_smi->intf, "type",
&smi_type_proc_ops, &smi_type_proc_ops,
new_smi); new_smi);
...@@ -2217,6 +2220,7 @@ static int try_smi_init(struct smi_info *new_smi) ...@@ -2217,6 +2220,7 @@ static int try_smi_init(struct smi_info *new_smi)
"Unable to create proc entry: %d\n", rv); "Unable to create proc entry: %d\n", rv);
goto out_err_stop_timer; goto out_err_stop_timer;
} }
#endif
/* Don't increment till we know we have succeeded. */ /* Don't increment till we know we have succeeded. */
smi_num++; smi_num++;
......
...@@ -1344,6 +1344,7 @@ static int ssif_detect(struct i2c_client *client, struct i2c_board_info *info) ...@@ -1344,6 +1344,7 @@ static int ssif_detect(struct i2c_client *client, struct i2c_board_info *info)
return rv; return rv;
} }
#ifdef CONFIG_IPMI_PROC_INTERFACE
static int smi_type_proc_show(struct seq_file *m, void *v) static int smi_type_proc_show(struct seq_file *m, void *v)
{ {
seq_puts(m, "ssif\n"); seq_puts(m, "ssif\n");
...@@ -1407,6 +1408,7 @@ static const struct file_operations smi_stats_proc_ops = { ...@@ -1407,6 +1408,7 @@ static const struct file_operations smi_stats_proc_ops = {
.llseek = seq_lseek, .llseek = seq_lseek,
.release = single_release, .release = single_release,
}; };
#endif
static int strcmp_nospace(char *s1, char *s2) static int strcmp_nospace(char *s1, char *s2)
{ {
...@@ -1742,6 +1744,7 @@ static int ssif_probe(struct i2c_client *client, const struct i2c_device_id *id) ...@@ -1742,6 +1744,7 @@ static int ssif_probe(struct i2c_client *client, const struct i2c_device_id *id)
goto out_remove_attr; goto out_remove_attr;
} }
#ifdef CONFIG_IPMI_PROC_INTERFACE
rv = ipmi_smi_add_proc_entry(ssif_info->intf, "type", rv = ipmi_smi_add_proc_entry(ssif_info->intf, "type",
&smi_type_proc_ops, &smi_type_proc_ops,
ssif_info); ssif_info);
...@@ -1757,6 +1760,7 @@ static int ssif_probe(struct i2c_client *client, const struct i2c_device_id *id) ...@@ -1757,6 +1760,7 @@ static int ssif_probe(struct i2c_client *client, const struct i2c_device_id *id)
pr_err(PFX "Unable to create proc entry: %d\n", rv); pr_err(PFX "Unable to create proc entry: %d\n", rv);
goto out_err_unreg; goto out_err_unreg;
} }
#endif
out: out:
if (rv) { if (rv) {
...@@ -1775,8 +1779,10 @@ static int ssif_probe(struct i2c_client *client, const struct i2c_device_id *id) ...@@ -1775,8 +1779,10 @@ static int ssif_probe(struct i2c_client *client, const struct i2c_device_id *id)
kfree(resp); kfree(resp);
return rv; return rv;
#ifdef CONFIG_IPMI_PROC_INTERFACE
out_err_unreg: out_err_unreg:
ipmi_unregister_smi(ssif_info->intf); ipmi_unregister_smi(ssif_info->intf);
#endif
out_remove_attr: out_remove_attr:
device_remove_group(&ssif_info->client->dev, &ipmi_ssif_dev_attr_group); device_remove_group(&ssif_info->client->dev, &ipmi_ssif_dev_attr_group);
......
...@@ -241,11 +241,13 @@ static inline void ipmi_free_smi_msg(struct ipmi_smi_msg *msg) ...@@ -241,11 +241,13 @@ static inline void ipmi_free_smi_msg(struct ipmi_smi_msg *msg)
msg->done(msg); msg->done(msg);
} }
#ifdef CONFIG_IPMI_PROC_INTERFACE
/* Allow the lower layer to add things to the proc filesystem /* Allow the lower layer to add things to the proc filesystem
directory for this interface. Note that the entry will directory for this interface. Note that the entry will
automatically be dstroyed when the interface is destroyed. */ automatically be dstroyed when the interface is destroyed. */
int ipmi_smi_add_proc_entry(ipmi_smi_t smi, char *name, int ipmi_smi_add_proc_entry(ipmi_smi_t smi, char *name,
const struct file_operations *proc_ops, const struct file_operations *proc_ops,
void *data); void *data);
#endif
#endif /* __LINUX_IPMI_SMI_H */ #endif /* __LINUX_IPMI_SMI_H */
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