[PATCH v4 08/10] ALSA: pcm_dmaengine: Use dma_slave_caps bus width helpers

Nuno Sá nuno.sa at analog.com
Mon Sep 14 08:39:38 PDT 2026


On Mon, Sep 14, 2026 at 11:12:09AM +0300, Andy Shevchenko wrote:
> On Fri, Sep 11, 2026 at 06:25:43PM +0100, Nuno Sá wrote:
> > Use the dma_slave_caps bus width helpers instead of reading the legacy
> > src_addr_widths and dst_addr_widths masks directly.
> > 
> > Keep the existing default assumption of 1, 2 and 4 byte widths when the
> > DMA channel does not report slave capabilities.
> 
> ...
> 
> > int snd_dmaengine_pcm_refine_runtime_hwparams(
> >  	struct snd_pcm_hardware *hw,
> >  	struct dma_chan *chan)
> >  {
> > +	enum dma_slave_buswidth default_widths[] = {
> > +		DMA_SLAVE_BUSWIDTH_1_BYTE,
> > +		DMA_SLAVE_BUSWIDTH_2_BYTES,
> > +		DMA_SLAVE_BUSWIDTH_4_BYTES,
> > +	};
> >  	struct dma_slave_caps dma_caps;
> > -	u32 addr_widths = BIT(DMA_SLAVE_BUSWIDTH_1_BYTE) |
> > -			  BIT(DMA_SLAVE_BUSWIDTH_2_BYTES) |
> > -			  BIT(DMA_SLAVE_BUSWIDTH_4_BYTES);
> 
> > +	dma_buswidth_mask_t bus_widths = {};
> 
> Do you really need the zeroing?

I think so. dma_bus_width_set_many() just does __set_bit() under the
hood so if we do not zero initialize I think we could be left with some
random bits in the mask. Unless I'm missing something.

- Nuno Sá

> 
> >  	snd_pcm_format_t i;
> >  	int ret = 0;
> 
> >  	if (!hw || !chan || !dma_data)
> >  		return -EINVAL;
> >  
> > +	ret = dma_bus_width_set_many(bus_widths, default_widths,
> > +				     ARRAY_SIZE(default_widths));
> > +	if (ret)
> > +		return ret;
> 
> I assume that if ret == 0, bus_widths should be set accordingly.
> 
> -- 
> With Best Regards,
> Andy Shevchenko
> 
> 



More information about the linux-arm-kernel mailing list