aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorLABBE Corentin <clabbe.montjoie@gmail.com>2015-11-13 07:31:51 -0500
committerCorey Minyard <cminyard@mvista.com>2016-01-12 16:08:49 -0500
commit99ee67351bedf23fe6b969dd94cc2847b397cd20 (patch)
tree3457af4778120d3fd538aacf20d65f286d11c8ad
parent03891f9c853d5c4473224478a1e03ea00d70ff8d (diff)
ipmi: constify some struct and char arrays
Lots of char arrays could be set as const since they contain only literal char arrays. We could in the same time make const some struct members who are pointer to those const char arrays. Signed-off-by: LABBE Corentin <clabbe.montjoie@gmail.com> Signed-off-by: Corey Minyard <cminyard@mvista.com>
-rw-r--r--drivers/char/ipmi/ipmi_msghandler.c7
-rw-r--r--drivers/char/ipmi/ipmi_si_intf.c27
2 files changed, 20 insertions, 14 deletions
diff --git a/drivers/char/ipmi/ipmi_msghandler.c b/drivers/char/ipmi/ipmi_msghandler.c
index e3536da05c88..94fb407d8561 100644
--- a/drivers/char/ipmi/ipmi_msghandler.c
+++ b/drivers/char/ipmi/ipmi_msghandler.c
@@ -472,9 +472,10 @@ static DEFINE_MUTEX(smi_watchers_mutex);
472#define ipmi_get_stat(intf, stat) \ 472#define ipmi_get_stat(intf, stat) \
473 ((unsigned int) atomic_read(&(intf)->stats[IPMI_STAT_ ## stat])) 473 ((unsigned int) atomic_read(&(intf)->stats[IPMI_STAT_ ## stat]))
474 474
475static char *addr_src_to_str[] = { "invalid", "hotmod", "hardcoded", "SPMI", 475static const char * const addr_src_to_str[] = {
476 "ACPI", "SMBIOS", "PCI", 476 "invalid", "hotmod", "hardcoded", "SPMI", "ACPI", "SMBIOS", "PCI",
477 "device-tree", "default" }; 477 "device-tree", "default"
478};
478 479
479const char *ipmi_addr_src_to_str(enum ipmi_addr_src src) 480const char *ipmi_addr_src_to_str(enum ipmi_addr_src src)
480{ 481{
diff --git a/drivers/char/ipmi/ipmi_si_intf.c b/drivers/char/ipmi/ipmi_si_intf.c
index 4cc72fa017c7..440574de3cb4 100644
--- a/drivers/char/ipmi/ipmi_si_intf.c
+++ b/drivers/char/ipmi/ipmi_si_intf.c
@@ -105,7 +105,8 @@ enum si_intf_state {
105enum si_type { 105enum si_type {
106 SI_KCS, SI_SMIC, SI_BT 106 SI_KCS, SI_SMIC, SI_BT
107}; 107};
108static char *si_to_str[] = { "kcs", "smic", "bt" }; 108
109static const char * const si_to_str[] = { "kcs", "smic", "bt" };
109 110
110#define DEVICE_NAME "ipmi_si" 111#define DEVICE_NAME "ipmi_si"
111 112
@@ -1341,7 +1342,7 @@ static unsigned int num_slave_addrs;
1341 1342
1342#define IPMI_IO_ADDR_SPACE 0 1343#define IPMI_IO_ADDR_SPACE 0
1343#define IPMI_MEM_ADDR_SPACE 1 1344#define IPMI_MEM_ADDR_SPACE 1
1344static char *addr_space_to_str[] = { "i/o", "mem" }; 1345static const char * const addr_space_to_str[] = { "i/o", "mem" };
1345 1346
1346static int hotmod_handler(const char *val, struct kernel_param *kp); 1347static int hotmod_handler(const char *val, struct kernel_param *kp);
1347 1348
@@ -1723,27 +1724,31 @@ static int mem_setup(struct smi_info *info)
1723 */ 1724 */
1724enum hotmod_op { HM_ADD, HM_REMOVE }; 1725enum hotmod_op { HM_ADD, HM_REMOVE };
1725struct hotmod_vals { 1726struct hotmod_vals {
1726 char *name; 1727 const char *name;
1727 int val; 1728 const int val;
1728}; 1729};
1729static struct hotmod_vals hotmod_ops[] = { 1730
1731static const struct hotmod_vals hotmod_ops[] = {
1730 { "add", HM_ADD }, 1732 { "add", HM_ADD },
1731 { "remove", HM_REMOVE }, 1733 { "remove", HM_REMOVE },
1732 { NULL } 1734 { NULL }
1733}; 1735};
1734static struct hotmod_vals hotmod_si[] = { 1736
1737static const struct hotmod_vals hotmod_si[] = {
1735 { "kcs", SI_KCS }, 1738 { "kcs", SI_KCS },
1736 { "smic", SI_SMIC }, 1739 { "smic", SI_SMIC },
1737 { "bt", SI_BT }, 1740 { "bt", SI_BT },
1738 { NULL } 1741 { NULL }
1739}; 1742};
1740static struct hotmod_vals hotmod_as[] = { 1743
1744static const struct hotmod_vals hotmod_as[] = {
1741 { "mem", IPMI_MEM_ADDR_SPACE }, 1745 { "mem", IPMI_MEM_ADDR_SPACE },
1742 { "i/o", IPMI_IO_ADDR_SPACE }, 1746 { "i/o", IPMI_IO_ADDR_SPACE },
1743 { NULL } 1747 { NULL }
1744}; 1748};
1745 1749
1746static int parse_str(struct hotmod_vals *v, int *val, char *name, char **curr) 1750static int parse_str(const struct hotmod_vals *v, int *val, char *name,
1751 char **curr)
1747{ 1752{
1748 char *s; 1753 char *s;
1749 int i; 1754 int i;
@@ -2870,7 +2875,7 @@ static int ipmi_parisc_remove(struct parisc_device *dev)
2870 return 0; 2875 return 0;
2871} 2876}
2872 2877
2873static struct parisc_device_id ipmi_parisc_tbl[] = { 2878static const struct parisc_device_id ipmi_parisc_tbl[] = {
2874 { HPHW_MC, HVERSION_REV_ANY_ID, 0x004, 0xC0 }, 2879 { HPHW_MC, HVERSION_REV_ANY_ID, 0x004, 0xC0 },
2875 { 0, } 2880 { 0, }
2876}; 2881};
@@ -3444,8 +3449,8 @@ static inline void wait_for_timer_and_thread(struct smi_info *smi_info)
3444 3449
3445static const struct ipmi_default_vals 3450static const struct ipmi_default_vals
3446{ 3451{
3447 int type; 3452 const int type;
3448 int port; 3453 const int port;
3449} ipmi_defaults[] = 3454} ipmi_defaults[] =
3450{ 3455{
3451 { .type = SI_KCS, .port = 0xca2 }, 3456 { .type = SI_KCS, .port = 0xca2 },