From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751266AbdBLLGu (ORCPT ); Sun, 12 Feb 2017 06:06:50 -0500 Received: from Galois.linutronix.de ([146.0.238.70]:36306 "EHLO Galois.linutronix.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751120AbdBLLGu (ORCPT ); Sun, 12 Feb 2017 06:06:50 -0500 Date: Sun, 12 Feb 2017 12:06:47 +0100 (CET) From: Thomas Gleixner To: "Tobin C. Harding" cc: linux-kernel@vger.kernel.org, Ingo Molnar , "H. Peter Anvin" , x86@kernel.org Subject: Re: [PATCH 2/2] arch/x86: Fix sparse warning symbol not declared In-Reply-To: <1486881870-2490-3-git-send-email-me@tobin.cc> Message-ID: References: <1486881870-2490-1-git-send-email-me@tobin.cc> <1486881870-2490-3-git-send-email-me@tobin.cc> User-Agent: Alpine 2.20 (DEB 67 2015-01-07) MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Sun, 12 Feb 2017, Tobin C. Harding wrote: > This patch adds function declaration in order to quiet sparse symbol > not declared warning. Same comment vs. 'This patch' as before. Hint, we already know that this is a patch, otherwise it would be mislabeled. > > Signed-off-by: Tobin C. Harding > --- > > Unsure why adding declaration quiets sparse. Because sparse finds a declaration before the definition. > This may not be the correct solution. Right, it's not. > Only testing done is building and booting kernel. Since 'purgatory' is > called from assembler and does not need forward declaration the only > advantage to this patch seems to be to save the next newbie from > investigating the sparse warning. Well, yes. But just quietening a checker by slapping a pointless forward declaration into the code is not pretty either. A smarter checker might catch that. The proper solution is to have a local include file 'purgatory.h' and put the declaration there. Include it in both files even if that's not required for the ASM file. But that documents, that the function is used outside of purgatory.c Thanks, tglx