mirror of https://gitee.com/openkylin/linux.git
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>
This commit is contained in:
parent
5186cf9c74
commit
81d02b7f8c
|
@ -694,7 +694,7 @@ static int bt_size(void)
|
|||
return sizeof(struct si_sm_data);
|
||||
}
|
||||
|
||||
struct si_sm_handlers bt_smi_handlers = {
|
||||
const struct si_sm_handlers bt_smi_handlers = {
|
||||
.init_data = bt_init_data,
|
||||
.start_transaction = bt_start_transaction,
|
||||
.get_result = bt_get_result,
|
||||
|
|
|
@ -540,7 +540,7 @@ static void kcs_cleanup(struct si_sm_data *kcs)
|
|||
{
|
||||
}
|
||||
|
||||
struct si_sm_handlers kcs_smi_handlers = {
|
||||
const struct si_sm_handlers kcs_smi_handlers = {
|
||||
.init_data = init_kcs_data,
|
||||
.start_transaction = start_kcs_transaction,
|
||||
.get_result = get_kcs_result,
|
||||
|
|
|
@ -342,7 +342,7 @@ struct ipmi_smi {
|
|||
* an umpreemptible region to use this. You must fetch the
|
||||
* value into a local variable and make sure it is not NULL.
|
||||
*/
|
||||
struct ipmi_smi_handlers *handlers;
|
||||
const struct ipmi_smi_handlers *handlers;
|
||||
void *send_info;
|
||||
|
||||
#ifdef CONFIG_PROC_FS
|
||||
|
@ -1015,7 +1015,7 @@ int ipmi_get_smi_info(int if_num, struct ipmi_smi_info *data)
|
|||
{
|
||||
int rv = 0;
|
||||
ipmi_smi_t intf;
|
||||
struct ipmi_smi_handlers *handlers;
|
||||
const struct ipmi_smi_handlers *handlers;
|
||||
|
||||
mutex_lock(&ipmi_interfaces_mutex);
|
||||
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,
|
|||
}
|
||||
|
||||
|
||||
static void smi_send(ipmi_smi_t intf, struct ipmi_smi_handlers *handlers,
|
||||
static void smi_send(ipmi_smi_t intf, const struct ipmi_smi_handlers *handlers,
|
||||
struct ipmi_smi_msg *smi_msg, int priority)
|
||||
{
|
||||
int run_to_completion = intf->run_to_completion;
|
||||
|
@ -2747,7 +2747,7 @@ void ipmi_poll_interface(ipmi_user_t user)
|
|||
}
|
||||
EXPORT_SYMBOL(ipmi_poll_interface);
|
||||
|
||||
int ipmi_register_smi(struct ipmi_smi_handlers *handlers,
|
||||
int ipmi_register_smi(const struct ipmi_smi_handlers *handlers,
|
||||
void *send_info,
|
||||
struct ipmi_device_id *device_id,
|
||||
struct device *si_dev,
|
||||
|
@ -4019,7 +4019,7 @@ static void check_msg_timeout(ipmi_smi_t intf, struct seq_table *ent,
|
|||
unsigned int *waiting_msgs)
|
||||
{
|
||||
struct ipmi_recv_msg *msg;
|
||||
struct ipmi_smi_handlers *handlers;
|
||||
const struct ipmi_smi_handlers *handlers;
|
||||
|
||||
if (intf->in_shutdown)
|
||||
return;
|
||||
|
@ -4086,7 +4086,7 @@ static void check_msg_timeout(ipmi_smi_t intf, struct seq_table *ent,
|
|||
ipmi_inc_stat(intf,
|
||||
retransmitted_ipmb_commands);
|
||||
|
||||
smi_send(intf, intf->handlers, smi_msg, 0);
|
||||
smi_send(intf, handlers, smi_msg, 0);
|
||||
} else
|
||||
ipmi_free_smi_msg(smi_msg);
|
||||
|
||||
|
|
|
@ -163,7 +163,7 @@ struct smi_info {
|
|||
int intf_num;
|
||||
ipmi_smi_t intf;
|
||||
struct si_sm_data *si_sm;
|
||||
struct si_sm_handlers *handlers;
|
||||
const struct si_sm_handlers *handlers;
|
||||
enum si_type si_type;
|
||||
spinlock_t si_lock;
|
||||
struct ipmi_smi_msg *waiting_msg;
|
||||
|
@ -1254,7 +1254,7 @@ static void set_maintenance_mode(void *send_info, bool enable)
|
|||
atomic_set(&smi_info->req_events, 0);
|
||||
}
|
||||
|
||||
static struct ipmi_smi_handlers handlers = {
|
||||
static const struct ipmi_smi_handlers handlers = {
|
||||
.owner = THIS_MODULE,
|
||||
.start_processing = smi_start_processing,
|
||||
.get_smi_info = get_smi_info,
|
||||
|
@ -1442,14 +1442,14 @@ static int std_irq_setup(struct smi_info *info)
|
|||
return rv;
|
||||
}
|
||||
|
||||
static unsigned char port_inb(struct si_sm_io *io, unsigned int offset)
|
||||
static unsigned char port_inb(const struct si_sm_io *io, unsigned int offset)
|
||||
{
|
||||
unsigned int addr = io->addr_data;
|
||||
|
||||
return inb(addr + (offset * io->regspacing));
|
||||
}
|
||||
|
||||
static void port_outb(struct si_sm_io *io, unsigned int offset,
|
||||
static void port_outb(const struct si_sm_io *io, unsigned int offset,
|
||||
unsigned char b)
|
||||
{
|
||||
unsigned int addr = io->addr_data;
|
||||
|
@ -1457,14 +1457,14 @@ static void port_outb(struct si_sm_io *io, unsigned int offset,
|
|||
outb(b, addr + (offset * io->regspacing));
|
||||
}
|
||||
|
||||
static unsigned char port_inw(struct si_sm_io *io, unsigned int offset)
|
||||
static unsigned char port_inw(const struct si_sm_io *io, unsigned int offset)
|
||||
{
|
||||
unsigned int addr = io->addr_data;
|
||||
|
||||
return (inw(addr + (offset * io->regspacing)) >> io->regshift) & 0xff;
|
||||
}
|
||||
|
||||
static void port_outw(struct si_sm_io *io, unsigned int offset,
|
||||
static void port_outw(const struct si_sm_io *io, unsigned int offset,
|
||||
unsigned char b)
|
||||
{
|
||||
unsigned int addr = io->addr_data;
|
||||
|
@ -1472,14 +1472,14 @@ static void port_outw(struct si_sm_io *io, unsigned int offset,
|
|||
outw(b << io->regshift, addr + (offset * io->regspacing));
|
||||
}
|
||||
|
||||
static unsigned char port_inl(struct si_sm_io *io, unsigned int offset)
|
||||
static unsigned char port_inl(const struct si_sm_io *io, unsigned int offset)
|
||||
{
|
||||
unsigned int addr = io->addr_data;
|
||||
|
||||
return (inl(addr + (offset * io->regspacing)) >> io->regshift) & 0xff;
|
||||
}
|
||||
|
||||
static void port_outl(struct si_sm_io *io, unsigned int offset,
|
||||
static void port_outl(const struct si_sm_io *io, unsigned int offset,
|
||||
unsigned char b)
|
||||
{
|
||||
unsigned int addr = io->addr_data;
|
||||
|
@ -1552,49 +1552,52 @@ static int port_setup(struct smi_info *info)
|
|||
return 0;
|
||||
}
|
||||
|
||||
static unsigned char intf_mem_inb(struct si_sm_io *io, unsigned int offset)
|
||||
static unsigned char intf_mem_inb(const struct si_sm_io *io,
|
||||
unsigned int offset)
|
||||
{
|
||||
return readb((io->addr)+(offset * io->regspacing));
|
||||
}
|
||||
|
||||
static void intf_mem_outb(struct si_sm_io *io, unsigned int offset,
|
||||
unsigned char b)
|
||||
static void intf_mem_outb(const struct si_sm_io *io, unsigned int offset,
|
||||
unsigned char b)
|
||||
{
|
||||
writeb(b, (io->addr)+(offset * io->regspacing));
|
||||
}
|
||||
|
||||
static unsigned char intf_mem_inw(struct si_sm_io *io, unsigned int offset)
|
||||
static unsigned char intf_mem_inw(const struct si_sm_io *io,
|
||||
unsigned int offset)
|
||||
{
|
||||
return (readw((io->addr)+(offset * io->regspacing)) >> io->regshift)
|
||||
& 0xff;
|
||||
}
|
||||
|
||||
static void intf_mem_outw(struct si_sm_io *io, unsigned int offset,
|
||||
unsigned char b)
|
||||
static void intf_mem_outw(const struct si_sm_io *io, unsigned int offset,
|
||||
unsigned char b)
|
||||
{
|
||||
writeb(b << io->regshift, (io->addr)+(offset * io->regspacing));
|
||||
}
|
||||
|
||||
static unsigned char intf_mem_inl(struct si_sm_io *io, unsigned int offset)
|
||||
static unsigned char intf_mem_inl(const struct si_sm_io *io,
|
||||
unsigned int offset)
|
||||
{
|
||||
return (readl((io->addr)+(offset * io->regspacing)) >> io->regshift)
|
||||
& 0xff;
|
||||
}
|
||||
|
||||
static void intf_mem_outl(struct si_sm_io *io, unsigned int offset,
|
||||
unsigned char b)
|
||||
static void intf_mem_outl(const struct si_sm_io *io, unsigned int offset,
|
||||
unsigned char b)
|
||||
{
|
||||
writel(b << io->regshift, (io->addr)+(offset * io->regspacing));
|
||||
}
|
||||
|
||||
#ifdef readq
|
||||
static unsigned char mem_inq(struct si_sm_io *io, unsigned int offset)
|
||||
static unsigned char mem_inq(const struct si_sm_io *io, unsigned int offset)
|
||||
{
|
||||
return (readq((io->addr)+(offset * io->regspacing)) >> io->regshift)
|
||||
& 0xff;
|
||||
}
|
||||
|
||||
static void mem_outq(struct si_sm_io *io, unsigned int offset,
|
||||
static void mem_outq(const struct si_sm_io *io, unsigned int offset,
|
||||
unsigned char b)
|
||||
{
|
||||
writeq(b << io->regshift, (io->addr)+(offset * io->regspacing));
|
||||
|
@ -2522,7 +2525,7 @@ static void ipmi_pci_remove(struct pci_dev *pdev)
|
|||
pci_disable_device(pdev);
|
||||
}
|
||||
|
||||
static struct pci_device_id ipmi_pci_devices[] = {
|
||||
static const struct pci_device_id ipmi_pci_devices[] = {
|
||||
{ PCI_DEVICE(PCI_HP_VENDOR_ID, PCI_MMC_DEVICE_ID) },
|
||||
{ PCI_DEVICE_CLASS(PCI_ERMC_CLASSCODE, PCI_ERMC_CLASSCODE_MASK) },
|
||||
{ 0, }
|
||||
|
@ -2751,7 +2754,7 @@ static int acpi_ipmi_probe(struct platform_device *dev)
|
|||
return rv;
|
||||
}
|
||||
|
||||
static struct acpi_device_id acpi_ipmi_match[] = {
|
||||
static const struct acpi_device_id acpi_ipmi_match[] = {
|
||||
{ "IPI0001", 0 },
|
||||
{ },
|
||||
};
|
||||
|
@ -3324,7 +3327,7 @@ static inline void wait_for_timer_and_thread(struct smi_info *smi_info)
|
|||
del_timer_sync(&smi_info->si_timer);
|
||||
}
|
||||
|
||||
static struct ipmi_default_vals
|
||||
static const struct ipmi_default_vals
|
||||
{
|
||||
int type;
|
||||
int port;
|
||||
|
|
|
@ -46,8 +46,8 @@ struct si_sm_data;
|
|||
* this interface.
|
||||
*/
|
||||
struct si_sm_io {
|
||||
unsigned char (*inputb)(struct si_sm_io *io, unsigned int offset);
|
||||
void (*outputb)(struct si_sm_io *io,
|
||||
unsigned char (*inputb)(const struct si_sm_io *io, unsigned int offset);
|
||||
void (*outputb)(const struct si_sm_io *io,
|
||||
unsigned int offset,
|
||||
unsigned char b);
|
||||
|
||||
|
@ -135,7 +135,7 @@ struct si_sm_handlers {
|
|||
};
|
||||
|
||||
/* Current state machines that we can use. */
|
||||
extern struct si_sm_handlers kcs_smi_handlers;
|
||||
extern struct si_sm_handlers smic_smi_handlers;
|
||||
extern struct si_sm_handlers bt_smi_handlers;
|
||||
extern const struct si_sm_handlers kcs_smi_handlers;
|
||||
extern const struct si_sm_handlers smic_smi_handlers;
|
||||
extern const struct si_sm_handlers bt_smi_handlers;
|
||||
|
||||
|
|
|
@ -589,7 +589,7 @@ static int smic_size(void)
|
|||
return sizeof(struct si_sm_data);
|
||||
}
|
||||
|
||||
struct si_sm_handlers smic_smi_handlers = {
|
||||
const struct si_sm_handlers smic_smi_handlers = {
|
||||
.init_data = init_smic_data,
|
||||
.start_transaction = start_smic_transaction,
|
||||
.get_result = smic_get_result,
|
||||
|
|
|
@ -207,7 +207,7 @@ static inline int ipmi_demangle_device_id(const unsigned char *data,
|
|||
upper layer until the start_processing() function in the handlers
|
||||
is called, and the lower layer must get the interface from that
|
||||
call. */
|
||||
int ipmi_register_smi(struct ipmi_smi_handlers *handlers,
|
||||
int ipmi_register_smi(const struct ipmi_smi_handlers *handlers,
|
||||
void *send_info,
|
||||
struct ipmi_device_id *device_id,
|
||||
struct device *dev,
|
||||
|
|
Loading…
Reference in New Issue