From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from relay.hostedemail.com (smtprelay0013.hostedemail.com [216.40.44.13]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id C45522BE621 for ; Tue, 3 Feb 2026 05:58:00 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=216.40.44.13 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1770098282; cv=none; b=DkAVKopoKSDVDyPVzrSZsQbusUT+nJfrwCmg1xFm9jkvai1go/X7xXR8iOCA7qT/WNKOWC4b8/6Awl7mQWBVb2fmFCG/7noJQ9NjzSkMpYbuxsarEt1k+x3sRgFAEwhglE1SvcOEJTnvsbr9RvIqu42/y3+94BPDq+yMYW1yAsA= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1770098282; c=relaxed/simple; bh=iom8SF7JEpy1Aj1sA3p283ffLfjMJ5adQMWu4RE9cu0=; h=Message-ID:Subject:From:To:Date:In-Reply-To:References: Content-Type:MIME-Version; b=Dbv9L1zIt7rHS2kMUo9M1x7yQv/4bvrS1BHV+XURNrC9ULGmfujSTJcODU9FvRJxYuZar/m8Wf3lXclXEjHVByf73729RgC/ebhNUQDey7QjmJG/vVYdKEnxDZ2iuOswlcccPdbMJRaYjjRaOCkgSYoF6xsw73784bRlQSDiKbw= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=perches.com; spf=pass smtp.mailfrom=perches.com; arc=none smtp.client-ip=216.40.44.13 Authentication-Results: smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=perches.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=perches.com Received: from omf12.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay08.hostedemail.com (Postfix) with ESMTP id E232C140367; Tue, 3 Feb 2026 05:57:53 +0000 (UTC) Received: from [HIDDEN] (Authenticated sender: joe@perches.com) by omf12.hostedemail.com (Postfix) with ESMTPA id D1C701D; Tue, 3 Feb 2026 05:57:51 +0000 (UTC) Message-ID: Subject: Re: Checkpatch false positive: externs should be avoided in .c files From: Joe Perches To: Nam Cao , Andy Whitcroft , Dwaipayan Ray , Lukas Bulwahn , linux-kernel@vger.kernel.org Date: Mon, 02 Feb 2026 21:57:50 -0800 In-Reply-To: <875x8fz6yz.fsf@yellow.woof> References: <875x8fz6yz.fsf@yellow.woof> Content-Type: text/plain; charset="ISO-8859-1" Content-Transfer-Encoding: quoted-printable User-Agent: Evolution 3.58.2 (3.58.2-1.fc43) Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-Rspamd-Server: rspamout07 X-Rspamd-Queue-Id: D1C701D X-Stat-Signature: dfdjbson8nqubnftpgernjscaxr3gyey X-Session-Marker: 6A6F6540706572636865732E636F6D X-Session-ID: U2FsdGVkX1+4XDiG+Kt9y8atZX0wZwlokneLAEkR1zM= X-HE-Tag: 1770098271-706722 X-HE-Meta: U2FsdGVkX18p4zwdsGer2w+oMEidblHakQvLpOkz+Cr1DlIMnzsgBhxUtsMLHgbM7QO4CW7tmtEWHiFJ99j6SVpwJLe/JNt6wn9TlDQMSKiKXTLKpZsQJgBeBNmokfNEbUoUKH0fPtYp6N44wSbxCUeq5S+D9j/ul8IbnJkWFK3lbLyzxGaDbzMBT1jjKzzp9fEELkvtRT77ayg+At2TOmn5TA1F8Fhnqva394quXtm5v4RgOtOsHf6UGVOTKYJ/0lPBjGp3XB1BTXcBhUdq6ci98ZjEWhhoLj7PphwOfObJ5Z7B1sxNoV13dH7F0KhnjtHYCPgADCY9DM3u4suGEyVvs4p2X4gb On Mon, 2026-02-02 at 13:05 +0100, Nam Cao wrote: > Hi, >=20 > checkpatch seems to give a wrong warning about this patch: > https://lore.kernel.org/linux-riscv/20260202115403.2119218-1-namcao@linut= ronix.de/T/#u >=20 > WARNING: externs should be avoided in .c files > #663: FILE: arch/riscv/kernel/setup.c:49: > +atomic_t hart_lottery __section(".sdata"); >=20 > I think this is wrong, because 'extern' does not even appear anywhere in > that part of the diff. >=20 > I attempted to look into checkpatch, but my perl knowledge is not > sufficient to dig deeper into this issue. Can you please have a look? Please use the more common style like: atomic_t __section(".sdata") hart_lottery; --- diff --git a/arch/riscv/kernel/setup.c b/arch/riscv/kernel/setup.c index b5bc5fc65cea..c89cc272440b 100644 --- a/arch/riscv/kernel/setup.c +++ b/arch/riscv/kernel/setup.c @@ -46,11 +46,7 @@ * This is used before the kernel initializes the BSS so it can't be in th= e * BSS. */ -atomic_t hart_lottery __section(".sdata") -#ifdef CONFIG_XIP_KERNEL -=3D ATOMIC_INIT(0xC001BEEF) -#endif -; +atomic_t hart_lottery __section(".sdata"); unsigned long boot_cpu_hartid; EXPORT_SYMBOL_GPL(boot_cpu_hartid); =20