Message ID | 20230822111832.822367-1-ruanjinjie@huawei.com (mailing list archive) |
---|---|
Headers |
Received: from vger.kernel.org ([23.128.96.18]) by www.linuxtv.org with esmtp (Exim 4.92) (envelope-from <linux-media-owner@vger.kernel.org>) id 1qYPPX-005hDR-9J; Tue, 22 Aug 2023 11:18:59 +0000 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233448AbjHVLS6 (ORCPT <rfc822;mkrufky@linuxtv.org> + 1 other); Tue, 22 Aug 2023 07:18:58 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:43960 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229777AbjHVLS6 (ORCPT <rfc822;linux-media@vger.kernel.org>); Tue, 22 Aug 2023 07:18:58 -0400 Received: from szxga03-in.huawei.com (szxga03-in.huawei.com [45.249.212.189]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 895691BE for <linux-media@vger.kernel.org>; Tue, 22 Aug 2023 04:18:56 -0700 (PDT) Received: from kwepemi500008.china.huawei.com (unknown [172.30.72.53]) by szxga03-in.huawei.com (SkyGuard) with ESMTP id 4RVRbp3McLzLpJq; Tue, 22 Aug 2023 19:15:50 +0800 (CST) Received: from huawei.com (10.90.53.73) by kwepemi500008.china.huawei.com (7.221.188.139) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2507.31; Tue, 22 Aug 2023 19:18:54 +0800 From: Jinjie Ruan <ruanjinjie@huawei.com> To: <mchehab@kernel.org>, <linux-media@vger.kernel.org>, <andrzej.p@collabora.com> CC: <ruanjinjie@huawei.com> Subject: [PATCH -next v2 0/2] media: cx231xx: Add two macros and switch to use kmemdup() helper Date: Tue, 22 Aug 2023 19:18:30 +0800 Message-ID: <20230822111832.822367-1-ruanjinjie@huawei.com> X-Mailer: git-send-email 2.34.1 MIME-Version: 1.0 Content-Transfer-Encoding: 7BIT Content-Type: text/plain; charset=US-ASCII X-Originating-IP: [10.90.53.73] X-ClientProxiedBy: dggems701-chm.china.huawei.com (10.3.19.178) To kwepemi500008.china.huawei.com (7.221.188.139) X-CFilter-Loop: Reflected X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_BLOCKED,SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: <linux-media.vger.kernel.org> X-Mailing-List: linux-media@vger.kernel.org X-LSpam-Score: -2.4 (--) X-LSpam-Report: No, score=-2.4 required=5.0 tests=BAYES_00=-1.9,HEADER_FROM_DIFFERENT_DOMAINS=0.5,MAILING_LIST_MULTI=-1 autolearn=ham autolearn_force=no |
Series |
media: cx231xx: Add two macros and switch to use kmemdup() helper
|
|
Message
Jinjie Ruan
Aug. 22, 2023, 11:18 a.m. UTC
As Andrzej suggested, add BUF_SIZE and TIMEOUT_MS macros to replace the magic constant 4096 and 2000. On the other hand, use kmemdup() helper instead of open-coding to simplify the code. Jinjie Ruan (2): media: cx231xx: Add BUF_SIZE and TIMEOUT_MS macros media: cx231xx: Switch to use kmemdup() helper drivers/media/usb/cx231xx/cx231xx-core.c | 7 +++---- drivers/media/usb/cx231xx/cx231xx.h | 3 +++ 2 files changed, 6 insertions(+), 4 deletions(-)
Comments
Hi Jinjie, W dniu 22.08.2023 o 13:18, Jinjie Ruan pisze: > As Andrzej suggested, add BUF_SIZE and TIMEOUT_MS macros to replace > the magic constant 4096 and 2000. > > On the other hand, use kmemdup() helper instead of open-coding to > simplify the code. > Sorry about the delay. I think I'd prefer the kmemdup() patch as the first one so that it does not depend on the patch adding the macros. And then the one adding the macros becomes optional. Speaking about the latter, maybe BUF_SIZE and TIMEOUT_MS are a bit too vague? No strong opinion, though. Also, BUF_SIZE is suspiciously identical to PAGE_SIZE on some/many architectures. Any thoughts about it? Regards, Andrzej > Jinjie Ruan (2): > media: cx231xx: Add BUF_SIZE and TIMEOUT_MS macros > media: cx231xx: Switch to use kmemdup() helper > > drivers/media/usb/cx231xx/cx231xx-core.c | 7 +++---- > drivers/media/usb/cx231xx/cx231xx.h | 3 +++ > 2 files changed, 6 insertions(+), 4 deletions(-) >
On 2023/9/1 3:05, Andrzej Pietrasiewicz wrote: > Hi Jinjie, > > W dniu 22.08.2023 o 13:18, Jinjie Ruan pisze: >> As Andrzej suggested, add BUF_SIZE and TIMEOUT_MS macros to replace >> the magic constant 4096 and 2000. >> >> On the other hand, use kmemdup() helper instead of open-coding to >> simplify the code. >> > > Sorry about the delay. > > I think I'd prefer the kmemdup() patch as the first one so that it does not > depend on the patch adding the macros. And then the one adding the macros > becomes optional. > > Speaking about the latter, maybe BUF_SIZE and TIMEOUT_MS are a bit too > vague? > No strong opinion, though. Also, BUF_SIZE is suspiciously identical to > PAGE_SIZE on some/many architectures. Any thoughts about it? So just use the PAGE_SIZE macro? > > Regards, > > Andrzej > >> Jinjie Ruan (2): >> media: cx231xx: Add BUF_SIZE and TIMEOUT_MS macros >> media: cx231xx: Switch to use kmemdup() helper >> >> drivers/media/usb/cx231xx/cx231xx-core.c | 7 +++---- >> drivers/media/usb/cx231xx/cx231xx.h | 3 +++ >> 2 files changed, 6 insertions(+), 4 deletions(-) >> >
On 2023/9/1 3:05, Andrzej Pietrasiewicz wrote: > Hi Jinjie, > > W dniu 22.08.2023 o 13:18, Jinjie Ruan pisze: >> As Andrzej suggested, add BUF_SIZE and TIMEOUT_MS macros to replace >> the magic constant 4096 and 2000. >> >> On the other hand, use kmemdup() helper instead of open-coding to >> simplify the code. >> > > Sorry about the delay. > > I think I'd prefer the kmemdup() patch as the first one so that it does not > depend on the patch adding the macros. And then the one adding the macros > becomes optional. > > Speaking about the latter, maybe BUF_SIZE and TIMEOUT_MS are a bit too > vague? > No strong opinion, though. Also, BUF_SIZE is suspiciously identical to > PAGE_SIZE on some/many architectures. Any thoughts about it? PAGE_SIZE is configurable, which can be 2^12, 2^14, 2^16, such as ARM64: /* PAGE_SHIFT determines the page size */ #define PAGE_SHIFT>----->-------CONFIG_ARM64_PAGE_SHIFT #define PAGE_SIZE>------>-------(_AC(1, UL) << PAGE_SHIFT) > > Regards, > > Andrzej > >> Jinjie Ruan (2): >> media: cx231xx: Add BUF_SIZE and TIMEOUT_MS macros >> media: cx231xx: Switch to use kmemdup() helper >> >> drivers/media/usb/cx231xx/cx231xx-core.c | 7 +++---- >> drivers/media/usb/cx231xx/cx231xx.h | 3 +++ >> 2 files changed, 6 insertions(+), 4 deletions(-) >> >