Message ID | 20230311173303.262618-1-krzysztof.kozlowski@linaro.org |
---|---|
State | New |
Headers |
Return-Path: <linux-kernel-owner@vger.kernel.org> Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:5915:0:0:0:0:0 with SMTP id v21csp379927wrd; Sat, 11 Mar 2023 09:38:27 -0800 (PST) X-Google-Smtp-Source: AK7set+wcYilZtF7UH48oDKl3KxWiTda3SlASb2OifFEOU+CzQUZh+HuzHir3Y76imYGCgdRCYV3 X-Received: by 2002:a17:902:e5ce:b0:19e:2ea9:2174 with SMTP id u14-20020a170902e5ce00b0019e2ea92174mr36093524plf.33.1678556307669; Sat, 11 Mar 2023 09:38:27 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1678556307; cv=none; d=google.com; s=arc-20160816; b=KdT/OVp+zt1/QAphUQDfh6y6N7bmjb0lqZLu08u1hHOmraPgWKnideWSHT53IBN5yk kSMryLsqEu7GBWXwnKSCLSqVm5zswbXaZTVsguPvwqU/Jc0Ep/XKUFtFfWrxyknD6eyA PsPl2awmfFEGienaYxLja9tfS++KLBtcTTTcyvuc9fNvVkaABJbeMIFxeMfGDbjlDohz sA+B5FcA/LRx5QY/IxSBuy/3ePpVC9a4W8vXoLYymOKlRDZiFH1Lr5fSgWMldiwuVaab +tY5X8k+3PNMHU9iWdApUKKP243khH1a8eQ8vqEg8YtqbOOzawYixxkW0oyhiTOTGusA 7Svw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :message-id:date:subject:cc:to:from:dkim-signature; bh=Wf3VcA12/YrUundcroeR6wyGdqPTMCPD8/QGoi4c1VQ=; b=QLZo7Hyk+LyyQ1Or9zutm/kuWInOky6td15fAiG9XN3Nbt3Qs1NVecOQclcvYk5UCb fWdwzGL53r5Qx4uKT0BC+l8fjRYVDhyTK0NgQ89wnQLb4jD2TarLWgDk7vHWK6hBv4QE riQlqtwLSyixaTPfzhmUSUVTCKvGepSIibYf3k9Wiyv6IJFFNdsrySvcgPkSRscbHrDM bX4TVgKpkb/kLbyPRoM0l+iGSO2L2EaD1lzou0OIgWjizWdciInHRnYKOFmepanigF5I eLIRN4bcOhhMZmmb0mi2g2y8lxg1GhcbvYdMeWlnVCmEGFy8kP4I7QkcJvOmiWLaUpy+ l5wg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=UlZRqvn1; 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; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id a14-20020a170902ecce00b0019aa8ffd978si2778042plh.253.2023.03.11.09.38.15; Sat, 11 Mar 2023 09:38:27 -0800 (PST) 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=@linaro.org header.s=google header.b=UlZRqvn1; 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; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230057AbjCKRdR (ORCPT <rfc822;toshivichauhan@gmail.com> + 99 others); Sat, 11 Mar 2023 12:33:17 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:57896 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229612AbjCKRdP (ORCPT <rfc822;linux-kernel@vger.kernel.org>); Sat, 11 Mar 2023 12:33:15 -0500 Received: from mail-ed1-x529.google.com (mail-ed1-x529.google.com [IPv6:2a00:1450:4864:20::529]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id C574A11163 for <linux-kernel@vger.kernel.org>; Sat, 11 Mar 2023 09:33:13 -0800 (PST) Received: by mail-ed1-x529.google.com with SMTP id k10so32932638edk.13 for <linux-kernel@vger.kernel.org>; Sat, 11 Mar 2023 09:33:13 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1678555992; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:from:to:cc:subject:date:message-id:reply-to; bh=Wf3VcA12/YrUundcroeR6wyGdqPTMCPD8/QGoi4c1VQ=; b=UlZRqvn12gq/jGCCnKeQnJcvhYq4mKfAWsv8joCF1SKk81V5nKo6bL4qnULGKxYSD5 B2YK/KjiT/rlm1xbIwn85ZKrc4c5jKwMcQLv0cv1YQTnYNYLj8AXVQMeP01QTZYrOVpf Jp18EuL79aOIZ+Hn1V8XgZoi/kIP+++F4/Gfbh5nloPb73y1VGK+t4uKQ/p8h+Yv+SfS Pcn7Pq4eq7a2t9MOj4lkEc9R3yRwiiZ8/xLmMkoHHRKXZZuFOM3Ti/RBu3sw/i5sTRie O+ZU0ciUG2+ddhxbNO7pPID0i7DAj18EzJI8cQVD+MbBI5wRiig3+DhLGub5ZUyNjxLF 4Onw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; t=1678555992; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=Wf3VcA12/YrUundcroeR6wyGdqPTMCPD8/QGoi4c1VQ=; b=JlN4Sm2cDlOCAaMlh2FT0LZaYBC/fkRnuoc81SXZh7QexcD6fFXwcvs5yWqfGiCHPf b1/8XZpZgrDl6h0NUTFh+f0BCrTgeqK+Z7rh64V14So6WaecxU8I5FXVneArfvKT60Tn kb7OOpCxtE3W3pL10vlfJPOuBG04X5v8xxUP3LD/wd9pcTsCB/isUVA8IyCBiokwpLUA 3nhaDz/He9xYwuI5BZ9m3sMNGGE0xN1cejbAjk00+v2hnTTNIJAX3eK0pmMutRGveTPp YiX0y+lTbxfyn08QrQhliVqcT9VtCwBPxShA7dpD1FYl89JrsUUGOApdel5cHdZtbQhP Lb7A== X-Gm-Message-State: AO0yUKUpqMqVnotMla3cI1SiL+NcW5CAAKvKfFDBkHQpy3vXHJRdNQe/ K30ZQv+X+pqPBymF9jRvSeD2Vg== X-Received: by 2002:aa7:c40c:0:b0:4fa:ac78:7f2a with SMTP id j12-20020aa7c40c000000b004faac787f2amr1891149edq.41.1678555992182; Sat, 11 Mar 2023 09:33:12 -0800 (PST) Received: from krzk-bin.. ([2a02:810d:15c0:828:6927:e94d:fc63:9d6e]) by smtp.gmail.com with ESMTPSA id k15-20020a50ce4f000000b004d8287c775fsm1440885edj.8.2023.03.11.09.33.10 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 11 Mar 2023 09:33:11 -0800 (PST) From: Krzysztof Kozlowski <krzysztof.kozlowski@linaro.org> To: Andrew Lunn <andrew@lunn.ch>, Florian Fainelli <f.fainelli@gmail.com>, Vladimir Oltean <olteanv@gmail.com>, "David S. Miller" <davem@davemloft.net>, Eric Dumazet <edumazet@google.com>, Jakub Kicinski <kuba@kernel.org>, Paolo Abeni <pabeni@redhat.com>, Hauke Mehrtens <hauke@hauke-m.de>, Woojung Huh <woojung.huh@microchip.com>, UNGLinuxDriver@microchip.com, Claudiu Manoil <claudiu.manoil@nxp.com>, Alexandre Belloni <alexandre.belloni@bootlin.com>, Colin Foster <colin.foster@in-advantage.com>, Michael Hennerich <michael.hennerich@analog.com>, Alexander Aring <alex.aring@gmail.com>, Stefan Schmidt <stefan@datenfreihafen.org>, Miquel Raynal <miquel.raynal@bootlin.com>, Heiner Kallweit <hkallweit1@gmail.com>, Russell King <linux@armlinux.org.uk>, netdev@vger.kernel.org, linux-kernel@vger.kernel.org, linux-wpan@vger.kernel.org Cc: Krzysztof Kozlowski <krzysztof.kozlowski@linaro.org> Subject: [PATCH 01/12] net: dsa: lantiq_gswip: mark OF related data as maybe unused Date: Sat, 11 Mar 2023 18:32:52 +0100 Message-Id: <20230311173303.262618-1-krzysztof.kozlowski@linaro.org> X-Mailer: git-send-email 2.34.1 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_NONE, SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED 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: <linux-kernel.vger.kernel.org> X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1760093858747759079?= X-GMAIL-MSGID: =?utf-8?q?1760093858747759079?= |
Series |
[01/12] net: dsa: lantiq_gswip: mark OF related data as maybe unused
|
|
Commit Message
Krzysztof Kozlowski
March 11, 2023, 5:32 p.m. UTC
The driver can be compile tested with !CONFIG_OF making certain data
unused:
drivers/net/dsa/lantiq_gswip.c:1888:34: error: ‘xway_gphy_match’ defined but not used [-Werror=unused-const-variable=]
Signed-off-by: Krzysztof Kozlowski <krzysztof.kozlowski@linaro.org>
---
drivers/net/dsa/lantiq_gswip.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
Comments
On Sat, Mar 11, 2023 at 06:32:52PM +0100, Krzysztof Kozlowski wrote: > The driver can be compile tested with !CONFIG_OF making certain data > unused: > > drivers/net/dsa/lantiq_gswip.c:1888:34: error: ‘xway_gphy_match’ defined but not used [-Werror=unused-const-variable=] > > Signed-off-by: Krzysztof Kozlowski <krzysztof.kozlowski@linaro.org> > --- Do you happen to have any context as to why of_match_node() without CONFIG_OF is implemented as: #define of_match_node(_matches, _node) NULL and not as: static inline const struct of_device_id * of_match_node(const struct of_device_id *matches, const struct device_node *node) { return NULL; } ? Generally, the static inline shim function model is nicer, because it allows us to not scatter __maybe_unused all around.
On 11/03/2023 19:14, Vladimir Oltean wrote: > On Sat, Mar 11, 2023 at 06:32:52PM +0100, Krzysztof Kozlowski wrote: >> The driver can be compile tested with !CONFIG_OF making certain data >> unused: >> >> drivers/net/dsa/lantiq_gswip.c:1888:34: error: ‘xway_gphy_match’ defined but not used [-Werror=unused-const-variable=] >> >> Signed-off-by: Krzysztof Kozlowski <krzysztof.kozlowski@linaro.org> >> --- > > Do you happen to have any context as to why of_match_node() without > CONFIG_OF is implemented as: > > #define of_match_node(_matches, _node) NULL > > and not as: > > static inline const struct of_device_id * > of_match_node(const struct of_device_id *matches, > const struct device_node *node) > { > return NULL; > } > > ? > > Generally, the static inline shim function model is nicer, because it > allows us to not scatter __maybe_unused all around. Sorry, I don't follow. I don't touch that wrappers, just fix errors related to OF device ID tables, although in few cases it is indeed related to of_match_node. Best regards, Krzysztof
On Sun, Mar 12, 2023 at 11:20:38AM +0100, Krzysztof Kozlowski wrote: > On 11/03/2023 19:14, Vladimir Oltean wrote: > > On Sat, Mar 11, 2023 at 06:32:52PM +0100, Krzysztof Kozlowski wrote: > >> The driver can be compile tested with !CONFIG_OF making certain data > >> unused: > >> > >> drivers/net/dsa/lantiq_gswip.c:1888:34: error: ‘xway_gphy_match’ defined but not used [-Werror=unused-const-variable=] > >> > >> Signed-off-by: Krzysztof Kozlowski <krzysztof.kozlowski@linaro.org> > >> --- > > > > Do you happen to have any context as to why of_match_node() without > > CONFIG_OF is implemented as: > > > > #define of_match_node(_matches, _node) NULL > > > > and not as: > > > > static inline const struct of_device_id * > > of_match_node(const struct of_device_id *matches, > > const struct device_node *node) > > { > > return NULL; > > } > > > > ? > > > > Generally, the static inline shim function model is nicer, because it > > allows us to not scatter __maybe_unused all around. > > Sorry, I don't follow. I don't touch that wrappers, just fix errors > related to OF device ID tables, although in few cases it is indeed > related to of_match_node. I'm saying this because in lantiq_gswip.c, xway_gphy_match is accessed through of_match_node(). If the shim definition for of_match_node() was different, the variable wouldn't have been unused with CONFIG_OF=n. I guess it's worth considering changing that wrapper instead of adding the __maybe_unused.
On Sun, 12 Mar 2023 12:57:29 +0200 Vladimir Oltean wrote: > > Sorry, I don't follow. I don't touch that wrappers, just fix errors > > related to OF device ID tables, although in few cases it is indeed > > related to of_match_node. > > I'm saying this because in lantiq_gswip.c, xway_gphy_match is accessed > through of_match_node(). If the shim definition for of_match_node() was > different, the variable wouldn't have been unused with CONFIG_OF=n. > I guess it's worth considering changing that wrapper instead of adding > the __maybe_unused. Hi Krzysztof, have you had a chance to check if using an empty static inline is enough to silence the compiler? Seems like it could save us quite some churn? Or do we want the of_match_node() decorations to go away in general?
Hello: This series was applied to netdev/net-next.git (main) by David S. Miller <davem@davemloft.net>: On Sat, 11 Mar 2023 18:32:52 +0100 you wrote: > The driver can be compile tested with !CONFIG_OF making certain data > unused: > > drivers/net/dsa/lantiq_gswip.c:1888:34: error: ‘xway_gphy_match’ defined but not used [-Werror=unused-const-variable=] > > Signed-off-by: Krzysztof Kozlowski <krzysztof.kozlowski@linaro.org> > > [...] Here is the summary with links: - [01/12] net: dsa: lantiq_gswip: mark OF related data as maybe unused https://git.kernel.org/netdev/net-next/c/6ea1e67788f3 - [02/12] net: dsa: lan9303: drop of_match_ptr for ID table https://git.kernel.org/netdev/net-next/c/ced5c5a0a2ea - [03/12] net: dsa: seville_vsc9953: drop of_match_ptr for ID table https://git.kernel.org/netdev/net-next/c/1eb8566dd08d - [04/12] net: dsa: ksz9477: drop of_match_ptr for ID table https://git.kernel.org/netdev/net-next/c/00923ff2e1ba - [05/12] net: dsa: ocelot: drop of_match_ptr for ID table https://git.kernel.org/netdev/net-next/c/0f17b42827ae - [06/12] net: phy: ks8995: drop of_match_ptr for ID table https://git.kernel.org/netdev/net-next/c/b0b7d1b6260b - [07/12] net: ieee802154: adf7242: drop of_match_ptr for ID table https://git.kernel.org/netdev/net-next/c/3df09beef650 - [08/12] net: ieee802154: mcr20a: drop of_match_ptr for ID table https://git.kernel.org/netdev/net-next/c/3896c40b7824 - [09/12] net: ieee802154: at86rf230: drop of_match_ptr for ID table https://git.kernel.org/netdev/net-next/c/32b7030681a4 - [10/12] net: ieee802154: ca8210: drop of_match_ptr for ID table https://git.kernel.org/netdev/net-next/c/cdfe4fc4d946 - [11/12] net: ieee802154: adf7242: drop owner from driver https://git.kernel.org/netdev/net-next/c/059fa9972340 - [12/12] net: ieee802154: ca8210: drop owner from driver https://git.kernel.org/netdev/net-next/c/613a3c44a373 You are awesome, thank you!
On Wed, 15 Mar 2023 08:20:20 +0000 patchwork-bot+netdevbpf@kernel.org wrote: > This series was applied to netdev/net-next.git (main) > by David S. Miller <davem@davemloft.net>: :) :) :)
On 15/03/2023 06:22, Jakub Kicinski wrote: > On Sun, 12 Mar 2023 12:57:29 +0200 Vladimir Oltean wrote: >>> Sorry, I don't follow. I don't touch that wrappers, just fix errors >>> related to OF device ID tables, although in few cases it is indeed >>> related to of_match_node. >> >> I'm saying this because in lantiq_gswip.c, xway_gphy_match is accessed >> through of_match_node(). If the shim definition for of_match_node() was >> different, the variable wouldn't have been unused with CONFIG_OF=n. >> I guess it's worth considering changing that wrapper instead of adding >> the __maybe_unused. > > Hi Krzysztof, have you had a chance to check if using an empty static > inline is enough to silence the compiler? Seems like it could save > us quite some churn? Or do we want the of_match_node() decorations > to go away in general? I am pretty sure fixing of_match_node() and of_match_ptr() (independent case) would supersed this patchset, but it is a bit bigger change than I have available time now. I didn't try it yet. Best regards, Krzysztof
diff --git a/drivers/net/dsa/lantiq_gswip.c b/drivers/net/dsa/lantiq_gswip.c index 05ecaa007ab1..3c76a1a14aee 100644 --- a/drivers/net/dsa/lantiq_gswip.c +++ b/drivers/net/dsa/lantiq_gswip.c @@ -1885,7 +1885,7 @@ static const struct xway_gphy_match_data xrx300_gphy_data = { .ge_firmware_name = "lantiq/xrx300_phy11g_a21.bin", }; -static const struct of_device_id xway_gphy_match[] = { +static const struct of_device_id xway_gphy_match[] __maybe_unused = { { .compatible = "lantiq,xrx200-gphy-fw", .data = NULL }, { .compatible = "lantiq,xrx200a1x-gphy-fw", .data = &xrx200a1x_gphy_data }, { .compatible = "lantiq,xrx200a2x-gphy-fw", .data = &xrx200a2x_gphy_data },