aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/char
diff options
context:
space:
mode:
authorMatthew Garrett <mjg@redhat.com>2010-05-26 17:43:45 -0400
committerLinus Torvalds <torvalds@linux-foundation.org>2010-05-27 12:12:49 -0400
commit5fedc4a282f0c6f5be5e4bebc8840f6022153bb3 (patch)
treecdbfc893d5c98b106e22f7f0c3f81ea1b9023bcc /drivers/char
parent4de85cd6d6018825e19f76f1208775f23ecc393f (diff)
ipmi: change addr_source to an enum rather than strings
Switch from a char* to an enum to identify the address source of SIs, making it easier to handle them appropriately during registration. Signed-off-by: Matthew Garrett <mjg@redhat.com> Signed-off-by: Corey Minyard <cminyard@mvista.com> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Diffstat (limited to 'drivers/char')
-rw-r--r--drivers/char/ipmi/ipmi_si_intf.c44
1 files changed, 25 insertions, 19 deletions
diff --git a/drivers/char/ipmi/ipmi_si_intf.c b/drivers/char/ipmi/ipmi_si_intf.c
index 47ffe4a90a95..93ab75887fbf 100644
--- a/drivers/char/ipmi/ipmi_si_intf.c
+++ b/drivers/char/ipmi/ipmi_si_intf.c
@@ -107,6 +107,14 @@ enum si_type {
107}; 107};
108static char *si_to_str[] = { "kcs", "smic", "bt" }; 108static char *si_to_str[] = { "kcs", "smic", "bt" };
109 109
110enum ipmi_addr_src {
111 SI_INVALID = 0, SI_HOTMOD, SI_HARDCODED, SI_SPMI, SI_ACPI, SI_SMBIOS,
112 SI_PCI, SI_DEVICETREE, SI_DEFAULT
113};
114static char *ipmi_addr_src_to_str[] = { NULL, "hotmod", "hardcoded", "SPMI",
115 "ACPI", "SMBIOS", "PCI",
116 "device-tree", "default" };
117
110#define DEVICE_NAME "ipmi_si" 118#define DEVICE_NAME "ipmi_si"
111 119
112static struct platform_driver ipmi_driver = { 120static struct platform_driver ipmi_driver = {
@@ -188,7 +196,7 @@ struct smi_info {
188 int (*irq_setup)(struct smi_info *info); 196 int (*irq_setup)(struct smi_info *info);
189 void (*irq_cleanup)(struct smi_info *info); 197 void (*irq_cleanup)(struct smi_info *info);
190 unsigned int io_size; 198 unsigned int io_size;
191 char *addr_source; /* ACPI, PCI, SMBIOS, hardcode, default. */ 199 enum ipmi_addr_src addr_source; /* ACPI, PCI, SMBIOS, hardcode, etc. */
192 void (*addr_source_cleanup)(struct smi_info *info); 200 void (*addr_source_cleanup)(struct smi_info *info);
193 void *addr_source_data; 201 void *addr_source_data;
194 202
@@ -1755,7 +1763,7 @@ static int hotmod_handler(const char *val, struct kernel_param *kp)
1755 goto out; 1763 goto out;
1756 } 1764 }
1757 1765
1758 info->addr_source = "hotmod"; 1766 info->addr_source = SI_HOTMOD;
1759 info->si_type = si_type; 1767 info->si_type = si_type;
1760 info->io.addr_data = addr; 1768 info->io.addr_data = addr;
1761 info->io.addr_type = addr_space; 1769 info->io.addr_type = addr_space;
@@ -1813,7 +1821,7 @@ static __devinit void hardcode_find_bmc(void)
1813 if (!info) 1821 if (!info)
1814 return; 1822 return;
1815 1823
1816 info->addr_source = "hardcoded"; 1824 info->addr_source = SI_HARDCODED;
1817 1825
1818 if (!si_type[i] || strcmp(si_type[i], "kcs") == 0) { 1826 if (!si_type[i] || strcmp(si_type[i], "kcs") == 0) {
1819 info->si_type = SI_KCS; 1827 info->si_type = SI_KCS;
@@ -2004,7 +2012,7 @@ static __devinit int try_init_spmi(struct SPMITable *spmi)
2004 return -ENOMEM; 2012 return -ENOMEM;
2005 } 2013 }
2006 2014
2007 info->addr_source = "SPMI"; 2015 info->addr_source = SI_SPMI;
2008 2016
2009 /* Figure out the interface type. */ 2017 /* Figure out the interface type. */
2010 switch (spmi->InterfaceType) { 2018 switch (spmi->InterfaceType) {
@@ -2105,7 +2113,7 @@ static int __devinit ipmi_pnp_probe(struct pnp_dev *dev,
2105 if (!info) 2113 if (!info)
2106 return -ENOMEM; 2114 return -ENOMEM;
2107 2115
2108 info->addr_source = "ACPI"; 2116 info->addr_source = SI_ACPI;
2109 2117
2110 handle = acpi_dev->handle; 2118 handle = acpi_dev->handle;
2111 2119
@@ -2269,7 +2277,7 @@ static __devinit void try_init_dmi(struct dmi_ipmi_data *ipmi_data)
2269 return; 2277 return;
2270 } 2278 }
2271 2279
2272 info->addr_source = "SMBIOS"; 2280 info->addr_source = SI_SMBIOS;
2273 2281
2274 switch (ipmi_data->type) { 2282 switch (ipmi_data->type) {
2275 case 0x01: /* KCS */ 2283 case 0x01: /* KCS */
@@ -2368,7 +2376,7 @@ static int __devinit ipmi_pci_probe(struct pci_dev *pdev,
2368 if (!info) 2376 if (!info)
2369 return -ENOMEM; 2377 return -ENOMEM;
2370 2378
2371 info->addr_source = "PCI"; 2379 info->addr_source = SI_PCI;
2372 2380
2373 switch (class_type) { 2381 switch (class_type) {
2374 case PCI_ERMC_CLASSCODE_TYPE_SMIC: 2382 case PCI_ERMC_CLASSCODE_TYPE_SMIC:
@@ -2508,7 +2516,7 @@ static int __devinit ipmi_of_probe(struct of_device *dev,
2508 } 2516 }
2509 2517
2510 info->si_type = (enum si_type) match->data; 2518 info->si_type = (enum si_type) match->data;
2511 info->addr_source = "device-tree"; 2519 info->addr_source = SI_DEVICETREE;
2512 info->irq_setup = std_irq_setup; 2520 info->irq_setup = std_irq_setup;
2513 2521
2514 if (resource.flags & IORESOURCE_IO) { 2522 if (resource.flags & IORESOURCE_IO) {
@@ -2951,7 +2959,7 @@ static __devinit void default_find_bmc(void)
2951 if (!info) 2959 if (!info)
2952 return; 2960 return;
2953 2961
2954 info->addr_source = NULL; 2962 info->addr_source = SI_DEFAULT;
2955 2963
2956 info->si_type = ipmi_defaults[i].type; 2964 info->si_type = ipmi_defaults[i].type;
2957 info->io_setup = port_setup; 2965 info->io_setup = port_setup;
@@ -2994,16 +3002,14 @@ static int try_smi_init(struct smi_info *new_smi)
2994 int rv; 3002 int rv;
2995 int i; 3003 int i;
2996 3004
2997 if (new_smi->addr_source) { 3005 printk(KERN_INFO "ipmi_si: Trying %s-specified %s state"
2998 printk(KERN_INFO "ipmi_si: Trying %s-specified %s state" 3006 " machine at %s address 0x%lx, slave address 0x%x,"
2999 " machine at %s address 0x%lx, slave address 0x%x," 3007 " irq %d\n",
3000 " irq %d\n", 3008 ipmi_addr_src_to_str[new_smi->addr_source],
3001 new_smi->addr_source, 3009 si_to_str[new_smi->si_type],
3002 si_to_str[new_smi->si_type], 3010 addr_space_to_str[new_smi->io.addr_type],
3003 addr_space_to_str[new_smi->io.addr_type], 3011 new_smi->io.addr_data,
3004 new_smi->io.addr_data, 3012 new_smi->slave_addr, new_smi->irq);
3005 new_smi->slave_addr, new_smi->irq);
3006 }
3007 3013
3008 mutex_lock(&smi_infos_lock); 3014 mutex_lock(&smi_infos_lock);
3009 if (!is_new_interface(new_smi)) { 3015 if (!is_new_interface(new_smi)) {