linux-can.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Oliver Hartkopp <socketcan@hartkopp.net>
To: Alexander Aring <aar@pengutronix.de>
Cc: Marc Kleine-Budde <mkl@pengutronix.de>,
	"linux-can@vger.kernel.org" <linux-can@vger.kernel.org>
Subject: Re: [PATCH v2] can: build proc support only if CONFIG_PROC_FS is activated
Date: Sat, 18 Jun 2016 10:57:55 +0200	[thread overview]
Message-ID: <57650D13.1030706@hartkopp.net> (raw)
In-Reply-To: <1466165326-29777-1-git-send-email-mkl@pengutronix.de>

Hi Alexander,

there's a procfs dependency of the CAN_BCM too.

On 06/17/2016 02:08 PM, Marc Kleine-Budde wrote:
> From: Alexander Aring <aar@pengutronix.de>
>
> When building can subsystem with CONFIG_PROC_FS=n I detected some unused
> variables warning by using proc functions.

Did you miss to switch on CAN_BCM when doing a CONFIG_PROC_FS disabled test?

Or is the procfs subsystem that intelligent that it just disables the 
functionality so that the users (e.g. in bcm.c) don't need to care about 
CONFIG_PROC_FS.

Regards,
Oliver

> 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>
> [mkl: provide static inline noops instead of using #ifdefs]
> Signed-off-by: Marc Kleine-Budde <mkl@pengutronix.de>
> ---
> Hello,
>
> picking up Alex's work. I've switched from #ifdef's to no-ops.
>
> regards,
> Marc
>
>   net/can/Makefile |  3 ++-
>   net/can/af_can.h | 11 +++++++++++
>   net/can/proc.c   |  3 +--
>   3 files changed, 14 insertions(+), 3 deletions(-)
>
> diff --git a/net/can/Makefile b/net/can/Makefile
> index cef49eb1f5c7..10936754e3f2 100644
> --- a/net/can/Makefile
> +++ b/net/can/Makefile
> @@ -3,7 +3,8 @@
>   #
>
>   obj-$(CONFIG_CAN)	+= can.o
> -can-y			:= af_can.o proc.o
> +can-y			:= af_can.o
> +can-$(CONFIG_PROC_FS)	+= proc.o
>
>   obj-$(CONFIG_CAN_RAW)	+= can-raw.o
>   can-raw-y		:= raw.o
> diff --git a/net/can/af_can.h b/net/can/af_can.h
> index fca0fe9fc45a..38a79ff20022 100644
> --- a/net/can/af_can.h
> +++ b/net/can/af_can.h
> @@ -113,8 +113,19 @@ 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 */
> diff --git a/net/can/proc.c b/net/can/proc.c
> index 1a19b985a868..85ef7bb0f176 100644
> --- a/net/can/proc.c
> +++ b/net/can/proc.c
> @@ -517,8 +517,7 @@ void can_init_proc(void)
>   	can_dir = proc_mkdir("can", init_net.proc_net);
>
>   	if (!can_dir) {
> -		printk(KERN_INFO "can: failed to create /proc/net/can . "
> -		       "CONFIG_PROC_FS missing?\n");
> +		pr_info("can: failed to create /proc/net/can.\n");
>   		return;
>   	}
>
>

  parent reply	other threads:[~2016-06-18  8:58 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-06-17 12:08 [PATCH v2] can: build proc support only if CONFIG_PROC_FS is activated Marc Kleine-Budde
2016-06-17 12:34 ` Oliver Hartkopp
2016-06-18  8:57 ` Oliver Hartkopp [this message]
2016-06-18  9:36   ` Alexander Aring
2016-06-18  9:41     ` Oliver Hartkopp
2016-06-18 11:15       ` Alexander Aring
2016-06-18 11:19         ` Alexander Aring

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=57650D13.1030706@hartkopp.net \
    --to=socketcan@hartkopp.net \
    --cc=aar@pengutronix.de \
    --cc=linux-can@vger.kernel.org \
    --cc=mkl@pengutronix.de \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).