aboutsummaryrefslogtreecommitdiff
path: root/hid-tm.h
diff options
context:
space:
mode:
authorKimplul <kimi.h.kuparinen@gmail.com>2021-03-24 20:48:04 +0200
committerKimplul <kimi.h.kuparinen@gmail.com>2021-03-24 20:48:04 +0200
commit301f7fa87fa2bafbd9ed3436aa7eb865b341563c (patch)
tree1bda82c0cd2f0093d74fb423da626fde0f17dd0a /hid-tm.h
parentc2be549438657a7e0b863a1ed58ba17e8fb5ff33 (diff)
downloadhid-tmff2-301f7fa87fa2bafbd9ed3436aa7eb865b341563c.tar.gz
hid-tmff2-301f7fa87fa2bafbd9ed3436aa7eb865b341563c.zip
Merge branch 'minalloc'
Diffstat (limited to 'hid-tm.h')
-rw-r--r--hid-tm.h48
1 files changed, 0 insertions, 48 deletions
diff --git a/hid-tm.h b/hid-tm.h
deleted file mode 100644
index e0117ae..0000000
--- a/hid-tm.h
+++ /dev/null
@@ -1,48 +0,0 @@
-#include <linux/hid.h>
-#include <linux/usb.h>
-#include <linux/input.h>
-#include <linux/slab.h>
-#include <linux/module.h>
-
-#define USB_VENDOR_ID_THRUSTMASTER 0x044f
-
-struct api_context {
- struct completion done;
- int status;
-};
-
-struct api_context ctx;
-
-int usb_start_wait_urb(struct urb *urb, int timeout, int *actual_length)
-{
- unsigned long expire;
- int retval;
-
- init_completion(&ctx.done);
- urb->context = &ctx;
- urb->actual_length = 0;
- retval = usb_submit_urb(urb, GFP_ATOMIC);
- if (unlikely(retval))
- goto out;
-
- expire = timeout ? msecs_to_jiffies(timeout) : MAX_SCHEDULE_TIMEOUT;
- if (!wait_for_completion_timeout(&ctx.done, expire)) {
- usb_kill_urb(urb);
- retval = (ctx.status == -ENOENT ? -ETIMEDOUT : ctx.status);
-
- dev_dbg(&urb->dev->dev,
- "%s timed out on ep%d%s len=%u/%u\n",
- current->comm,
- usb_endpoint_num(&urb->ep->desc),
- usb_urb_dir_in(urb) ? "in" : "out",
- urb->actual_length,
- urb->transfer_buffer_length);
- } else
- retval = ctx.status;
-out:
- if (actual_length)
- *actual_length = urb->actual_length;
-
- usb_free_urb(urb);
- return retval;
-}