diff options
author | Corey Minyard <cminyard@mvista.com> | 2015-06-13 11:34:25 -0400 |
---|---|---|
committer | Corey Minyard <cminyard@mvista.com> | 2015-09-03 16:02:27 -0400 |
commit | 81d02b7f8c507f06299476a0e5b2aa677c5eaecb (patch) | |
tree | 4c29fc370d9ebdcd853f835013195a158193410d | |
parent | 5186cf9c74034a4a7856de9c8048493be34c457d (diff) |
ipmi: Make some data const that was only read
Several data structures were only used for reading, so make them
const.
Signed-off-by: Corey Minyard <cminyard@mvista.com>
-rw-r--r-- | drivers/char/ipmi/ipmi_bt_sm.c | 2 | ||||
-rw-r--r-- | drivers/char/ipmi/ipmi_kcs_sm.c | 2 | ||||
-rw-r--r-- | drivers/char/ipmi/ipmi_msghandler.c | 12 | ||||
-rw-r--r-- | drivers/char/ipmi/ipmi_si_intf.c | 47 | ||||
-rw-r--r-- | drivers/char/ipmi/ipmi_si_sm.h | 10 | ||||
-rw-r--r-- | drivers/char/ipmi/ipmi_smic_sm.c | 2 | ||||
-rw-r--r-- | include/linux/ipmi_smi.h | 2 |
7 files changed, 40 insertions, 37 deletions
diff --git a/drivers/char/ipmi/ipmi_bt_sm.c b/drivers/char/ipmi/ipmi_bt_sm.c index 61e71616689b..feafdab734ae 100644 --- a/drivers/char/ipmi/ipmi_bt_sm.c +++ b/drivers/char/ipmi/ipmi_bt_sm.c | |||
@@ -694,7 +694,7 @@ static int bt_size(void) | |||
694 | return sizeof(struct si_sm_data); | 694 | return sizeof(struct si_sm_data); |
695 | } | 695 | } |
696 | 696 | ||
697 | struct si_sm_handlers bt_smi_handlers = { | 697 | const struct si_sm_handlers bt_smi_handlers = { |
698 | .init_data = bt_init_data, | 698 | .init_data = bt_init_data, |
699 | .start_transaction = bt_start_transaction, | 699 | .start_transaction = bt_start_transaction, |
700 | .get_result = bt_get_result, | 700 | .get_result = bt_get_result, |
diff --git a/drivers/char/ipmi/ipmi_kcs_sm.c b/drivers/char/ipmi/ipmi_kcs_sm.c index 8c25f596808a..1da61af7f576 100644 --- a/drivers/char/ipmi/ipmi_kcs_sm.c +++ b/drivers/char/ipmi/ipmi_kcs_sm.c | |||
@@ -540,7 +540,7 @@ static void kcs_cleanup(struct si_sm_data *kcs) | |||
540 | { | 540 | { |
541 | } | 541 | } |
542 | 542 | ||
543 | struct si_sm_handlers kcs_smi_handlers = { | 543 | const struct si_sm_handlers kcs_smi_handlers = { |
544 | .init_data = init_kcs_data, | 544 | .init_data = init_kcs_data, |
545 | .start_transaction = start_kcs_transaction, | 545 | .start_transaction = start_kcs_transaction, |
546 | .get_result = get_kcs_result, | 546 | .get_result = get_kcs_result, |
diff --git a/drivers/char/ipmi/ipmi_msghandler.c b/drivers/char/ipmi/ipmi_msghandler.c index ef4a418f630a..e9ea29c4ec60 100644 --- a/drivers/char/ipmi/ipmi_msghandler.c +++ b/drivers/char/ipmi/ipmi_msghandler.c | |||
@@ -342,7 +342,7 @@ struct ipmi_smi { | |||
342 | * an umpreemptible region to use this. You must fetch the | 342 | * an umpreemptible region to use this. You must fetch the |
343 | * value into a local variable and make sure it is not NULL. | 343 | * value into a local variable and make sure it is not NULL. |
344 | */ | 344 | */ |
345 | struct ipmi_smi_handlers *handlers; | 345 | const struct ipmi_smi_handlers *handlers; |
346 | void *send_info; | 346 | void *send_info; |
347 | 347 | ||
348 | #ifdef CONFIG_PROC_FS | 348 | #ifdef CONFIG_PROC_FS |
@@ -1015,7 +1015,7 @@ int ipmi_get_smi_info(int if_num, struct ipmi_smi_info *data) | |||
1015 | { | 1015 | { |
1016 | int rv = 0; | 1016 | int rv = 0; |
1017 | ipmi_smi_t intf; | 1017 | ipmi_smi_t intf; |
1018 | struct ipmi_smi_handlers *handlers; | 1018 | const struct ipmi_smi_handlers *handlers; |
1019 | 1019 | ||
1020 | mutex_lock(&ipmi_interfaces_mutex); | 1020 | mutex_lock(&ipmi_interfaces_mutex); |
1021 | list_for_each_entry_rcu(intf, &ipmi_interfaces, link) { | 1021 | list_for_each_entry_rcu(intf, &ipmi_interfaces, link) { |
@@ -1501,7 +1501,7 @@ static struct ipmi_smi_msg *smi_add_send_msg(ipmi_smi_t intf, | |||
1501 | } | 1501 | } |
1502 | 1502 | ||
1503 | 1503 | ||
1504 | static void smi_send(ipmi_smi_t intf, struct ipmi_smi_handlers *handlers, | 1504 | static void smi_send(ipmi_smi_t intf, const struct ipmi_smi_handlers *handlers, |
1505 | struct ipmi_smi_msg *smi_msg, int priority) | 1505 | struct ipmi_smi_msg *smi_msg, int priority) |
1506 | { | 1506 | { |
1507 | int run_to_completion = intf->run_to_completion; | 1507 | int run_to_completion = intf->run_to_completion; |
@@ -2747,7 +2747,7 @@ void ipmi_poll_interface(ipmi_user_t user) | |||
2747 | } | 2747 | } |
2748 | EXPORT_SYMBOL(ipmi_poll_interface); | 2748 | EXPORT_SYMBOL(ipmi_poll_interface); |
2749 | 2749 | ||
2750 | int ipmi_register_smi(struct ipmi_smi_handlers *handlers, | 2750 | int ipmi_register_smi(const struct ipmi_smi_handlers *handlers, |
2751 | void *send_info, | 2751 | void *send_info, |
2752 | struct ipmi_device_id *device_id, | 2752 | struct ipmi_device_id *device_id, |
2753 | struct device *si_dev, | 2753 | struct device *si_dev, |
@@ -4019,7 +4019,7 @@ static void check_msg_timeout(ipmi_smi_t intf, struct seq_table *ent, | |||
4019 | unsigned int *waiting_msgs) | 4019 | unsigned int *waiting_msgs) |
4020 | { | 4020 | { |
4021 | struct ipmi_recv_msg *msg; | 4021 | struct ipmi_recv_msg *msg; |
4022 | struct ipmi_smi_handlers *handlers; | 4022 | const struct ipmi_smi_handlers *handlers; |
4023 | 4023 | ||
4024 | if (intf->in_shutdown) | 4024 | if (intf->in_shutdown) |
4025 | return; | 4025 | return; |
@@ -4086,7 +4086,7 @@ static void check_msg_timeout(ipmi_smi_t intf, struct seq_table *ent, | |||
4086 | ipmi_inc_stat(intf, | 4086 | ipmi_inc_stat(intf, |
4087 | retransmitted_ipmb_commands); | 4087 | retransmitted_ipmb_commands); |
4088 | 4088 | ||
4089 | smi_send(intf, intf->handlers, smi_msg, 0); | 4089 | smi_send(intf, handlers, smi_msg, 0); |
4090 | } else | 4090 | } else |
4091 | ipmi_free_smi_msg(smi_msg); | 4091 | ipmi_free_smi_msg(smi_msg); |
4092 | 4092 | ||
diff --git a/drivers/char/ipmi/ipmi_si_intf.c b/drivers/char/ipmi/ipmi_si_intf.c index 4387bd6de2ca..4a4a13dc98b3 100644 --- a/drivers/char/ipmi/ipmi_si_intf.c +++ b/drivers/char/ipmi/ipmi_si_intf.c | |||
@@ -163,7 +163,7 @@ struct smi_info { | |||
163 | int intf_num; | 163 | int intf_num; |
164 | ipmi_smi_t intf; | 164 | ipmi_smi_t intf; |
165 | struct si_sm_data *si_sm; | 165 | struct si_sm_data *si_sm; |
166 | struct si_sm_handlers *handlers; | 166 | const struct si_sm_handlers *handlers; |
167 | enum si_type si_type; | 167 | enum si_type si_type; |
168 | spinlock_t si_lock; | 168 | spinlock_t si_lock; |
169 | struct ipmi_smi_msg *waiting_msg; | 169 | struct ipmi_smi_msg *waiting_msg; |
@@ -1254,7 +1254,7 @@ static void set_maintenance_mode(void *send_info, bool enable) | |||
1254 | atomic_set(&smi_info->req_events, 0); | 1254 | atomic_set(&smi_info->req_events, 0); |
1255 | } | 1255 | } |
1256 | 1256 | ||
1257 | static struct ipmi_smi_handlers handlers = { | 1257 | static const struct ipmi_smi_handlers handlers = { |
1258 | .owner = THIS_MODULE, | 1258 | .owner = THIS_MODULE, |
1259 | .start_processing = smi_start_processing, | 1259 | .start_processing = smi_start_processing, |
1260 | .get_smi_info = get_smi_info, | 1260 | .get_smi_info = get_smi_info, |
@@ -1442,14 +1442,14 @@ static int std_irq_setup(struct smi_info *info) | |||
1442 | return rv; | 1442 | return rv; |
1443 | } | 1443 | } |
1444 | 1444 | ||
1445 | static unsigned char port_inb(struct si_sm_io *io, unsigned int offset) | 1445 | static unsigned char port_inb(const struct si_sm_io *io, unsigned int offset) |
1446 | { | 1446 | { |
1447 | unsigned int addr = io->addr_data; | 1447 | unsigned int addr = io->addr_data; |
1448 | 1448 | ||
1449 | return inb(addr + (offset * io->regspacing)); | 1449 | return inb(addr + (offset * io->regspacing)); |
1450 | } | 1450 | } |
1451 | 1451 | ||
1452 | static void port_outb(struct si_sm_io *io, unsigned int offset, | 1452 | static void port_outb(const struct si_sm_io *io, unsigned int offset, |
1453 | unsigned char b) | 1453 | unsigned char b) |
1454 | { | 1454 | { |
1455 | unsigned int addr = io->addr_data; | 1455 | unsigned int addr = io->addr_data; |
@@ -1457,14 +1457,14 @@ static void port_outb(struct si_sm_io *io, unsigned int offset, | |||
1457 | outb(b, addr + (offset * io->regspacing)); | 1457 | outb(b, addr + (offset * io->regspacing)); |
1458 | } | 1458 | } |
1459 | 1459 | ||
1460 | static unsigned char port_inw(struct si_sm_io *io, unsigned int offset) | 1460 | static unsigned char port_inw(const struct si_sm_io *io, unsigned int offset) |
1461 | { | 1461 | { |
1462 | unsigned int addr = io->addr_data; | 1462 | unsigned int addr = io->addr_data; |
1463 | 1463 | ||
1464 | return (inw(addr + (offset * io->regspacing)) >> io->regshift) & 0xff; | 1464 | return (inw(addr + (offset * io->regspacing)) >> io->regshift) & 0xff; |
1465 | } | 1465 | } |
1466 | 1466 | ||
1467 | static void port_outw(struct si_sm_io *io, unsigned int offset, | 1467 | static void port_outw(const struct si_sm_io *io, unsigned int offset, |
1468 | unsigned char b) | 1468 | unsigned char b) |
1469 | { | 1469 | { |
1470 | unsigned int addr = io->addr_data; | 1470 | unsigned int addr = io->addr_data; |
@@ -1472,14 +1472,14 @@ static void port_outw(struct si_sm_io *io, unsigned int offset, | |||
1472 | outw(b << io->regshift, addr + (offset * io->regspacing)); | 1472 | outw(b << io->regshift, addr + (offset * io->regspacing)); |
1473 | } | 1473 | } |
1474 | 1474 | ||
1475 | static unsigned char port_inl(struct si_sm_io *io, unsigned int offset) | 1475 | static unsigned char port_inl(const struct si_sm_io *io, unsigned int offset) |
1476 | { | 1476 | { |
1477 | unsigned int addr = io->addr_data; | 1477 | unsigned int addr = io->addr_data; |
1478 | 1478 | ||
1479 | return (inl(addr + (offset * io->regspacing)) >> io->regshift) & 0xff; | 1479 | return (inl(addr + (offset * io->regspacing)) >> io->regshift) & 0xff; |
1480 | } | 1480 | } |
1481 | 1481 | ||
1482 | static void port_outl(struct si_sm_io *io, unsigned int offset, | 1482 | static void port_outl(const struct si_sm_io *io, unsigned int offset, |
1483 | unsigned char b) | 1483 | unsigned char b) |
1484 | { | 1484 | { |
1485 | unsigned int addr = io->addr_data; | 1485 | unsigned int addr = io->addr_data; |
@@ -1552,49 +1552,52 @@ static int port_setup(struct smi_info *info) | |||
1552 | return 0; | 1552 | return 0; |
1553 | } | 1553 | } |
1554 | 1554 | ||
1555 | static unsigned char intf_mem_inb(struct si_sm_io *io, unsigned int offset) | 1555 | static unsigned char intf_mem_inb(const struct si_sm_io *io, |
1556 | unsigned int offset) | ||
1556 | { | 1557 | { |
1557 | return readb((io->addr)+(offset * io->regspacing)); | 1558 | return readb((io->addr)+(offset * io->regspacing)); |
1558 | } | 1559 | } |
1559 | 1560 | ||
1560 | static void intf_mem_outb(struct si_sm_io *io, unsigned int offset, | 1561 | static void intf_mem_outb(const struct si_sm_io *io, unsigned int offset, |
1561 | unsigned char b) | 1562 | unsigned char b) |
1562 | { | 1563 | { |
1563 | writeb(b, (io->addr)+(offset * io->regspacing)); | 1564 | writeb(b, (io->addr)+(offset * io->regspacing)); |
1564 | } | 1565 | } |
1565 | 1566 | ||
1566 | static unsigned char intf_mem_inw(struct si_sm_io *io, unsigned int offset) | 1567 | static unsigned char intf_mem_inw(const struct si_sm_io *io, |
1568 | unsigned int offset) | ||
1567 | { | 1569 | { |
1568 | return (readw((io->addr)+(offset * io->regspacing)) >> io->regshift) | 1570 | return (readw((io->addr)+(offset * io->regspacing)) >> io->regshift) |
1569 | & 0xff; | 1571 | & 0xff; |
1570 | } | 1572 | } |
1571 | 1573 | ||
1572 | static void intf_mem_outw(struct si_sm_io *io, unsigned int offset, | 1574 | static void intf_mem_outw(const struct si_sm_io *io, unsigned int offset, |
1573 | unsigned char b) | 1575 | unsigned char b) |
1574 | { | 1576 | { |
1575 | writeb(b << io->regshift, (io->addr)+(offset * io->regspacing)); | 1577 | writeb(b << io->regshift, (io->addr)+(offset * io->regspacing)); |
1576 | } | 1578 | } |
1577 | 1579 | ||
1578 | static unsigned char intf_mem_inl(struct si_sm_io *io, unsigned int offset) | 1580 | static unsigned char intf_mem_inl(const struct si_sm_io *io, |
1581 | unsigned int offset) | ||
1579 | { | 1582 | { |
1580 | return (readl((io->addr)+(offset * io->regspacing)) >> io->regshift) | 1583 | return (readl((io->addr)+(offset * io->regspacing)) >> io->regshift) |
1581 | & 0xff; | 1584 | & 0xff; |
1582 | } | 1585 | } |
1583 | 1586 | ||
1584 | static void intf_mem_outl(struct si_sm_io *io, unsigned int offset, | 1587 | static void intf_mem_outl(const struct si_sm_io *io, unsigned int offset, |
1585 | unsigned char b) | 1588 | unsigned char b) |
1586 | { | 1589 | { |
1587 | writel(b << io->regshift, (io->addr)+(offset * io->regspacing)); | 1590 | writel(b << io->regshift, (io->addr)+(offset * io->regspacing)); |
1588 | } | 1591 | } |
1589 | 1592 | ||
1590 | #ifdef readq | 1593 | #ifdef readq |
1591 | static unsigned char mem_inq(struct si_sm_io *io, unsigned int offset) | 1594 | static unsigned char mem_inq(const struct si_sm_io *io, unsigned int offset) |
1592 | { | 1595 | { |
1593 | return (readq((io->addr)+(offset * io->regspacing)) >> io->regshift) | 1596 | return (readq((io->addr)+(offset * io->regspacing)) >> io->regshift) |
1594 | & 0xff; | 1597 | & 0xff; |
1595 | } | 1598 | } |
1596 | 1599 | ||
1597 | static void mem_outq(struct si_sm_io *io, unsigned int offset, | 1600 | static void mem_outq(const struct si_sm_io *io, unsigned int offset, |
1598 | unsigned char b) | 1601 | unsigned char b) |
1599 | { | 1602 | { |
1600 | writeq(b << io->regshift, (io->addr)+(offset * io->regspacing)); | 1603 | writeq(b << io->regshift, (io->addr)+(offset * io->regspacing)); |
@@ -2522,7 +2525,7 @@ static void ipmi_pci_remove(struct pci_dev *pdev) | |||
2522 | pci_disable_device(pdev); | 2525 | pci_disable_device(pdev); |
2523 | } | 2526 | } |
2524 | 2527 | ||
2525 | static struct pci_device_id ipmi_pci_devices[] = { | 2528 | static const struct pci_device_id ipmi_pci_devices[] = { |
2526 | { PCI_DEVICE(PCI_HP_VENDOR_ID, PCI_MMC_DEVICE_ID) }, | 2529 | { PCI_DEVICE(PCI_HP_VENDOR_ID, PCI_MMC_DEVICE_ID) }, |
2527 | { PCI_DEVICE_CLASS(PCI_ERMC_CLASSCODE, PCI_ERMC_CLASSCODE_MASK) }, | 2530 | { PCI_DEVICE_CLASS(PCI_ERMC_CLASSCODE, PCI_ERMC_CLASSCODE_MASK) }, |
2528 | { 0, } | 2531 | { 0, } |
@@ -2751,7 +2754,7 @@ err_free: | |||
2751 | return rv; | 2754 | return rv; |
2752 | } | 2755 | } |
2753 | 2756 | ||
2754 | static struct acpi_device_id acpi_ipmi_match[] = { | 2757 | static const struct acpi_device_id acpi_ipmi_match[] = { |
2755 | { "IPI0001", 0 }, | 2758 | { "IPI0001", 0 }, |
2756 | { }, | 2759 | { }, |
2757 | }; | 2760 | }; |
@@ -3324,7 +3327,7 @@ static inline void wait_for_timer_and_thread(struct smi_info *smi_info) | |||
3324 | del_timer_sync(&smi_info->si_timer); | 3327 | del_timer_sync(&smi_info->si_timer); |
3325 | } | 3328 | } |
3326 | 3329 | ||
3327 | static struct ipmi_default_vals | 3330 | static const struct ipmi_default_vals |
3328 | { | 3331 | { |
3329 | int type; | 3332 | int type; |
3330 | int port; | 3333 | int port; |
diff --git a/drivers/char/ipmi/ipmi_si_sm.h b/drivers/char/ipmi/ipmi_si_sm.h index df89f73475fb..a705027c0493 100644 --- a/drivers/char/ipmi/ipmi_si_sm.h +++ b/drivers/char/ipmi/ipmi_si_sm.h | |||
@@ -46,8 +46,8 @@ struct si_sm_data; | |||
46 | * this interface. | 46 | * this interface. |
47 | */ | 47 | */ |
48 | struct si_sm_io { | 48 | struct si_sm_io { |
49 | unsigned char (*inputb)(struct si_sm_io *io, unsigned int offset); | 49 | unsigned char (*inputb)(const struct si_sm_io *io, unsigned int offset); |
50 | void (*outputb)(struct si_sm_io *io, | 50 | void (*outputb)(const struct si_sm_io *io, |
51 | unsigned int offset, | 51 | unsigned int offset, |
52 | unsigned char b); | 52 | unsigned char b); |
53 | 53 | ||
@@ -135,7 +135,7 @@ struct si_sm_handlers { | |||
135 | }; | 135 | }; |
136 | 136 | ||
137 | /* Current state machines that we can use. */ | 137 | /* Current state machines that we can use. */ |
138 | extern struct si_sm_handlers kcs_smi_handlers; | 138 | extern const struct si_sm_handlers kcs_smi_handlers; |
139 | extern struct si_sm_handlers smic_smi_handlers; | 139 | extern const struct si_sm_handlers smic_smi_handlers; |
140 | extern struct si_sm_handlers bt_smi_handlers; | 140 | extern const struct si_sm_handlers bt_smi_handlers; |
141 | 141 | ||
diff --git a/drivers/char/ipmi/ipmi_smic_sm.c b/drivers/char/ipmi/ipmi_smic_sm.c index c8e77afa8b96..8f7c73ff58f2 100644 --- a/drivers/char/ipmi/ipmi_smic_sm.c +++ b/drivers/char/ipmi/ipmi_smic_sm.c | |||
@@ -589,7 +589,7 @@ static int smic_size(void) | |||
589 | return sizeof(struct si_sm_data); | 589 | return sizeof(struct si_sm_data); |
590 | } | 590 | } |
591 | 591 | ||
592 | struct si_sm_handlers smic_smi_handlers = { | 592 | const struct si_sm_handlers smic_smi_handlers = { |
593 | .init_data = init_smic_data, | 593 | .init_data = init_smic_data, |
594 | .start_transaction = start_smic_transaction, | 594 | .start_transaction = start_smic_transaction, |
595 | .get_result = smic_get_result, | 595 | .get_result = smic_get_result, |
diff --git a/include/linux/ipmi_smi.h b/include/linux/ipmi_smi.h index 0b1e569f5ff5..41de0cf34c49 100644 --- a/include/linux/ipmi_smi.h +++ b/include/linux/ipmi_smi.h | |||
@@ -207,7 +207,7 @@ static inline int ipmi_demangle_device_id(const unsigned char *data, | |||
207 | upper layer until the start_processing() function in the handlers | 207 | upper layer until the start_processing() function in the handlers |
208 | is called, and the lower layer must get the interface from that | 208 | is called, and the lower layer must get the interface from that |
209 | call. */ | 209 | call. */ |
210 | int ipmi_register_smi(struct ipmi_smi_handlers *handlers, | 210 | int ipmi_register_smi(const struct ipmi_smi_handlers *handlers, |
211 | void *send_info, | 211 | void *send_info, |
212 | struct ipmi_device_id *device_id, | 212 | struct ipmi_device_id *device_id, |
213 | struct device *dev, | 213 | struct device *dev, |