linux-mm.kvack.org archive mirror
 help / color / mirror / Atom feed
From: Konrad Rzeszutek Wilk <konrad.wilk@oracle.com>
To: Bob Liu <lliubbo@gmail.com>
Cc: gregkh@linuxfoundation.org, dan.magenheimer@oracle.com,
	fengguang.wu@intel.com, linux-mm@kvack.org,
	Bob Liu <bob.liu@oracle.com>
Subject: Re: [PATCH] staging: zcache: fix compile error
Date: Mon, 1 Apr 2013 08:17:36 -0400	[thread overview]
Message-ID: <20130401121736.GA11995@phenom.dumpdata.com> (raw)
In-Reply-To: <1364788247-30657-1-git-send-email-bob.liu@oracle.com>

On Mon, Apr 01, 2013 at 11:50:47AM +0800, Bob Liu wrote:
> Because 'ramster_debugfs_init' is not defined if !CONFIG_DEBUG_FS, there is
> compile error like:
> 
> $ make drivers/staging/zcache/
> 
> staging/zcache/zbud.c:291:16: warning: ‘zbud_pers_evicted_pageframes’ defined
> but not used [-Wunused-variable]
> staging/zcache/ramster/ramster.c: In function ‘ramster_init’:
> staging/zcache/ramster/ramster.c:981:2: error: implicit declaration of
> function ‘ramster_debugfs_init’ [-Werror=implicit-function-declaration]
> 
> This patch fix it and reduce some #ifdef CONFIG_DEBUG_FS in .c files with the
> same way.
> 
> Reported-by: Fengguang Wu <fengguang.wu@intel.com>
> Signed-off-by: Bob Liu <bob.liu@oracle.com>
> ---
>  drivers/staging/zcache/ramster/ramster.c |    4 ++++
>  drivers/staging/zcache/zbud.c            |    6 ++++--
>  drivers/staging/zcache/zcache-main.c     |    2 --
>  3 files changed, 8 insertions(+), 4 deletions(-)
> 
> diff --git a/drivers/staging/zcache/ramster/ramster.c b/drivers/staging/zcache/ramster/ramster.c
> index 4f715c7..e562c14 100644
> --- a/drivers/staging/zcache/ramster/ramster.c
> +++ b/drivers/staging/zcache/ramster/ramster.c
> @@ -134,6 +134,10 @@ static int ramster_debugfs_init(void)
>  }
>  #undef	zdebugfs
>  #undef	zdfs64
> +#else
> +static int ramster_debugfs_init(void)
> +{
> +}

That is not going to work. It will complain about not returning a proper value.
Also you can use inline in it.
>  #endif
>  
>  static LIST_HEAD(ramster_rem_op_list);
> diff --git a/drivers/staging/zcache/zbud.c b/drivers/staging/zcache/zbud.c
> index fdff5c6..2d38c96 100644
> --- a/drivers/staging/zcache/zbud.c
> +++ b/drivers/staging/zcache/zbud.c
> @@ -342,6 +342,10 @@ static int zbud_debugfs_init(void)
>  }
>  #undef	zdfs
>  #undef	zdfs64
> +#else
> +static int zbud_debugfs_init(void)
> +{
> +}

Ditto. You need to return 0 and you can make it inline.

>  #endif
>  
>  /* protects the buddied list and all unbuddied lists */
> @@ -1051,9 +1055,7 @@ void zbud_init(void)
>  {
>  	int i;
>  
> -#ifdef CONFIG_DEBUG_FS
>  	zbud_debugfs_init();
> -#endif
>  	BUG_ON((sizeof(struct tmem_handle) * 2 > CHUNK_SIZE));
>  	BUG_ON(sizeof(struct zbudpage) > sizeof(struct page));
>  	for (i = 0; i < NCHUNKS; i++) {
> diff --git a/drivers/staging/zcache/zcache-main.c b/drivers/staging/zcache/zcache-main.c
> index 4e52a94..ac75670 100644
> --- a/drivers/staging/zcache/zcache-main.c
> +++ b/drivers/staging/zcache/zcache-main.c
> @@ -1753,9 +1753,7 @@ static int zcache_init(void)
>  		namestr = "ramster";
>  		ramster_register_pamops(&zcache_pamops);
>  	}
> -#ifdef CONFIG_DEBUG_FS
>  	zcache_debugfs_init();
> -#endif
>  	if (zcache_enabled) {
>  		unsigned int cpu;
>  

That looks OK, and should be as a seperate patch - as there are no compilation
failures with zcache-main.c

> -- 
> 1.7.10.4
> 

--
To unsubscribe, send a message with 'unsubscribe linux-mm' in
the body to majordomo@kvack.org.  For more info on Linux MM,
see: http://www.linux-mm.org/ .
Don't email: <a href=mailto:"dont@kvack.org"> email@kvack.org </a>

  reply	other threads:[~2013-04-01 12:17 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-04-01  3:50 [PATCH] staging: zcache: fix compile error Bob Liu
2013-04-01 12:17 ` Konrad Rzeszutek Wilk [this message]
2013-04-01 17:56   ` Greg KH
2013-04-07  1:14 ` Ric Mason
2013-04-07  8:06   ` Bob Liu
2013-04-07  8:11     ` Ric Mason

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=20130401121736.GA11995@phenom.dumpdata.com \
    --to=konrad.wilk@oracle.com \
    --cc=bob.liu@oracle.com \
    --cc=dan.magenheimer@oracle.com \
    --cc=fengguang.wu@intel.com \
    --cc=gregkh@linuxfoundation.org \
    --cc=linux-mm@kvack.org \
    --cc=lliubbo@gmail.com \
    /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).