From patchwork Thu Sep 1 09:04:37 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: 3828 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 322AC23F22 for ; Thu, 1 Sep 2011 09:05:27 +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 279B8A18088 for ; Thu, 1 Sep 2011 09:05:27 +0000 (UTC) Received: by mail-fx0-f52.google.com with SMTP id 18so721928fxd.11 for ; Thu, 01 Sep 2011 02:05:27 -0700 (PDT) Received: by 10.223.88.214 with SMTP id b22mr1402900fam.5.1314867898588; Thu, 01 Sep 2011 02:04:58 -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.11.8 with SMTP id m8cs44977lab; Thu, 1 Sep 2011 02:04:58 -0700 (PDT) Received: by 10.91.167.17 with SMTP id u17mr1104844ago.162.1314867897453; Thu, 01 Sep 2011 02:04:57 -0700 (PDT) Received: from mailout1.samsung.com (mailout1.samsung.com [203.254.224.24]) by mx.google.com with ESMTP id h11si530860ana.71.2011.09.01.02.04.56; Thu, 01 Sep 2011 02:04:57 -0700 (PDT) Received-SPF: neutral (google.com: 203.254.224.24 is neither permitted nor denied by best guess record for domain of thomas.abraham@linaro.org) client-ip=203.254.224.24; Authentication-Results: mx.google.com; spf=neutral (google.com: 203.254.224.24 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 (mailout1.samsung.com [203.254.224.24]) by mailout1.samsung.com (Oracle Communications Messaging Exchange Server 7u4-19.01 64bit (built Sep 7 2010)) with ESMTP id <0LQU005XW6JBUO50@mailout1.samsung.com> for patches@linaro.org; Thu, 01 Sep 2011 18:04:55 +0900 (KST) X-AuditID: cbfee61b-b7b7fae000005864-d9-4e5f4ab700a6 Received: from epmmp2 ( [203.254.227.17]) by epcpsbgm2.samsung.com (MMPCPMTA) with SMTP id FE.0B.22628.7BA4F5E4; Thu, 01 Sep 2011 18:04:55 +0900 (KST) Received: from localhost.localdomain ([107.108.73.37]) by mmp2.samsung.com (iPlanet Messaging Server 5.2 Patch 2 (built Jul 14 2004)) with ESMTPA id <0LQU001MY6JYD0@mmp2.samsung.com> for patches@linaro.org; Thu, 01 Sep 2011 18:04:55 +0900 (KST) Date: Thu, 01 Sep 2011 14:34:37 +0530 From: Thomas Abraham Subject: [PATCH v2 1/6] DMA: PL330: move filter function into driver In-reply-to: <1314867882-11755-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, robherring2@gmail.com, vinod.koul@intel.com, patches@linaro.org, jassisinghbrar@gmail.com, boojin.kim@samsung.com Message-id: <1314867882-11755-2-git-send-email-thomas.abraham@linaro.org> X-Mailer: git-send-email 1.6.6.rc2 Content-transfer-encoding: 7BIT References: <1314867882-11755-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_ */