From patchwork Fri Aug 26 08:40:09 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: 3709 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 EF9F523F25 for ; Fri, 26 Aug 2011 08:40:34 +0000 (UTC) Received: from mail-gw0-f52.google.com (mail-gw0-f52.google.com [74.125.83.52]) by fiordland.canonical.com (Postfix) with ESMTP id B4908A1854D for ; Fri, 26 Aug 2011 08:40:34 +0000 (UTC) Received: by gwj15 with SMTP id 15so3656975gwj.11 for ; Fri, 26 Aug 2011 01:40:34 -0700 (PDT) Received: by 10.150.240.14 with SMTP id n14mr1967654ybh.41.1314348034198; Fri, 26 Aug 2011 01:40:34 -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.151.27.20 with SMTP id e20cs274306ybj; Fri, 26 Aug 2011 01:40:33 -0700 (PDT) Received: by 10.236.157.104 with SMTP id n68mr4696187yhk.74.1314348033753; Fri, 26 Aug 2011 01:40:33 -0700 (PDT) Received: from mailout4.samsung.com (mailout4.samsung.com [203.254.224.34]) by mx.google.com with ESMTP id s3si2220824anh.62.2011.08.26.01.40.33; Fri, 26 Aug 2011 01:40:33 -0700 (PDT) Received-SPF: neutral (google.com: 203.254.224.34 is neither permitted nor denied by best guess record for domain of thomas.abraham@linaro.org) client-ip=203.254.224.34; Authentication-Results: mx.google.com; spf=neutral (google.com: 203.254.224.34 is neither permitted nor denied by best guess record for domain of thomas.abraham@linaro.org) smtp.mail=thomas.abraham@linaro.org Received: from epcpsbgm1.samsung.com (mailout4.samsung.com [203.254.224.34]) by mailout4.samsung.com (Oracle Communications Messaging Exchange Server 7u4-19.01 64bit (built Sep 7 2010)) with ESMTP id <0LQJ00I8I1F7RFL0@mailout4.samsung.com> for patches@linaro.org; Fri, 26 Aug 2011 17:40:32 +0900 (KST) X-AuditID: cbfee61a-b7cf1ae00000208e-7e-4e575c00af73 Received: from epmmp1 ( [203.254.227.16]) by epcpsbgm1.samsung.com (MMPCPMTA) with SMTP id 9B.A6.08334.00C575E4; Fri, 26 Aug 2011 17:40:32 +0900 (KST) Received: from localhost.localdomain ([107.108.73.37]) by mmp1.samsung.com (iPlanet Messaging Server 5.2 Patch 2 (built Jul 14 2004)) with ESMTPA id <0LQJ005J71FB2H@mmp1.samsung.com> for patches@linaro.org; Fri, 26 Aug 2011 17:40:32 +0900 (KST) Date: Fri, 26 Aug 2011 14:10:09 +0530 From: Thomas Abraham Subject: [PATCH 1/6] DMA: PL330: move filter function into driver In-reply-to: <1314348014-2481-1-git-send-email-thomas.abraham@linaro.org> To: devicetree-discuss@lists.ozlabs.org Cc: grant.likely@secretlab.ca, linux-arm-kernel@lists.infradead.org, linux-samsung-soc@vger.kernel.org, kgene.kim@samsung.com, vinod.koul@intel.com, patches@linaro.org, jassisinghbrar@gmail.com, boojin.kim@samsung.com Message-id: <1314348014-2481-2-git-send-email-thomas.abraham@linaro.org> X-Mailer: git-send-email 1.6.6.rc2 Content-transfer-encoding: 7BIT References: <1314348014-2481-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 --- 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 95976cf..7df2516 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_ */