From: T.Michael Turney <quic_mturney@quicinc.com>
To: Pintu Agarwal <pintu.ping@gmail.com>,
open list <linux-kernel@vger.kernel.org>, <robh+dt@kernel.org>,
<devicetree@vger.kernel.org>, <frowand.list@gmail.com>,
linux-mm <linux-mm@kvack.org>
Subject: Re: Queries: Using ifdef CONFIG condition in dts files
Date: Thu, 26 May 2022 07:23:27 -0700 [thread overview]
Message-ID: <65f1b675-84ac-b5da-6075-2a9f0353ab37@quicinc.com> (raw)
In-Reply-To: <CAOuPNLgzBA2Sbn6vS4856LwYyBo67OYKQp49+xpwX=Bi+KpLZg@mail.gmail.com>
Kernel developers correct me where I go astray, but this seems like the
CONFIG_XYZ value is not available in this file. This would explain why
the disable case works.
At top of dtsi file are you #include <config.h> or whatever the correct
syntax is to see the CONFIG values?
Cheers,
T.mike
On 5/26/2022 1:46 AM, Pintu Agarwal wrote:
> Hi,
>
> I have a generic question regarding conditional compilation options in
> dts/dtsi files.
> Our Kernel version is: 4.14
> Let's say I have a Kernel config such as CONFIG_XYZ.
> This driver uses a CMA reserved memory and its node is defined in a
> mysoc.dtsi file.
> Like:
> #if defined(CONFIG_XYZ)
> &reserved_mem {
> xyz_region: xyz_region {
> compatible = "shared-dma-pool";
> reusable;
> size = <0x600000>;
> };
> };
> #endif
>
> The problem is as follows:
> a) The same kernel/dts source is shared across 2 product versions.
> b) In one product we need to enable this CONFIG_XYZ but in another
> product we need to disable it.
> c) When we disable the CONFIG we wanted this dts node also to be
> disabled together.
> d) When we add "#if defined(CONFIG_XYZ)" check in the dtsi file, it
> works if the CONFIG is disabled, but it does not work if CONFIG is
> enabled (node is not getting created).
> e) This mysoc.dtsi file is getting included in many other dts files,
> so we cannot add a compilation check in Makefile. We will end up
> renaming many files just to protect this one change.
>
> Is there any other better way to handle this situation ?
>
> I see that in latest kernel we have a conditional compilation added like this:
> #ifdef SOC_HAS_USB2_CH2
> https://elixir.bootlin.com/linux/latest/source/arch/arm64/boot/dts/renesas/salvator-common.dtsi#L1028
>
> But the same is not recognized by the device tree compiler when using
> kernel CONFIG_ check.
>
> Is it the device-tree compiler issue which got fixed in the latest version ?
> Or, is it because Kernel config cannot be shared with device-tree ?
>
> Please let us know if there is any other opinion.
>
>
> Thank you.
>
> Regards,
> Pintu
next prev parent reply other threads:[~2022-05-26 14:23 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-05-26 7:23 Pintu Agarwal
2022-05-26 8:46 ` Pintu Agarwal
2022-05-26 14:23 ` T.Michael Turney [this message]
2022-05-27 10:04 ` Pintu Agarwal
2022-05-27 11:36 ` Pintu Agarwal
2022-05-28 3:51 ` Pintu Agarwal
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=65f1b675-84ac-b5da-6075-2a9f0353ab37@quicinc.com \
--to=quic_mturney@quicinc.com \
--cc=devicetree@vger.kernel.org \
--cc=frowand.list@gmail.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-mm@kvack.org \
--cc=pintu.ping@gmail.com \
--cc=robh+dt@kernel.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