Received: by 2002:a05:6a10:9848:0:0:0:0 with SMTP id x8csp2606590pxf; Sun, 21 Mar 2021 00:22:18 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxoPXOTUqfuB3VecKEQU9IVTTtuIveX7Rm71a+vh+4fKsb7epBijio93nQxfEAI8cyeKW+J X-Received: by 2002:a05:6402:520b:: with SMTP id s11mr19409184edd.212.1616311338068; Sun, 21 Mar 2021 00:22:18 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1616311338; cv=none; d=google.com; s=arc-20160816; b=U838eQqrvvyZojL3CUHWIAbNZ3IgCB/GSY174MMJiMfMYs/QNo4M7UsYEevQI1HgZb hCdTTPeJsnIO/0RHE/qYAt/AczPMG4eSsA3WzT76Ytqu7Yn1EAd8XD0mxlF7Qs0ct9Ib qQ1c+BV/S5yKwRc7HSN935FHgeVQHRdWS3QWDy81s8pMO/ysgZJNPpoxS5CnM6B8O+8a b4viitrmid8E8M5QaEXrjG0kGmtzsLYNRg4VwvuMLjZHa95BPg2fsSWFEEP6TEaFLuwB H69k8zj8eEWHumFOg9ogmFdak5guOy1sSpZTOonTQ6hsni0Ehql7LZ204JqSgYfWX1yn euyw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:in-reply-to:content-disposition:mime-version :references:message-id:subject:cc:to:from:date:dkim-signature; bh=4oIvSGCLG9vOOscfN6LL871ywFN+8CwELmJq3RbhMgE=; b=dxLEzgZW3qjf21KXecfW3d1th1g+x8pGBBz+/uzTX5vLV1kAh8HFjf+/CnfTIr8hKD BzI8PwvXdld5PeG6jVrGYSEG6ulewDxUoHwtpjdARMfXwcizN7AQrb6pQfKduDbJkP3I /zqidbC3yOl3uzZUWmvT73O097HoYNfjk0q6BqENxoLPISbT06D8VthXAz5ZCDAmLAVg B9aQFqOGKJwLrRBUOSlglCW4vDeBo6++KdIQNRw5Wies/rCZVz5PQk7lsTxEBllLbBxd nkpfA5mlv5eNHPJPJoeBzJQsS9qa/pjAyKRo0DFR74lemaB8mnk2UjiSsGuappRMC2S8 FMLw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b="CAh2x/cm"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id v3si8708362edc.195.2021.03.21.00.21.55; Sun, 21 Mar 2021 00:22:18 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b="CAh2x/cm"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230021AbhCUHEA (ORCPT + 99 others); Sun, 21 Mar 2021 03:04:00 -0400 Received: from mail.kernel.org ([198.145.29.99]:44062 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229962AbhCUHDf (ORCPT ); Sun, 21 Mar 2021 03:03:35 -0400 Received: by mail.kernel.org (Postfix) with ESMTPSA id B10DA61925; Sun, 21 Mar 2021 07:03:33 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1616310214; bh=eWR1vjTOqhNaQFvUZ36N91C5MwTCvpaR7JxD2y3UuFM=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=CAh2x/cmWUZJGqrbvg2Vt0GH5ZwcTiAb/jbhNUSJmeAUpMHyu5+HBDs6eyzo/NWjB BsIXQr+7NfqC5wgEa56afqpbSR+KPB44P/vUN62c7xaPaJRAQO4YYsrP0YuxYEHdue Tf8x5x7FiavyArQis6OxxNpXufjFG4xBhf3ljS7A= Date: Sun, 21 Mar 2021 08:03:29 +0100 From: Greg KH To: Fabio Aiuto Cc: joe@perches.com, apw@canonical.com, linux-kernel@vger.kernel.org Subject: Re: CHECKPATCH: missing a warning soon after include files decl -c Message-ID: References: <20210320105424.GA3698@agape.jhs> <20210320144911.GA2999@agape.jhs> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20210320144911.GA2999@agape.jhs> Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Sat, Mar 20, 2021 at 03:49:12PM +0100, Fabio Aiuto wrote: > On Sat, Mar 20, 2021 at 11:59:44AM +0100, Greg KH wrote: > > On Sat, Mar 20, 2021 at 11:54:24AM +0100, Fabio Aiuto wrote: > > > Hi, > > > > > > here's an issue in checkpatch.pl > > > > > > $ perl script/checkpatch.pl -f drivers/staging/rtl8723bs/core/rtw_ap.c > > > > > > I get three warning related to an extern declaration > > > > > > WARNING: externs should be avoided in .c files > > > #14: FILE: drivers/staging/rtl8723bs/core/rtw_ap.c:14: > > > +extern unsigned char WMM_OUI[]; > > > -- > > > WARNING: externs should be avoided in .c files > > > #15: FILE: drivers/staging/rtl8723bs/core/rtw_ap.c:15: > > > +extern unsigned char WPS_OUI[]; > > > -- > > > WARNING: externs should be avoided in .c files > > > #16: FILE: drivers/staging/rtl8723bs/core/rtw_ap.c:16: > > > +extern unsigned char P2P_OUI[]; > > > ---------------------- > > > > > > but the file checked has 4 extern declaration: > > > ----------------------------- > > > #define _RTW_AP_C_ > > > > > > #include > > > #include > > > #include > > > > > > extern unsigned char RTW_WPA_OUI[]; > > > extern unsigned char WMM_OUI[]; > > > extern unsigned char WPS_OUI[]; > > > extern unsigned char P2P_OUI[]; > > > > > > void init_mlme_ap_info(struct adapter *padapter) > > > ------------------------------- > > > > > > If I add a ';' this way: > > > ---------------------------- > > > #define _RTW_AP_C_ > > > > > > #include > > > #include > > > #include > > > ; > > > extern unsigned char RTW_WPA_OUI[]; > > > extern unsigned char WMM_OUI[]; > > > extern unsigned char WPS_OUI[]; > > > extern unsigned char P2P_OUI[]; > > > > > > void init_mlme_ap_info(struct adapter *padapter) > > > -------------------------------- > > > > Wait, why would you do the above? > > > > Don't try to trick a perl script that has a hard time parsing C files, > > try to resolve the original issue here. > > > > And that is that the above definitions should be in a .h file somewhere. > > If you make that move then all should be fine. > > > > thanks, > > > > greg k-h > > that's another issue > > WARNING: externs should be avoided in .c files > #35: FILE: drivers/staging/rtl8723bs/core/rtw_efuse.c:35: > +bool > > CHECK: Lines should not end with a '(' > #36: FILE: drivers/staging/rtl8723bs/core/rtw_efuse.c:36: > --- > > but that's what I see in line 35 > > > #define REG_EFUSE_CTRL 0x0030 > #define EFUSE_CTRL REG_EFUSE_CTRL /* E-Fuse Control. */ > > bool<--------------------------------- line 35 > Efuse_Read1ByteFromFakeContent( > struct adapter *padapter, > u16 Offset, > u8 *Value); > bool > Efuse_Read1ByteFromFakeContent( > struct adapter *padapter, That's some horrid code formatting, just clean it up to look normal and all will be fine. > another one... > > WARNING: externs should be avoided in .c files > #40: FILE: drivers/staging/rtl8723bs/core/rtw_ioctl_set.c:40: > +u8 rtw_do_join(struct adapter *padapter); <-------- do I miss > something about extern keyword? Having a global function prototype in a .c file is not a good idea. Again, fix it up and all will be fine. thanks, greg k-h