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 83E2CC0015E for ; Wed, 9 Aug 2023 19:15:33 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232122AbjHITPb (ORCPT ); Wed, 9 Aug 2023 15:15:31 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:46764 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232532AbjHITPR (ORCPT ); Wed, 9 Aug 2023 15:15:17 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 5C65E423C; Wed, 9 Aug 2023 12:13:51 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id 40B346456F; Wed, 9 Aug 2023 19:13:15 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id F0B1DC433C8; Wed, 9 Aug 2023 19:13:13 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1691608394; bh=LeVB41u38/bhZJrLFYAIuDBKlGLS2oWJkoZGthUq6Jo=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=foNa56/Lvq4BCC02Q0ZTTK/jrSpYteAeDNQMdVNsyuFpsa9NA9veVhr1OryMX+6Y1 5eo69vm1HvoiTG/+RFjyCQUESdxy1N0V+PJuoo1I77HXUdV3RoOcJFCZST144usBxk UqEJUWXAf0J7zQ9DhyHWd2jZwqL+H5iiHiKzAPlCHjXM+t4Kc8ZU3QdqHoA9saStRU Pnz4Y7aXVJn7GLkEWc2VbOhGhLklgpJvPd9SppbWmrEeCxXm3cUUU3eFiZoNv7QEqV x4aWcmFpjm9Wc5o5cBSbEX5yduts81Vog3ta1qctnKYw0yuKy+UFvwlpdkybvwANvG 8jGt+6GCg8oFw== Date: Wed, 9 Aug 2023 21:13:10 +0200 From: Andi Shyti To: Nick Desaulniers Cc: Jean Delvare , Nathan Chancellor , Tom Rix , linux-kernel@vger.kernel.org, linux-i2c@vger.kernel.org, llvm@lists.linux.dev, kernel test robot Subject: Re: [PATCH] i2c/busses: fix -Wmissing-variable-declarations Message-ID: <20230809191310.atpqztlpgdbdvc5m@intel.intel> References: <20230808-i2c-amd_static-v1-1-1902f608bba1@google.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20230808-i2c-amd_static-v1-1-1902f608bba1@google.com> Precedence: bulk List-ID: X-Mailing-List: linux-i2c@vger.kernel.org Hi Nick, On Tue, Aug 08, 2023 at 09:56:16AM -0700, Nick Desaulniers wrote: > I'm looking to enable -Wmissing-variable-declarations behind W=1. 0day > bot spotted the following instance: > > drivers/i2c/busses/i2c-amd756.c:286:20: warning: no previous extern > declaration for non-static variable 'amd756_smbus' > [-Wmissing-variable-declarations] > 286 | struct i2c_adapter amd756_smbus = { > | ^ > drivers/i2c/busses/i2c-amd756.c:286:1: note: declare 'static' if the > variable is not intended to be used outside of this translation unit > 286 | struct i2c_adapter amd756_smbus = { > | ^ > > This symbol is referenced by more than one translation unit, so create > then include the correct header for their declarations. > > Reported-by: kernel test robot > Closes: https://lore.kernel.org/llvm/202308081000.tTL1ElTr-lkp@intel.com/ > Signed-off-by: Nick Desaulniers You might want to have a Fixes tag here and Cc: Jean Delvare [...] > --- /dev/null > +++ b/drivers/i2c/busses/i2c-amd756.h > @@ -0,0 +1,3 @@ > +/* SPDX-License-Identifier: GPL-2.0 */ Please, leave a space here. And you might also want to have something like: #ifndef __I2C_AMD_756_H__ #define __I2C_AMD_756_H__ > +#include space here. > +extern struct i2c_adapter amd756_smbus; #endif /* __I2C_AMD_756_H__ */ Jean, any opinion on this patch, I don't really know this driver, but is there a way to avoid this extern declaration. Thanks, Andi