From 7e50387bceda4d5542e4ba87097f69071b425fe5 Mon Sep 17 00:00:00 2001 From: Corey Minyard Date: Thu, 9 Oct 2014 07:20:32 -0500 Subject: [PATCH] ipmi: Move the address source to string to ipmi-generic code It was in the system interface driver, but is generic functionality. Signed-off-by: Corey Minyard --- drivers/char/ipmi/ipmi_msghandler.c | 12 ++++++++++++ drivers/char/ipmi/ipmi_si_intf.c | 10 +++------- include/linux/ipmi.h | 1 + 3 files changed, 16 insertions(+), 7 deletions(-) diff --git a/drivers/char/ipmi/ipmi_msghandler.c b/drivers/char/ipmi/ipmi_msghandler.c index f816211f..e5d7c0b 100644 --- a/drivers/char/ipmi/ipmi_msghandler.c +++ b/drivers/char/ipmi/ipmi_msghandler.c @@ -474,6 +474,18 @@ static DEFINE_MUTEX(smi_watchers_mutex); #define ipmi_get_stat(intf, stat) \ ((unsigned int) atomic_read(&(intf)->stats[IPMI_STAT_ ## stat])) +static char *addr_src_to_str[] = { "invalid", "hotmod", "hardcoded", "SPMI", + "ACPI", "SMBIOS", "PCI", + "device-tree", "default" }; + +const char *ipmi_addr_src_to_str(enum ipmi_addr_src src) +{ + if (src > SI_DEFAULT) + src = 0; /* Invalid */ + return addr_src_to_str[src]; +} +EXPORT_SYMBOL(ipmi_addr_src_to_str); + static int is_lan_addr(struct ipmi_addr *addr) { return addr->addr_type == IPMI_LAN_ADDR_TYPE; diff --git a/drivers/char/ipmi/ipmi_si_intf.c b/drivers/char/ipmi/ipmi_si_intf.c index 8747119..337182b 100644 --- a/drivers/char/ipmi/ipmi_si_intf.c +++ b/drivers/char/ipmi/ipmi_si_intf.c @@ -111,10 +111,6 @@ enum si_type { }; static char *si_to_str[] = { "kcs", "smic", "bt" }; -static char *ipmi_addr_src_to_str[] = { NULL, "hotmod", "hardcoded", "SPMI", - "ACPI", "SMBIOS", "PCI", - "device-tree", "default" }; - #define DEVICE_NAME "ipmi_si" static struct platform_driver ipmi_driver; @@ -3279,8 +3275,8 @@ static int add_smi(struct smi_info *new_smi) int rv = 0; printk(KERN_INFO PFX "Adding %s-specified %s state machine", - ipmi_addr_src_to_str[new_smi->addr_source], - si_to_str[new_smi->si_type]); + ipmi_addr_src_to_str(new_smi->addr_source), + si_to_str[new_smi->si_type]); mutex_lock(&smi_infos_lock); if (!is_new_interface(new_smi)) { printk(KERN_CONT " duplicate interface\n"); @@ -3310,7 +3306,7 @@ static int try_smi_init(struct smi_info *new_smi) printk(KERN_INFO PFX "Trying %s-specified %s state" " machine at %s address 0x%lx, slave address 0x%x," " irq %d\n", - ipmi_addr_src_to_str[new_smi->addr_source], + ipmi_addr_src_to_str(new_smi->addr_source), si_to_str[new_smi->si_type], addr_space_to_str[new_smi->io.addr_type], new_smi->io.addr_data, diff --git a/include/linux/ipmi.h b/include/linux/ipmi.h index 76d2acb..47b8f8d 100644 --- a/include/linux/ipmi.h +++ b/include/linux/ipmi.h @@ -278,6 +278,7 @@ enum ipmi_addr_src { SI_INVALID = 0, SI_HOTMOD, SI_HARDCODED, SI_SPMI, SI_ACPI, SI_SMBIOS, SI_PCI, SI_DEVICETREE, SI_DEFAULT }; +const char *ipmi_addr_src_to_str(enum ipmi_addr_src src); union ipmi_smi_info_union { /* -- 2.7.4