From: Ruan Jinjie <ruanjinjie@huawei.com>
To: Andrzej Pietrasiewicz <andrzej.p@collabora.com>,
<mchehab@kernel.org>, <linux-media@vger.kernel.org>
Subject: Re: [PATCH -next v3 2/2] media: cx231xx: Add EP5_BUF_SIZE and EP5_TIMEOUT_MS macros
Date: Sat, 9 Sep 2023 15:30:43 +0800 [thread overview]
Message-ID: <d0ea4639-cabf-466a-784f-164040c19faa@huawei.com> (raw)
In-Reply-To: <ede17d5c-a727-5308-1cff-8adf2eb090e9@collabora.com>
On 2023/9/8 20:26, Andrzej Pietrasiewicz wrote:
> Hi,
>
> W dniu 3.09.2023 o 10:14, Jinjie Ruan pisze:
>> Define EP5_BUF_SIZE and EP5_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>
>> ---
>> v2:
>> - Adjust the patch to be the second.
>> - Adjust the macro name.
>> ---
>> drivers/media/usb/cx231xx/cx231xx-core.c | 4 ++--
>> drivers/media/usb/cx231xx/cx231xx.h | 3 +++
>> 2 files changed, 5 insertions(+), 2 deletions(-)
>>
>> diff --git a/drivers/media/usb/cx231xx/cx231xx-core.c
>> b/drivers/media/usb/cx231xx/cx231xx-core.c
>> index 746727ea1a4c..57a8b4780a7d 100644
>> --- a/drivers/media/usb/cx231xx/cx231xx-core.c
>> +++ b/drivers/media/usb/cx231xx/cx231xx-core.c
>> @@ -751,12 +751,12 @@ int cx231xx_ep5_bulkout(struct cx231xx *dev, u8
>> *firmware, u16 size)
>> int ret = -ENOMEM;
>> u32 *buffer;
>> - buffer = kmemdup(firmware, 4096, GFP_KERNEL);
>> + buffer = kmemdup(firmware, EP5_BUF_SIZE, GFP_KERNEL);
>> if (buffer == NULL)
>> return -ENOMEM;
>> ret = usb_bulk_msg(dev->udev, usb_sndbulkpipe(dev->udev, 5),
>> - buffer, 4096, &actlen, 2000);
>> + buffer, EP5_BUF_SIZE, &actlen, EP5_TIMEOUT_MS);
>>
>
> $ git grep 4096 drivers/media/usb/cx231xx | sort | wc -l
> 6
>
> 4096 is a pretty popular constant in this driver. What about the other 4
> places?
Thank you! I'll replace them together.
>
> Andrzej
>
>> if (ret)
>> dev_err(dev->dev,
>> diff --git a/drivers/media/usb/cx231xx/cx231xx.h
>> b/drivers/media/usb/cx231xx/cx231xx.h
>> index 6929e4d97067..74339a6a2f71 100644
>> --- a/drivers/media/usb/cx231xx/cx231xx.h
>> +++ b/drivers/media/usb/cx231xx/cx231xx.h
>> @@ -120,6 +120,9 @@
>> #define CX23417_OSC_EN 8
>> #define CX23417_RESET 9
>> +#define EP5_BUF_SIZE 4096
>> +#define EP5_TIMEOUT_MS 2000
>> +
>> struct cx23417_fmt {
>> u32 fourcc; /* v4l2 format id */
>> int depth;
>
prev parent reply other threads:[~2023-09-09 7:30 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-09-03 8:14 [PATCH -next v3 0/2] media: cx231xx: Switch to use kmemdup() helper and add two macros Jinjie Ruan
2023-09-03 8:14 ` [PATCH -next v3 1/2] media: cx231xx: Switch to use kmemdup() helper Jinjie Ruan
2023-09-08 12:19 ` Andrzej Pietrasiewicz
2023-09-09 7:29 ` Ruan Jinjie
2023-09-03 8:14 ` [PATCH -next v3 2/2] media: cx231xx: Add EP5_BUF_SIZE and EP5_TIMEOUT_MS macros Jinjie Ruan
2023-09-08 12:26 ` Andrzej Pietrasiewicz
2023-09-09 7:30 ` Ruan Jinjie [this message]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=d0ea4639-cabf-466a-784f-164040c19faa@huawei.com \
--to=ruanjinjie@huawei.com \
--cc=andrzej.p@collabora.com \
--cc=linux-media@vger.kernel.org \
--cc=mchehab@kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.