Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

can: build proc support only if CONFIG_PROC_FS is activated

When building can subsystem with CONFIG_PROC_FS=n I detected some unused
variables warning by using proc functions. In CAN the proc handling is
nicely placed in one object file. This patch adds simple add a
dependency on CONFIG_PROC_FS for CAN's proc.o file and corresponding
static inline no-op functions.

Signed-off-by: Alexander Aring <aar@pengutronix.de>
Acked-by: Oliver Hartkopp <socketcan@hartkopp.net>
[mkl: provide static inline noops instead of using #ifdefs]
Signed-off-by: Marc Kleine-Budde <mkl@pengutronix.de>

authored by

Alexander Aring and committed by
Marc Kleine-Budde
a20fadf8 3636876a

+14 -3
+2 -1
net/can/Makefile
··· 3 3 # 4 4 5 5 obj-$(CONFIG_CAN) += can.o 6 - can-y := af_can.o proc.o 6 + can-y := af_can.o 7 + can-$(CONFIG_PROC_FS) += proc.o 7 8 8 9 obj-$(CONFIG_CAN_RAW) += can-raw.o 9 10 can-raw-y := raw.o
+11
net/can/af_can.h
··· 113 113 extern struct dev_rcv_lists can_rx_alldev_list; 114 114 115 115 /* function prototypes for the CAN networklayer procfs (proc.c) */ 116 + #ifdef CONFIG_PROC_FS 116 117 void can_init_proc(void); 117 118 void can_remove_proc(void); 119 + #else 120 + static inline void can_init_proc(void) 121 + { 122 + pr_info("can: Can't create /proc/net/can. CONFIG_PROC_FS missing!\n"); 123 + } 124 + 125 + static inline void can_remove_proc(void) 126 + { 127 + } 128 + #endif 118 129 void can_stat_update(unsigned long data); 119 130 120 131 /* structures and variables from af_can.c needed in proc.c for reading */
+1 -2
net/can/proc.c
··· 517 517 can_dir = proc_mkdir("can", init_net.proc_net); 518 518 519 519 if (!can_dir) { 520 - printk(KERN_INFO "can: failed to create /proc/net/can . " 521 - "CONFIG_PROC_FS missing?\n"); 520 + pr_info("can: failed to create /proc/net/can.\n"); 522 521 return; 523 522 } 524 523