diff mbox

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

Message ID 20171024153521.GA112921@beast (mailing list archive)
State New, archived
Headers show

Commit Message

Kees Cook Oct. 24, 2017, 3:35 p.m. UTC
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 <perex@perex.cz>
Cc: Takashi Iwai <tiwai@suse.com>
Cc: David Howells <dhowells@redhat.com>
Cc: alsa-devel@alsa-project.org
Signed-off-by: Kees Cook <keescook@chromium.org>
---
 sound/oss/waveartist.c | 9 +++++----
 1 file changed, 5 insertions(+), 4 deletions(-)

Comments

Takashi Iwai Oct. 24, 2017, 7:25 p.m. UTC | #1
On Tue, 24 Oct 2017 17:35:21 +0200,
Kees Cook wrote:
> 
> 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 <perex@perex.cz>
> Cc: Takashi Iwai <tiwai@suse.com>
> Cc: David Howells <dhowells@redhat.com>
> Cc: alsa-devel@alsa-project.org
> Signed-off-by: Kees Cook <keescook@chromium.org>

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
Kees Cook Oct. 24, 2017, 8:07 p.m. UTC | #2
On Tue, Oct 24, 2017 at 12:25 PM, Takashi Iwai <tiwai@suse.de> wrote:
> On Tue, 24 Oct 2017 17:35:21 +0200,
> Kees Cook wrote:
>>
>> 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 <perex@perex.cz>
>> Cc: Takashi Iwai <tiwai@suse.com>
>> Cc: David Howells <dhowells@redhat.com>
>> Cc: alsa-devel@alsa-project.org
>> Signed-off-by: Kees Cook <keescook@chromium.org>
>
> 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
Takashi Iwai Oct. 25, 2017, 10:06 a.m. UTC | #3
On Tue, 24 Oct 2017 22:07:34 +0200,
Kees Cook wrote:
> 
> On Tue, Oct 24, 2017 at 12:25 PM, Takashi Iwai <tiwai@suse.de> wrote:
> > On Tue, 24 Oct 2017 17:35:21 +0200,
> > Kees Cook wrote:
> >>
> >> 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 <perex@perex.cz>
> >> Cc: Takashi Iwai <tiwai@suse.com>
> >> Cc: David Howells <dhowells@redhat.com>
> >> Cc: alsa-devel@alsa-project.org
> >> Signed-off-by: Kees Cook <keescook@chromium.org>
> >
> > 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
Kees Cook Oct. 25, 2017, 10:17 a.m. UTC | #4
On Wed, Oct 25, 2017 at 3:06 AM, Takashi Iwai <tiwai@suse.de> wrote:
> On Tue, 24 Oct 2017 22:07:34 +0200,
> Kees Cook wrote:
>>
>> On Tue, Oct 24, 2017 at 12:25 PM, Takashi Iwai <tiwai@suse.de> wrote:
>> > On Tue, 24 Oct 2017 17:35:21 +0200,
>> > Kees Cook wrote:
>> >>
>> >> 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 <perex@perex.cz>
>> >> Cc: Takashi Iwai <tiwai@suse.com>
>> >> Cc: David Howells <dhowells@redhat.com>
>> >> Cc: alsa-devel@alsa-project.org
>> >> Signed-off-by: Kees Cook <keescook@chromium.org>
>> >
>> > 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.

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
Takashi Iwai Oct. 25, 2017, 10:23 a.m. UTC | #5
On Wed, 25 Oct 2017 12:17:25 +0200,
Kees Cook wrote:
> 
> On Wed, Oct 25, 2017 at 3:06 AM, Takashi Iwai <tiwai@suse.de> wrote:
> > On Tue, 24 Oct 2017 22:07:34 +0200,
> > Kees Cook wrote:
> >>
> >> On Tue, Oct 24, 2017 at 12:25 PM, Takashi Iwai <tiwai@suse.de> wrote:
> >> > On Tue, 24 Oct 2017 17:35:21 +0200,
> >> > Kees Cook wrote:
> >> >>
> >> >> 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 <perex@perex.cz>
> >> >> Cc: Takashi Iwai <tiwai@suse.com>
> >> >> Cc: David Howells <dhowells@redhat.com>
> >> >> Cc: alsa-devel@alsa-project.org
> >> >> Signed-off-by: Kees Cook <keescook@chromium.org>
> >> >
> >> > 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.
> 
> 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
diff mbox

Patch

diff --git a/sound/oss/waveartist.c b/sound/oss/waveartist.c
index 4f0c3a232e41..c051c8e6023e 100644
--- a/sound/oss/waveartist.c
+++ b/sound/oss/waveartist.c
@@ -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;