Received: by 2002:a05:6a10:413:0:0:0:0 with SMTP id 19csp33071pxp; Tue, 8 Mar 2022 19:30:20 -0800 (PST) X-Google-Smtp-Source: ABdhPJwN8SuNqEpWaUYTlyMrv6ewd8LC2ss9iCruYlv+fy+8iBZrXqy0y4LC+zMp4gRPSbQo6W49 X-Received: by 2002:a17:90b:3142:b0:1bf:ad38:1d79 with SMTP id ip2-20020a17090b314200b001bfad381d79mr1077822pjb.154.1646796620633; Tue, 08 Mar 2022 19:30:20 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1646796620; cv=none; d=google.com; s=arc-20160816; b=NImyxowkt6gIAMjoJR0Ih8WBBou0HQvJ/+2N06tN2a/y1jLRR1FPD0VlM3+L4fgUcF ZQoqTRrSiruLk5F8jMjY1yW9fZYbS/gP3Xxf5h8Iz6UARkK4t869TqT2YLpG0RGGc+6g rycOdkCLzIFO2AA139gZqRROgi1AKGKtf3bVBIbA6vC/1v9qKNZ46R87bJn1jn/vllKv bR+CJ8ZGw9+OuQOfX6ODqyY4+xlDdmrpI0iQmdSBPMdbJ0OJSnhV+g/qp7ohbDG1WRz8 IEFS2EKNTTH3WMdQZlT+gR3hdXfo+jAZ0HsHmi8pcRsU+tujHZsRhJZuVQDC+edHX5KG QQmQ== 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-transfer-encoding :content-disposition:mime-version:references:reply-to:message-id :subject:cc:to:from:date; bh=nROpLgSU0Sg6jNTH1xmoj01dpvuvhSBfN00e2fx3cIE=; b=Atzy68kP+P2c7ufhdaz1qS21qJ7UEAonF3mXq8MC0BaA+AO/eBeCO3Syb2AGN4yusi FaoR56rge8qJeieiaX6BpuU9jgq8H2NJaVheoYlt6LwUn0cio5jqnglDwLfYQeje+lxC n0P70d9ZEvgjNXvAN4CBz+tMDPmiV5aHd1FJa2rdvca17CeS8pvjm4e42HKxwy1t8M9n D0Zr9osc8UIOgsHhIr9WaVdPaWbOAHqmKr4QmthJ835eDeQfnsedl29vvNyRdDny4+67 KrubAXcuBmDQ/ad1STKBSoSjNfiZhK2z+ns+Mvq8LnbKAUsjF0IGS3D+5dZ71kPCpx7S QQsg== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=alibaba.com Return-Path: Received: from lindbergh.monkeyblade.net (lindbergh.monkeyblade.net. [2620:137:e000::1:18]) by mx.google.com with ESMTPS id r17-20020a632b11000000b0038098ab4f78si665412pgr.731.2022.03.08.19.30.20 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 08 Mar 2022 19:30:20 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:18 as permitted sender) client-ip=2620:137:e000::1:18; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=alibaba.com Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id 9780E15B9B6; Tue, 8 Mar 2022 19:30:18 -0800 (PST) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231631AbiCIDbM (ORCPT + 99 others); Tue, 8 Mar 2022 22:31:12 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:43300 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231629AbiCIDbK (ORCPT ); Tue, 8 Mar 2022 22:31:10 -0500 Received: from out30-131.freemail.mail.aliyun.com (out30-131.freemail.mail.aliyun.com [115.124.30.131]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 7B0EB6579C for ; Tue, 8 Mar 2022 19:30:11 -0800 (PST) X-Alimail-AntiSpam: AC=PASS;BC=-1|-1;BR=01201311R471e4;CH=green;DM=||false|;DS=||;FP=0|-1|-1|-1|0|-1|-1|-1;HT=e01e04395;MF=dust.li@linux.alibaba.com;NM=1;PH=DS;RN=4;SR=0;TI=SMTPD_---0V6h7SCV_1646796608; Received: from localhost(mailfrom:dust.li@linux.alibaba.com fp:SMTPD_---0V6h7SCV_1646796608) by smtp.aliyun-inc.com(127.0.0.1); Wed, 09 Mar 2022 11:30:08 +0800 Date: Wed, 9 Mar 2022 11:30:08 +0800 From: "dust.li" To: Jakub Kicinski Cc: kernel test robot , kbuild-all@lists.01.org, linux-kernel@vger.kernel.org Subject: Re: [saeed:net-next 154/185] net/smc/smc_sysctl.h:23:16: warning: no previous prototype for 'smc_sysctl_net_init' Message-ID: <20220309033008.GH35207@linux.alibaba.com> Reply-To: dust.li@linux.alibaba.com References: <202203081012.KgONXWsS-lkp@intel.com> <20220308051655.GF35207@linux.alibaba.com> <20220307212520.176fce24@kicinski-fedora-pc1c0hjn.dhcp.thefacebook.com> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: <20220307212520.176fce24@kicinski-fedora-pc1c0hjn.dhcp.thefacebook.com> X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00, HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,RDNS_NONE, SPF_HELO_NONE,T_SCC_BODY_TEXT_LINE,UNPARSEABLE_RELAY autolearn=no 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 On Mon, Mar 07, 2022 at 09:25:20PM -0800, Jakub Kicinski wrote: >On Tue, 8 Mar 2022 13:16:55 +0800 dust.li wrote: >> >vim +/smc_sysctl_net_init +23 net/smc/smc_sysctl.h >> > >> > 22 >> > > 23 int __net_init smc_sysctl_net_init(struct net *net) >> > 24 { >> > 25 net->smc.sysctl_autocorking_size = SMC_AUTOCORKING_DEFAULT_SIZE; >> > 26 return 0; >> > 27 } >> > 28 >> > > 29 void __net_exit smc_sysctl_net_exit(struct net *net) { } >> > 30 >> >> Hi Jakub: >> >> Sorry to bother again on this ! >> Looks like we still need to add 'static inline' or add an extra >> declaration for these 2 functions if we want to get rid of these warnings. >> What do you think ? > >Sorry my comment was pretty unclear an unnecessary. > >I meant that you don't need the __net_init annotation, it still >needs to be a static inline. So this is what I meant: > >diff --git a/net/smc/smc_sysctl.h b/net/smc/smc_sysctl.h >index 1d554300604d..0becc11bd2f4 100644 >--- a/net/smc/smc_sysctl.h >+++ b/net/smc/smc_sysctl.h >@@ -20,13 +20,13 @@ void __net_exit smc_sysctl_net_exit(struct net *net); > > #else > >-int __net_init smc_sysctl_net_init(struct net *net) >+static inline int smc_sysctl_net_init(struct net *net) > { > net->smc.sysctl_autocorking_size = SMC_AUTOCORKING_DEFAULT_SIZE; > return 0; > } > >-void __net_exit smc_sysctl_net_exit(struct net *net) { } >+static inline void smc_sysctl_net_exit(struct net *net) { } > > #endif /* CONFIG_SYSCTL */ > > > >But really it does not matter if the __net_init / exit is there, >so this works too: Another small comment: When re-compile with the W=1, I found '__net_exit' has noinline annotation when CONFIG_NET_NS not set: #define __net_exit __ref #define __ref __section(".ref.text") noinline If '__net_exit' is used together with 'static inline', the compiler would give another warning: net/smc/smc_sysctl.h:29:58: warning: ignoring attribute ‘gnu_inline’ because it conflicts with attribute ‘noinline’ [-Wattributes] 29 | static inline void __net_exit smc_sysctl_net_exit(struct net *net) { } So I think your first version would be good. Thanks. > >diff --git a/net/smc/smc_sysctl.h b/net/smc/smc_sysctl.h >index 1d554300604d..6979e7173669 100644 >--- a/net/smc/smc_sysctl.h >+++ b/net/smc/smc_sysctl.h >@@ -20,13 +20,13 @@ void __net_exit smc_sysctl_net_exit(struct net *net); > > #else > >-int __net_init smc_sysctl_net_init(struct net *net) >+static inline int __net_init smc_sysctl_net_init(struct net *net) > { > net->smc.sysctl_autocorking_size = SMC_AUTOCORKING_DEFAULT_SIZE; > return 0; > } > >-void __net_exit smc_sysctl_net_exit(struct net *net) { } >+static inline void __net_exit smc_sysctl_net_exit(struct net *net) { } > > #endif /* CONFIG_SYSCTL */ >