From mboxrd@z Thu Jan 1 00:00:00 1970 From: Arnd Bergmann Subject: Re: [PATCH 2/5] spi: pl022: use generic DMA slave configuration if possible Date: Tue, 29 Jan 2013 13:13:03 +0000 Message-ID: <201301291313.03511.arnd@arndb.de> References: <1359395857-1235-1-git-send-email-arnd@arndb.de> <1359410300-26113-3-git-send-email-arnd@arndb.de> <1359445794.31148.34.camel@smile> Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Cc: Vinod Koul , Viresh Kumar , devicetree-discuss-uLR06cmDAlY/bJ5BZ2RsiQ@public.gmane.org, Mark Brown , Jon Hunter , spi-devel-general-5NWGOfrQmneRv+LV9MX5uipxlwaOVQ5f@public.gmane.org, linux-arm-kernel-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r@public.gmane.org To: Andy Shevchenko Return-path: In-Reply-To: <1359445794.31148.34.camel@smile> List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: spi-devel-general-bounces-5NWGOfrQmneRv+LV9MX5uipxlwaOVQ5f@public.gmane.org List-Id: linux-spi.vger.kernel.org On Tuesday 29 January 2013, Andy Shevchenko wrote: > > +static int pl022_dma_autoprobe(struct pl022 *pl022) > > +{ > > + struct device *dev = &pl022->adev->dev; > > + > > + /* automatically configure DMA channels from platform, normally using DT */ > > + pl022->dma_rx_channel = dma_request_slave_channel(dev, "rx"); > > + if (!pl022->dma_rx_channel) > > + goto err_no_rxchan; > > + > > + pl022->dma_tx_channel = dma_request_slave_channel(dev, "tx"); > > + if (!pl022->dma_tx_channel) > > + goto err_no_txchan; > > + > > + pl022->dummypage = kmalloc(PAGE_SIZE, GFP_KERNEL); > > Where this memory will be freed? > In dependence of the answer could you consider to use > devm_kmalloc or __get_free_page? There is another function like this called pl022_dma_probe() that has the same allocation, and it gets freed in the same place. It's probably worth changing this into something different, but I felt that it didn't belong into this patch. I was also not sure if the best option would be dmam_alloc_coherent, dev_kzalloc, or __get_free_page. 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 From mboxrd@z Thu Jan 1 00:00:00 1970 From: arnd@arndb.de (Arnd Bergmann) Date: Tue, 29 Jan 2013 13:13:03 +0000 Subject: [PATCH 2/5] spi: pl022: use generic DMA slave configuration if possible In-Reply-To: <1359445794.31148.34.camel@smile> References: <1359395857-1235-1-git-send-email-arnd@arndb.de> <1359410300-26113-3-git-send-email-arnd@arndb.de> <1359445794.31148.34.camel@smile> Message-ID: <201301291313.03511.arnd@arndb.de> To: linux-arm-kernel@lists.infradead.org List-Id: linux-arm-kernel.lists.infradead.org On Tuesday 29 January 2013, Andy Shevchenko wrote: > > +static int pl022_dma_autoprobe(struct pl022 *pl022) > > +{ > > + struct device *dev = &pl022->adev->dev; > > + > > + /* automatically configure DMA channels from platform, normally using DT */ > > + pl022->dma_rx_channel = dma_request_slave_channel(dev, "rx"); > > + if (!pl022->dma_rx_channel) > > + goto err_no_rxchan; > > + > > + pl022->dma_tx_channel = dma_request_slave_channel(dev, "tx"); > > + if (!pl022->dma_tx_channel) > > + goto err_no_txchan; > > + > > + pl022->dummypage = kmalloc(PAGE_SIZE, GFP_KERNEL); > > Where this memory will be freed? > In dependence of the answer could you consider to use > devm_kmalloc or __get_free_page? There is another function like this called pl022_dma_probe() that has the same allocation, and it gets freed in the same place. It's probably worth changing this into something different, but I felt that it didn't belong into this patch. I was also not sure if the best option would be dmam_alloc_coherent, dev_kzalloc, or __get_free_page. Arnd