summaryrefslogtreecommitdiff
path: root/drivers/staging/vt6656/usbpipe.c
diff options
context:
space:
mode:
authorMalcolm Priestley <tvboxspy@gmail.com>2019-12-20 21:15:24 +0000
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>2020-01-03 11:46:57 +0100
commit69cc1f925e1aa74b96e2ace67e3453a50d091d2f (patch)
tree61b4eba9b3108e9ca19f2a1266211902abe130b3 /drivers/staging/vt6656/usbpipe.c
parent7de6155c8968a3342d1bef3f7a2084d31ae6e4be (diff)
staging: vt6656: limit reg output to block size
vnt_control_out appears to fail when BBREG is greater than 64 writes. Create new function that will relay an array in no larger than the indicated block size. It appears that this command has always failed but was ignored by driver until the introduction of error checking. Cc: stable <stable@vger.kernel.org> # v5.3+ Signed-off-by: Malcolm Priestley <tvboxspy@gmail.com> Link: https://lore.kernel.org/r/a41f0601-df46-ce6e-ab7c-35e697946e2a@gmail.com Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Diffstat (limited to 'drivers/staging/vt6656/usbpipe.c')
-rw-r--r--drivers/staging/vt6656/usbpipe.c17
1 files changed, 17 insertions, 0 deletions
diff --git a/drivers/staging/vt6656/usbpipe.c b/drivers/staging/vt6656/usbpipe.c
index 488ebd98773d..d977d4777e4f 100644
--- a/drivers/staging/vt6656/usbpipe.c
+++ b/drivers/staging/vt6656/usbpipe.c
@@ -76,6 +76,23 @@ int vnt_control_out_u8(struct vnt_private *priv, u8 reg, u8 reg_off, u8 data)
reg_off, reg, sizeof(u8), &data);
}
+int vnt_control_out_blocks(struct vnt_private *priv,
+ u16 block, u8 reg, u16 length, u8 *data)
+{
+ int ret = 0, i;
+
+ for (i = 0; i < length; i += block) {
+ u16 len = min_t(int, length - i, block);
+
+ ret = vnt_control_out(priv, MESSAGE_TYPE_WRITE,
+ i, reg, len, data + i);
+ if (ret)
+ goto end;
+ }
+end:
+ return ret;
+}
+
int vnt_control_in(struct vnt_private *priv, u8 request, u16 value,
u16 index, u16 length, u8 *buffer)
{