[-next,v2,1/2] media: cx231xx: Add BUF_SIZE and TIMEOUT_MS macros
Commit Message
Define BUF_SIZE and TIMEOUT_MS macros to make the code
more readable.
Signed-off-by: Jinjie Ruan <ruanjinjie@huawei.com>
Suggested-by: Andrzej Pietrasiewicz <andrzej.p@collabora.com>
---
drivers/media/usb/cx231xx/cx231xx-core.c | 8 ++++----
drivers/media/usb/cx231xx/cx231xx.h | 3 +++
2 files changed, 7 insertions(+), 4 deletions(-)
@@ -751,13 +751,13 @@ int cx231xx_ep5_bulkout(struct cx231xx *dev, u8 *firmware, u16 size)
int ret = -ENOMEM;
u32 *buffer;
- buffer = kzalloc(4096, GFP_KERNEL);
+ buffer = kzalloc(BUF_SIZE, GFP_KERNEL);
if (buffer == NULL)
return -ENOMEM;
- memcpy(&buffer[0], firmware, 4096);
+ memcpy(&buffer[0], firmware, BUF_SIZE);
ret = usb_bulk_msg(dev->udev, usb_sndbulkpipe(dev->udev, 5),
- buffer, 4096, &actlen, 2000);
+ buffer, BUF_SIZE, &actlen, TIMEOUT_MS);
if (ret)
dev_err(dev->dev,
@@ -994,7 +994,7 @@ int cx231xx_init_isoc(struct cx231xx *dev, int max_packets,
/* De-allocates all pending stuff */
cx231xx_uninit_isoc(dev);
- dma_q->p_left_data = kzalloc(4096, GFP_KERNEL);
+ dma_q->p_left_data = kzalloc(BUF_SIZE, GFP_KERNEL);
if (dma_q->p_left_data == NULL)
return -ENOMEM;
@@ -120,6 +120,9 @@
#define CX23417_OSC_EN 8
#define CX23417_RESET 9
+#define BUF_SIZE 4096
+#define TIMEOUT_MS 2000
+
struct cx23417_fmt {
u32 fourcc; /* v4l2 format id */
int depth;