Re: [PATCH] mmc: tmio: allow DMA request hook to return error status

From: Geert Uytterhoeven
Date: Fri Jul 27 2018 - 03:51:42 EST


Hi Yamada-san,

On Fri, Jul 27, 2018 at 3:15 AM Masahiro Yamada
<yamada.masahiro@xxxxxxxxxxxxx> wrote:
> dma_request_chan() may return ERR_PTR(-EPROBE_DEFER), but
> tmio_mmc_request_dma() cannot propagate it since it is a
> void function.
>
> Change the return type to int so that the driver can retry
> probing later in case the DMA-engine driver is probed after
> the TMIO MMC driver.
>
> I moved the call for tmio_mmc_request_dma() up because it may
> fail now. I also removed unneeded clearing of host->chan_{tx,rx}
> because (struct tmio_mmc_host) is allocated by kzalloc().
>
> Signed-off-by: Masahiro Yamada <yamada.masahiro@xxxxxxxxxxxxx>

Thanks for your patch!

Isn't the idea to fall back to PIO if the DMA-engine driver is not found?

Unfortunately there's no way to distinguish between "DMA-engine hasn't been
probed yet" and "DMA-engine is not available" (e.g. CONFIG_RCAR_DMAC=n).
In both cases, dma_request_chan() will return -EPROBE_DEFER.
So if you treat this as an actual error, and propagate it, the following
will happen:
- In case 1, the MMC driver will be reprobed successfully later.
- In case 2,the MMC driver will never succeed.

Or am I missing something?

Gr{oetje,eeting}s,

Geert

--
Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- geert@xxxxxxxxxxxxxx

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