Skip to contentSkip to conversation

Staging: media: Using set_up timer

PATCH New Vaishali Thakkar 1 participant 3 messages Feb 18, 2015

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

v2 cover Staging: media: Using set_up timer

This patch-set introduces the use of function setup_timer instead of structure assignments as it is the preferred way to setup and set the timer. This change is done using Coccinelle. Also, data value of setup_timer function is changed here.

Vaishali Thakkar (2):
Staging: media: lirc: Use setup_timer
Staging: media: Change data value in setup_timer

 drivers/staging/media/lirc/lirc_sir.c | 4 +---
 1 file changed, 1 insertion(+), 3 deletions(-)
Signature · 1 line
1.9.1
#1 lore raw

PATCH v2 1/2 Staging: media: lirc: Use setup_timer

This patch introduces the use of function setup_timer instead of structure assignments as it is the preferred way to setup and set the timer.

This is done using Coccinelle and semantic patch used is as follows:

@@
expression x,y,z;
@@

- init_timer (&x);
+ setup_timer (&x, y, z);
- x.function = y;
- x.data = z;

---
Changes in v2:
-Changed commit log

 drivers/staging/media/lirc/lirc_sir.c | 4 +---
 1 file changed, 1 insertion(+), 3 deletions(-)
drivers/staging/media/lirc/lirc_sir.c +1 -3
index 39f4733..d1ada8c 100644
@@ -683,9 +683,7 @@ static int init_port(void)
 	}
 	pr_info("I/O port 0x%.4x, IRQ %d.\n", io, irq);
 
-	init_timer(&timerlist);
-	timerlist.function = sir_timeout;
-	timerlist.data = 0xabadcafe;
+	setup_timer(&timerlist, sir_timeout, 0xabadcafe);
 
 	return 0;
 }
Signature · 1 line
1.9.1
#2 lore raw

PATCH v2 2/2 Staging: media: Change data value in setup_timer function

In reply to Vaishali Thakkar

Here, data value 0xabadcafe in function setup_timer seems like a nonsense value and timer handler function is not using it anyway. So, change it to 0.

---
Changes in v2:
-Add this change as a seperate patch -Here, I could make a private structure for the
driver to hold the various global variables but that would be a major change and may be need a lot of work. So, I am proposing a simple change here. I can go for those changes if Greg thinks its good for this driver as I don't know the goal of this driver.

 drivers/staging/media/lirc/lirc_sir.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/staging/media/lirc/lirc_sir.c +1 -1
index d1ada8c..29087f6 100644
@@ -683,7 +683,7 @@ static int init_port(void)
 	}
 	pr_info("I/O port 0x%.4x, IRQ %d.\n", io, irq);
 
-	setup_timer(&timerlist, sir_timeout, 0xabadcafe);
+	setup_timer(&timerlist, sir_timeout, 0);
 
 	return 0;
 }
Signature · 1 line
1.9.1