Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 249558
b: refs/heads/master
c: 98d7969
h: refs/heads/master
v: v3
  • Loading branch information
K. Y. Srinivasan authored and Greg Kroah-Hartman committed May 11, 2011
1 parent 61b3f2c commit 27f2646
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 20 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: 35abb21ace3413de6ea8d5c7750cedfd46111f0c
refs/heads/master: 98d796905b5515af30198796088599993530243d
33 changes: 14 additions & 19 deletions trunk/drivers/staging/hv/rndis_filter.c
Original file line number Diff line number Diff line change
Expand Up @@ -59,8 +59,7 @@ struct rndis_device {

struct rndis_request {
struct list_head list_ent;
int wait_condition;
wait_queue_head_t wait_event;
struct completion wait_event;

/*
* FIXME: We assumed a fixed size response here. If we do ever need to
Expand Down Expand Up @@ -125,7 +124,7 @@ static struct rndis_request *get_rndis_request(struct rndis_device *dev,
if (!request)
return NULL;

init_waitqueue_head(&request->wait_event);
init_completion(&request->wait_event);

rndis_msg = &request->request_msg;
rndis_msg->ndis_msg_type = msg_type;
Expand Down Expand Up @@ -305,8 +304,7 @@ static void rndis_filter_receive_response(struct rndis_device *dev,
}
}

request->wait_condition = 1;
wake_up(&request->wait_event);
complete(&request->wait_event);
} else {
dev_err(&dev->net_dev->dev->device,
"no rndis request found for this response "
Expand Down Expand Up @@ -465,6 +463,7 @@ static int rndis_filter_query_device(struct rndis_device *dev, u32 oid,
struct rndis_query_request *query;
struct rndis_query_complete *query_complete;
int ret = 0;
int t;

if (!result)
return -EINVAL;
Expand All @@ -484,14 +483,12 @@ static int rndis_filter_query_device(struct rndis_device *dev, u32 oid,
query->info_buflen = 0;
query->dev_vc_handle = 0;

request->wait_condition = 0;
ret = rndis_filter_send_request(dev, request);
if (ret != 0)
goto Cleanup;

wait_event_timeout(request->wait_event, request->wait_condition,
msecs_to_jiffies(1000));
if (request->wait_condition == 0) {
t = wait_for_completion_timeout(&request->wait_event, HZ);
if (t == 0) {
ret = -ETIMEDOUT;
goto Cleanup;
}
Expand Down Expand Up @@ -543,7 +540,7 @@ static int rndis_filter_set_packet_filter(struct rndis_device *dev,
struct rndis_set_request *set;
struct rndis_set_complete *set_complete;
u32 status;
int ret;
int ret, t;

request = get_rndis_request(dev, REMOTE_NDIS_SET_MSG,
RNDIS_MESSAGE_SIZE(struct rndis_set_request) +
Expand All @@ -562,14 +559,13 @@ static int rndis_filter_set_packet_filter(struct rndis_device *dev,
memcpy((void *)(unsigned long)set + sizeof(struct rndis_set_request),
&new_filter, sizeof(u32));

request->wait_condition = 0;
ret = rndis_filter_send_request(dev, request);
if (ret != 0)
goto Cleanup;

wait_event_timeout(request->wait_event, request->wait_condition,
msecs_to_jiffies(2000));
if (request->wait_condition == 0) {
t = wait_for_completion_timeout(&request->wait_event, HZ);

if (t == 0) {
ret = -1;
dev_err(&dev->net_dev->dev->device,
"timeout before we got a set response...\n");
Expand Down Expand Up @@ -624,7 +620,7 @@ static int rndis_filter_init_device(struct rndis_device *dev)
struct rndis_initialize_request *init;
struct rndis_initialize_complete *init_complete;
u32 status;
int ret;
int ret, t;

request = get_rndis_request(dev, REMOTE_NDIS_INITIALIZE_MSG,
RNDIS_MESSAGE_SIZE(struct rndis_initialize_request));
Expand All @@ -642,17 +638,16 @@ static int rndis_filter_init_device(struct rndis_device *dev)

dev->state = RNDIS_DEV_INITIALIZING;

request->wait_condition = 0;
ret = rndis_filter_send_request(dev, request);
if (ret != 0) {
dev->state = RNDIS_DEV_UNINITIALIZED;
goto Cleanup;
}


wait_event_timeout(request->wait_event, request->wait_condition,
msecs_to_jiffies(1000));
if (request->wait_condition == 0) {
t = wait_for_completion_timeout(&request->wait_event, HZ);

if (t == 0) {
ret = -ETIMEDOUT;
goto Cleanup;
}
Expand Down

0 comments on commit 27f2646

Please sign in to comment.