• Ezequiel Garcia's avatar
    mmc: jz4740: rework pre_req/post_req implementation · 96e03fff
    Ezequiel Garcia authored
    As reported by Aaro, the JZ4740 MMC driver throws a warning when the kernel
    is built without preemption (CONFIG_PREEMPT_NONE=y).
    
    [   16.461094] jz4740-mmc 13450000.mmc: [jz4740_mmc_prepare_dma_data] invalid cookie: data->host_cookie 567 host->next_data.cookie 568
    [   16.473120] jz4740-mmc 13450000.mmc: [jz4740_mmc_prepare_dma_data] invalid cookie: data->host_cookie 568 host->next_data.cookie 569
    [   16.485144] jz4740-mmc 13450000.mmc: [jz4740_mmc_prepare_dma_data] invalid cookie: data->host_cookie 569 host->next_data.cookie 570
    [   16.497170] jz4740-mmc 13450000.mmc: [jz4740_mmc_prepare_dma_data] invalid cookie: data->host_cookie 570 host->next_data.cookie 571
    
    The problem seems to be related to how pre_req/post_req is implemented.
    Currently, it seems the driver expects jz4740_mmc_prepare_dma_data() to be
    called with monotonically increasing host_cookie values, which is wrong.
    
    Moreover, the implementation is overly complicated, keeping track of
    unneeded "next cookie" state.
    
    So, instead of attempting to fix the current pre_req/post_req
    implementation, this commit refactors the driver, dropping the state,
    following other drivers such as dw_mmc and sdhci.
    
    Cc: Paul Cercueil <paul@crapouillou.net>
    Cc: Mathieu Malaterre <malat@debian.org>
    Reported-by: default avatarAaro Koskinen <aaro.koskinen@iki.fi>
    Signed-off-by: default avatarEzequiel Garcia <ezequiel@collabora.com>
    Tested-by: default avatarAaro Koskinen <aaro.koskinen@iki.fi>
    Signed-off-by: default avatarUlf Hansson <ulf.hansson@linaro.org>
    96e03fff
jz4740_mmc.c 28.7 KB