hc
2024-02-20 102a0743326a03cd1a1202ceda21e175b7d3575c
kernel/drivers/dma/virt-dma.c
....@@ -1,11 +1,8 @@
1
+// SPDX-License-Identifier: GPL-2.0-only
12 /*
23 * Virtual DMA channel support for DMAengine
34 *
45 * Copyright (C) 2012 Russell King
5
- *
6
- * This program is free software; you can redistribute it and/or modify
7
- * it under the terms of the GNU General Public License version 2 as
8
- * published by the Free Software Foundation.
96 */
107 #include <linux/device.h>
118 #include <linux/dmaengine.h>
....@@ -83,9 +80,9 @@
8380 * This tasklet handles the completion of a DMA descriptor by
8481 * calling its callback and freeing it.
8582 */
86
-static void vchan_complete(unsigned long arg)
83
+static void vchan_complete(struct tasklet_struct *t)
8784 {
88
- struct virt_dma_chan *vc = (struct virt_dma_chan *)arg;
85
+ struct virt_dma_chan *vc = from_tasklet(vc, t, task);
8986 struct virt_dma_desc *vd, *_vd;
9087 struct dmaengine_desc_callback cb;
9188 LIST_HEAD(head);
....@@ -101,15 +98,14 @@
10198 }
10299 spin_unlock_irq(&vc->lock);
103100
104
- dmaengine_desc_callback_invoke(&cb, NULL);
101
+ dmaengine_desc_callback_invoke(&cb, &vd->tx_result);
105102
106103 list_for_each_entry_safe(vd, _vd, &head, node) {
107104 dmaengine_desc_get_callback(&vd->tx, &cb);
108105
109106 list_del(&vd->node);
107
+ dmaengine_desc_callback_invoke(&cb, &vd->tx_result);
110108 vchan_vdesc_fini(vd);
111
-
112
- dmaengine_desc_callback_invoke(&cb, NULL);
113109 }
114110 }
115111
....@@ -118,13 +114,8 @@
118114 struct virt_dma_desc *vd, *_vd;
119115
120116 list_for_each_entry_safe(vd, _vd, head, node) {
121
- if (dmaengine_desc_test_reuse(&vd->tx)) {
122
- list_move_tail(&vd->node, &vc->desc_allocated);
123
- } else {
124
- dev_dbg(vc->chan.device->dev, "txd %p: freeing\n", vd);
125
- list_del(&vd->node);
126
- vc->desc_free(vd);
127
- }
117
+ list_del(&vd->node);
118
+ vchan_vdesc_fini(vd);
128119 }
129120 }
130121 EXPORT_SYMBOL_GPL(vchan_dma_desc_free_list);
....@@ -138,8 +129,9 @@
138129 INIT_LIST_HEAD(&vc->desc_submitted);
139130 INIT_LIST_HEAD(&vc->desc_issued);
140131 INIT_LIST_HEAD(&vc->desc_completed);
132
+ INIT_LIST_HEAD(&vc->desc_terminated);
141133
142
- tasklet_init(&vc->task, vchan_complete, (unsigned long)vc);
134
+ tasklet_setup(&vc->task, vchan_complete);
143135
144136 vc->chan.device = dmadev;
145137 list_add_tail(&vc->chan.device_node, &dmadev->channels);