From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1755814AbcFTPyE (ORCPT ); Mon, 20 Jun 2016 11:54:04 -0400 Received: from mout.kundenserver.de ([212.227.17.24]:49420 "EHLO mout.kundenserver.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1755276AbcFTPu7 (ORCPT ); Mon, 20 Jun 2016 11:50:59 -0400 From: Arnd Bergmann To: Marc Kleine-Budde Cc: Arnd Bergmann , Oliver Hartkopp , "David S. Miller" , Alexander Aring , linux-can@vger.kernel.org, netdev@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH] can: only call can_stat_update with procfs Date: Mon, 20 Jun 2016 17:51:52 +0200 Message-Id: <20160620155234.2414971-1-arnd@arndb.de> X-Mailer: git-send-email 2.9.0 X-Provags-ID: V03:K0:qUuk2Ez6Gty5f1SzVtT4ppVvcbPoTx2P4L4eR16SfCm+1CkzoeG gZrV9r0onR/BwExH/NZy6w+xEMEyE1WQRiCDcCTYVq6S7QLLc+5xEOmJJa7QhzewWXEhWc/ NEZyYZyDRBPVXhqtCoq1Du7qp9Qcium21UbJdCK/TLuWXGlipwKSPYKpdblkji+dEeZLn0V WxWfAK/8uPAKv4LfHICAw== X-UI-Out-Filterresults: notjunk:1;V01:K0:WGRpX5/hN6c=:z0I/gL3HY5sArFUIyNBWMq 6OWEdLOOVab1fdZK0aRhSjdhZm1ZW9JKrA4r4ybQvQsImr9M4AexjW339cHDrp05dz8/Q/08A 3a3NY3mw3hHhWuniFt38q4B9Lmjp3jmTybpg6rVgHwW+GMJv/e76SNfKBGDU1m0FHFGIHIQNr zZphDHQsg/QF1mJozfkF730xeavbeOktcknfUnb5v8EshmE43gcLEMPRtwQR2x6syLgH0Ubyi zQgfrdb/Pg+TCZpl0/mXCXXqwBwFDG9QVQw91aBYZtNYTQQIRUMIp1aa1VxpfVVGr6dsfuoPW Wae5ZX8bYcqz+03IBRSzRGtbb5BdYjJBybSIQ3YCde8WVdFxlWcbDAePdL2Pk1w9tt2mPAJn8 P/El90meTP6wqqb7lMR+URrN/v0mBIFytrvP8cyXUlhH045W99b43LijwB2Xjd6ygCSFO59u6 3Ai69GQolzzAhQvlp2UVbF/Ht4jB+ZI+EexHEqv/FWvwAkjv+DngSFsYt5j9j+PsA+JZcNC7M SXZqTCtcNkWO10bEMkH5dzLRMi9STtnipk9+NTF8h0EMEizJNSfTEWRCSBt2qYUgEOzHZJZL1 Yn//utY4w2iAOM9Zj7g4GqVhw4T8URIm0MZUCkwz7JFwzXJgNSQhPtFTorG2JnijItsNO1nWC GoSzbBZaiFmPC0eLqy6VEe1GOWwR5rHFOnRpLO63YjV+bnZB7pJkdQOS5otFKwFat1S0= Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org The change to leave out procfs support in CAN when CONFIG_PROC_FS is not set was incomplete and leads to a build error: net/built-in.o: In function `can_init': :(.init.text+0x9858): undefined reference to `can_stat_update' ERROR: "can_stat_update" [net/can/can.ko] undefined! This tries a better approach, encapsulating all of the calls within IS_ENABLED(), so we also leave out the timer function from the object file. Signed-off-by: Arnd Bergmann Fixes: a20fadf85312 ("can: build proc support only if CONFIG_PROC_FS is activated") --- net/can/af_can.c | 22 ++++++++++++---------- net/can/af_can.h | 11 ----------- 2 files changed, 12 insertions(+), 21 deletions(-) diff --git a/net/can/af_can.c b/net/can/af_can.c index 166d436196c1..1108079d934f 100644 --- a/net/can/af_can.c +++ b/net/can/af_can.c @@ -911,14 +911,14 @@ static __init int can_init(void) if (!rcv_cache) return -ENOMEM; - if (stats_timer) { + if (IS_ENABLED(CONFIG_PROC_FS)) { + if (stats_timer) { /* the statistics are updated every second (timer triggered) */ - setup_timer(&can_stattimer, can_stat_update, 0); - mod_timer(&can_stattimer, round_jiffies(jiffies + HZ)); - } else - can_stattimer.function = NULL; - - can_init_proc(); + setup_timer(&can_stattimer, can_stat_update, 0); + mod_timer(&can_stattimer, round_jiffies(jiffies + HZ)); + } + can_init_proc(); + } /* protocol register */ sock_register(&can_family_ops); @@ -933,10 +933,12 @@ static __exit void can_exit(void) { struct net_device *dev; - if (stats_timer) - del_timer_sync(&can_stattimer); + if (IS_ENABLED(CONFIG_PROC_FS)) { + if (stats_timer) + del_timer_sync(&can_stattimer); - can_remove_proc(); + can_remove_proc(); + } /* protocol unregister */ dev_remove_pack(&canfd_packet); diff --git a/net/can/af_can.h b/net/can/af_can.h index 38a79ff20022..fca0fe9fc45a 100644 --- a/net/can/af_can.h +++ b/net/can/af_can.h @@ -113,19 +113,8 @@ struct s_pstats { extern struct dev_rcv_lists can_rx_alldev_list; /* function prototypes for the CAN networklayer procfs (proc.c) */ -#ifdef CONFIG_PROC_FS void can_init_proc(void); void can_remove_proc(void); -#else -static inline void can_init_proc(void) -{ - pr_info("can: Can't create /proc/net/can. CONFIG_PROC_FS missing!\n"); -} - -static inline void can_remove_proc(void) -{ -} -#endif void can_stat_update(unsigned long data); /* structures and variables from af_can.c needed in proc.c for reading */ -- 2.9.0