Received: by 2002:ac0:a591:0:0:0:0:0 with SMTP id m17-v6csp448494imm; Sat, 7 Jul 2018 00:35:38 -0700 (PDT) X-Google-Smtp-Source: AAOMgpfoPYXnDXCJ/Uqd95M//m2cXoX0yR0izasHRLdpITL4UlWLKdOeyqoDGFhc83gaQeffRfpV X-Received: by 2002:a17:902:68:: with SMTP id 95-v6mr12989368pla.178.1530948938161; Sat, 07 Jul 2018 00:35:38 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1530948938; cv=none; d=google.com; s=arc-20160816; b=CVmcQqkY3qt1BLSxlNjpMTjWxfLKWUTeApqx003Hr+EuHPP/uxOiFF4TVEh/se2PsX gqnubuo8DxpfmJ4yNEp+uSAt5qfYtS7LtxJs4usNI5GiwJ2U00VR/zW54TfNi2txGmd7 7ipOkDuBZ0oenJrrWxInKvUkdnH0FE16ReDx4Le2GDShozkhu/oEq1BjZGICcbT9uPEM z0h27W+DgCj5g/DO3cUHjr1ZtMUyxeZpuSi6UxxEMyfdwtdh8fOVSpg6NBOoZqk1xmvO TjyIZWbpYqmH5KJ3cCAo6x5rPwuAo+kTFbqBYaibnGHVDSWOpZZh1yn7aovG2BnDUn1Z BnNA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:cc:to:subject:message-id:date:from :references:in-reply-to:mime-version:dkim-signature :arc-authentication-results; bh=pNfVVRyr21nqrWIw7SM71QicGBqxaKES+kmnpFGgnpE=; b=tK8hlFPeuVLzvkp0MYD2qsswMxoDlq9xaxX9jYPSj2l7mlg/4pNCw2UdnZw04UTCSQ WxZtqO6c9M7MxKZo1MOyOtRzQy64gnkyLLMYq2KL71DxUUaEtONyx69i3KA5pJKvHosE mI+pq4AMYr0RSzw/a+BR/qZ3R10Oxae/1lJQ3lHUzTIRAfI6kj1zuZsf1kzTL122HGFr rkdcEa867nYb/UwDpxzaH4Bme3BRC0IRd89Hq3bXzbt1bjcCdmZ2EaEY4424ya+UxFxe cHv4dohy+DrfHkJWA8Z2U+OiHvypM8O/KeIlxMr0hG7fPHt7e+g1vCv7zQN79TKnb2fN sgyA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=Bg3vhCiP; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id z8-v6si9598647pgr.260.2018.07.07.00.35.22; Sat, 07 Jul 2018 00:35:38 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=Bg3vhCiP; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752809AbeGGHen (ORCPT + 99 others); Sat, 7 Jul 2018 03:34:43 -0400 Received: from mail-pl0-f67.google.com ([209.85.160.67]:38402 "EHLO mail-pl0-f67.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1750816AbeGGHel (ORCPT ); Sat, 7 Jul 2018 03:34:41 -0400 Received: by mail-pl0-f67.google.com with SMTP id b1-v6so3837737pls.5; Sat, 07 Jul 2018 00:34:41 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:in-reply-to:references:from:date:message-id:subject:to :cc; bh=pNfVVRyr21nqrWIw7SM71QicGBqxaKES+kmnpFGgnpE=; b=Bg3vhCiPymtjyar1QR6cidcOU0lNwYvpNsyDDUmByiXfT8OCsbg74VOP2X2p82kLpm Wbo6k2S9Qua/g4NE/fRU5HnOdeEshey4SNkERDFftuXYtKjnOymx9vlud3qqy0BTxjFA lzwjoiPK8e9HiG/LEaNSVsC3UabQeTjVj44RnH1gaCDEiZ1IImo02z/hih28oGwq8Hd1 sGKuv8teGYMpmp277RD2ybTdz/M4E77iuCRRgVk4nicbx9S8b63t0F7BFJiUPtd51P+V QnKQ2K8mQuZFmxuMX6IQ6ucqfVURKkNH3aYRym86UOOh1yMKmIGeFvBitGOjV4wrztF/ k7Nw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:in-reply-to:references:from:date :message-id:subject:to:cc; bh=pNfVVRyr21nqrWIw7SM71QicGBqxaKES+kmnpFGgnpE=; b=V039GBXPp6yE2kg5FR3JHrXgEfXjiOXByM27M90+q8ceh5VBHZ4fMNqjGJCDCtgcHA EHmstbZ+IF3GEhjvxfKeg/o74EFsq/ignY7g/kKhtnyCcxBAAjKIW/IK2vue6yLZVC/M E6YU1lKImIuy9y/bCtwVTCiKOaCIV1kaGLyQTHrhr5UTrGpNHy19csU+yR+tRLytfTr6 SK5sN5Ir9DN3gDSQkm5ssvN0+kHQbzU3FWoSa5r+/qN8EAC23w3C5JDeyRQ1a1JvRymv hXGVzgwWxtrBoq8mm4NdBcnrzHoLVxySyLzur1zg+lFGhRHxMt09vGd0noRxOK41TsPO a2fA== X-Gm-Message-State: APt69E1Al/+NyvkGXXoApjyu1sgMjsbK3roUxNwdc6nEspjUha3ehBx5 VjfuaIOoSE8U6w92W6wVUv92okFHhGzHThCzkb4= X-Received: by 2002:a17:902:683:: with SMTP id 3-v6mr13057684plh.291.1530948880932; Sat, 07 Jul 2018 00:34:40 -0700 (PDT) MIME-Version: 1.0 Received: by 2002:a17:90a:2604:0:0:0:0 with HTTP; Sat, 7 Jul 2018 00:34:40 -0700 (PDT) In-Reply-To: <1530815198.6642.1@smtp.crapouillou.net> References: <20180703123214.23090-1-paul@crapouillou.net> <20180703123214.23090-2-paul@crapouillou.net> <1530815198.6642.1@smtp.crapouillou.net> From: PrasannaKumar Muralidharan Date: Sat, 7 Jul 2018 13:04:40 +0530 Message-ID: Subject: Re: [PATCH 01/14] dmaengine: dma-jz4780: Avoid hardcoding number of channels To: Paul Cercueil Cc: Vinod Koul , Rob Herring , Mark Rutland , Ralf Baechle , Paul Burton , James Hogan , Zubair Lutfullah Kakakhel , Mathieu Malaterre , Daniel Silsby , dmaengine@vger.kernel.org, "open list:OPEN FIRMWARE AND FLATTENED DEVICE TREE BINDINGS" , open list , Linux-MIPS Content-Type: text/plain; charset="UTF-8" Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 5 July 2018 at 23:56, Paul Cercueil wrote: > Hi PrasannaKumar, > > >> Hi Paul, >> >> On 3 July 2018 at 18:02, Paul Cercueil wrote: >>> >>> As part of the work to support various other Ingenic JZ47xx SoC >>> versions, >>> which don't feature the same number of DMA channels per core, we now >>> deduce the number of DMA channels available from the devicetree >>> compatible string. >>> >>> Signed-off-by: Paul Cercueil >>> --- >>> drivers/dma/dma-jz4780.c | 53 +++++++++++++++++++++++++++++----------- >>> 1 file changed, 39 insertions(+), 14 deletions(-) >>> >>> diff --git a/drivers/dma/dma-jz4780.c b/drivers/dma/dma-jz4780.c >>> index 85820a2d69d4..b40f491f0367 100644 >>> --- a/drivers/dma/dma-jz4780.c >>> +++ b/drivers/dma/dma-jz4780.c >>> @@ -16,6 +16,7 @@ >>> #include >>> #include >>> #include >>> +#include >>> #include >>> #include >>> #include >>> @@ -23,8 +24,6 @@ >>> #include "dmaengine.h" >>> #include "virt-dma.h" >>> >>> -#define JZ_DMA_NR_CHANNELS 32 >>> - >>> /* Global registers. */ >>> #define JZ_DMA_REG_DMAC 0x1000 >>> #define JZ_DMA_REG_DIRQP 0x1004 >>> @@ -135,14 +134,20 @@ struct jz4780_dma_chan { >>> unsigned int curr_hwdesc; >>> }; >>> >>> +enum jz_version { >>> + ID_JZ4780, >>> +}; >>> + >>> struct jz4780_dma_dev { >>> struct dma_device dma_device; >>> void __iomem *base; >>> struct clk *clk; >>> unsigned int irq; >>> + unsigned int nb_channels; >>> + enum jz_version version; >>> >>> uint32_t chan_reserved; >>> - struct jz4780_dma_chan chan[JZ_DMA_NR_CHANNELS]; >>> + struct jz4780_dma_chan chan[]; >> >> >> Looks like a variable length array in struct. I think there is some >> effort to remove the usage of VLA. Can you revisit this? I may be >> wrong, please feel free to correct. > > > Are you sure? It's the first time I hear about it. > Could anybody confirm? Please see [1] for info. Variable Length Arrays in struct is expressly forbidden in C99, C11. Clang does not support it. To make kernel compile with Clang few people are trying to remove/reduce VLAIS usage. 1. https://blog.linuxplumbersconf.org/2013/ocw/system/presentations/1221/original/VLAIS.pdf