Received: by 2002:ac0:a5a7:0:0:0:0:0 with SMTP id m36-v6csp461927imm; Wed, 11 Jul 2018 05:41:48 -0700 (PDT) X-Google-Smtp-Source: AAOMgpeT8DSjZf1FizWzTuCFeotDbgXycTTaxl3XGwCZBM4iyPXaAIznLsIlCsAA/hV9oAG4y/91 X-Received: by 2002:a17:902:1007:: with SMTP id b7-v6mr28292890pla.277.1531312908528; Wed, 11 Jul 2018 05:41:48 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1531312908; cv=none; d=google.com; s=arc-20160816; b=nkwhh0eqoMiLZu2a9ETklXTqZ937FB4UXksy6WI7f6ef/Z5lBCoMYnNvZRaj/13hOh cDt1oz2qEhKYyjtyJpsP/0m181r0ankjNACK0lNIqILlad1CCGGn7z41H78MzBN0Xiqj UsPKlvxQ2SR7BJ+ujLc/2flCEi3w11li0vTy2OxfMZtz7kcMNz49TWk6qD2VyiUq6B2M kioxiHLKVwogkuN7kqo6eqFR8n5HF3QIQM9P5UML0ceUX3SQtQ0acBfzidqHh3OtCOGC iwGbuzGUxWvM4h16KT1xwT3H4IUCjBeqyJflg8zuocalOqVy4bjstmBjX+LFIc0riTIl hLCg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:user-agent:in-reply-to :content-disposition:mime-version:references:message-id:subject:cc :to:from:date:dkim-signature:arc-authentication-results; bh=n1+q/3MYXCBs0+kv+KM55Qhica4EZF9i8s3mRiPWzs0=; b=MNiUs4fmEz7IsuDdDY0+CNoGH0wx49aHD3J2cVR1QEB5f1OwidH1PHb8qABbr7cK4P i6EWwoMbmfkFwlRUPfd11UCYwMs+QEtaXMAczy7nDERq7t8DaBEmUiT/5qk57MSINvr6 PiYkWCWNj4KLneb3GwA3tL9HrA68Q/WIchEAXiZo+HyhyuOsm3fcneGxB6NfeHHFa2hi YoBWDWbE8XxfkQgCQBof0JenrDG/sN3uNwtI6/0Grn4iGmX/eD0Moqe6E6GfOPIuKwGy vfUcmlOrEpqMHsoJ7nAFKcsJs5FPRcpSYVIb3tT201GXzNpl9a62eaH5YNMjvczrDm+g UyFA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=OEwZQWwe; 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=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id s15-v6si19297370pgr.269.2018.07.11.05.41.33; Wed, 11 Jul 2018 05:41:48 -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=@kernel.org header.s=default header.b=OEwZQWwe; 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=NONE dis=NONE) header.from=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1732837AbeGKMSR (ORCPT + 99 others); Wed, 11 Jul 2018 08:18:17 -0400 Received: from mail.kernel.org ([198.145.29.99]:58286 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1732503AbeGKMSQ (ORCPT ); Wed, 11 Jul 2018 08:18:16 -0400 Received: from localhost (unknown [106.200.243.225]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id 5DEF22084A; Wed, 11 Jul 2018 12:14:11 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1531311252; bh=9BfqPJy/9QTritHy6541J/y+6FdvNY1b5TuICtLJWWQ=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=OEwZQWwe/Xk5gESbjiQgPzmSRJX7L2O2UcxV7TQv/Z/qrzEzd4ybiCzNRtw2KAL5V 4GqKvjHA99dBZ4912ufdz+S6efTr34r0Bvsjma2KI1RbXSA5T5ZUbgPs1EVeGC271X ndU7V0UZhQj0PUjTspnf7HvWoRhOLKDw2isGxz+o= Date: Wed, 11 Jul 2018 17:44:03 +0530 From: Vinod To: Paul Cercueil , Rob Herring Cc: Mark Rutland , Ralf Baechle , Paul Burton , James Hogan , Zubair Lutfullah Kakakhel , Mathieu Malaterre , Daniel Silsby , dmaengine@vger.kernel.org, devicetree@vger.kernel.org, linux-kernel@vger.kernel.org, linux-mips@linux-mips.org Subject: Re: [PATCH 01/14] dmaengine: dma-jz4780: Avoid hardcoding number of channels Message-ID: <20180711121403.GR3219@vkoul-mobl> References: <20180703123214.23090-1-paul@crapouillou.net> <20180703123214.23090-2-paul@crapouillou.net> <20180709165945.GH22377@vkoul-mobl> <1531236550.17118.0@crapouillou.net> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <1531236550.17118.0@crapouillou.net> User-Agent: Mutt/1.9.2 (2017-12-15) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Hi Paul, On 10-07-18, 17:29, Paul Cercueil wrote: > > > +static const unsigned int jz4780_dma_nb_channels[] = { > > > + [ID_JZ4780] = 32, > > > +}; > > > + > > > +static const struct of_device_id jz4780_dma_dt_match[] = { > > > + { .compatible = "ingenic,jz4780-dma", .data = (void *)ID_JZ4780 }, > > > + {}, > > > +}; > > > > Looking at description I was hoping that channels would be in DT, > > channels is hardware information, so should come from DT rather than > > coding the kernel... > > I had a talk with Linus Walleij (GPIO maintainer) about that: > http://lkml.iu.edu/hypermail/linux/kernel/1701.3/05422.html > > And I agree with him, we shouldn't have in devicetree what we can deduce > from the compatible string. But there doesn't seem to be an enforced > policy about it. Looking at this, yes that can be done as you have implemented but adding new compatible and tables every time seems not so great to me. If DT can describe these hardware features then driver can take action generically and we avoid these tables and skip some patches here.. > > @Rob, what do you think? Rob what is the recommendation here? > > > > - jzdma = devm_kzalloc(dev, sizeof(*jzdma), GFP_KERNEL); > > > + if (of_id) > > > + version = (enum jz_version)of_id->data; > > > + else > > > + version = ID_JZ4780; /* Default when not probed from DT */ > > > > where else would it be probed from.... ? > > Platform, MFD driver, etc. But not likely to happen. > I can remove these lines if you want. Lets add when we land support for those. -- ~Vinod