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 vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 6A87EC001DC for ; Wed, 26 Jul 2023 11:31:17 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233399AbjGZLbQ (ORCPT ); Wed, 26 Jul 2023 07:31:16 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:60690 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230060AbjGZLbO (ORCPT ); Wed, 26 Jul 2023 07:31:14 -0400 Received: from out3-smtp.messagingengine.com (out3-smtp.messagingengine.com [66.111.4.27]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 58839DB for ; Wed, 26 Jul 2023 04:31:13 -0700 (PDT) Received: from compute6.internal (compute6.nyi.internal [10.202.2.47]) by mailout.nyi.internal (Postfix) with ESMTP id BB3095C0048; Wed, 26 Jul 2023 07:31:12 -0400 (EDT) Received: from imap51 ([10.202.2.101]) by compute6.internal (MEProxy); Wed, 26 Jul 2023 07:31:12 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=arndb.de; h=cc :cc:content-transfer-encoding:content-type: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= 1690371072; x=1690457472; bh=tN1tOIi6LgdYyNWu0Imw1ahtdb+2EI1lLQO E3uE4dcc=; b=Ism7zxqTNnubAG9Mfl1QlpNd6eWjoLk9spt6HFx1cFQEvWbxHZ0 pWaDXHKpVLqv9lVvUq8w4piGVIEu3BJBgCjCKIYPWYXzKvx49RCmFfO6ICOJ4Mc3 Tnd0GGh3ACh9POkx77WZapoXhspzHZLn6Wcplo1wXYU8nECgs1Ds0rFsuL49Vjzv bhiveCvKJCxn3FHqBo2XLbTY6uZ7pLlUdadR076rN39BAaFklLT5C7ylDziEB9b1 64pcTA2x8DQpmYCKMoKYoOryD7QvpCp9v9S+X++ZvcBbSW/YUIYK6D5eSduCD+hL eUB/K5xeFLtZYlPPeiecnQvgGrk4wn6WWgA== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=cc:cc:content-transfer-encoding :content-type: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= 1690371072; x=1690457472; bh=tN1tOIi6LgdYyNWu0Imw1ahtdb+2EI1lLQO E3uE4dcc=; b=uboAnPfNz52PjzqONL4HLHIXmaOmMFmFmVTHgg+VS7n1nfglMFZ zSezRUf3ny96xibiLrFvbiNokE6GXOSTECb8VbUv0Tq13Knq6Q7n3R6P15+7nv5a fyDIQ4py9vTgCKKg/1jksqbsSzFG3n3dltAqPqfZjJMirqYYp9VBp7sD65CEnrqI ttkzG5i/RBU+xg5YMTODg2pjG756wrgaoQnmcXAYOOGbwZhtKad9Uf0MCaqIEsGf 3R4Gy8dzM4CuJl+O9IKK/4VV3l5AV2KbnuakD59goVdvQoGkuFT0Q+hRFuCW3Add j9gS1HusT+dP76MQ3/JdIBoc/Rpk4C/rbEQ== X-ME-Sender: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgedviedriedvgdegtdcutefuodetggdotefrodftvf curfhrohhfihhlvgemucfhrghsthforghilhdpqfgfvfdpuffrtefokffrpgfnqfghnecu uegrihhlohhuthemuceftddtnecusecvtfgvtghiphhivghnthhsucdlqddutddtmdenuc fjughrpefofgggkfgjfhffhffvvefutgfgsehtqhertderreejnecuhfhrohhmpedftehr nhguuceuvghrghhmrghnnhdfuceorghrnhgusegrrhhnuggsrdguvgeqnecuggftrfgrth htvghrnhepgeefjeehvdelvdffieejieejiedvvdfhleeivdelveehjeelteegudektdfg jeevnecuvehluhhsthgvrhfuihiivgeptdenucfrrghrrghmpehmrghilhhfrhhomheprg hrnhgusegrrhhnuggsrdguvg X-ME-Proxy: Feedback-ID: i56a14606:Fastmail Received: by mailuser.nyi.internal (Postfix, from userid 501) id 5799FB60089; Wed, 26 Jul 2023 07:31:11 -0400 (EDT) X-Mailer: MessagingEngine.com Webmail Interface User-Agent: Cyrus-JMAP/3.9.0-alpha0-592-ga9d4a09b4b-fm-defalarms-20230725.001-ga9d4a09b Mime-Version: 1.0 Message-Id: In-Reply-To: <20230726105436.h3kqtjzbhvjrg6kp@pengutronix.de> References: <20230726100626.167490-1-wangzhu9@huawei.com> <20230726105436.h3kqtjzbhvjrg6kp@pengutronix.de> Date: Wed, 26 Jul 2023 13:30:49 +0200 From: "Arnd Bergmann" To: =?UTF-8?Q?Uwe_Kleine-K=C3=B6nig?= , "Zhu Wang" Cc: "Andrzej Hajda" , "Neil Armstrong" , rfoss@kernel.org, "laurent.pinchart" , jonas@kwiboo.se, "Jernej Skrabec" , "Dave Airlie" , "Daniel Vetter" , "Javier Martinez Canillas" , "Doug Anderson" , benjamin.mugnier@foss.st.com, =?UTF-8?Q?Marek_Beh=C3=BAn?= , anarsoul@gmail.com, duwe@suse.de, "Maxime Ripard" , dri-devel@lists.freedesktop.org, linux-kernel@vger.kernel.org, "Andy Shevchenko" Subject: Re: [PATCH -next] drm/bridge: fix -Wunused-const-variable= warning Content-Type: text/plain;charset=utf-8 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Wed, Jul 26, 2023, at 12:54, Uwe Kleine-K=C3=B6nig wrote: > On Wed, Jul 26, 2023 at 06:06:26PM +0800, Zhu Wang wrote: >> >> Fixes: 5d97408e0d70 ("drm/bridge: move ANA78xx driver to analogix sub= directory") This is the wrong commit, the driver was just in a different place before that, and the bug was already present in commit 0647e7dd3f7ab ("drm/bridge: Add Analogix anx78xx support"). >> =20 >> +#if IS_ENABLED(CONFIG_OF) >> static const u8 anx7808_i2c_addresses[] =3D { >> [I2C_IDX_TX_P0] =3D 0x78, >> [I2C_IDX_TX_P1] =3D 0x7a, >> @@ -52,6 +53,7 @@ static const u8 anx781x_i2c_addresses[] =3D { >> [I2C_IDX_RX_P0] =3D 0x7e, >> [I2C_IDX_RX_P1] =3D 0x80, >> }; >> +#endif > > You can mark anx7808_i2c_addresses with __maybe_unused, then the #if > isn't needed. Neither of these should be needed, as the driver only works with CONFIG_OF anyway. >> struct anx78xx_platform_data { >> struct regulator *dvdd10; >> @@ -1387,7 +1389,9 @@ MODULE_DEVICE_TABLE(of, anx78xx_match_table); >> static struct i2c_driver anx78xx_driver =3D { >> .driver =3D { >> .name =3D "anx7814", >> +#if IS_ENABLED(CONFIG_OF) >> .of_match_table =3D of_match_ptr(anx78xx_match_table), >> +#endif > > If CONFIG_OF is disabled of_match_ptr(something) evaluates to NULL, so > you can drop the #if here. > > Having said that the better fix is probably to just do > > .of_match_table =3D anx78xx_match_table, > > as systems using ACPI can benefit from the of_match_table, too. > See b89a9e9890d4 ("gpio: aggregator: Remove CONFIG_OF and of_match_ptr= () > protections") for an example. Agreed, removing the #ifdef checks and the of_match_ptr() wrapper is the right solution here. I see similar things in other bridge drivers that could be changed at the same time: $ git grep of_match_ptr drivers/gpu/drm/bridge/ drivers/gpu/drm/bridge/analogix/analogix-anx6345.c: .of_m= atch_table =3D of_match_ptr(anx6345_match_table), drivers/gpu/drm/bridge/analogix/analogix-anx78xx.c: .of_m= atch_table =3D of_match_ptr(anx78xx_match_table), drivers/gpu/drm/bridge/cadence/cdns-mhdp8546-core.c: .of_matc= h_table =3D of_match_ptr(mhdp_ids), drivers/gpu/drm/bridge/chrontel-ch7033.c: .of_match_table = =3D of_match_ptr(ch7033_dt_ids), drivers/gpu/drm/bridge/sil-sii8620.c: .of_match_table =3D of_m= atch_ptr(sii8620_dt_match), drivers/gpu/drm/bridge/ti-tfp410.c: .of_match_table =3D of_m= atch_ptr(tfp410_match), The other ones are even worse because they use of_match_ptr() without the corresponding #ifdef around the match table, so the of_match_ptr() does not even have the effect of saving a few bytes of .data segment. Arnd