Re: [PATCH 1/2] dmaengine: rcar-dmac: Use of_data values instead of a macro

Geert Uytterhoeven
2019-08-27T13:08:29Z

Hi Shimoda-san,

On Tue, Aug 27, 2019 at 1:12 PM Yoshihiro Shimoda
<yoshihiro.shimoda.uh@renesas.com> wrote:
> Since we will have changed memory mapping of the DMAC in the future,
> this patch uses of_data values instead of a macro to calculate
> each channel's base offset.
>
> Signed-off-by: Yoshihiro Shimoda <yoshihiro.shimoda.uh@renesas.com>

Reviewed-by: Geert Uytterhoeven <geert+renesas@glider.be>

> --- a/drivers/dma/sh/rcar-dmac.c
> +++ b/drivers/dma/sh/rcar-dmac.c
> @@ -208,12 +208,20 @@ struct rcar_dmac {
>
> #define to_rcar_dmac(d) container_of(d, struct rcar_dmac, engine)
>
> +/*
> + * struct rcar_dmac_of_data - This driver's OF data
> + * @chan_offset_base: DMAC channels base offset
> + * @chan_offset_coefficient: DMAC channels offset coefficient

Perhaps "stride" instead of "coefficient"? Or "step"?

> @@ -1803,10 +1813,15 @@ static int rcar_dmac_probe(struct platform_device *pdev)
> unsigned int channels_offset = 0;
> struct dma_device *engine;
> struct rcar_dmac *dmac;
> + const struct rcar_dmac_of_data *data;
> struct resource *mem;
> unsigned int i;
> int ret;
>
> + data = of_device_get_match_data(&pdev->dev);
> + if (!data)
> + return -EINVAL;

This cannot fail, as the driver is DT only, and all entries in the match table
have a data pointer.

Gr{oetje,eeting}s,

Geert

--
Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- geert@linux-m68k.org

In personal conversations with technical people, I call myself a hacker. But
when I'm talking to journalists I just say "programmer" or something like that.
-- Linus Torvalds