netvsc: get rid of completion timeouts
[cascardo/linux.git] / drivers / net / hyperv / netvsc.c
index 719cb35..6909c32 100644 (file)
@@ -95,9 +95,7 @@ static void free_netvsc_device(struct netvsc_device *nvdev)
 
 static struct netvsc_device *get_outbound_net_device(struct hv_device *device)
 {
-       struct net_device *ndev = hv_get_drvdata(device);
-       struct net_device_context *net_device_ctx = netdev_priv(ndev);
-       struct netvsc_device *net_device = net_device_ctx->nvdev;
+       struct netvsc_device *net_device = hv_device_to_netvsc_device(device);
 
        if (net_device && net_device->destroy)
                net_device = NULL;
@@ -107,9 +105,7 @@ static struct netvsc_device *get_outbound_net_device(struct hv_device *device)
 
 static struct netvsc_device *get_inbound_net_device(struct hv_device *device)
 {
-       struct net_device *ndev = hv_get_drvdata(device);
-       struct net_device_context *net_device_ctx = netdev_priv(ndev);
-       struct netvsc_device *net_device = net_device_ctx->nvdev;
+       struct netvsc_device *net_device = hv_device_to_netvsc_device(device);
 
        if (!net_device)
                goto get_in_err;
@@ -128,8 +124,7 @@ static int netvsc_destroy_buf(struct hv_device *device)
        struct nvsp_message *revoke_packet;
        int ret = 0;
        struct net_device *ndev = hv_get_drvdata(device);
-       struct net_device_context *net_device_ctx = netdev_priv(ndev);
-       struct netvsc_device *net_device = net_device_ctx->nvdev;
+       struct netvsc_device *net_device = net_device_to_netvsc_device(ndev);
 
        /*
         * If we got a section count, it means we received a
@@ -249,7 +244,6 @@ static int netvsc_destroy_buf(struct hv_device *device)
 static int netvsc_init_buf(struct hv_device *device)
 {
        int ret = 0;
-       unsigned long t;
        struct netvsc_device *net_device;
        struct nvsp_message *init_packet;
        struct net_device *ndev;
@@ -310,9 +304,7 @@ static int netvsc_init_buf(struct hv_device *device)
                goto cleanup;
        }
 
-       t = wait_for_completion_timeout(&net_device->channel_init_wait, 5*HZ);
-       BUG_ON(t == 0);
-
+       wait_for_completion(&net_device->channel_init_wait);
 
        /* Check the response */
        if (init_packet->msg.v1_msg.
@@ -395,8 +387,7 @@ static int netvsc_init_buf(struct hv_device *device)
                goto cleanup;
        }
 
-       t = wait_for_completion_timeout(&net_device->channel_init_wait, 5*HZ);
-       BUG_ON(t == 0);
+       wait_for_completion(&net_device->channel_init_wait);
 
        /* Check the response */
        if (init_packet->msg.v1_msg.
@@ -450,7 +441,6 @@ static int negotiate_nvsp_ver(struct hv_device *device,
 {
        struct net_device *ndev = hv_get_drvdata(device);
        int ret;
-       unsigned long t;
 
        memset(init_packet, 0, sizeof(struct nvsp_message));
        init_packet->hdr.msg_type = NVSP_MSG_TYPE_INIT;
@@ -467,10 +457,7 @@ static int negotiate_nvsp_ver(struct hv_device *device,
        if (ret != 0)
                return ret;
 
-       t = wait_for_completion_timeout(&net_device->channel_init_wait, 5*HZ);
-
-       if (t == 0)
-               return -ETIMEDOUT;
+       wait_for_completion(&net_device->channel_init_wait);
 
        if (init_packet->msg.init_msg.init_complete.status !=
            NVSP_STAT_SUCCESS)