From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-5.3 required=3.0 tests=BAYES_00, HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,NICE_REPLY_A,SPF_HELO_NONE, SPF_PASS,USER_AGENT_SANE_1 autolearn=no autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id BF1CFC48BE5 for ; Fri, 11 Jun 2021 07:19:52 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id A5162613B3 for ; Fri, 11 Jun 2021 07:19:52 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231362AbhFKHVt (ORCPT ); Fri, 11 Jun 2021 03:21:49 -0400 Received: from szxga02-in.huawei.com ([45.249.212.188]:3960 "EHLO szxga02-in.huawei.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230460AbhFKHVq (ORCPT ); Fri, 11 Jun 2021 03:21:46 -0400 Received: from dggemv711-chm.china.huawei.com (unknown [172.30.72.53]) by szxga02-in.huawei.com (SkyGuard) with ESMTP id 4G1XG16kQKz6ty6; Fri, 11 Jun 2021 15:16:41 +0800 (CST) Received: from dggpeml500020.china.huawei.com (7.185.36.88) by dggemv711-chm.china.huawei.com (10.1.198.66) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2176.2; Fri, 11 Jun 2021 15:19:47 +0800 Received: from [10.174.177.174] (10.174.177.174) by dggpeml500020.china.huawei.com (7.185.36.88) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2176.2; Fri, 11 Jun 2021 15:19:46 +0800 Subject: Re: [PATCH -next v2] media: staging: atomisp: use list_move_tail instead of list_del/list_add_tail in atomisp_compat_css20.c To: Andy Shevchenko CC: Linux Kernel Mailing List , "Mauro Carvalho Chehab" , Greg Kroah-Hartman , Sakari Ailus , Andy Shevchenko , Kaixu Xia , "Gustavo A. R. Silva" , Wei Yongjun , YueHaibing , , , Linux Media Mailing List , , kernel-janitors , Hulk Robot References: <20210609072409.1357327-1-libaokun1@huawei.com> From: "libaokun (A)" Message-ID: Date: Fri, 11 Jun 2021 15:19:46 +0800 User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:78.0) Gecko/20100101 Thunderbird/78.9.0 MIME-Version: 1.0 In-Reply-To: Content-Type: text/plain; charset="utf-8"; format=flowed Content-Transfer-Encoding: 8bit X-Originating-IP: [10.174.177.174] X-ClientProxiedBy: dggems701-chm.china.huawei.com (10.3.19.178) To dggpeml500020.china.huawei.com (7.185.36.88) X-CFilter-Loop: Reflected Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Thank you for your advice. That's a great idea. I'm about to send a patch v3 with the changes suggested by you. Best Regards 在 2021/6/10 2:17, Andy Shevchenko 写道: > On Wed, Jun 9, 2021 at 4:32 PM Baokun Li wrote: >> Using list_move_tail() instead of list_del() + list_add_tail() in atomisp_compat_css20.c. > Have you considered using list_splice() instead of entire while-loops? > Or something similar from list.h... > >> while (!list_empty(&asd->s3a_stats_in_css)) { >> s3a_buf = list_entry(asd->s3a_stats_in_css.next, >> struct atomisp_s3a_buf, list); >> - list_del(&s3a_buf->list); >> - list_add_tail(&s3a_buf->list, &asd->s3a_stats); >> + list_move_tail(&s3a_buf->list, &asd->s3a_stats); >> } >> while (!list_empty(&asd->s3a_stats_ready)) { >> s3a_buf = list_entry(asd->s3a_stats_ready.next, >> struct atomisp_s3a_buf, list); >> - list_del(&s3a_buf->list); >> - list_add_tail(&s3a_buf->list, &asd->s3a_stats); >> + list_move_tail(&s3a_buf->list, &asd->s3a_stats); >> } >> while (!list_empty(&asd->dis_stats_in_css)) { >> dis_buf = list_entry(asd->dis_stats_in_css.next, >> struct atomisp_dis_buf, list); >> - list_del(&dis_buf->list); >> - list_add_tail(&dis_buf->list, &asd->dis_stats); >> + list_move_tail(&dis_buf->list, &asd->dis_stats); >> } >> while (!list_empty(&asd->metadata_in_css[i])) { >> md_buf = list_entry(asd->metadata_in_css[i].next, >> struct atomisp_metadata_buf, list); >> - list_del(&md_buf->list); >> - list_add_tail(&md_buf->list, &asd->metadata[i]); >> + list_move_tail(&md_buf->list, &asd->metadata[i]); >> } >> while (!list_empty(&asd->metadata_ready[i])) { >> md_buf = list_entry(asd->metadata_ready[i].next, >> struct atomisp_metadata_buf, list); >> - list_del(&md_buf->list); >> - list_add_tail(&md_buf->list, &asd->metadata[i]); >> + list_move_tail(&md_buf->list, &asd->metadata[i]); >> }