media: flexcop-usb: fix control-message timeouts

commit cd1798a387825cc4a51282f5a611ad05bb1ad75f upstream.

USB control-message timeouts are specified in milliseconds and should
specifically not vary with CONFIG_HZ.

Note that the driver was multiplying some of the timeout values with HZ
twice resulting in 3000-second timeouts with HZ=1000.

Also note that two of the timeout defines are currently unused.

Fixes: 2154be651b ("[media] redrat3: new rc-core IR transceiver device driver")
Cc: stable@vger.kernel.org      # 3.0
Signed-off-by: Johan Hovold <johan@kernel.org>
Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
This commit is contained in:
Johan Hovold
2021-10-25 13:16:36 +01:00
committed by Greg Kroah-Hartman
parent 7cac8a5624
commit 460525acc9
2 changed files with 11 additions and 11 deletions

View File

@@ -87,7 +87,7 @@ static int flexcop_usb_readwrite_dw(struct flexcop_device *fc, u16 wRegOffsPCI,
0, 0,
fc_usb->data, fc_usb->data,
sizeof(u32), sizeof(u32),
B2C2_WAIT_FOR_OPERATION_RDW * HZ); B2C2_WAIT_FOR_OPERATION_RDW);
if (ret != sizeof(u32)) { if (ret != sizeof(u32)) {
err("error while %s dword from %d (%d).", read ? "reading" : err("error while %s dword from %d (%d).", read ? "reading" :
@@ -155,7 +155,7 @@ static int flexcop_usb_v8_memory_req(struct flexcop_usb *fc_usb,
wIndex, wIndex,
fc_usb->data, fc_usb->data,
buflen, buflen,
nWaitTime * HZ); nWaitTime);
if (ret != buflen) if (ret != buflen)
ret = -EIO; ret = -EIO;
@@ -249,13 +249,13 @@ static int flexcop_usb_i2c_req(struct flexcop_i2c_adapter *i2c,
/* DKT 020208 - add this to support special case of DiSEqC */ /* DKT 020208 - add this to support special case of DiSEqC */
case USB_FUNC_I2C_CHECKWRITE: case USB_FUNC_I2C_CHECKWRITE:
pipe = B2C2_USB_CTRL_PIPE_OUT; pipe = B2C2_USB_CTRL_PIPE_OUT;
nWaitTime = 2; nWaitTime = 2000;
request_type |= USB_DIR_OUT; request_type |= USB_DIR_OUT;
break; break;
case USB_FUNC_I2C_READ: case USB_FUNC_I2C_READ:
case USB_FUNC_I2C_REPEATREAD: case USB_FUNC_I2C_REPEATREAD:
pipe = B2C2_USB_CTRL_PIPE_IN; pipe = B2C2_USB_CTRL_PIPE_IN;
nWaitTime = 2; nWaitTime = 2000;
request_type |= USB_DIR_IN; request_type |= USB_DIR_IN;
break; break;
default: default:
@@ -282,7 +282,7 @@ static int flexcop_usb_i2c_req(struct flexcop_i2c_adapter *i2c,
wIndex, wIndex,
fc_usb->data, fc_usb->data,
buflen, buflen,
nWaitTime * HZ); nWaitTime);
if (ret != buflen) if (ret != buflen)
ret = -EIO; ret = -EIO;

View File

@@ -91,13 +91,13 @@ typedef enum {
UTILITY_SRAM_TESTVERIFY = 0x16, UTILITY_SRAM_TESTVERIFY = 0x16,
} flexcop_usb_utility_function_t; } flexcop_usb_utility_function_t;
#define B2C2_WAIT_FOR_OPERATION_RW (1*HZ) #define B2C2_WAIT_FOR_OPERATION_RW 1000
#define B2C2_WAIT_FOR_OPERATION_RDW (3*HZ) #define B2C2_WAIT_FOR_OPERATION_RDW 3000
#define B2C2_WAIT_FOR_OPERATION_WDW (1*HZ) #define B2C2_WAIT_FOR_OPERATION_WDW 1000
#define B2C2_WAIT_FOR_OPERATION_V8READ (3*HZ) #define B2C2_WAIT_FOR_OPERATION_V8READ 3000
#define B2C2_WAIT_FOR_OPERATION_V8WRITE (3*HZ) #define B2C2_WAIT_FOR_OPERATION_V8WRITE 3000
#define B2C2_WAIT_FOR_OPERATION_V8FLASH (3*HZ) #define B2C2_WAIT_FOR_OPERATION_V8FLASH 3000
typedef enum { typedef enum {
V8_MEMORY_PAGE_DVB_CI = 0x20, V8_MEMORY_PAGE_DVB_CI = 0x20,