Skip to content

Commit

Permalink
dmaengine: virt-dma: Convert to use list_for_each_entry_safe()
Browse files Browse the repository at this point in the history
Use list_for_each_entry_safe() instead of open coding variants.

Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Signed-off-by: Vinod Koul <vinod.koul@intel.com>
  • Loading branch information
Andy Shevchenko authored and Vinod Koul committed Apr 26, 2017
1 parent e57d055 commit fdb980f
Showing 1 changed file with 5 additions and 6 deletions.
11 changes: 5 additions & 6 deletions drivers/dma/virt-dma.c
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,7 @@ EXPORT_SYMBOL_GPL(vchan_find_desc);
static void vchan_complete(unsigned long arg)
{
struct virt_dma_chan *vc = (struct virt_dma_chan *)arg;
struct virt_dma_desc *vd;
struct virt_dma_desc *vd, *_vd;
struct dmaengine_desc_callback cb;
LIST_HEAD(head);

Expand All @@ -103,8 +103,7 @@ static void vchan_complete(unsigned long arg)

dmaengine_desc_callback_invoke(&cb, NULL);

while (!list_empty(&head)) {
vd = list_first_entry(&head, struct virt_dma_desc, node);
list_for_each_entry_safe(vd, _vd, &head, node) {
dmaengine_desc_get_callback(&vd->tx, &cb);

list_del(&vd->node);
Expand All @@ -119,9 +118,9 @@ static void vchan_complete(unsigned long arg)

void vchan_dma_desc_free_list(struct virt_dma_chan *vc, struct list_head *head)
{
while (!list_empty(head)) {
struct virt_dma_desc *vd = list_first_entry(head,
struct virt_dma_desc, node);
struct virt_dma_desc *vd, *_vd;

list_for_each_entry_safe(vd, _vd, head, node) {
if (dmaengine_desc_test_reuse(&vd->tx)) {
list_move_tail(&vd->node, &vc->desc_allocated);
} else {
Expand Down

0 comments on commit fdb980f

Please sign in to comment.