Skip to contentSkip to conversation

sound: oss: waveartist: Convert timers to use timer_setup()

PATCH In review Kees Cook 2 participants 6 messages Oct 24, 2017 – Oct 25, 2017 Sound

lore
Share & tools
lore

Kees Cook

author
#0 lore raw

PATCH 1/1 sound: oss: waveartist: 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 Jaroslav Kysela <[email protected]>
Cc Takashi Iwai <[email protected]>
Cc David Howells <[email protected]>
---
 sound/oss/waveartist.c | 9 +++++----
 1 file changed, 5 insertions(+), 4 deletions(-)
sound/oss/waveartist.c +5 -4
index 4f0c3a232e41..c051c8e6023e 100644
@@ -151,6 +151,7 @@ static DEFINE_SPINLOCK(waveartist_lock);
 #define machine_is_netwinder() 0
 #else
 static struct timer_list vnc_timer;
+static int timer_nr_waveartist_devs;
 static void vnc_configure_mixer(struct wavnc_info *devc,
 				unsigned int input_mask);
 static int vnc_private_ioctl(int dev, unsigned int cmd, int __user *arg);
@@ -1414,8 +1415,8 @@ attach_waveartist(struct address_info *hw, const struct waveartist_mixer_info *m
 	else {
 #ifdef CONFIG_ARCH_NETWINDER
 		if (machine_is_netwinder()) {
-			setup_timer(&vnc_timer, vnc_slider_tick,
-				    nr_waveartist_devs);
+			timer_nr_waveartist_devs = nr_waveartist_devs;
+			timer_setup(&vnc_timer, vnc_slider_tick, 0);
 			mod_timer(&vnc_timer, jiffies);
 
 			vnc_configure_mixer(devc, 0);
@@ -1799,11 +1800,11 @@ vnc_slider(struct wavnc_info *devc)
 }
 
 static void
-vnc_slider_tick(unsigned long data)
+vnc_slider_tick(struct timer_list *unused)
 {
 	int next_timeout;
 
-	if (vnc_slider(adev_info + data))
+	if (vnc_slider(adev_info + timer_nr_waveartist_devs))
 		next_timeout = 5;	// mixer reported change
 	else
 		next_timeout = VNC_TIMER_PERIOD;
Signature · 6 lines
2.7.4


-- 
Kees Cook
Pixel Security
#1 lore raw
Quoted 10 lines · Kees Cook

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 Jaroslav Kysela <[email protected]>
Cc Takashi Iwai <[email protected]>
Cc David Howells <[email protected]>

I'll skip this as sound/oss/* is already disabled in recent kernels in kbuild, and we're going to remove the whole code soon later.

thanks,

Takashi

author
#2 lore raw
Quoted 7 lines · Takashi Iwai
Quoted 5 lines · Kees Cook

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.

Quoted 8 lines
Quoted 5 lines
Cc Jaroslav Kysela <[email protected]>
Cc Takashi Iwai <[email protected]>
Cc David Howells <[email protected]>

I'll skip this as sound/oss/* is already disabled in recent kernels in kbuild, and we're going to remove the whole code soon later.

At the end of these conversions, the old init_timer() and setup_timer() APIs will be removed, which would break anything still trying to use it (obviously). But if sound/oss/* is _already_ unbuildable, then sure, this is fine by me to leave out. :)

Thanks!

-Kees

Signature · 2 lines
Kees Cook
Pixel Security
#3 lore raw
Quoted 15 lines · Kees Cook
Quoted 13 lines · Takashi Iwai
Quoted 10 lines · Kees Cook

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 Jaroslav Kysela <[email protected]>
Cc Takashi Iwai <[email protected]>
Cc David Howells <[email protected]>
Quoted 7 lines
Quoted 2 lines

I'll skip this as sound/oss/* is already disabled in recent kernels in kbuild, and we're going to remove the whole code soon later.

At the end of these conversions, the old init_timer() and setup_timer() APIs will be removed, which would break anything still trying to use it (obviously). But if sound/oss/* is _already_ unbuildable, then sure, this is fine by me to leave out. :)

I see a few still remaining users of setup_timer() in sound/*. Do you already have conversion patches? They are all trivial, so I can cook up in minutes, too.

thanks,

Takashi

author
#4 lore raw
Quoted 20 lines · Takashi Iwai
Quoted 18 lines · Kees Cook
Quoted 15 lines · Takashi Iwai
Quoted 10 lines · Kees Cook

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 Jaroslav Kysela <[email protected]>
Cc Takashi Iwai <[email protected]>
Cc David Howells <[email protected]>

I'll skip this as sound/oss/* is already disabled in recent kernels in kbuild, and we're going to remove the whole code soon later.

Quoted 8 lines
Quoted 4 lines

At the end of these conversions, the old init_timer() and setup_timer() APIs will be removed, which would break anything still trying to use it (obviously). But if sound/oss/* is _already_ unbuildable, then sure, this is fine by me to leave out. :)

I see a few still remaining users of setup_timer() in sound/*. Do you already have conversion patches? They are all trivial, so I can cook up in minutes, too.

I haven't sent the trivial ones (since I am expecting to do a treewide mechanical change for those). I can send you the rest as a patch instead, if you want?

-Kees

Signature · 2 lines
Kees Cook
Pixel Security
#5 lore raw
Quoted 27 lines · Kees Cook
Quoted 25 lines · Takashi Iwai
Quoted 22 lines · Kees Cook
Quoted 7 lines · Takashi Iwai
Quoted 5 lines · Kees Cook

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.

Quoted 8 lines
Quoted 5 lines
Cc Jaroslav Kysela <[email protected]>
Cc Takashi Iwai <[email protected]>
Cc David Howells <[email protected]>

I'll skip this as sound/oss/* is already disabled in recent kernels in kbuild, and we're going to remove the whole code soon later.

At the end of these conversions, the old init_timer() and setup_timer() APIs will be removed, which would break anything still trying to use it (obviously). But if sound/oss/* is _already_ unbuildable, then sure, this is fine by me to leave out. :)

Quoted 7 lines
Quoted 3 lines

I see a few still remaining users of setup_timer() in sound/*. Do you already have conversion patches? They are all trivial, so I can cook up in minutes, too.

I haven't sent the trivial ones (since I am expecting to do a treewide mechanical change for those). I can send you the rest as a patch instead, if you want?

Yeah, sure, earlier is easier for me :)

Takashi