diff options
author | Dmitry Torokhov <dmitry.torokhov@gmail.com> | 2018-08-10 03:28:35 +0300 |
---|---|---|
committer | Dmitry Torokhov <dmitry.torokhov@gmail.com> | 2019-06-23 09:55:23 +0300 |
commit | 6ac0aec6b0a651d64eef759fddf17d9145b51033 (patch) | |
tree | 64e8b5f744e8ccaed644cb8282b11abae7a41ae6 /drivers/input/joystick/iforce/iforce-usb.c | |
parent | 633354d1910262f2a3262797572ff72da461379e (diff) | |
download | linux-6ac0aec6b0a651d64eef759fddf17d9145b51033.tar.xz |
Input: iforce - allow callers supply data buffer when fetching device IDs
We want to move buffer handling into transport layers as the properties of
buffers (DMA-safety, alignment, etc) are different for different
transports. To allow this, let's allow caller to specify their own buffers
for the results of iforce_get_id_packet() and let transport drivers to
figure what buffers they need to use for transfers.
Tested-by: Tim Schumacher <timschumi@gmx.de>
Signed-off-by: Dmitry Torokhov <dmitry.torokhov@gmail.com>
Diffstat (limited to 'drivers/input/joystick/iforce/iforce-usb.c')
-rw-r--r-- | drivers/input/joystick/iforce/iforce-usb.c | 11 |
1 files changed, 6 insertions, 5 deletions
diff --git a/drivers/input/joystick/iforce/iforce-usb.c b/drivers/input/joystick/iforce/iforce-usb.c index b3743fde2a3a..68155c4de412 100644 --- a/drivers/input/joystick/iforce/iforce-usb.c +++ b/drivers/input/joystick/iforce/iforce-usb.c @@ -87,7 +87,8 @@ static void iforce_usb_xmit(struct iforce *iforce) __iforce_usb_xmit(iforce); } -static int iforce_usb_get_id(struct iforce *iforce, u8 *packet) +static int iforce_usb_get_id(struct iforce *iforce, u8 id, + u8 *response_data, size_t *response_len) { struct iforce_usb *iforce_usb = container_of(iforce, struct iforce_usb, iforce); @@ -100,18 +101,18 @@ static int iforce_usb_get_id(struct iforce *iforce, u8 *packet) status = usb_control_msg(iforce_usb->usbdev, usb_rcvctrlpipe(iforce_usb->usbdev, 0), - packet[0], + id, USB_TYPE_VENDOR | USB_DIR_IN | USB_RECIP_INTERFACE, 0, 0, buf, IFORCE_MAX_LENGTH, HZ); if (status < 0) { dev_err(&iforce_usb->intf->dev, "usb_submit_urb failed: %d\n", status); - } else if (buf[0] != packet[0]) { + } else if (buf[0] != id) { status = -EIO; } else { - iforce->ecmd = 0xff00 | status; - memcpy(iforce->edata, buf, status); + memcpy(response_data, buf, status); + *response_len = status; status = 0; } |