提交 e5a78fad 编写于 作者: S Stephen Hemminger 提交者: David S. Miller

hv_netvsc: use ARRAY_SIZE() for NDIS versions

Don't hard code size of array of NDIS versions.
Signed-off-by: NStephen Hemminger <sthemmin@microsoft.com>
Signed-off-by: NDavid S. Miller <davem@davemloft.net>
上级 30d1de08
...@@ -577,9 +577,10 @@ static int netvsc_connect_vsp(struct hv_device *device) ...@@ -577,9 +577,10 @@ static int netvsc_connect_vsp(struct hv_device *device)
struct netvsc_device *net_device; struct netvsc_device *net_device;
struct nvsp_message *init_packet; struct nvsp_message *init_packet;
int ndis_version; int ndis_version;
u32 ver_list[] = { NVSP_PROTOCOL_VERSION_1, NVSP_PROTOCOL_VERSION_2, const u32 ver_list[] = {
NVSP_PROTOCOL_VERSION_1, NVSP_PROTOCOL_VERSION_2,
NVSP_PROTOCOL_VERSION_4, NVSP_PROTOCOL_VERSION_5 }; NVSP_PROTOCOL_VERSION_4, NVSP_PROTOCOL_VERSION_5 };
int i, num_ver = 4; /* number of different NVSP versions */ int i;
net_device = get_outbound_net_device(device); net_device = get_outbound_net_device(device);
if (!net_device) if (!net_device)
...@@ -588,7 +589,7 @@ static int netvsc_connect_vsp(struct hv_device *device) ...@@ -588,7 +589,7 @@ static int netvsc_connect_vsp(struct hv_device *device)
init_packet = &net_device->channel_init_pkt; init_packet = &net_device->channel_init_pkt;
/* Negotiate the latest NVSP protocol supported */ /* Negotiate the latest NVSP protocol supported */
for (i = num_ver - 1; i >= 0; i--) for (i = ARRAY_SIZE(ver_list) - 1; i >= 0; i--)
if (negotiate_nvsp_ver(device, net_device, init_packet, if (negotiate_nvsp_ver(device, net_device, init_packet,
ver_list[i]) == 0) { ver_list[i]) == 0) {
net_device->nvsp_version = ver_list[i]; net_device->nvsp_version = ver_list[i];
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册