From patchwork Mon Sep 19 06:28:57 2011 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: thomas.abraham@linaro.org X-Patchwork-Id: 4169 Return-Path: X-Original-To: patchwork@peony.canonical.com Delivered-To: patchwork@peony.canonical.com Received: from fiordland.canonical.com (fiordland.canonical.com [91.189.94.145]) by peony.canonical.com (Postfix) with ESMTP id 2E3D523F58 for ; Mon, 19 Sep 2011 06:29:42 +0000 (UTC) Received: from mail-fx0-f52.google.com (mail-fx0-f52.google.com [209.85.161.52]) by fiordland.canonical.com (Postfix) with ESMTP id 1D65DA18188 for ; Mon, 19 Sep 2011 06:29:42 +0000 (UTC) Received: by mail-fx0-f52.google.com with SMTP id 23so5080832fxe.11 for ; Sun, 18 Sep 2011 23:29:42 -0700 (PDT) Received: by 10.223.5.76 with SMTP id 12mr4546424fau.103.1316413781894; Sun, 18 Sep 2011 23:29:41 -0700 (PDT) X-Forwarded-To: linaro-patchwork@canonical.com X-Forwarded-For: patch@linaro.org linaro-patchwork@canonical.com Delivered-To: patches@linaro.org Received: by 10.152.18.198 with SMTP id y6cs25023lad; Sun, 18 Sep 2011 23:29:41 -0700 (PDT) Received: by 10.68.42.10 with SMTP id j10mr709434pbl.230.1316413779071; Sun, 18 Sep 2011 23:29:39 -0700 (PDT) Received: from mailout3.samsung.com (mailout3.samsung.com. [203.254.224.33]) by mx.google.com with ESMTP id t3si11107326pbf.59.2011.09.18.23.29.38; Sun, 18 Sep 2011 23:29:39 -0700 (PDT) Received-SPF: neutral (google.com: 203.254.224.33 is neither permitted nor denied by best guess record for domain of thomas.abraham@linaro.org) client-ip=203.254.224.33; Authentication-Results: mx.google.com; spf=neutral (google.com: 203.254.224.33 is neither permitted nor denied by best guess record for domain of thomas.abraham@linaro.org) smtp.mail=thomas.abraham@linaro.org Received: from epcpsbgm2.samsung.com (mailout3.samsung.com [203.254.224.33]) by mailout3.samsung.com (Oracle Communications Messaging Exchange Server 7u4-19.01 64bit (built Sep 7 2010)) with ESMTP id <0LRR0070YBDDZEP0@mailout3.samsung.com> for patches@linaro.org; Mon, 19 Sep 2011 15:29:37 +0900 (KST) X-AuditID: cbfee61b-b7b7fae000005864-72-4e76e1518657 Received: from epmmp1.local.host ( [203.254.227.16]) by epcpsbgm2.samsung.com (MMPCPMTA) with SMTP id 2E.02.22628.151E67E4; Mon, 19 Sep 2011 15:29:37 +0900 (KST) Received: from localhost.localdomain ([107.108.73.37]) by mmp1.samsung.com (Oracle Communications Messaging Exchange Server 7u4-19.01 64bit (built Sep 7 2010)) with ESMTPA id <0LRR00A9LBD4LZ90@mmp1.samsung.com> for patches@linaro.org; Mon, 19 Sep 2011 15:29:37 +0900 (KST) From: Thomas Abraham To: devicetree-discuss@lists.ozlabs.org, vinod.koul@intel.com Cc: grant.likely@secretlab.ca, linux-arm-kernel@lists.infradead.org, linux-samsung-soc@vger.kernel.org, kgene.kim@samsung.com, robherring2@gmail.com, patches@linaro.org, jassisinghbrar@gmail.com, boojin.kim@samsung.com Subject: [PATCH 1/6] DMA: PL330: move filter function into driver Date: Mon, 19 Sep 2011 11:58:57 +0530 Message-id: <1316413742-23535-2-git-send-email-thomas.abraham@linaro.org> X-Mailer: git-send-email 1.6.6.rc2 In-reply-to: <1316413742-23535-1-git-send-email-thomas.abraham@linaro.org> References: <1316413742-23535-1-git-send-email-thomas.abraham@linaro.org> X-Brightmail-Tracker: AAAAAA== The dma channel selection filter function is moved from plat-samsung into the pl330 driver. In additon to that, a check is added in the filter function to ensure that the channel on which the filter has been invoked is pl330 channel instance (and avoid any incorrect access of chan->private in a system with multiple types of DMA drivers). Suggested-by: Russell King Signed-off-by: Thomas Abraham Acked-by: Jassi Brar Acked-by: Grant Likely --- arch/arm/plat-samsung/dma-ops.c | 6 ------ drivers/dma/pl330.c | 15 +++++++++++++++ include/linux/amba/pl330.h | 2 ++ 3 files changed, 17 insertions(+), 6 deletions(-) diff --git a/arch/arm/plat-samsung/dma-ops.c b/arch/arm/plat-samsung/dma-ops.c index 6e3d9ab..8d18425 100644 --- a/arch/arm/plat-samsung/dma-ops.c +++ b/arch/arm/plat-samsung/dma-ops.c @@ -17,12 +17,6 @@ #include -static inline bool pl330_filter(struct dma_chan *chan, void *param) -{ - struct dma_pl330_peri *peri = chan->private; - return peri->peri_id == (unsigned)param; -} - static unsigned samsung_dmadev_request(enum dma_ch dma_ch, struct samsung_dma_info *info) { diff --git a/drivers/dma/pl330.c b/drivers/dma/pl330.c index 621134f..5f1d24c 100644 --- a/drivers/dma/pl330.c +++ b/drivers/dma/pl330.c @@ -116,6 +116,9 @@ struct dma_pl330_desc { struct dma_pl330_chan *pchan; }; +/* forward declaration */ +static struct amba_driver pl330_driver; + static inline struct dma_pl330_chan * to_pchan(struct dma_chan *ch) { @@ -267,6 +270,18 @@ static void dma_pl330_rqcb(void *token, enum pl330_op_err err) tasklet_schedule(&pch->task); } +bool pl330_filter(struct dma_chan *chan, void *param) +{ + struct dma_pl330_peri *peri; + + if (chan->device->dev->driver != &pl330_driver.drv) + return false; + + peri = chan->private; + return peri->peri_id == (unsigned)param; +} +EXPORT_SYMBOL(pl330_filter); + static int pl330_alloc_chan_resources(struct dma_chan *chan) { struct dma_pl330_chan *pch = to_pchan(chan); diff --git a/include/linux/amba/pl330.h b/include/linux/amba/pl330.h index d12f077..6db72da 100644 --- a/include/linux/amba/pl330.h +++ b/include/linux/amba/pl330.h @@ -12,6 +12,7 @@ #ifndef __AMBA_PL330_H_ #define __AMBA_PL330_H_ +#include #include struct dma_pl330_peri { @@ -38,4 +39,5 @@ struct dma_pl330_platdata { unsigned mcbuf_sz; }; +extern bool pl330_filter(struct dma_chan *chan, void *param); #endif /* __AMBA_PL330_H_ */