linux-bcache.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Coly Li <colyli@suse.de>
To: Amitoj Kaur Chawla <amitoj1606@gmail.com>,
	kent.overstreet@gmail.com, shli@kernel.org,
	linux-bcache@vger.kernel.org, linux-raid@vger.kernel.org,
	linux-kernel@vger.kernel.org
Cc: julia.lawall@lip6.fr
Subject: Re: [PATCH] bcache: Use setup_timer and mod_timer
Date: Thu, 30 Jun 2016 20:11:26 +0800	[thread overview]
Message-ID: <cb7cfc00-b3f6-d2c5-6c0f-eb81f78f797c@suse.de> (raw)
In-Reply-To: <20160630114520.GA8025@amitoj-Inspiron-3542>

在 16/6/30 下午7:45, Amitoj Kaur Chawla 写道:
> Convert a call to init_timer and accompanying intializations of
> the timer's data and function fields to a call to setup_timer.
> 
> The Coccinelle semantic patch that fixes one part of this issue
> is as follows:
> @@
> expression t,d,f,e1;
> identifier x1;
> statement S1;
> @@
> 
> (
> -t.data = d;
> |
> -t.function = f;
> |
> -init_timer(&t);
> +setup_timer(&t,f,d);
> |
> -init_timer_on_stack(&t);
> +setup_timer_on_stack(&t,f,d);
> )
> <... when != S1
> t.x1 = e1;
> ...>
> 
> Also convert calls to add_timer and intialisation of timer's expire
> field to a call to mod_timer which is more compact.
> 
> Signed-off-by: Amitoj Kaur Chawla <amitoj1606@gmail.com>
> ---
>  drivers/md/bcache/stats.c | 7 ++-----
>  1 file changed, 2 insertions(+), 5 deletions(-)
> 
> diff --git a/drivers/md/bcache/stats.c b/drivers/md/bcache/stats.c
> index 0ca072c..094d6d6 100644
> --- a/drivers/md/bcache/stats.c
> +++ b/drivers/md/bcache/stats.c
> @@ -233,9 +233,6 @@ void bch_cache_accounting_init(struct cache_accounting *acc,
>  	kobject_init(&acc->day.kobj,		&bch_stats_ktype);
>  
>  	closure_init(&acc->cl, parent);
> -	init_timer(&acc->timer);
> -	acc->timer.expires	= jiffies + accounting_delay;
> -	acc->timer.data		= (unsigned long) acc;
> -	acc->timer.function	= scale_accounting;
> -	add_timer(&acc->timer);
> +	setup_timer(&acc->timer, scale_accounting, (unsigned long) acc);
> +	mod_timer(&acc->timer, jiffies + accounting_delay);
>  }
> 

This patch uses new setup_timer() and mod_timer() interface to
initialize acc->timer. No change in functionality. It is OK to me.

Reviewed-by: Coly Li <colyli@suse.de>

Coly

      reply	other threads:[~2016-06-30 12:12 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-06-30 11:45 [PATCH] bcache: Use setup_timer and mod_timer Amitoj Kaur Chawla
2016-06-30 12:11 ` Coly Li [this message]

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=cb7cfc00-b3f6-d2c5-6c0f-eb81f78f797c@suse.de \
    --to=colyli@suse.de \
    --cc=amitoj1606@gmail.com \
    --cc=julia.lawall@lip6.fr \
    --cc=kent.overstreet@gmail.com \
    --cc=linux-bcache@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-raid@vger.kernel.org \
    --cc=shli@kernel.org \
    /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).