From patchwork Tue Apr 2 11:16:45 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Padmavathi Venna X-Patchwork-Id: 2377021 Return-Path: X-Original-To: patchwork-linux-arm@patchwork.kernel.org Delivered-To: patchwork-process-083081@patchwork2.kernel.org Received: from merlin.infradead.org (merlin.infradead.org [205.233.59.134]) by patchwork2.kernel.org (Postfix) with ESMTP id BF3FEDF2A1 for ; Tue, 2 Apr 2013 11:18:53 +0000 (UTC) Received: from localhost ([::1] helo=merlin.infradead.org) by merlin.infradead.org with esmtp (Exim 4.80.1 #2 (Red Hat Linux)) id 1UMzCe-0006PD-8w; Tue, 02 Apr 2013 11:16:36 +0000 Received: from mailout4.samsung.com ([203.254.224.34]) by merlin.infradead.org with esmtp (Exim 4.80.1 #2 (Red Hat Linux)) id 1UMzCa-0006OR-5i for linux-arm-kernel@lists.infradead.org; Tue, 02 Apr 2013 11:16:34 +0000 Received: from epcpsbgr2.samsung.com (u142.gpu120.samsung.co.kr [203.254.230.142]) by mailout4.samsung.com (Oracle Communications Messaging Server 7u4-24.01 (7.0.4.24.0) 64bit (built Nov 17 2011)) with ESMTP id <0MKM00BYHKN9EYP0@mailout4.samsung.com> for linux-arm-kernel@lists.infradead.org; Tue, 02 Apr 2013 20:16:28 +0900 (KST) Received: from epcpsbgm1.samsung.com ( [172.20.52.125]) by epcpsbgr2.samsung.com (EPCPMTA) with SMTP id 5D.53.07735.C0EBA515; Tue, 02 Apr 2013 20:16:28 +0900 (KST) X-AuditID: cbfee68e-b7f946d000001e37-9d-515abe0c9550 Received: from epmmp2 ( [203.254.227.17]) by epcpsbgm1.samsung.com (EPCPMTA) with SMTP id 1C.C9.17838.C0EBA515; Tue, 02 Apr 2013 20:16:28 +0900 (KST) Received: from padma-linuxpc.sisodomain.com ([107.108.83.35]) by mmp2.samsung.com (Oracle Communications Messaging Server 7u4-24.01(7.0.4.24.0) 64bit (built Nov 17 2011)) with ESMTPA id <0MKM00IM4KN90S50@mmp2.samsung.com>; Tue, 02 Apr 2013 20:16:28 +0900 (KST) From: Padmavathi Venna To: linux-samsung-soc@vger.kernel.org, devicetree-discuss@lists.ozlabs.org, linux-arm-kernel@lists.infradead.org, padma.v@samsung.com, padma.kvr@gmail.com Subject: [PATCH V3] DMA: PL330: Add check if device tree compatible Date: Tue, 02 Apr 2013 16:46:45 +0530 Message-id: <1364901405-16541-1-git-send-email-padma.v@samsung.com> X-Mailer: git-send-email 1.7.4.4 X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFmpikeLIzCtJLcpLzFFi42JZI2JSq8uzLyrQYNMlE4u/k46xW7w5+YfN 4t/sU2wWB2Y/ZLXoXXCVzWLT42usFjPO72OyaF82h9Xi983vbBYXV3xhsnjZt5/Fgdvj969J jB47Z91l91i85yWTx+Yl9R7nZyxk9Hg58TebR9+WVYwenzfJBXBEcdmkpOZklqUW6dslcGVM unWKpWCjSMX0JetZGhhPC3QxcnJICJhITNn+gRXCFpO4cG89WxcjF4eQwFJGifvb77DBFB04 9p4FIjGdUWLbr/9QTg+TxPH+P+xdjBwcbAI6Ei1nXUDiIgJzGCWat89gBHGYBaYwSizfdw9s h7CAs8SBTZuZQGwWAVWJQ9eOg9m8QPGZnVuYIdYpSByb+pUVpFlCYBe7xI5b69ggGgQkvk0+ xAKyTUJAVmLTAah6SYmDK26wTGAUXMDIsIpRNLUguaA4Kb3ISK84Mbe4NC9dLzk/dxMjMPxP /3vWt4Px5gHrQ4zJQOMmMkuJJucD4yevJN7Q2MzIwtTE1NjI3NKMNGElcV61FutAIYH0xJLU 7NTUgtSi+KLSnNTiQ4xMHJxSDYw2R1ZYHAm9dfKL79mnU3mCQoMWvX37MbTx2ON3S89e7mJ6 mFZZ8//2o9sO5o9muzzQMQk4azarelqtqHaD15QqSTGr1InOjyNP3zI//CM0+9bcht6Z908v eOW2ZIW3tcuqmzwBr49MnCnLKXAs6LhsRpe43tplmVKpLvP3THkZv7uoefJ//0mrlViKMxIN tZiLihMB7gzsapUCAAA= X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFrrPIsWRmVeSWpSXmKPExsVy+t9jQV2efVGBBrMuaFn8nXSM3eLNyT9s Fv9mn2KzODD7IatF74KrbBabHl9jtZhxfh+TRfuyOawWv29+Z7O4uOILk8XLvv0sDtwev39N YvTYOesuu8fiPS+ZPDYvqfc4P2Mho8fLib/ZPPq2rGL0+LxJLoAjqoHRJiM1MSW1SCE1Lzk/ JTMv3VbJOzjeOd7UzMBQ19DSwlxJIS8xN9VWycUnQNctMwfoUiWFssScUqBQQGJxsZK+HaYJ oSFuuhYwjRG6viFBcD1GBmggYQ1jxqRbp1gKNopUTF+ynqWB8bRAFyMnh4SAicSBY+9ZIGwx iQv31rN1MXJxCAlMZ5TY9us/C4TTwyRxvP8PexcjBwebgI5Ey1kXkLiIwBxGiebtMxhBHGaB KYwSy/fdYwUZJSzgLHFg02YmEJtFQFXi0LXjYDYvUHxm5xZmiHUKEsemfmWdwMi9gJFhFaNo akFyQXFSeq6hXnFibnFpXrpecn7uJkZwdD2T2sG4ssHiEKMAB6MSD6/DnMhAIdbEsuLK3EOM EhzMSiK8cTujAoV4UxIrq1KL8uOLSnNSiw8xJgNtn8gsJZqcD4z8vJJ4Q2MTc1NjU0sTCxMz S9KElcR5D7RaBwoJpCeWpGanphakFsFsYeLglGpgnFK/raP2ldWF0wKxz1+Hh/gkNzPHbJFr s1tzeGWV6dE3E++qe2lvuLt13h3mE06ZLN2utz9ZPYpbwxPWxXVG/bvcp5u3Fjzztf+3Km3H s+7EFMetvjK9JetWFP4OsfwZGPGjV21/wRrtk7+fm2w5qb/i1Zc/IhtyspP4JfNvzuq4pvMx 0bXxgBJLcUaioRZzUXEiAGf+QBPyAgAA DLP-Filter: Pass X-MTR: 20000000000000000@CPGS X-CFilter-Loop: Reflected X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20130402_071632_458803_CE2ADEE1 X-CRM114-Status: GOOD ( 11.22 ) X-Spam-Score: -9.2 (---------) X-Spam-Report: SpamAssassin version 3.3.2 on merlin.infradead.org summary: Content analysis details: (-9.2 points) pts rule name description ---- ---------------------- -------------------------------------------------- -5.0 RCVD_IN_DNSWL_HI RBL: Sender listed at http://www.dnswl.org/, high trust [203.254.224.34 listed in list.dnswl.org] -0.0 SPF_HELO_PASS SPF: HELO matches SPF record -2.3 RP_MATCHES_RCVD Envelope sender domain matches handover relay domain -1.9 BAYES_00 BODY: Bayes spam probability is 0 to 1% [score: 0.0000] Cc: kgene.kim@samsung.com, arnd@arndb.de, boojin.kim@samsung.com, sbkim73@samsung.com, broonie@opensource.wolfsonmicro.com, vinod.koul@intel.com X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org This patch register the dma controller with generic dma helpers only in DT case. This also adds some extra error handling in the driver. Signed-off-by: Padmavathi Venna Reported-by: Sachin Kamat --- Based on Vinod Koul next branch. Changes since V2: - Removed pl330_free_chan_resources for error handling in probe. Changes since V1: - return silently when of_dma_controller_register fails, as suggested by Arnd. drivers/dma/pl330.c | 33 ++++++++++++++++++++++----------- 1 files changed, 22 insertions(+), 11 deletions(-) diff --git a/drivers/dma/pl330.c b/drivers/dma/pl330.c index 345e2a1..fa388c1c 100644 --- a/drivers/dma/pl330.c +++ b/drivers/dma/pl330.c @@ -2882,7 +2882,7 @@ pl330_probe(struct amba_device *adev, const struct amba_id *id) { struct dma_pl330_platdata *pdat; struct dma_pl330_dmac *pdmac; - struct dma_pl330_chan *pch; + struct dma_pl330_chan *pch, *_p; struct pl330_info *pi; struct dma_device *pd; struct resource *res; @@ -2984,7 +2984,17 @@ pl330_probe(struct amba_device *adev, const struct amba_id *id) ret = dma_async_device_register(pd); if (ret) { dev_err(&adev->dev, "unable to register DMAC\n"); - goto probe_err2; + goto probe_err3; + } + + if (adev->dev.of_node) { + ret = of_dma_controller_register(adev->dev.of_node, + of_dma_pl330_xlate, pdmac); + if (ret) { + dev_err(&adev->dev, + "unable to register DMA to the generic" + "DT DMA helpers\n"); + } } dev_info(&adev->dev, @@ -2995,16 +3005,15 @@ pl330_probe(struct amba_device *adev, const struct amba_id *id) pi->pcfg.data_bus_width / 8, pi->pcfg.num_chan, pi->pcfg.num_peri, pi->pcfg.num_events); - ret = of_dma_controller_register(adev->dev.of_node, - of_dma_pl330_xlate, pdmac); - if (ret) { - dev_err(&adev->dev, - "unable to register DMA to the generic DT DMA helpers\n"); - goto probe_err2; - } - return 0; +probe_err3: + amba_set_drvdata(adev, NULL); + /* Idle the DMAC */ + list_for_each_entry_safe(pch, _p, &pdmac->ddma.channels, + chan.device_node) + /* Remove the channel */ + list_del(&pch->chan.device_node); probe_err2: pl330_del(pi); probe_err1: @@ -3023,8 +3032,10 @@ static int pl330_remove(struct amba_device *adev) if (!pdmac) return 0; - of_dma_controller_free(adev->dev.of_node); + if (adev->dev.of_node) + of_dma_controller_free(adev->dev.of_node); + dma_async_device_unregister(&pdmac->ddma); amba_set_drvdata(adev, NULL); /* Idle the DMAC */