From: Pintu Agarwal <pintu.ping@gmail.com>
To: 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: Queries: Using ifdef CONFIG condition in dts files
Date: Thu, 26 May 2022 12:53:18 +0530 [thread overview]
Message-ID: <CAOuPNLjGWp4+Ub_Ccaw+tx1NQrNcqyjUG5K30uPH3uYTF_wxfw@mail.gmail.com> (raw)
[-- Attachment #1: Type: text/plain, Size: 1756 bytes --]
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/D/ident/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
[-- Attachment #2: Type: text/html, Size: 5398 bytes --]
next reply other threads:[~2022-05-26 7:23 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-05-26 7:23 Pintu Agarwal [this message]
2022-05-26 8:46 ` Pintu Agarwal
2022-05-26 14:23 ` T.Michael Turney
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=CAOuPNLjGWp4+Ub_Ccaw+tx1NQrNcqyjUG5K30uPH3uYTF_wxfw@mail.gmail.com \
--to=pintu.ping@gmail.com \
--cc=devicetree@vger.kernel.org \
--cc=frowand.list@gmail.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-mm@kvack.org \
--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