Skip to contentSkip to conversation

staging: greybus: Use setup_timer function instead of initializing timer with the function and data fields

PATCH New sayli karnik 1 participant 1 message Sep 21, 2016

Subsystems (3)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 staging: greybus: Use setup_timer function instead of initializing timer with the function and data fields

This patch uses setup_timer function instead of initializing timer with the function and data fields. Done using coccinelle:
@@
expression e, func, da;
@@

-init_timer (&e);
+setup_timer (&e, func, da);

(
-e.function = func;
-e.data = da;
|
-e.data = da;
-e.function = func;
)

---
 drivers/staging/greybus/loopback.c | 5 ++---
 1 file changed, 2 insertions(+), 3 deletions(-)
drivers/staging/greybus/loopback.c +2 -3
index 8b0d0dc..2a29f06 100644
@@ -603,7 +603,8 @@ static int gb_loopback_async_operation(struct gb_loopback *gb, int type,
 		return -ENOMEM;
 
 	INIT_WORK(&op_async->work, gb_loopback_async_operation_work);
-	init_timer(&op_async->timer);
+	setup_timer(&op_async->timer, gb_loopback_async_operation_timeout,
+		    (unsigned long)operation->id);
 	kref_init(&op_async->kref);
 
 	operation = gb_operation_create(gb->connection, type, request_size,
@@ -634,9 +635,7 @@ static int gb_loopback_async_operation(struct gb_loopback *gb, int type,
 	if (ret)
 		goto error;
 
-	op_async->timer.function = gb_loopback_async_operation_timeout;
 	op_async->timer.expires = jiffies + gb->jiffy_timeout;
-	op_async->timer.data = (unsigned long)operation->id;
 	add_timer(&op_async->timer);
 
 	goto done;
Signature · 1 line
2.7.4