Re: [PATCH v6 10/40] dma: cirrus: Convert to DT for Cirrus EP93xx

From: Andy Shevchenko
Date: Wed Dec 13 2023 - 13:28:53 EST


On Tue, Dec 12, 2023 at 11:20:27AM +0300, Nikita Shubin wrote:
> Convert Cirrus EP93xx DMA to device tree usage:
>
> - add OF ID match table with data
> - add of_probe for device tree
> - add xlate for m2m/m2p
> - drop subsys_initcall code
> - drop platform probe
> - drop platform structs usage
>
> >From now only it supports only device tree probing.

"From now on it only..." (and single "only" is enough).

...

> + edmac->clk = devm_clk_get(dev, dma_clk_name);
> if (IS_ERR(edmac->clk)) {
> + dev_warn(dev, "failed to get clock\n");
> continue;
> }

This is incorrect, it doesn't handle deferred probe in two aspects:
- spamming the logs;
- not really trying to reprobe.

...

> +static bool ep93xx_m2p_dma_filter(struct dma_chan *chan, void *filter_param)
> +{
> + struct ep93xx_dma_chan *echan = to_ep93xx_dma_chan(chan);
> + struct ep93xx_dma_chan_cfg *cfg = filter_param;
> +
> + if (cfg->dir == ep93xx_dma_chan_direction(chan)) {
> + echan->dma_cfg = *cfg;
> + return true;
> + }
> +
> + return false;

Perhaps

if (cfg->dir != ep93xx_dma_chan_direction(chan))
return false;

echan->dma_cfg = *cfg;
return true;

> +}

...

> + if (!is_slave_direction(direction))
> + return NULL;
> +
> +

One blank line is enough.

...

> + switch (port) {
> + case EP93XX_DMA_SSP:
> + case EP93XX_DMA_IDE:
> + break;
> + default:
> + return NULL;
> + }

> + if (!is_slave_direction(direction))
> + return NULL;

This can be performed before switch, no?

...

> +#include <linux/device.h>
> +#include <linux/property.h>
> +#include <linux/string.h>
> #include <linux/types.h>
> #include <linux/dmaengine.h>
> #include <linux/dma-mapping.h>

Perhaps make it a bit more ordered by squeezing to the (most) ordered parts?

--
With Best Regards,
Andy Shevchenko