Received: by 2002:a25:824b:0:0:0:0:0 with SMTP id d11csp372010ybn; Tue, 1 Oct 2019 22:50:13 -0700 (PDT) X-Google-Smtp-Source: APXvYqymGToGzrk87VOFfIYFgjpKWEVwmGElh0tZIB/gaPywgOJpv+FjfsNZ9CycbJtdEL8XaKb/ X-Received: by 2002:a17:906:1357:: with SMTP id x23mr1569298ejb.66.1569995413372; Tue, 01 Oct 2019 22:50:13 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1569995413; cv=none; d=google.com; s=arc-20160816; b=zPVsAuWeUTY4Kyn7ua3A1MbkAOuOZ//IC7WUp1Sgla+J/j1xCjZTIqQ/ZPI56bUKGl mt9BiH92LW9LIGORHiGOPBIr8nSV2p7k86j2uyNsVIVUym2bmngqxzzCVUY5wo1vdv8y RFFzvt+Ibr8Z5AJw/SUtR++mGFTd1Fq17j0dtfON7mmdGZPlxMq5j72UXNljBNSqtz+j 0uWFfY2LE4HvelF9xdjZcUJGhtlzRB0ZSxmWf2MXTXA3duPgVxNjbCyLR2hm2gCSZqeP OOvDJIY2rLlOTAfeNlmXlxgnZwHhCgtrbbu9JuiTtwbIvzfFgdXz9qhYvq2VK2KOWxAG S+Ww== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:in-reply-to:content-disposition :mime-version:references:subject:cc:to:from:date:message-id; bh=7juTQtP1fGtdijjUC7WXaUFZUEcGC/S0f5sAvsKcGvM=; b=FVp8bMNbJBygMePedgK8fHq9+QAesM0+Q0dDafdC75lXKOOMg7b7JI46Vq2jqRy+Re kJEaY9RAS6t2IGWpv27xK467oF0iPMQVTEItnyt9DB31q4xqihKYRqhZHszDWXHdlSHM NjRecX+WUMpZuJ1XlA7+tVkF2Tl57QHMZvem9DtdCtPl9kXjKgL0d9z8aQqQ/y1et9Su VOmac9cRJwEwXifoDqBduHmVUk5Xk0MXNyiyH54HP5iP2WbauAwDN9h4tmjXLrE8QA7k dTDKW2Mil2c/iK6qZws4kRsGK9uHqUIEzXs4nG/CUncyvSkOupIchp5oVcJUsYNQyOxk tgFw== ARC-Authentication-Results: i=1; mx.google.com; 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=fail (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 j2si10129071edp.114.2019.10.01.22.49.48; Tue, 01 Oct 2019 22:50:13 -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; 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=fail (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728047AbfJAWJH (ORCPT + 99 others); Tue, 1 Oct 2019 18:09:07 -0400 Received: from mail-io1-f67.google.com ([209.85.166.67]:38108 "EHLO mail-io1-f67.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726521AbfJAWJH (ORCPT ); Tue, 1 Oct 2019 18:09:07 -0400 Received: by mail-io1-f67.google.com with SMTP id u8so52146502iom.5; Tue, 01 Oct 2019 15:09:05 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:message-id:date:from:to:cc:subject:references :mime-version:content-disposition:in-reply-to; bh=7juTQtP1fGtdijjUC7WXaUFZUEcGC/S0f5sAvsKcGvM=; b=fqhjcf9BXhljxP4/ITKBY41/UUT2Y7qzTREbrCQ1snQ+i4jaE4MvZbzfPvBxB7zQkn uLe48Cx+VAlbyprrGEvPj3ydx4swophMTxLNIexFrK00G8eRFPPQ6Ol92vJGgTidCPoF 3ddm9Yf46nJFEfNaiW8SZZEbpM3ng9m6TdbMHWr5WoWs9g39sw/MJqYmuXcaWHvYYtPJ dbVGQofAzeq9IXJNsmoO95kJQfz/4samg/JbjdyEcxZp2Xy3G42lsNgvF88JjAayBEZC iJSfwKbMaiRnYBdkwPqEEfZN26oGLcH/lKHzEipC64aOH/aXeyqQNcqnUizvb99xrgps TK4w== X-Gm-Message-State: APjAAAWV/uNAqvCnSnGJRgoOGd4HaiO+OmG3iCr5dSjR/SsDbYKdc8tr CUehCwK8whRlZm+8wQLSAw== X-Received: by 2002:a6b:f703:: with SMTP id k3mr464617iog.20.1569967745190; Tue, 01 Oct 2019 15:09:05 -0700 (PDT) Received: from localhost ([2607:fb90:1780:6fbf:9c38:e932:436b:4079]) by smtp.gmail.com with ESMTPSA id h62sm9876566ild.78.2019.10.01.15.09.04 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 01 Oct 2019 15:09:04 -0700 (PDT) Message-ID: <5d93ce80.1c69fb81.4acf3.4716@mx.google.com> Date: Tue, 01 Oct 2019 17:09:01 -0500 From: Rob Herring To: rananta@codeaurora.org Cc: Frank Rowand , Trilok Soni , Android Kernel Team , devicetree@vger.kernel.org, linux-kernel@vger.kernel.org Subject: Re: [PATCH] of: Add of_get_memory_prop() References: <20190918184656.7633-1-rananta@codeaurora.org> <19d727bbfce08e59294920ba8097be7a@codeaurora.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <19d727bbfce08e59294920ba8097be7a@codeaurora.org> X-Mutt-References: <19d727bbfce08e59294920ba8097be7a@codeaurora.org> Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Wed, Sep 18, 2019 at 03:32:14PM -0700, rananta@codeaurora.org wrote: > On 2019-09-18 13:13, Rob Herring wrote: > > On Wed, Sep 18, 2019 at 1:47 PM Raghavendra Rao Ananta > > wrote: > > > > > > On some embedded systems, the '/memory' dt-property gets updated > > > by the bootloader (for example, the DDR configuration) and then > > > gets passed onto the kernel. The device drivers may have to read > > > the properties at runtime to make decisions. Hence, add > > > of_get_memory_prop() for the device drivers to query the requested > > > > Function name doesn't match. Device drivers don't need to access the > > FDT. > > > > > properties. > > > > > > Signed-off-by: Raghavendra Rao Ananta > > > --- > > > drivers/of/fdt.c | 27 +++++++++++++++++++++++++++ > > > include/linux/of_fdt.h | 1 + > > > 2 files changed, 28 insertions(+) > > > > We don't add kernel api's without users. > > > > > > > > diff --git a/drivers/of/fdt.c b/drivers/of/fdt.c > > > index 223d617ecfe1..925cf2852433 100644 > > > --- a/drivers/of/fdt.c > > > +++ b/drivers/of/fdt.c > > > @@ -79,6 +79,33 @@ void __init of_fdt_limit_memory(int limit) > > > } > > > } > > > > > > +/** > > > + * of_fdt_get_memory_prop - Return the requested property from the > > > /memory node > > > + * > > > + * On match, returns a non-zero positive value which represents the > > > property > > > + * value. Otherwise returns -ENOENT. > > > + */ > > > +int of_fdt_get_memory_prop(const char *pname) > > > +{ > > > + int memory; > > > + int len; > > > + fdt32_t *prop = NULL; > > > + > > > + if (!pname) > > > + return -EINVAL; > > > + > > > + memory = fdt_path_offset(initial_boot_params, "/memory"); > > > > Memory nodes should have a unit-address, so this won't work frequently. > Sorry, can you please elaborate more on this? What do you mean by > unit-address and working frequently? A memory node is typically going to be something like: /memory@80000000. So your function will not work for any of those cases. And just '/memory' generates a dtc warning. Rob