ipmi: Move lun and address out of channel struct
authorCorey Minyard <cminyard@mvista.com>
Tue, 5 Sep 2017 20:50:12 +0000 (15:50 -0500)
committerCorey Minyard <cminyard@mvista.com>
Wed, 27 Sep 2017 21:03:45 +0000 (16:03 -0500)
Put it in it's own struct, getting ready for channel information
being dynamically changed.

Signed-off-by: Corey Minyard <cminyard@mvista.com>
drivers/char/ipmi/ipmi_msghandler.c

index c6ee1de8d76bd7dc7c50605ba26d3a4101a81b28..58cecebe950ff2ae4afae52389ce12ac3f86b62b 100644 (file)
@@ -245,7 +245,9 @@ struct seq_table {
 struct ipmi_channel {
        unsigned char medium;
        unsigned char protocol;
+};
 
+struct ipmi_my_addrinfo {
        /*
         * My slave address.  This is initialized to IPMI_BMC_SLAVE_ADDR,
         * but may be changed by the user.
@@ -530,6 +532,7 @@ struct ipmi_smi {
 
        /* Channel information */
        struct ipmi_channel channels[IPMI_MAX_CHANNELS];
+       struct ipmi_my_addrinfo addrinfo[IPMI_MAX_CHANNELS];
 
        /* Proc FS stuff. */
        struct proc_dir_entry *proc_dir;
@@ -1251,7 +1254,7 @@ int ipmi_set_my_address(ipmi_user_t   user,
 {
        if (channel >= IPMI_MAX_CHANNELS)
                return -EINVAL;
-       user->intf->channels[channel].address = address;
+       user->intf->addrinfo[channel].address = address;
        return 0;
 }
 EXPORT_SYMBOL(ipmi_set_my_address);
@@ -1262,7 +1265,7 @@ int ipmi_get_my_address(ipmi_user_t   user,
 {
        if (channel >= IPMI_MAX_CHANNELS)
                return -EINVAL;
-       *address = user->intf->channels[channel].address;
+       *address = user->intf->addrinfo[channel].address;
        return 0;
 }
 EXPORT_SYMBOL(ipmi_get_my_address);
@@ -1273,7 +1276,7 @@ int ipmi_set_my_LUN(ipmi_user_t   user,
 {
        if (channel >= IPMI_MAX_CHANNELS)
                return -EINVAL;
-       user->intf->channels[channel].lun = LUN & 0x3;
+       user->intf->addrinfo[channel].lun = LUN & 0x3;
        return 0;
 }
 EXPORT_SYMBOL(ipmi_set_my_LUN);
@@ -1284,7 +1287,7 @@ int ipmi_get_my_LUN(ipmi_user_t   user,
 {
        if (channel >= IPMI_MAX_CHANNELS)
                return -EINVAL;
-       *address = user->intf->channels[channel].lun;
+       *address = user->intf->addrinfo[channel].lun;
        return 0;
 }
 EXPORT_SYMBOL(ipmi_get_my_LUN);
@@ -2045,8 +2048,8 @@ static int check_addr(ipmi_smi_t       intf,
 {
        if (addr->channel >= IPMI_MAX_CHANNELS)
                return -EINVAL;
-       *lun = intf->channels[addr->channel].lun;
-       *saddr = intf->channels[addr->channel].address;
+       *lun = intf->addrinfo[addr->channel].lun;
+       *saddr = intf->addrinfo[addr->channel].address;
        return 0;
 }
 
@@ -2167,8 +2170,8 @@ send_get_device_id_cmd(ipmi_smi_t intf)
                              NULL,
                              NULL,
                              0,
-                             intf->channels[0].address,
-                             intf->channels[0].lun,
+                             intf->addrinfo[0].address,
+                             intf->addrinfo[0].lun,
                              -1, 0);
 }
 
@@ -2347,9 +2350,9 @@ static int smi_ipmb_proc_show(struct seq_file *m, void *v)
        ipmi_smi_t intf = m->private;
        int        i;
 
-       seq_printf(m, "%x", intf->channels[0].address);
+       seq_printf(m, "%x", intf->addrinfo[0].address);
        for (i = 1; i < IPMI_MAX_CHANNELS; i++)
-               seq_printf(m, " %x", intf->channels[i].address);
+               seq_printf(m, " %x", intf->addrinfo[i].address);
        seq_putc(m, '\n');
 
        return 0;
@@ -3113,8 +3116,8 @@ send_guid_cmd(ipmi_smi_t intf, int chan)
                              NULL,
                              NULL,
                              0,
-                             intf->channels[0].address,
-                             intf->channels[0].lun,
+                             intf->addrinfo[0].address,
+                             intf->addrinfo[0].lun,
                              -1, 0);
 }
 
@@ -3200,8 +3203,8 @@ send_channel_info_cmd(ipmi_smi_t intf, int chan)
                              NULL,
                              NULL,
                              0,
-                             intf->channels[0].address,
-                             intf->channels[0].lun,
+                             intf->addrinfo[0].address,
+                             intf->addrinfo[0].lun,
                              -1, 0);
 }
 
@@ -3331,11 +3334,11 @@ int ipmi_register_smi(const struct ipmi_smi_handlers *handlers,
        INIT_WORK(&intf->bmc_reg_work, redo_bmc_reg);
        intf->si_dev = si_dev;
        for (j = 0; j < IPMI_MAX_CHANNELS; j++) {
-               intf->channels[j].address = IPMI_BMC_SLAVE_ADDR;
-               intf->channels[j].lun = 2;
+               intf->addrinfo[j].address = IPMI_BMC_SLAVE_ADDR;
+               intf->addrinfo[j].lun = 2;
        }
        if (slave_addr != 0)
-               intf->channels[0].address = slave_addr;
+               intf->addrinfo[0].address = slave_addr;
        INIT_LIST_HEAD(&intf->users);
        intf->handlers = handlers;
        intf->send_info = send_info;
@@ -3665,7 +3668,7 @@ static int handle_ipmb_get_msg_cmd(ipmi_smi_t          intf,
                msg->data[3] = msg->rsp[6];
                msg->data[4] = ((netfn + 1) << 2) | (msg->rsp[7] & 0x3);
                msg->data[5] = ipmb_checksum(&(msg->data[3]), 2);
-               msg->data[6] = intf->channels[msg->rsp[3] & 0xf].address;
+               msg->data[6] = intf->addrinfo[msg->rsp[3] & 0xf].address;
                /* rqseq/lun */
                msg->data[7] = (msg->rsp[7] & 0xfc) | (msg->rsp[4] & 0x3);
                msg->data[8] = msg->rsp[8]; /* cmd */
@@ -4849,8 +4852,8 @@ static void ipmi_panic_request_and_wait(ipmi_smi_t           intf,
                            &smi_msg,
                            &recv_msg,
                            0,
-                           intf->channels[0].address,
-                           intf->channels[0].lun,
+                           intf->addrinfo[0].address,
+                           intf->addrinfo[0].lun,
                            0, 1); /* Don't retry, and don't wait. */
        if (rv)
                atomic_sub(2, &panic_done_count);
@@ -4999,7 +5002,7 @@ static void send_panic_events(char *str)
                 */
                if (((intf->event_receiver & 1) == 0)
                    && (intf->event_receiver != 0)
-                   && (intf->event_receiver != intf->channels[0].address)) {
+                   && (intf->event_receiver != intf->addrinfo[0].address)) {
                        /*
                         * The event receiver is valid, send an IPMB
                         * message.
@@ -5036,7 +5039,7 @@ static void send_panic_events(char *str)
                        data[0] = 0;
                        data[1] = 0;
                        data[2] = 0xf0; /* OEM event without timestamp. */
-                       data[3] = intf->channels[0].address;
+                       data[3] = intf->addrinfo[0].address;
                        data[4] = j++; /* sequence # */
                        /*
                         * Always give 11 bytes, so strncpy will fill