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]

 



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 <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]);
                 }




[Index of Archives]     [Linux Driver Development]     [Linux Driver Backports]     [DMA Engine]     [Linux GPIO]     [Linux SPI]     [Video for Linux]     [Linux USB Devel]     [Linux Coverity]     [Linux Audio Users]     [Linux Kernel]     [Linux SCSI]     [Yosemite Backpacking]
  Powered by Linux