From: Frank Li <[email protected]>

Replace open-coded chan->device->dev with dmaengine_get_provider_device()
to avoid direct access to DMA engine internals. The WARN_ON check for
chan->device is no longer needed since already checked return value of
dma_request_chan(). It is impossible dma_chan is not NULL and DMA engine
device is NULL.

Prepare to make struct dma_device private.

Signed-off-by: Frank Li <[email protected]>
---
 sound/soc/ti/davinci-mcasp.c | 10 ++++------
 1 file changed, 4 insertions(+), 6 deletions(-)

diff --git a/sound/soc/ti/davinci-mcasp.c b/sound/soc/ti/davinci-mcasp.c
index 481d1042ddb6d..e871925517dca 100644
--- a/sound/soc/ti/davinci-mcasp.c
+++ b/sound/soc/ti/davinci-mcasp.c
@@ -2477,6 +2477,7 @@ static const char *sdma_prefix = "ti,omap";
 static int davinci_mcasp_get_dma_type(struct davinci_mcasp *mcasp)
 {
        struct dma_chan *chan;
+       struct device *dma_dev;
        const char *tmp;
        int ret = PCM_EDMA;
 
@@ -2488,13 +2489,10 @@ static int davinci_mcasp_get_dma_type(struct 
davinci_mcasp *mcasp)
        if (IS_ERR(chan))
                return dev_err_probe(mcasp->dev, PTR_ERR(chan),
                                     "Can't verify DMA configuration\n");
-       if (WARN_ON(!chan->device || !chan->device->dev)) {
-               dma_release_channel(chan);
-               return -EINVAL;
-       }
 
-       if (chan->device->dev->of_node)
-               ret = of_property_read_string(chan->device->dev->of_node,
+       dma_dev = dmaengine_get_provider_device(chan);
+       if (dma_dev->of_node)
+               ret = of_property_read_string(dma_dev->of_node,
                                              "compatible", &tmp);
        else
                dev_dbg(mcasp->dev, "DMA controller has no of-node\n");

-- 
2.43.0


Reply via email to