aboutsummaryrefslogtreecommitdiffstats
path: root/net/can
diff options
context:
space:
mode:
authorArnd Bergmann <arnd@arndb.de>2016-06-20 11:51:52 -0400
committerMarc Kleine-Budde <mkl@pengutronix.de>2016-06-23 05:23:49 -0400
commit2781ff5c8fc7722e97503f96686bf6d7093069a9 (patch)
tree8ed27b0a850a173cbfd1cab3227ee0c271ec48f0 /net/can
parentb95e5928fcc76d156352570858abdea7b2628efd (diff)
can: only call can_stat_update with procfs
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 <arnd@arndb.de> Fixes: a20fadf85312 ("can: build proc support only if CONFIG_PROC_FS is activated") Signed-off-by: Marc Kleine-Budde <mkl@pengutronix.de>
Diffstat (limited to 'net/can')
-rw-r--r--net/can/af_can.c22
-rw-r--r--net/can/af_can.h11
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)
911 if (!rcv_cache) 911 if (!rcv_cache)
912 return -ENOMEM; 912 return -ENOMEM;
913 913
914 if (stats_timer) { 914 if (IS_ENABLED(CONFIG_PROC_FS)) {
915 if (stats_timer) {
915 /* the statistics are updated every second (timer triggered) */ 916 /* the statistics are updated every second (timer triggered) */
916 setup_timer(&can_stattimer, can_stat_update, 0); 917 setup_timer(&can_stattimer, can_stat_update, 0);
917 mod_timer(&can_stattimer, round_jiffies(jiffies + HZ)); 918 mod_timer(&can_stattimer, round_jiffies(jiffies + HZ));
918 } else 919 }
919 can_stattimer.function = NULL; 920 can_init_proc();
920 921 }
921 can_init_proc();
922 922
923 /* protocol register */ 923 /* protocol register */
924 sock_register(&can_family_ops); 924 sock_register(&can_family_ops);
@@ -933,10 +933,12 @@ static __exit void can_exit(void)
933{ 933{
934 struct net_device *dev; 934 struct net_device *dev;
935 935
936 if (stats_timer) 936 if (IS_ENABLED(CONFIG_PROC_FS)) {
937 del_timer_sync(&can_stattimer); 937 if (stats_timer)
938 del_timer_sync(&can_stattimer);
938 939
939 can_remove_proc(); 940 can_remove_proc();
941 }
940 942
941 /* protocol unregister */ 943 /* protocol unregister */
942 dev_remove_pack(&canfd_packet); 944 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 {
113extern struct dev_rcv_lists can_rx_alldev_list; 113extern struct dev_rcv_lists can_rx_alldev_list;
114 114
115/* function prototypes for the CAN networklayer procfs (proc.c) */ 115/* function prototypes for the CAN networklayer procfs (proc.c) */
116#ifdef CONFIG_PROC_FS
117void can_init_proc(void); 116void can_init_proc(void);
118void can_remove_proc(void); 117void can_remove_proc(void);
119#else
120static inline void can_init_proc(void)
121{
122 pr_info("can: Can't create /proc/net/can. CONFIG_PROC_FS missing!\n");
123}
124
125static inline void can_remove_proc(void)
126{
127}
128#endif
129void can_stat_update(unsigned long data); 118void can_stat_update(unsigned long data);
130 119
131/* structures and variables from af_can.c needed in proc.c for reading */ 120/* structures and variables from af_can.c needed in proc.c for reading */