vmbus: make channel_message table constant
authorStephen Hemminger <stephen@networkplumber.org>
Sun, 5 Mar 2017 01:27:16 +0000 (18:27 -0700)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Fri, 17 Mar 2017 06:10:49 +0000 (15:10 +0900)
This table is immutable and should be const.
Cleanup indentation and whitespace for this as well.

Signed-off-by: Stephen Hemminger <sthemmin@microsoft.com>
Signed-off-by: K. Y. Srinivasan <kys@microsoft.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
drivers/hv/channel_mgmt.c
drivers/hv/hyperv_vmbus.h
drivers/hv/vmbus_drv.c

index f33465d..c1ba440 100644 (file)
@@ -1097,30 +1097,30 @@ static void vmbus_onversion_response(
 }
 
 /* Channel message dispatch table */
-struct vmbus_channel_message_table_entry
-       channel_message_table[CHANNELMSG_COUNT] = {
-       {CHANNELMSG_INVALID,                    0, NULL},
-       {CHANNELMSG_OFFERCHANNEL,               0, vmbus_onoffer},
-       {CHANNELMSG_RESCIND_CHANNELOFFER,       0, vmbus_onoffer_rescind},
-       {CHANNELMSG_REQUESTOFFERS,              0, NULL},
-       {CHANNELMSG_ALLOFFERS_DELIVERED,        1, vmbus_onoffers_delivered},
-       {CHANNELMSG_OPENCHANNEL,                0, NULL},
-       {CHANNELMSG_OPENCHANNEL_RESULT,         1, vmbus_onopen_result},
-       {CHANNELMSG_CLOSECHANNEL,               0, NULL},
-       {CHANNELMSG_GPADL_HEADER,               0, NULL},
-       {CHANNELMSG_GPADL_BODY,                 0, NULL},
-       {CHANNELMSG_GPADL_CREATED,              1, vmbus_ongpadl_created},
-       {CHANNELMSG_GPADL_TEARDOWN,             0, NULL},
-       {CHANNELMSG_GPADL_TORNDOWN,             1, vmbus_ongpadl_torndown},
-       {CHANNELMSG_RELID_RELEASED,             0, NULL},
-       {CHANNELMSG_INITIATE_CONTACT,           0, NULL},
-       {CHANNELMSG_VERSION_RESPONSE,           1, vmbus_onversion_response},
-       {CHANNELMSG_UNLOAD,                     0, NULL},
-       {CHANNELMSG_UNLOAD_RESPONSE,            1, vmbus_unload_response},
-       {CHANNELMSG_18,                         0, NULL},
-       {CHANNELMSG_19,                         0, NULL},
-       {CHANNELMSG_20,                         0, NULL},
-       {CHANNELMSG_TL_CONNECT_REQUEST,         0, NULL},
+const struct vmbus_channel_message_table_entry
+channel_message_table[CHANNELMSG_COUNT] = {
+       { CHANNELMSG_INVALID,                   0, NULL },
+       { CHANNELMSG_OFFERCHANNEL,              0, vmbus_onoffer },
+       { CHANNELMSG_RESCIND_CHANNELOFFER,      0, vmbus_onoffer_rescind },
+       { CHANNELMSG_REQUESTOFFERS,             0, NULL },
+       { CHANNELMSG_ALLOFFERS_DELIVERED,       1, vmbus_onoffers_delivered },
+       { CHANNELMSG_OPENCHANNEL,               0, NULL },
+       { CHANNELMSG_OPENCHANNEL_RESULT,        1, vmbus_onopen_result },
+       { CHANNELMSG_CLOSECHANNEL,              0, NULL },
+       { CHANNELMSG_GPADL_HEADER,              0, NULL },
+       { CHANNELMSG_GPADL_BODY,                0, NULL },
+       { CHANNELMSG_GPADL_CREATED,             1, vmbus_ongpadl_created },
+       { CHANNELMSG_GPADL_TEARDOWN,            0, NULL },
+       { CHANNELMSG_GPADL_TORNDOWN,            1, vmbus_ongpadl_torndown },
+       { CHANNELMSG_RELID_RELEASED,            0, NULL },
+       { CHANNELMSG_INITIATE_CONTACT,          0, NULL },
+       { CHANNELMSG_VERSION_RESPONSE,          1, vmbus_onversion_response },
+       { CHANNELMSG_UNLOAD,                    0, NULL },
+       { CHANNELMSG_UNLOAD_RESPONSE,           1, vmbus_unload_response },
+       { CHANNELMSG_18,                        0, NULL },
+       { CHANNELMSG_19,                        0, NULL },
+       { CHANNELMSG_20,                        0, NULL },
+       { CHANNELMSG_TL_CONNECT_REQUEST,        0, NULL },
 };
 
 /*
index 884f83b..b552c3a 100644 (file)
@@ -376,7 +376,7 @@ struct vmbus_channel_message_table_entry {
        void (*message_handler)(struct vmbus_channel_message_header *msg);
 };
 
-extern struct vmbus_channel_message_table_entry
+extern const struct vmbus_channel_message_table_entry
        channel_message_table[CHANNELMSG_COUNT];
 
 
index 5ca5004..8b272d3 100644 (file)
@@ -853,7 +853,7 @@ void vmbus_on_msg_dpc(unsigned long data)
        struct hv_message *msg = (struct hv_message *)page_addr +
                                  VMBUS_MESSAGE_SINT;
        struct vmbus_channel_message_header *hdr;
-       struct vmbus_channel_message_table_entry *entry;
+       const struct vmbus_channel_message_table_entry *entry;
        struct onmessage_work_context *ctx;
        u32 message_type = msg->header.message_type;