@samitouri / QOSamiQemu / commits / f00bef33fe

hw/dma/soc_dma: Simplify soc_dma_ch_update()

Now we only have "mem" and "other" as soc_dma_port_type values, we can simplify soc_dma_ch_update(): either both src and dst are mem, in which case we use transfer_mem2mem and set update to 1 to tell omap_dma_transfer_setup() to update all the guest-visible src/dest/count information to indicate a completed transfer; or else we use the omap_dma_transfer_generic() function, and we set update to 0 to tell omap_dma_transfer_setup() that the transfer function will be updating the src/dest/count. Signed-off-by: Peter Maydell <peter.maydell@linaro.org> Message-id: 20260710105907.2570621-3-peter.maydell@linaro.org Reviewed-by: Alex Bennée <alex.bennee@linaro.org>

Peter Maydell committed Jul 20, 2026 at 19:05 UTC f00bef33febb92dfc91a00bba3e4819070ee8d29
1 file changed +5 -10
hw/dma/soc_dma.c
+5 -10
@@ -121,19 +121,14 @@ void soc_dma_ch_update(struct soc_dma_ch_s *ch)
121 enum soc_dma_port_type src, dst;
122
123 src = soc_dma_ch_update_type(ch, 0);
124 - if (src == soc_dma_port_other) {
124 + dst = soc_dma_ch_update_type(ch, 1);
125 + if (src == soc_dma_port_other || dst == soc_dma_port_other) {
126 ch->update = 0;
127 ch->transfer_fn = ch->dma->transfer_fn;
127 - return;
128 - }
129 - dst = soc_dma_ch_update_type(ch, 1);
130 -
131 - if (src == soc_dma_port_mem && dst == soc_dma_port_mem)
128 + } else {
129 + ch->update = 1;
130 ch->transfer_fn = transfer_mem2mem;
133 - else
134 - ch->transfer_fn = ch->dma->transfer_fn;
135 -
136 - ch->update = (dst != soc_dma_port_other);
131 + }
132 }
133
134 static void soc_dma_ch_freq_update(struct dma_s *s)