From patchwork Wed Jan 23 22:28:46 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Arnd Bergmann X-Patchwork-Id: 2027051 Return-Path: X-Original-To: patchwork-spi-devel-general@patchwork.kernel.org Delivered-To: patchwork-process-083081@patchwork2.kernel.org Received: from lists.sourceforge.net (lists.sourceforge.net [216.34.181.88]) by patchwork2.kernel.org (Postfix) with ESMTP id 571D5DF23E for ; Wed, 23 Jan 2013 22:29:12 +0000 (UTC) Received: from localhost ([127.0.0.1] helo=sfs-ml-3.v29.ch3.sourceforge.com) by sfs-ml-3.v29.ch3.sourceforge.com with esmtp (Exim 4.76) (envelope-from ) id 1Ty8oh-0003ri-Hg; Wed, 23 Jan 2013 22:29:11 +0000 Received: from sog-mx-1.v43.ch3.sourceforge.com ([172.29.43.191] helo=mx.sourceforge.net) by sfs-ml-3.v29.ch3.sourceforge.com with esmtp (Exim 4.76) (envelope-from ) id 1Ty8of-0003rd-Sf for spi-devel-general@lists.sourceforge.net; Wed, 23 Jan 2013 22:29:09 +0000 X-ACL-Warn: Received: from moutng.kundenserver.de ([212.227.126.171]) by sog-mx-1.v43.ch3.sourceforge.com with esmtps (TLSv1:RC4-SHA:128) (Exim 4.76) id 1Ty8ob-0003Ik-TU for spi-devel-general@lists.sourceforge.net; Wed, 23 Jan 2013 22:29:09 +0000 Received: from klappe2.localnet (HSI-KBW-46-223-90-92.hsi.kabel-badenwuerttemberg.de [46.223.90.92]) by mrelayeu.kundenserver.de (node=mrbap0) with ESMTP (Nemesis) id 0MUCN0-1UOzLx0Pre-00RC9W; Wed, 23 Jan 2013 23:28:55 +0100 From: Arnd Bergmann To: Matt Porter Subject: Re: [PATCH v5 07/14] dmaengine: add dma_request_slave_channel_compat() Date: Wed, 23 Jan 2013 22:28:46 +0000 User-Agent: KMail/1.12.2 (Linux/3.7.0-7-generic; KDE/4.3.2; x86_64; ; ) References: <1358281974-8411-1-git-send-email-mporter@ti.com> <1358281974-8411-8-git-send-email-mporter@ti.com> In-Reply-To: <1358281974-8411-8-git-send-email-mporter@ti.com> MIME-Version: 1.0 Message-Id: <201301232228.46716.arnd@arndb.de> X-Provags-ID: V02:K0:FKU9UoZs/61UN2WTXH0LuUALS1mSfU50NSDT4rCGfz/ C25mCtL5unYXUeyVn3SbfeOQvT75Per9fnNlZLHTbY+1W+USV6 R8uniTTYvJapiz7TJ6t3g19wNK2EpkhXFe3F0duxMKXT86LFdA c68uPHTPnGxASCgCqJJizObATjqr41FNL4mdqhxTgUkOI8/9+O TzfzyWfv1qa75u6b2ZfMHzBohz0ruKnJ+2xr45ZHxTUqIqgpwH l+Dm7q578uv5NQAZA1h/XA9dSKWTG/KpqxagWdTFnvBVakXLpi QqOpm39v30tHP5fUQ0c2lTJmwswDQwxCNx5Ym/zmWCg8hXJDHF lZKMbpslgvni6QKEP/EI= X-Spam-Score: -0.0 (/) X-Spam-Report: Spam Filtering performed by mx.sourceforge.net. See http://spamassassin.org/tag/ for more details. -0.0 RCVD_IN_DNSWL_NONE RBL: Sender listed at http://www.dnswl.org/, no trust [212.227.126.171 listed in list.dnswl.org] -0.0 SPF_HELO_PASS SPF: HELO matches SPF record X-Headers-End: 1Ty8ob-0003Ik-TU Cc: Linux DaVinci Kernel List , Linux OMAP List , Russell King , Benoit Cousson , Linux Documentation List , Tony Lindgren , Linux MMC List , Devicetree Discuss , Mark Brown , Sekhar Nori , Linux Kernel Mailing List , Rob Herring , Vinod Koul , Rob Landley , Dan Williams , Linux SPI Devel List , Chris Ball , Linux ARM Kernel List X-BeenThere: spi-devel-general@lists.sourceforge.net X-Mailman-Version: 2.1.9 Precedence: list List-Id: Linux SPI core/device drivers discussion List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: spi-devel-general-bounces@lists.sourceforge.net On Tuesday 15 January 2013, Matt Porter wrote: > Adds a dma_request_slave_channel_compat() wrapper which accepts > both the arguments from dma_request_channel() and > dma_request_slave_channel(). Based on whether the driver is > instantiated via DT, the appropriate channel request call will be > made. > > This allows for a much cleaner migration of drivers to the > dmaengine DT API as platforms continue to be mixed between those > that boot using DT and those that do not. I noticed today some drivers in linux-next that rely on this patch, but the patch itself still missing from -next. > --- a/include/linux/dmaengine.h > +++ b/include/linux/dmaengine.h > @@ -1047,6 +1047,16 @@ void dma_run_dependencies(struct dma_async_tx_descriptor *tx); > struct dma_chan *dma_find_channel(enum dma_transaction_type tx_type); > struct dma_chan *net_dma_find_channel(void); > #define dma_request_channel(mask, x, y) __dma_request_channel(&(mask), x, y) > +static inline struct dma_chan > +*dma_request_slave_channel_compat(dma_cap_mask_t mask, dma_filter_fn fn, > + void *fn_param, struct device *dev, > + char *name) > +{ > + if (dev->of_node) > + return dma_request_slave_channel(dev, name); > + else > + return dma_request_channel(mask, fn, fn_param); > +} Hmm, dma_request_channel is actually a macro that passes mask by reference, presumably because it can get modified by the filter function. Also, there may be cases where we do have an of_node but don't use the dma binding yet, or where dma_request_slave_channel doesn't actually use DT information but rather one of the other methods that Vinod was talking about adding. I think what it should look like instead is the below. Arnd ------------------------------------------------------------------------------ Master Visual Studio, SharePoint, SQL, ASP.NET, C# 2012, HTML5, CSS, MVC, Windows 8 Apps, JavaScript and much more. Keep your skills current with LearnDevNow - 3,200 step-by-step video tutorials by Microsoft MVPs and experts. ON SALE this month only -- learn more at: http://p.sf.net/sfu/learnnow-d2d diff --git a/include/linux/dmaengine.h b/include/linux/dmaengine.h index bfcdecb..b6ffd7d 100644 --- a/include/linux/dmaengine.h +++ b/include/linux/dmaengine.h @@ -993,6 +993,19 @@ static inline void dma_release_channel(struct dma_chan *chan) } #endif +static inline struct dma_chan *__dma_request_slave_channel_compat(dma_cap_mask_t *mask, + dma_filter_fn fn, void *fn_param, struct device *dev, + char *name) +{ + struct dma_chan *chan; + + chan = dma_request_slave_channel(dev, name); + if (chan) + return chan; + + return __dma_request_channel(mask, fn, fn_param); +} + /* --- DMA device --- */ int dma_async_device_register(struct dma_device *device); @@ -1001,6 +1014,8 @@ void dma_run_dependencies(struct dma_async_tx_descriptor *tx); struct dma_chan *dma_find_channel(enum dma_transaction_type tx_type); struct dma_chan *net_dma_find_channel(void); #define dma_request_channel(mask, x, y) __dma_request_channel(&(mask), x, y) +#define dma_request_slave_channel_compat(mask, x, y, dev, name) \ + __dma_request_slave_channel_compat(&(mask), x, y, dev, name) /* --- Helper iov-locking functions --- */