Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752511Ab3DVKLm (ORCPT ); Mon, 22 Apr 2013 06:11:42 -0400 Received: from mail-wi0-f171.google.com ([209.85.212.171]:33187 "EHLO mail-wi0-f171.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751259Ab3DVKLj (ORCPT ); Mon, 22 Apr 2013 06:11:39 -0400 Date: Mon, 22 Apr 2013 11:11:33 +0100 From: Lee Jones To: Vinod Koul Cc: linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org, arnd@arndb.de, linus.walleij@stericsson.com, Dan Williams , Per Forlin , Rabin Vincent Subject: Re: [PATCH 13/32] dmaengine: ste_dma40: Calculate number of logical channels from physical ones Message-ID: <20130422101133.GG3432@gmail.com> References: <1366279934-30761-1-git-send-email-lee.jones@linaro.org> <1366279934-30761-14-git-send-email-lee.jones@linaro.org> <20130422092321.GC24632@intel.com> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: <20130422092321.GC24632@intel.com> User-Agent: Mutt/1.5.21 (2010-09-15) Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 3963 Lines: 96 On Mon, 22 Apr 2013, Vinod Koul wrote: > On Thu, Apr 18, 2013 at 11:11:55AM +0100, Lee Jones wrote: > > This change will cost ~25KB of memory, but it's worth the trade-off, > > as it removes a great deal of overhead. It means that instead of only > > allocating memory for the logical channels in use, it does so for all > > available ones, which is 32 per physical channel. However, this now > > means we can remove some platform data and we don't have to worry > > about adding vendor specific variables to Device Tree. > > > > Cc: Vinod Koul > > Cc: Dan Williams > > Cc: Per Forlin > > Cc: Rabin Vincent > > Signed-off-by: Lee Jones > > --- > > arch/arm/mach-ux500/devices-db8500.c | 1 - > > drivers/dma/ste_dma40.c | 16 ++++++---------- > > include/linux/platform_data/dma-ste-dma40.h | 2 -- > > 3 files changed, 6 insertions(+), 13 deletions(-) > > > > diff --git a/arch/arm/mach-ux500/devices-db8500.c b/arch/arm/mach-ux500/devices-db8500.c > > index 03efd4c1..2fcb8c2 100644 > > --- a/arch/arm/mach-ux500/devices-db8500.c > > +++ b/arch/arm/mach-ux500/devices-db8500.c > > @@ -121,7 +121,6 @@ static const dma_addr_t dma40_rx_map[DB8500_DMA_NR_DEV] = { > > }; > > > > static struct stedma40_platform_data dma40_plat_data = { > > - .dev_len = DB8500_DMA_NR_DEV, > > .dev_rx = dma40_rx_map, > > .dev_tx = dma40_tx_map, > > .disabled_channels = {-1}, > > diff --git a/drivers/dma/ste_dma40.c b/drivers/dma/ste_dma40.c > > index 7b451b2..a39ef74 100644 > > --- a/drivers/dma/ste_dma40.c > > +++ b/drivers/dma/ste_dma40.c > > @@ -45,6 +45,9 @@ > > #define D40_LCLA_LINK_PER_EVENT_GRP 128 > > #define D40_LCLA_END D40_LCLA_LINK_PER_EVENT_GRP > > > > +/* Max number of logical channels per physical channel */ > > +#define D40_MAX_LOG_CHAN_PER_PHY 32 > > + > > /* Attempts before giving up to trying to get pages that are aligned */ > > #define MAX_LCLA_ALLOC_ATTEMPTS 256 > > > > @@ -3197,6 +3200,8 @@ static struct d40_base * __init d40_hw_detect_init(struct platform_device *pdev) > > else > > num_phy_chans = 4 * (readl(virtbase + D40_DREG_ICFG) & 0x7) + 4; > > > > + num_log_chans = num_phy_chans * D40_MAX_LOG_CHAN_PER_PHY; > > + > > dev_info(&pdev->dev, "hardware revision: %d @ 0x%x with %d physical channels\n", > > rev, res->start, num_phy_chans); > > > > @@ -3206,15 +3211,6 @@ static struct d40_base * __init d40_hw_detect_init(struct platform_device *pdev) > > goto failure; > > } > > > > - /* Count the number of logical channels in use */ > > - for (i = 0; i < plat_data->dev_len; i++) > > - if (plat_data->dev_rx[i] != 0) > > - num_log_chans++; > > - > > - for (i = 0; i < plat_data->dev_len; i++) > > - if (plat_data->dev_tx[i] != 0) > > - num_log_chans++; > > - > > base = kzalloc(ALIGN(sizeof(struct d40_base), 4) + > > (num_phy_chans + num_log_chans + ARRAY_SIZE(dma40_memcpy_channels)) * > > sizeof(struct d40_chan), GFP_KERNEL); > > @@ -3282,7 +3278,7 @@ static struct d40_base * __init d40_hw_detect_init(struct platform_device *pdev) > > * The max number of logical channels are event lines for all > > * src devices and dst devices > > */ > > - base->lookup_log_chans = kzalloc(plat_data->dev_len * 2 * > > + base->lookup_log_chans = kzalloc(num_log_chans * > you could have used devm_ helper for this. I'll convert the entire driver over to devm_ in a latter patch. > Acked-by: Vinod Koul Thanks. -- Lee Jones Linaro ST-Ericsson Landing Team Lead Linaro.org │ Open source software for ARM SoCs Follow Linaro: Facebook | Twitter | Blog -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/