From: Rob Herring <robh@kernel.org>
To: rananta@codeaurora.org
Cc: Frank Rowand <frowand.list@gmail.com>,
Trilok Soni <tsoni@codeaurora.org>,
Android Kernel Team <kernel-team@android.com>,
devicetree@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH] of: Add of_get_memory_prop()
Date: Tue, 01 Oct 2019 17:09:01 -0500 [thread overview]
Message-ID: <5d93ce80.1c69fb81.4acf3.4716@mx.google.com> (raw)
In-Reply-To: <19d727bbfce08e59294920ba8097be7a@codeaurora.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
> > <rananta@codeaurora.org> 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 <rananta@codeaurora.org>
> > > ---
> > > 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
next prev parent reply other threads:[~2019-10-01 22:09 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-09-18 18:46 [PATCH] of: Add of_get_memory_prop() Raghavendra Rao Ananta
2019-09-18 20:13 ` Rob Herring
2019-09-18 22:32 ` rananta
2019-10-01 22:09 ` Rob Herring [this message]
2019-10-17 18:35 ` Frank Rowand
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=5d93ce80.1c69fb81.4acf3.4716@mx.google.com \
--to=robh@kernel.org \
--cc=devicetree@vger.kernel.org \
--cc=frowand.list@gmail.com \
--cc=kernel-team@android.com \
--cc=linux-kernel@vger.kernel.org \
--cc=rananta@codeaurora.org \
--cc=tsoni@codeaurora.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox