Re: [PATCH 2/9] hw/dma/soc_dma: Simplify soc_dma_ch_update()

Alex Bennée <[email protected]>
Newsgroups org.nongnu.qemu-arm,org.nongnu.qemu-devel
Message-ID <[email protected]>
Peter Maydell <[email protected]> writes:

> 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 <[email protected]>
> ---
>  hw/dma/soc_dma.c | 15 +++++----------
>  1 file changed, 5 insertions(+), 10 deletions(-)
>
> diff --git a/hw/dma/soc_dma.c b/hw/dma/soc_dma.c
> index 8ba531feea..ff51338388 100644
> --- a/hw/dma/soc_dma.c
> +++ b/hw/dma/soc_dma.c
> @@ -121,19 +121,14 @@ void soc_dma_ch_update(struct soc_dma_ch_s *ch)
>      enum soc_dma_port_type src, dst;
>  
>      src = soc_dma_ch_update_type(ch, 0);
> -    if (src == soc_dma_port_other) {
> +    dst = soc_dma_ch_update_type(ch, 1);
> +    if (src == soc_dma_port_other || dst == soc_dma_port_other) {
>          ch->update = 0;
>          ch->transfer_fn = ch->dma->transfer_fn;
> -        return;
> -    }
> -    dst = soc_dma_ch_update_type(ch, 1);
> -
> -    if (src == soc_dma_port_mem && dst == soc_dma_port_mem)
> +    } else {
> +        ch->update = 1;
>          ch->transfer_fn = transfer_mem2mem;
> -    else
> -        ch->transfer_fn = ch->dma->transfer_fn;
> -
> -    ch->update = (dst != soc_dma_port_other);
> +    }
>  }

heh the diff is messy and the soc_dma_ch_update_type could do with some
clean-up but for this patch:

Reviewed-by: Alex Bennée <[email protected]>

>  
>  static void soc_dma_ch_freq_update(struct dma_s *s)

-- 
Alex Bennée
Virtualisation Tech Lead @ Linaro
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.