[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <CAHp75VesvRMGY25WP-ZQaqWE-kyyp25GsvM8h=yMfO5U6r1gDA@mail.gmail.com>
Date: Wed, 9 Jun 2021 21:17:23 +0300
From: Andy Shevchenko <andy.shevchenko@...il.com>
To: Baokun Li <libaokun1@...wei.com>
Cc: Linux Kernel Mailing List <linux-kernel@...r.kernel.org>,
Mauro Carvalho Chehab <mchehab@...nel.org>,
Greg Kroah-Hartman <gregkh@...uxfoundation.org>,
Sakari Ailus <sakari.ailus@...ux.intel.com>,
Andy Shevchenko <andriy.shevchenko@...ux.intel.com>,
Kaixu Xia <kaixuxia@...cent.com>,
"Gustavo A. R. Silva" <gustavoars@...nel.org>,
Wei Yongjun <weiyongjun1@...wei.com>,
YueHaibing <yuehaibing@...wei.com>, yangjihong1@...wei.com,
yukuai3@...wei.com,
Linux Media Mailing List <linux-media@...r.kernel.org>,
linux-staging@...ts.linux.dev,
kernel-janitors <kernel-janitors@...r.kernel.org>,
Hulk Robot <hulkci@...wei.com>
Subject: Re: [PATCH -next v2] media: staging: atomisp: use list_move_tail
instead of list_del/list_add_tail in atomisp_compat_css20.c
On Wed, Jun 9, 2021 at 4:32 PM Baokun Li <libaokun1@...wei.com> 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]);
> }
--
With Best Regards,
Andy Shevchenko
Powered by blists - more mailing lists