From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751079AbcEDEAv (ORCPT ); Wed, 4 May 2016 00:00:51 -0400 Received: from bear.ext.ti.com ([192.94.94.41]:50187 "EHLO bear.ext.ti.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1750708AbcEDEAu (ORCPT ); Wed, 4 May 2016 00:00:50 -0400 Subject: Re: [PATCH] mmc: omap: Use dma_request_chan() for requesting DMA channel To: Ulf Hansson References: <1461935197-28664-1-git-send-email-peter.ujfalusi@ti.com> CC: Kishon , Tony Lindgren , Roger Quadros , linux-mmc , linux-omap , "linux-kernel@vger.kernel.org" From: Peter Ujfalusi Message-ID: <8797d828-eb71-c747-f63a-e77762c51d82@ti.com> Date: Wed, 4 May 2016 06:59:54 +0300 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:45.0) Gecko/20100101 Thunderbird/45.0 MIME-Version: 1.0 In-Reply-To: Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 05/03/2016 11:00 PM, Peter Ujfalusi wrote: >>> @@ -1382,29 +1379,31 @@ static int mmc_omap_probe(struct platform_device *pdev) >>> goto err_free_iclk; >>> } >>> >>> - dma_cap_zero(mask); >>> - dma_cap_set(DMA_SLAVE, mask); >>> - >>> host->dma_tx_burst = -1; >>> host->dma_rx_burst = -1; >>> >>> - res = platform_get_resource_byname(pdev, IORESOURCE_DMA, "tx"); >>> - if (res) >>> - sig = res->start; >>> - host->dma_tx = dma_request_slave_channel_compat(mask, >>> - omap_dma_filter_fn, &sig, &pdev->dev, "tx"); >>> - if (!host->dma_tx) >>> - dev_warn(host->dev, "unable to obtain TX DMA engine channel %u\n", >>> - sig); >>> - >>> - res = platform_get_resource_byname(pdev, IORESOURCE_DMA, "rx"); >>> - if (res) >>> - sig = res->start; >>> - host->dma_rx = dma_request_slave_channel_compat(mask, >>> - omap_dma_filter_fn, &sig, &pdev->dev, "rx"); >>> - if (!host->dma_rx) >>> - dev_warn(host->dev, "unable to obtain RX DMA engine channel %u\n", >>> - sig); >>> + host->dma_tx = dma_request_chan(&pdev->dev, "tx"); >>> + if (IS_ERR(host->dma_tx)) { >>> + ret = PTR_ERR(host->dma_tx); >>> + if (ret == -EPROBE_DEFER) >>> + goto err_free_iclk; > > and one clk_put(host->fclk) is missing from here. > >>> + >>> + host->dma_tx = NULL; >> >> Instead of setting this to NULL, let's keep its value and later check >> it with IS_ERR() when needed. > > I thought about it, but decided against without need to have changes in other > places in the driver. This sentence does not make too much sense ;) Let's try it again: So, I have considered to use PTR_ERR in the driver for the DMA channel, but I wanted to avoid too broad changes in the driver. Keeping the ERR_PTR would bring no runtime benefit since we only care if we have channel or not. -- Péter