Received: by 2002:a05:6358:51dd:b0:131:369:b2a3 with SMTP id 29csp1282000rwl; Thu, 10 Aug 2023 08:57:05 -0700 (PDT) X-Google-Smtp-Source: AGHT+IFstl8G2aEDeisnqBNv+3/l4fE2KXe+4tBwsY/b1Duh90wUqTGoDnXomaIbWJN+VwcdfatW X-Received: by 2002:a05:6a21:7788:b0:137:a9d7:de12 with SMTP id bd8-20020a056a21778800b00137a9d7de12mr2653389pzc.59.1691683025403; Thu, 10 Aug 2023 08:57:05 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1691683025; cv=none; d=google.com; s=arc-20160816; b=jRnk2yQOSiDYbcfs1xWjiRqiey8SKu53qwPPYQD40r5Wa91hdJA9WLeyFi64JjLos9 ZNjfKkI4aHJife9tcvX6WMV2T3wgzCrrDgejWhbgnunIkJeOdmP1v3RxurkXxNBZs/Ph EXTf8SCT4yWBkFSJkMua3wJhShnI35HO+aiD27RLZ92oYdJUXoTLpyaXp7P8vPUJKFZH JfennjX3pNF30+9O1J80O7QIo7TvWO8zp9O7CXNQl6VclSthNMvib/NKVsiUNcPl8DRc bj05oVWuUj0rGJT7zpW25B5oOof6I9eXs8vYaN+y5QnswjOxHol3LfaGc6WbNT4Iee9v ER/A== 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 :organization:references:in-reply-to:message-id:subject:cc:to:from :date:dkim-signature:dkim-signature; bh=gt5T9KAX6h0xqCfiUcP6I8u8wZkJ21yXv35iTl4Gtdk=; fh=cNSLljLOaFlogi6MWjGPMhW+FLp8ZjjLOyPFg4rHAeg=; b=gcbjFu7jmEDTP/xb7zcqWxxnwnPm9mWHurY7p+L5lZ+CwaQncEl0tgq1Hvfmysqi/4 wg9fXAJfctx2FUlTmRt+nHAwNgstq3rMkqH9CoJ2ZL0FRzos8VIOx2sF02usX1JnlrxQ BWGjLFmw1qsZBMs5QlCFtFDZc4dECWt15qX0Qg+tVMhM9II8dEVVmDN9zU+Er4leJCPI 2zT/3/Q3/ofAhsnlH6+NVNbyy1BEhwjkDWS3Hiz+kajFOr4oronPIqXT8cmumBG/i0Qo 0eogA+qEwGNxYQa3/BZI+/Ha6iDfPV2CLUNk64SROvTj+SlZ2ffdIldzZ3ncjo3xvelq rBtw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@suse.de header.s=susede2_rsa header.b=Ap8G5lRC; dkim=neutral (no key) header.i=@suse.de header.s=susede2_ed25519; 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=suse.de Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id s7-20020a634507000000b0056546b5fef6si1784028pga.231.2023.08.10.08.56.51; Thu, 10 Aug 2023 08:57:05 -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=@suse.de header.s=susede2_rsa header.b=Ap8G5lRC; dkim=neutral (no key) header.i=@suse.de header.s=susede2_ed25519; 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=suse.de Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S235163AbjHJPNQ (ORCPT + 99 others); Thu, 10 Aug 2023 11:13:16 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:56372 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S236047AbjHJPNN (ORCPT ); Thu, 10 Aug 2023 11:13:13 -0400 Received: from smtp-out2.suse.de (smtp-out2.suse.de [195.135.220.29]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 6A9002694; Thu, 10 Aug 2023 08:13:12 -0700 (PDT) Received: from imap2.suse-dmz.suse.de (imap2.suse-dmz.suse.de [192.168.254.74]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (P-521) server-digest SHA512) (No client certificate requested) by smtp-out2.suse.de (Postfix) with ESMTPS id F18701F74B; Thu, 10 Aug 2023 15:13:10 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_rsa; t=1691680390; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=gt5T9KAX6h0xqCfiUcP6I8u8wZkJ21yXv35iTl4Gtdk=; b=Ap8G5lRCd2wrOy6xvgHmqXqWCfoS+MTJoF9k4fGqt8/bVMgNRM/h5rd6lAa89jo9l02d4M VxlCz/JQuhiQhdxNL5YYQufPPih2NecJDetK3i4T6B4xbKMUnJxyJpMRCJlWN8+cItVGyc poi7r0Qip1fH02ygYWbWF+LJjt2YFmI= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_ed25519; t=1691680390; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=gt5T9KAX6h0xqCfiUcP6I8u8wZkJ21yXv35iTl4Gtdk=; b=gm+mwcTKzKMut/jWo7SFLu/BRNuvnbbvx35QJ40kTSsPvScaYMWAGm54Wado4gonb8jvGO xkkpFndpcFjYM/Cg== Received: from imap2.suse-dmz.suse.de (imap2.suse-dmz.suse.de [192.168.254.74]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (P-521) server-digest SHA512) (No client certificate requested) by imap2.suse-dmz.suse.de (Postfix) with ESMTPS id AF6EF138E2; Thu, 10 Aug 2023 15:13:10 +0000 (UTC) Received: from dovecot-director2.suse.de ([192.168.254.65]) by imap2.suse-dmz.suse.de with ESMTPSA id jCg4KYb+1GSHGQAAMHmgww (envelope-from ); Thu, 10 Aug 2023 15:13:10 +0000 Date: Thu, 10 Aug 2023 17:13:08 +0200 From: Jean Delvare To: Andi Shyti Cc: Nick Desaulniers , 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: <20230810171308.5d5c591f@endymion.delvare> In-Reply-To: <20230809191310.atpqztlpgdbdvc5m@intel.intel> References: <20230808-i2c-amd_static-v1-1-1902f608bba1@google.com> <20230809191310.atpqztlpgdbdvc5m@intel.intel> Organization: SUSE Linux X-Mailer: Claws Mail 4.0.0 (GTK+ 3.24.34; x86_64-suse-linux-gnu) MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit X-Spam-Status: No, score=-4.4 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_MED,SPF_HELO_NONE, 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 Hi Andi, Nick, On Wed, 09 Aug 2023 21:13:10 +0200, Andi Shyti wrote: > 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 Fixes tag would cause unnecessary worry, with people backporting the patch while it doesn't actually fix anything. No need for that. > > [...] > > > --- /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 for your review. I would personally not bother with a header file, this is unnecessary burden. Just add the extern declaration to i2c-amd756.c as was already done in i2c-amd756-s4882.c. The whole thing is a horrible hack anyway and there won't be more occurrences of it, so the more simple it stays, the better. Some history: I wrote the pseudo-driver i2c-amd756-s4882 when the i2c-core did not yet support multiplexing. Nowadays, proper support would be implemented using i2c-mux-* and i2c-amd756-s4882.c would go away entirely. Actually, I very much doubt any of these 2007 Tyan server boards is still in activity today, so maybe we should just delete the driver. Note that i2c-nforce2.c will need the same fix as struct i2c_adapter nforce2_smbus is extern as well. -- Jean Delvare SUSE L3 Support