Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1162631AbdD0OWA (ORCPT ); Thu, 27 Apr 2017 10:22:00 -0400 Received: from mout.kundenserver.de ([212.227.126.130]:50746 "EHLO mout.kundenserver.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S939379AbdD0OV4 (ORCPT ); Thu, 27 Apr 2017 10:21:56 -0400 From: Arnd Bergmann To: Oliver Hartkopp , Marc Kleine-Budde , "David S. Miller" Cc: Arnd Bergmann , Thomas Gleixner , Cong Wang , Mario Kicherer , Eric Dumazet , linux-can@vger.kernel.org, netdev@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH net-next] can: fix build error without CONFIG_PROC_FS Date: Thu, 27 Apr 2017 16:21:37 +0200 Message-Id: <20170427142146.3107957-1-arnd@arndb.de> X-Mailer: git-send-email 2.9.0 X-Provags-ID: V03:K0:J088PRF9PuZniAg6ssB2WdSuhBT2KFh7AnIjrS0GSr8FGQKqtiv bmzNYLQ5ALkP/q+iPwy+M4q1a7a7hbW18n/8iTewgx2PHo7W7F5NylSk3YFrZmQCSAc8+om zRzUUvqAWgFVtGRmv9tD4yPSuYXbQ0LYaCCqY9fLwiFL/E8UjRZohs3r2i+Z84v5AMHrMzc 2DHB8spi2mY5jM1McKeNQ== X-UI-Out-Filterresults: notjunk:1;V01:K0:fEqI26pByL8=:CVV3X4yi+W2DjETjYcj2e6 94KZVzwk+uX4ZYQveuAHNJmduEda9RYlPWCyfeHRmFEx/cYHeMaDhv/sif6IWOmc2DIbMeslT txtANkpwgFsCp8SVfZ+Bgh7bS5YEYT4k4fXP/OMGC00xSJdy7T6oLxF/AUHnwS1KDwsR9nR7h U8VG2Rb+ceDU1f5RWRhVR1j+UgnXQmod+LTpZ/KVslCU0/ZgmDqTvHzdIJCax/QNqE/WC1kHk 6MBhCJGUaQYWRMBNeanyET7UOAwBMnix20ZjWqJkjJ4WHXAF4PXvQpg7+UZxapHEFSd3lvlY6 eB6mtkVozex6F6233TqObfOCh41p5GMCyke9RGZ7uUyIeqgRDjSe9MSbVyJZr93GDZoLaxvDJ CQw/QRbfhOfo+UXjTUxtOCVVrluPa/1YHS2n2e5nhfVkbi+5eJKHlUlAvofJAkpFyGAcncX5+ ed/HD0+949SPncK1/t8lTvE/VYCX7F+AYLVwPnbrTmGm6r3pBqtc3YSxAmKtvXyq999N1a9rA 6r15ebaUcjawYbxohteDEP5aY19Qe8YnSHZ/u4p7LwRqg7B9QjGDhzLknSgdJ2b85Mfi/Jjy+ I1AazIHZpd9v5WhGKvE6ci3EdenVgS3NUmAxuOJ4L2qzsCY+Sjz6g2dDW81UH3aCbhOkqKqif 9Qsto5ekDqFjF5ks5rGcoeeoZFozzLAHkLuDnp+hmUjxtwR0ZsbmP5/6DQ2leRye8Lb4= Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 2573 Lines: 82 The procfs dir entry was added inside of an #ifdef, causing a build error when we try to access it without CONFIG_PROC_FS set: net/can/bcm.c:1541:14: error: 'struct netns_can' has no member named 'bcmproc_dir' net/can/bcm.c: In function 'bcm_connect': net/can/bcm.c:1601:14: error: 'struct netns_can' has no member named 'bcmproc_dir' net/can/bcm.c: In function 'canbcm_pernet_init': net/can/bcm.c:1696:11: error: 'struct netns_can' has no member named 'bcmproc_dir' net/can/bcm.c: In function 'canbcm_pernet_exit': net/can/bcm.c:1707:15: error: 'struct netns_can' has no member named 'bcmproc_dir' This adds the same #ifdef around all users of the pointer. Alternatively we could move the pointer outside of the #ifdef. Fixes: 384317ef4187 ("can: network namespace support for CAN_BCM protocol") Signed-off-by: Arnd Bergmann --- net/can/bcm.c | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) diff --git a/net/can/bcm.c b/net/can/bcm.c index 0e855917b7e1..e6d9df27400b 100644 --- a/net/can/bcm.c +++ b/net/can/bcm.c @@ -1538,8 +1538,10 @@ static int bcm_release(struct socket *sock) } /* remove procfs entry */ +#ifdef CONFIG_PROC_FS if (net->can.bcmproc_dir && bo->bcm_proc_read) remove_proc_entry(bo->procname, net->can.bcmproc_dir); +#endif /* remove device reference */ if (bo->bound) { @@ -1597,7 +1599,7 @@ static int bcm_connect(struct socket *sock, struct sockaddr *uaddr, int len, /* no interface reference for ifindex = 0 ('any' CAN device) */ bo->ifindex = 0; } - +#ifdef CONFIG_PROC_FS if (net->can.bcmproc_dir) { /* unique socket address as filename */ sprintf(bo->procname, "%lu", sock_i_ino(sk)); @@ -1609,6 +1611,7 @@ static int bcm_connect(struct socket *sock, struct sockaddr *uaddr, int len, goto fail; } } +#endif bo->bound = 1; @@ -1691,22 +1694,23 @@ static const struct can_proto bcm_can_proto = { static int canbcm_pernet_init(struct net *net) { +#ifdef CONFIG_PROC_FS /* create /proc/net/can-bcm directory */ - if (IS_ENABLED(CONFIG_PROC_FS)) { - net->can.bcmproc_dir = - proc_net_mkdir(net, "can-bcm", net->proc_net); - } + net->can.bcmproc_dir = proc_net_mkdir(net, "can-bcm", net->proc_net); +#endif return 0; } static void canbcm_pernet_exit(struct net *net) { +#ifdef CONFIG_PROC_FS /* remove /proc/net/can-bcm directory */ if (IS_ENABLED(CONFIG_PROC_FS)) { if (net->can.bcmproc_dir) remove_proc_entry("can-bcm", net->proc_net); } +#endif } static struct pernet_operations canbcm_pernet_ops __read_mostly = { -- 2.9.0