Re: [PATCH -next v2] media: staging: atomisp: use list_move_tail instead of list_del/list_add_tail in atomisp_compat_css20.c

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Wed, Jun 9, 2021 at 4:32 PM Baokun Li <libaokun1@xxxxxxxxxx> 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



[Index of Archives]     [Kernel Development]     [Kernel Announce]     [Kernel Newbies]     [Linux Networking Development]     [Share Photos]     [IDE]     [Security]     [Git]     [Netfilter]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Device Mapper]

  Powered by Linux