Received: by 2002:a05:6358:1087:b0:cb:c9d3:cd90 with SMTP id j7csp265668rwi; Fri, 14 Oct 2022 01:25:33 -0700 (PDT) X-Google-Smtp-Source: AMsMyM6rC/xuvrGel2i9AuqpVJZb/emp8mcJezcfVvEeGi+UTsan/QBhFE7Vw41INsnd4HAUhvbx X-Received: by 2002:a17:907:2c5b:b0:78d:3f8a:19d0 with SMTP id hf27-20020a1709072c5b00b0078d3f8a19d0mr2653759ejc.369.1665735933456; Fri, 14 Oct 2022 01:25:33 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1665735933; cv=none; d=google.com; s=arc-20160816; b=SWTW+5qmVJkih6T3vy5uuBIuqW4PoOrOgUMPdqQ77B9SLyXe6Nf6BARJmJzuA9k+v1 xLHsUxYb5h9R5MifgeAi5vOWlFG4FoE/cfykZGT101+mZRtZD5CZbmM/Hehp/xr8CuaH 4HPJWz6M0d8PGCsIuZ4bEP+3BCYdJB80n1TF5q+T/enwADjic3trXq7K+U1uPfac1M60 58D/TaIfKpBs+qB4XiluVENQ/UU3WfdIGEm+KA8ZgvCD1VxJhWIQ2K8gdzmG1KS0QKHZ U/sawVslKp0v4KwqI7ZLViblXeLhTPSf4oi40n4N8s/isXk+YMNRQCnFXtGYj8SoWXlH 1/Qg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:subject:cc:to:from:date:references:in-reply-to :message-id:mime-version:user-agent:feedback-id:dkim-signature :dkim-signature; bh=m2djQg3F4DVynenjUu/6ySRNpcHRzX+D6LlzucfEhYs=; b=jfccGxoEeOKAHyK1DRDmj28SIRYpx/pOPsKA+2aIOohE9GvokHruYgpc3vXDVc9GR5 0eUsMT+CI5SAYzzAFduqPRrOJfdZ8xQ0eNwpcgAK8+gxau0ZWmXRP8rthUmlanwiLAzt VkjX83Qf109E7Fa0saHkjG7YUfHoVheOczIC1vegkp0/9nJLfV5eFq+KqUTzzJaGSBps /lKB6nRltShVgLDPWiHu2hO9GcOt3qpsr2PwCs6xYcFMLIrPYh7kC1ZAxe80ikvStRxB 7lOPDAaluGRa4W9kaJrOjIXIGtmWLt+JgssUk7rRTmAO5aWBGuNZtGyi+9iOmIEYGObF yYlg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@arndb.de header.s=fm2 header.b=EhwpxGIJ; dkim=pass header.i=@messagingengine.com header.s=fm3 header.b=YqcxPACN; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id go10-20020a1709070d8a00b0078d4c9d77adsi2324078ejc.94.2022.10.14.01.25.07; Fri, 14 Oct 2022 01:25:33 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@arndb.de header.s=fm2 header.b=EhwpxGIJ; dkim=pass header.i=@messagingengine.com header.s=fm3 header.b=YqcxPACN; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229809AbiJNILJ (ORCPT + 99 others); Fri, 14 Oct 2022 04:11:09 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:35114 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230070AbiJNILB (ORCPT ); Fri, 14 Oct 2022 04:11:01 -0400 Received: from out4-smtp.messagingengine.com (out4-smtp.messagingengine.com [66.111.4.28]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 5FFF7C6956; Fri, 14 Oct 2022 01:11:00 -0700 (PDT) Received: from compute3.internal (compute3.nyi.internal [10.202.2.43]) by mailout.nyi.internal (Postfix) with ESMTP id 952215C0097; Fri, 14 Oct 2022 04:10:59 -0400 (EDT) Received: from imap51 ([10.202.2.101]) by compute3.internal (MEProxy); Fri, 14 Oct 2022 04:10:59 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=arndb.de; h=cc :cc:content-type:date:date:from:from:in-reply-to:in-reply-to :message-id:mime-version:references:reply-to:sender:subject :subject:to:to; s=fm2; t=1665735059; x=1665821459; bh=m2djQg3F4D VynenjUu/6ySRNpcHRzX+D6LlzucfEhYs=; b=EhwpxGIJWz7/N+hl0C2NDCsdpD sSkzHhxV5b20Luv58TV4gL/dmXHZ1fxw3EETGEEf/OmAIwdj+3ORLjlCfyJREoX5 NyoV4BF/zTmfNZg5M4vw3USDC0rJndcYmdEs6NtD7LDJMBEWmt+KTbMpFCJea3+0 c9TNxIRzE5CXODdnEWnxYDT2kRHyQoUOJQVmblDyvpqyGLKODAijBkwIg8WHkuh1 mKkmXpWVjDZEH5g8fhYeCedyOw/urT4KNS+3dpH+pEiBnxlmGzCPNqVtViAJH8JT TI1pgtfAj3H/XvQlsoswowmDu/XknFtBFEbFNv8Q1ojLbUrKwUPTOfNOWJCA== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=cc:cc:content-type:date:date:feedback-id :feedback-id:from:from:in-reply-to:in-reply-to:message-id :mime-version:references:reply-to:sender:subject:subject:to:to :x-me-proxy:x-me-proxy:x-me-sender:x-me-sender:x-sasl-enc; s= fm3; t=1665735059; x=1665821459; bh=m2djQg3F4DVynenjUu/6ySRNpcHR zX+D6LlzucfEhYs=; b=YqcxPACNXvW6SWq3nFas6BSz8Pb8z8+Zh1QFfWfR4BLv hNa65a1BkkZl3n3hI2zZKteOlLqJTMbM59tTdUA5fhbpDnMK2GWhEdZkcM0+A02/ BxSFmO5eSablgsmMBJ2GZnvyJknzznxQMkFdHg4qgM+85nC13LG9fBzSpSsEmk7R AbrlIQ+qBdJj9k2vluO2oCRVzMvCR655aUXhpeTM5fXlk896JNQ1iwQc9SS8nhOM Xf3kyJiaH/9I1/j9cSSN1tLbbk6r2CBKqY2m2KgttscjKAhjEqoolvOT7q2u8+6Z l8rpAGPL/Zkh+zBU/j02LzI/R5zi6b/ohj3tXOcTig== X-ME-Sender: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgedvfedrfeekvddgtdduucetufdoteggodetrfdotf fvucfrrhhofhhilhgvmecuhfgrshhtofgrihhlpdfqfgfvpdfurfetoffkrfgpnffqhgen uceurghilhhouhhtmecufedttdenucesvcftvggtihhpihgvnhhtshculddquddttddmne cujfgurhepofgfggfkjghffffhvfevufgtsehttdertderredtnecuhfhrohhmpedftehr nhguuceuvghrghhmrghnnhdfuceorghrnhgusegrrhhnuggsrdguvgeqnecuggftrfgrth htvghrnhepffehueegteeihfegtefhjefgtdeugfegjeelheejueethfefgeeghfektdek teffnecuvehluhhsthgvrhfuihiivgeptdenucfrrghrrghmpehmrghilhhfrhhomheprg hrnhgusegrrhhnuggsrdguvg X-ME-Proxy: Feedback-ID: i56a14606:Fastmail Received: by mailuser.nyi.internal (Postfix, from userid 501) id 59E0BB60083; Fri, 14 Oct 2022 04:10:59 -0400 (EDT) X-Mailer: MessagingEngine.com Webmail Interface User-Agent: Cyrus-JMAP/3.7.0-alpha0-1047-g9e4af4ada4-fm-20221005.001-g9e4af4ad Mime-Version: 1.0 Message-Id: <767d768e-70e5-4a94-accb-3384a3bfd582@app.fastmail.com> In-Reply-To: <20221013195153.2767632-1-nathan@kernel.org> References: <20221013195153.2767632-1-nathan@kernel.org> Date: Fri, 14 Oct 2022 10:10:39 +0200 From: "Arnd Bergmann" To: "Nathan Chancellor" , "Rob Herring" , "Frank Rowand" Cc: devicetree@vger.kernel.org, linux-kernel@vger.kernel.org, "Matt Flax" Subject: Re: [PATCH] of: Define of_match_ptr() with PTR_IF() to avoid unused variable warnings Content-Type: text/plain X-Spam-Status: No, score=-2.8 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_LOW, RCVD_IN_MSPIKE_H3,RCVD_IN_MSPIKE_WL,SPF_HELO_PASS,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Thu, Oct 13, 2022, at 9:51 PM, Nathan Chancellor wrote: > > -#define of_match_ptr(_ptr) NULL > #define of_match_node(_matches, _node) NULL > #endif /* CONFIG_OF */ > > +#define of_match_ptr(_ptr) PTR_IF(IS_ENABLED(CONFIG_OF), (_ptr)) > + I think this is counterproductive, as it means we cannot use of_match_ptr() for its intended purpose any more, it will now cause a build failure for any driver that references a match table inside of an #ifdef. Ideally we should be able to find the misuse of this macro with coccinelle and have it automatically generate patches that just remove it from drivers. A first-level approximation would be this oneliner: git grep -wl of_match_ptr | xargs git grep -wL CONFIG_OF | xargs sed -i "s:of_match_ptr(\([\ \#\>\"a-zA-Z0-9_-]*\)):\1:" which takes care of 535 files that don't reference CONFIG_OF at all. There are 496 more files that use of_match_ptr() as well but also guard something inside of CONFIG_OF. Most of these are just incorrectly copy-pasted from older drivers and should not have an #ifdef in them to make the of_match_ptr() work, but they are not actually usable without CONFIG_OF. Historically, we added the #ifdef at the time when we supported hundreds of boards without DT and only a couple of boards with DT, so having the extra #ifdef was a way of ensuring that the DT conversion would not add a few extra bytes of .data to each driver. Now we support thousands of boards with DT and only a few dozen without DT, so this is all pointless. Arnd