From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by smtp.lore.kernel.org (Postfix) with ESMTP id 375B9C433F5 for ; Thu, 26 May 2022 08:46:34 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 9EC188D0003; Thu, 26 May 2022 04:46:33 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 99B128D0002; Thu, 26 May 2022 04:46:33 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 887AE8D0003; Thu, 26 May 2022 04:46:33 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0011.hostedemail.com [216.40.44.11]) by kanga.kvack.org (Postfix) with ESMTP id 78D238D0002 for ; Thu, 26 May 2022 04:46:33 -0400 (EDT) Received: from smtpin16.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay02.hostedemail.com (Postfix) with ESMTP id 48D8333A39 for ; Thu, 26 May 2022 08:46:33 +0000 (UTC) X-FDA: 79507263066.16.866190E Received: from mail-yb1-f177.google.com (mail-yb1-f177.google.com [209.85.219.177]) by imf06.hostedemail.com (Postfix) with ESMTP id 8A973180015 for ; Thu, 26 May 2022 08:46:29 +0000 (UTC) Received: by mail-yb1-f177.google.com with SMTP id s14so1772967ybc.10 for ; Thu, 26 May 2022 01:46:32 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=mime-version:references:in-reply-to:from:date:message-id:subject:to; bh=MnY+75yaFpPmjAWFmxJr1ChfpUtDSQjtIKbQOgLely0=; b=oPJtsyrFZIJkwUmv9Ks8yXpKKCjURNdJRmoGKf0dndmyo8zKnB6aD3XRr7TIU0qRvK kyAOfqvxMeZK4y/qlBhO/bEmSRJz3YntcOY//uxIPXpk4bG/8y9zWY5tCpD5GjBcYZvX XOC5XOfa5vKfzDPUpzU4up4Iciv1wNcXh8VuUWEG+QJvWiLGFnOYXrA0yeDCUZEsc2MT XNFjseh0vNq0q9at/+LMnMdy2T01YBJXjrp2etXQVhPCZFIMQPICQW8EOlyyi1ppCKZT 6b1Kv7jLTKN0amLWOu5Dy0EElAoklXMh3l0vAVypdGcIblXY3CSpgqLnlPA9MN6DR1FL Dpqg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to; bh=MnY+75yaFpPmjAWFmxJr1ChfpUtDSQjtIKbQOgLely0=; b=4iLzq4tOHfDR2mPH4x4BV5VHrwm7RWKUFNLywr9iW6YjL52QtF+fEgyeBnYdNaiE+X XyAb7OsVOkwZsCjXrFgES2yiRqI0fBLoaYqVdCRRxyjC+CLIWTuPbnlUguVnlLfjNbxe kTd9/n8XZi1KCtaTBO2mvRY0wGblSgxFdTozPD2+jfys6HxeLnRXhbIvOwk9fiFeVPhE s8amy+44yV4aybrATRuWXLUFDC5qsmNAFLztckUTWB/u+0QFurhPmf82E/UofIoHiJur KmqfBNDIvO7SXS8ZyCu9+zuvC4W8nnUjuLjM5maIG+0073oyZEJiO9DO3h7DkizHkxkM UKDg== X-Gm-Message-State: AOAM530JHBhCTZ5VJYSayPdc5aquNx4ravK43hIT/oukbMNGNtkvnYo8 QI6Y/pAnnxX4+JIjGnhBZhxmX8Qrdixfj7Ngm0Y= X-Google-Smtp-Source: ABdhPJxZFU4h9YxHSV5CxUe4ezrjnStAZaiSnUpTNUOJY0kbfjv6ia1TCXsKO/lAjA5di75hkY9csSTNGQvZtcxwFVo= X-Received: by 2002:a25:9901:0:b0:651:e25e:febe with SMTP id z1-20020a259901000000b00651e25efebemr11176373ybn.58.1653554792099; Thu, 26 May 2022 01:46:32 -0700 (PDT) MIME-Version: 1.0 References: In-Reply-To: From: Pintu Agarwal Date: Thu, 26 May 2022 14:16:20 +0530 Message-ID: Subject: Queries: Using ifdef CONFIG condition in dts files To: open list , robh+dt@kernel.org, devicetree@vger.kernel.org, frowand.list@gmail.com, linux-mm Content-Type: text/plain; charset="UTF-8" X-Rspamd-Server: rspam07 X-Rspamd-Queue-Id: 8A973180015 X-Stat-Signature: onb8hso9wufmkmz6xugqdekgqwhgi13d X-Rspam-User: Authentication-Results: imf06.hostedemail.com; dkim=pass header.d=gmail.com header.s=20210112 header.b=oPJtsyrF; spf=pass (imf06.hostedemail.com: domain of pintu.ping@gmail.com designates 209.85.219.177 as permitted sender) smtp.mailfrom=pintu.ping@gmail.com; dmarc=pass (policy=none) header.from=gmail.com X-HE-Tag: 1653554789-379453 X-Bogosity: Ham, tests=bogofilter, spamicity=0.000000, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: 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