From 8376d3c1f98988ae7f9e9bc2d1eeeb7d61fd206c Mon Sep 17 00:00:00 2001 From: Kees Cook Date: Mon, 16 Oct 2017 17:01:48 -0700 Subject: md: Convert timers to use timer_setup() In preparation for unconditionally passing the struct timer_list pointer to all timer callbacks, switch to using the new timer_setup() and from_timer() to pass the timer pointer explicitly. Cc: Kent Overstreet Cc: Shaohua Li Cc: Alasdair Kergon Cc: Mike Snitzer Cc: dm-devel@redhat.com Cc: linux-bcache@vger.kernel.org Cc: linux-raid@vger.kernel.org Signed-off-by: Kees Cook Reviewed-by: Michael Lyle Reviewed-by: Mike Snitzer Signed-off-by: Jens Axboe --- drivers/md/bcache/stats.c | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) (limited to 'drivers/md/bcache') diff --git a/drivers/md/bcache/stats.c b/drivers/md/bcache/stats.c index d0831d5bcc87..be119326297b 100644 --- a/drivers/md/bcache/stats.c +++ b/drivers/md/bcache/stats.c @@ -147,9 +147,9 @@ static void scale_stats(struct cache_stats *stats, unsigned long rescale_at) } } -static void scale_accounting(unsigned long data) +static void scale_accounting(struct timer_list *t) { - struct cache_accounting *acc = (struct cache_accounting *) data; + struct cache_accounting *acc = from_timer(acc, t, timer); #define move_stat(name) do { \ unsigned t = atomic_xchg(&acc->collector.name, 0); \ @@ -234,9 +234,7 @@ 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); + timer_setup(&acc->timer, scale_accounting, 0); acc->timer.expires = jiffies + accounting_delay; - acc->timer.data = (unsigned long) acc; - acc->timer.function = scale_accounting; add_timer(&acc->timer); } -- cgit v1.2.3