Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 8468
b: refs/heads/master
c: fb76b09
h: refs/heads/master
v: v3
  • Loading branch information
Vojtech Pavlik authored and Dmitry Torokhov committed Sep 5, 2005
1 parent 63e2b47 commit cca472b
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 26 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: 39fd748f56012fdde4cf862f127ce4cdec50d661
refs/heads/master: fb76b099f86624d3c629cfab071aa2296f65b7bb
32 changes: 7 additions & 25 deletions trunk/drivers/input/joystick/iforce/iforce-packets.c
Original file line number Diff line number Diff line change
Expand Up @@ -249,9 +249,6 @@ void iforce_process_packet(struct iforce *iforce, u16 cmd, unsigned char *data,

int iforce_get_id_packet(struct iforce *iforce, char *packet)
{
DECLARE_WAITQUEUE(wait, current);
int timeout = HZ; /* 1 second */

switch (iforce->bus) {

case IFORCE_USB:
Expand All @@ -260,22 +257,13 @@ int iforce_get_id_packet(struct iforce *iforce, char *packet)
iforce->cr.bRequest = packet[0];
iforce->ctrl->dev = iforce->usbdev;

set_current_state(TASK_INTERRUPTIBLE);
add_wait_queue(&iforce->wait, &wait);

if (usb_submit_urb(iforce->ctrl, GFP_ATOMIC)) {
set_current_state(TASK_RUNNING);
remove_wait_queue(&iforce->wait, &wait);
if (usb_submit_urb(iforce->ctrl, GFP_ATOMIC))
return -1;
}

while (timeout && iforce->ctrl->status == -EINPROGRESS)
timeout = schedule_timeout(timeout);
wait_event_interruptible_timeout(iforce->wait,
iforce->ctrl->status != -EINPROGRESS, HZ);

set_current_state(TASK_RUNNING);
remove_wait_queue(&iforce->wait, &wait);

if (!timeout) {
if (iforce->ctrl->status != -EINPROGRESS) {
usb_unlink_urb(iforce->ctrl);
return -1;
}
Expand All @@ -290,16 +278,10 @@ int iforce_get_id_packet(struct iforce *iforce, char *packet)
iforce->expect_packet = FF_CMD_QUERY;
iforce_send_packet(iforce, FF_CMD_QUERY, packet);

set_current_state(TASK_INTERRUPTIBLE);
add_wait_queue(&iforce->wait, &wait);

while (timeout && iforce->expect_packet)
timeout = schedule_timeout(timeout);

set_current_state(TASK_RUNNING);
remove_wait_queue(&iforce->wait, &wait);
wait_event_interruptible_timeout(iforce->wait,
!iforce->expect_packet, HZ);

if (!timeout) {
if (iforce->expect_packet) {
iforce->expect_packet = 0;
return -1;
}
Expand Down
1 change: 1 addition & 0 deletions trunk/drivers/input/joystick/iforce/iforce-usb.c
Original file line number Diff line number Diff line change
Expand Up @@ -95,6 +95,7 @@ static void iforce_usb_irq(struct urb *urb, struct pt_regs *regs)
goto exit;
}

wake_up(&iforce->wait);
iforce_process_packet(iforce,
(iforce->data[0] << 8) | (urb->actual_length - 1), iforce->data + 1, regs);

Expand Down

0 comments on commit cca472b

Please sign in to comment.