[<prev] [next>] [day] [month] [year] [list]
Message-ID: <20150611055227.GA6771@vaishali-Ideapad-Z570>
Date: Thu, 11 Jun 2015 11:22:27 +0530
From: Vaishali Thakkar <vthakkar1994@...il.com>
To: linux-kernel@...r.kernel.org
Cc: Julia Lawall <julia.lawall@...6.fr>
Subject: [PATCH] Drivers: block: Use setup_timer
Use the timer API function setup_timer instead of structure field
assignments to initialize a timer.
A simplified version of the Coccinelle semantic patch that performs
this transformation is as follows:
@change@
expression e1, e2, a;
@@
-init_timer(&e1);
+setup_timer(&e1, a, 0UL);
... when != a = e2
-e1.function = a;
Signed-off-by: Vaishali Thakkar <vthakkar1994@...il.com>
---
drivers/block/umem.c | 3 +--
1 file changed, 1 insertion(+), 2 deletions(-)
diff --git a/drivers/block/umem.c b/drivers/block/umem.c
index 4cf81b5..cd999a1 100644
--- a/drivers/block/umem.c
+++ b/drivers/block/umem.c
@@ -738,8 +738,7 @@ static void check_all_batteries(unsigned long ptr)
static void init_battery_timer(void)
{
- init_timer(&battery_timer);
- battery_timer.function = check_all_batteries;
+ setup_timer(&battery_timer, check_all_batteries, 0UL);
battery_timer.expires = jiffies + (HZ * 60);
add_timer(&battery_timer);
}
--
1.9.1
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Powered by blists - more mailing lists