Received: by 2002:a05:6a10:22f:0:0:0:0 with SMTP id 15csp417851pxk; Sun, 30 Aug 2020 08:25:15 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzeJ51qHTsWrnYUK2AT6X3lt84PMAojIkbpTqJegv+d6q/Al5CBHWc4yJL5Tb0Qx7UtLAPx X-Received: by 2002:a50:fc0e:: with SMTP id i14mr7577323edr.346.1598801115452; Sun, 30 Aug 2020 08:25:15 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1598801115; cv=none; d=google.com; s=arc-20160816; b=iQdsvoj0igDayxtVk5BQtvF8TEl+cW6yesgDzaVc73lVOOdoMsfQMFHNxLm6+IDrT/ D2z0jRyrjA0X6zaQvivps9oafo+VfP7smta74EWTh1foGwJ7ug9Z86jdMdNwTG3CaF2D qfiB8jj6FVD2DCQxF9VS42LXqVl8Y7/DOFHHVSLGlWM0aQTUeyo0KLGtAaqotP0XXBgc UBk3KASqHD0so+P4E7excsy6SPso170lpPRzUDOIbGGjX2Az3e5v0xiLHzdDGB2tnOZm fO2vxvBttoyhdk5OqUUBFRt0MXrJJdpCvCJwbCrSKjXGdwHJ2VKahLSS1EwlUXGKvGfO 9Hqg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:in-reply-to:content-disposition :mime-version:references:message-id:subject:cc:to:from:date; bh=B08j0fxP/QlcoGyStslsD8O1FuZosWiPY3Nb25fy6Zk=; b=XDBUk61bsNpHtvWiQ2CVJYwXdkcTA0z3GUU1Hwj0MP3UUX43iN4wjHnEEjW+55N0ll 2zvyZns4qll1JkBpLrYcVpBRRO2v1w7/7dttpneg8XfDqEOLppsPsPNG1AADtYeEF4KO Ddi1DTwQfrjCxrIIXXURajNQQofAL2P/FLORg3LgN3dbbA5KAy340TUMuzfOXyx214wr 7njUQQl3+O1Mz25wsSPDSirkmRDNxLXCPfLSOQk5iBibpPLOQGB1dc5/CbElfHDNaZ1y +QJiWOZq0OyEtHwdXdvR3X6jIK07DnFsH3hOFHLHy1JrnfaPFHKiEhsN77C2Qxqjf5pn 6MCA== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id w22si3768995ejk.590.2020.08.30.08.24.51; Sun, 30 Aug 2020 08:25:15 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726134AbgH3PXi (ORCPT + 99 others); Sun, 30 Aug 2020 11:23:38 -0400 Received: from vps0.lunn.ch ([185.16.172.187]:60878 "EHLO vps0.lunn.ch" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725993AbgH3PXf (ORCPT ); Sun, 30 Aug 2020 11:23:35 -0400 Received: from andrew by vps0.lunn.ch with local (Exim 4.94) (envelope-from ) id 1kCPB6-00CXF4-Sq; Sun, 30 Aug 2020 17:23:32 +0200 Date: Sun, 30 Aug 2020 17:23:32 +0200 From: Andrew Lunn To: Rob Herring Cc: devicetree@vger.kernel.org, "linux-kernel@vger.kernel.org" Subject: Re: [PATCH] of: of_match_node: Make stub an inline function to avoid W=1 warnings Message-ID: <20200830152332.GE2966560@lunn.ch> References: <20200828021939.2912798-1-andrew@lunn.ch> <20200828130034.GA2912863@lunn.ch> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Fri, Aug 28, 2020 at 05:09:52PM -0600, Rob Herring wrote: > On Fri, Aug 28, 2020 at 7:00 AM Andrew Lunn wrote: > > > > On Fri, Aug 28, 2020 at 04:19:39AM +0200, Andrew Lunn wrote: > > > When building without CONFIG_OF and W=1, errors are given about unused > > > arrays of match data, because of_match_node is stubbed as a macro. The > > > compile does not see it takes parameters when not astub, so it > > > generates warnings about unused variables. Replace the stub with an > > > inline function to avoid these false warnings. > > > > Hi Rob > > > > So 0-day shows some people have worked around this with #ifdef > > CONFIG_OF around the match table. > > > > I checked the object code for the file i'm interested in. The > > optimiser has correctly throw away the match table and all code around > > it with the inline stub. > > > > Which do you prefer? This patch and i remove the #ifdef, or the old > > stub and if add #ifdef around the driver i'm getting warnings from? > > Use of_device_get_match_data instead of of_match_node. > Hi Rob That does not work in the use case i'm interested in, which is giving a W=1 warning. Take a look at the last example in Documentation/devicetree/bindings/net/dsa/marvell.txt We have an Ethernet switch, using the compatible string "marvell,mv88e6390". Embedded within the hardware, and within the same driver, we have two MDIO busses. One is internal, for the PHYs integrated into the switch, and one is external, of discrete PHY connected to the switch. The external MDIO bus has its own compatible string. However, there is no struct driver for it, the switch driver is driving the MDIO bus. So of_device_get_match_data() will use the wrong match table. Andrew