* [PATCH] ALSA: sh: aica: Convert timers to use timer_setup()
@ 2017-10-05 0:53 Kees Cook
2017-10-05 6:22 ` Takashi Iwai
0 siblings, 1 reply; 6+ messages in thread
From: Kees Cook @ 2017-10-05 0:53 UTC (permalink / raw)
To: linux-kernel
Cc: Jaroslav Kysela, Takashi Iwai, Bhumika Goyal, Mark Brown,
alsa-devel, Thomas Gleixner
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. This requires adding a pointer to
hold the timer's target substream, as there won't be a way to pass this in
the future.
Cc: Jaroslav Kysela <perex@perex.cz>
Cc: Takashi Iwai <tiwai@suse.com>
Cc: Bhumika Goyal <bhumirks@gmail.com>
Cc: Mark Brown <broonie@kernel.org>
Cc: alsa-devel@alsa-project.org
Cc: Thomas Gleixner <tglx@linutronix.de>
Signed-off-by: Kees Cook <keescook@chromium.org>
---
This requires commit 686fef928bba ("timer: Prepare to change timer
callback argument type") in v4.14-rc3, but should be otherwise
stand-alone.
---
sound/sh/aica.c | 20 +++++++++-----------
1 file changed, 9 insertions(+), 11 deletions(-)
diff --git a/sound/sh/aica.c b/sound/sh/aica.c
index fdc680ae8aa0..2b26311405a4 100644
--- a/sound/sh/aica.c
+++ b/sound/sh/aica.c
@@ -299,14 +299,14 @@ static void run_spu_dma(struct work_struct *work)
}
}
-static void aica_period_elapsed(unsigned long timer_var)
+static void aica_period_elapsed(struct timer_list *t)
{
+ struct snd_card_aica *dreamcastcard = from_timer(dreamcastcard,
+ t, timer);
+ struct snd_pcm_substream *substream = dreamcastcard->timer_substream;
/*timer function - so cannot sleep */
int play_period;
struct snd_pcm_runtime *runtime;
- struct snd_pcm_substream *substream;
- struct snd_card_aica *dreamcastcard;
- substream = (struct snd_pcm_substream *) timer_var;
runtime = substream->runtime;
dreamcastcard = substream->pcm->private_data;
/* Have we played out an additional period? */
@@ -336,12 +336,12 @@ static void spu_begin_dma(struct snd_pcm_substream *substream)
/*get the queue to do the work */
schedule_work(&(dreamcastcard->spu_dma_work));
/* Timer may already be running */
- if (unlikely(dreamcastcard->timer.data)) {
+ if (unlikely(dreamcastcard->timer_substream)) {
mod_timer(&dreamcastcard->timer, jiffies + 4);
return;
}
- setup_timer(&dreamcastcard->timer, aica_period_elapsed,
- (unsigned long) substream);
+ timer_setup(&dreamcastcard->timer, aica_period_elapsed, 0);
+ dreamcastcard->timer_substream = substream;
mod_timer(&dreamcastcard->timer, jiffies + 4);
}
@@ -379,7 +379,7 @@ static int snd_aicapcm_pcm_close(struct snd_pcm_substream
{
struct snd_card_aica *dreamcastcard = substream->pcm->private_data;
flush_work(&(dreamcastcard->spu_dma_work));
- if (dreamcastcard->timer.data)
+ if (dreamcastcard->timer_substream)
del_timer(&dreamcastcard->timer);
kfree(dreamcastcard->channel);
spu_disable();
@@ -600,7 +600,7 @@ static int snd_aica_probe(struct platform_device *devptr)
{
int err;
struct snd_card_aica *dreamcastcard;
- dreamcastcard = kmalloc(sizeof(struct snd_card_aica), GFP_KERNEL);
+ dreamcastcard = kzalloc(sizeof(struct snd_card_aica), GFP_KERNEL);
if (unlikely(!dreamcastcard))
return -ENOMEM;
err = snd_card_new(&devptr->dev, index, SND_AICA_DRIVER,
@@ -619,8 +619,6 @@ static int snd_aica_probe(struct platform_device *devptr)
err = snd_aicapcmchip(dreamcastcard, 0);
if (unlikely(err < 0))
goto freedreamcast;
- dreamcastcard->timer.data = 0;
- dreamcastcard->channel = NULL;
/* Add basic controls */
err = add_aicamixer_controls(dreamcastcard);
if (unlikely(err < 0))
--
2.7.4
--
Kees Cook
Pixel Security
^ permalink raw reply related [flat|nested] 6+ messages in thread
* Re: [PATCH] ALSA: sh: aica: Convert timers to use timer_setup()
2017-10-05 0:53 [PATCH] ALSA: sh: aica: Convert timers to use timer_setup() Kees Cook
@ 2017-10-05 6:22 ` Takashi Iwai
0 siblings, 0 replies; 6+ messages in thread
From: Takashi Iwai @ 2017-10-05 6:22 UTC (permalink / raw)
To: Kees Cook
Cc: linux-kernel, alsa-devel, Bhumika Goyal, Mark Brown,
Thomas Gleixner, Jaroslav Kysela
On Thu, 05 Oct 2017 02:53:36 +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. This requires adding a pointer to
> hold the timer's target substream, as there won't be a way to pass this in
> the future.
>
> Cc: Jaroslav Kysela <perex@perex.cz>
> Cc: Takashi Iwai <tiwai@suse.com>
> Cc: Bhumika Goyal <bhumirks@gmail.com>
> Cc: Mark Brown <broonie@kernel.org>
> Cc: alsa-devel@alsa-project.org
> Cc: Thomas Gleixner <tglx@linutronix.de>
> Signed-off-by: Kees Cook <keescook@chromium.org>
> ---
> This requires commit 686fef928bba ("timer: Prepare to change timer
> callback argument type") in v4.14-rc3, but should be otherwise
> stand-alone.
The conversions look straightforward, so I'm going to apply it (and
other two you posted). But now I wonder why only three were chosen.
Will you keep working on the rest usages in sound/*, or would you
expect us doing the rest?
thanks,
Takashi
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [PATCH] ALSA: sh: aica: Convert timers to use timer_setup()
@ 2017-10-05 6:22 ` Takashi Iwai
0 siblings, 0 replies; 6+ messages in thread
From: Takashi Iwai @ 2017-10-05 6:22 UTC (permalink / raw)
To: Kees Cook
Cc: linux-kernel, alsa-devel, Bhumika Goyal, Mark Brown,
Thomas Gleixner, Jaroslav Kysela
On Thu, 05 Oct 2017 02:53:36 +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. This requires adding a pointer to
> hold the timer's target substream, as there won't be a way to pass this in
> the future.
>
> Cc: Jaroslav Kysela <perex@perex.cz>
> Cc: Takashi Iwai <tiwai@suse.com>
> Cc: Bhumika Goyal <bhumirks@gmail.com>
> Cc: Mark Brown <broonie@kernel.org>
> Cc: alsa-devel@alsa-project.org
> Cc: Thomas Gleixner <tglx@linutronix.de>
> Signed-off-by: Kees Cook <keescook@chromium.org>
> ---
> This requires commit 686fef928bba ("timer: Prepare to change timer
> callback argument type") in v4.14-rc3, but should be otherwise
> stand-alone.
The conversions look straightforward, so I'm going to apply it (and
other two you posted). But now I wonder why only three were chosen.
Will you keep working on the rest usages in sound/*, or would you
expect us doing the rest?
thanks,
Takashi
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [PATCH] ALSA: sh: aica: Convert timers to use timer_setup()
2017-10-05 6:22 ` Takashi Iwai
(?)
@ 2017-10-05 17:17 ` Kees Cook
2017-10-05 17:19 ` Takashi Iwai
-1 siblings, 1 reply; 6+ messages in thread
From: Kees Cook @ 2017-10-05 17:17 UTC (permalink / raw)
To: Takashi Iwai
Cc: LKML, moderated for non-subscribers, Bhumika Goyal, Mark Brown,
Thomas Gleixner, Jaroslav Kysela
On Wed, Oct 4, 2017 at 11:22 PM, Takashi Iwai <tiwai@suse.de> wrote:
> On Thu, 05 Oct 2017 02:53:36 +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. This requires adding a pointer to
>> hold the timer's target substream, as there won't be a way to pass this in
>> the future.
>>
>> Cc: Jaroslav Kysela <perex@perex.cz>
>> Cc: Takashi Iwai <tiwai@suse.com>
>> Cc: Bhumika Goyal <bhumirks@gmail.com>
>> Cc: Mark Brown <broonie@kernel.org>
>> Cc: alsa-devel@alsa-project.org
>> Cc: Thomas Gleixner <tglx@linutronix.de>
>> Signed-off-by: Kees Cook <keescook@chromium.org>
>> ---
>> This requires commit 686fef928bba ("timer: Prepare to change timer
>> callback argument type") in v4.14-rc3, but should be otherwise
>> stand-alone.
>
> The conversions look straightforward, so I'm going to apply it (and
> other two you posted). But now I wonder why only three were chosen.
> Will you keep working on the rest usages in sound/*, or would you
> expect us doing the rest?
Hi, thanks for applying them!
I'm working my way through the "non-trivial" changes first. I have a
coccinelle script that will do a mass-conversion of the common cases.
It's possible that those changes cover the other usages in sound/* or
that I haven't made my way through the others yet (it's a very long
list). I wouldn't object to other people helping with the conversions,
of course. :)
-Kees
--
Kees Cook
Pixel Security
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [PATCH] ALSA: sh: aica: Convert timers to use timer_setup()
2017-10-05 17:17 ` Kees Cook
@ 2017-10-05 17:19 ` Takashi Iwai
0 siblings, 0 replies; 6+ messages in thread
From: Takashi Iwai @ 2017-10-05 17:19 UTC (permalink / raw)
To: Kees Cook
Cc: LKML, moderated for non-subscribers, Bhumika Goyal, Mark Brown,
Thomas Gleixner, Jaroslav Kysela
On Thu, 05 Oct 2017 19:17:16 +0200,
Kees Cook wrote:
>
> On Wed, Oct 4, 2017 at 11:22 PM, Takashi Iwai <tiwai@suse.de> wrote:
> > On Thu, 05 Oct 2017 02:53:36 +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. This requires adding a pointer to
> >> hold the timer's target substream, as there won't be a way to pass this in
> >> the future.
> >>
> >> Cc: Jaroslav Kysela <perex@perex.cz>
> >> Cc: Takashi Iwai <tiwai@suse.com>
> >> Cc: Bhumika Goyal <bhumirks@gmail.com>
> >> Cc: Mark Brown <broonie@kernel.org>
> >> Cc: alsa-devel@alsa-project.org
> >> Cc: Thomas Gleixner <tglx@linutronix.de>
> >> Signed-off-by: Kees Cook <keescook@chromium.org>
> >> ---
> >> This requires commit 686fef928bba ("timer: Prepare to change timer
> >> callback argument type") in v4.14-rc3, but should be otherwise
> >> stand-alone.
> >
> > The conversions look straightforward, so I'm going to apply it (and
> > other two you posted). But now I wonder why only three were chosen.
> > Will you keep working on the rest usages in sound/*, or would you
> > expect us doing the rest?
>
> Hi, thanks for applying them!
>
> I'm working my way through the "non-trivial" changes first. I have a
> coccinelle script that will do a mass-conversion of the common cases.
> It's possible that those changes cover the other usages in sound/* or
> that I haven't made my way through the others yet (it's a very long
> list). I wouldn't object to other people helping with the conversions,
> of course. :)
OK, scripting is a better way, then I'd save my time and wait until
you get more systematic coverage, then :)
thanks,
Takashi
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [PATCH] ALSA: sh: aica: Convert timers to use timer_setup()
@ 2017-10-05 17:19 ` Takashi Iwai
0 siblings, 0 replies; 6+ messages in thread
From: Takashi Iwai @ 2017-10-05 17:19 UTC (permalink / raw)
To: Kees Cook
Cc: moderated for non-subscribers, LKML, Mark Brown, Thomas Gleixner,
Bhumika Goyal
On Thu, 05 Oct 2017 19:17:16 +0200,
Kees Cook wrote:
>
> On Wed, Oct 4, 2017 at 11:22 PM, Takashi Iwai <tiwai@suse.de> wrote:
> > On Thu, 05 Oct 2017 02:53:36 +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. This requires adding a pointer to
> >> hold the timer's target substream, as there won't be a way to pass this in
> >> the future.
> >>
> >> Cc: Jaroslav Kysela <perex@perex.cz>
> >> Cc: Takashi Iwai <tiwai@suse.com>
> >> Cc: Bhumika Goyal <bhumirks@gmail.com>
> >> Cc: Mark Brown <broonie@kernel.org>
> >> Cc: alsa-devel@alsa-project.org
> >> Cc: Thomas Gleixner <tglx@linutronix.de>
> >> Signed-off-by: Kees Cook <keescook@chromium.org>
> >> ---
> >> This requires commit 686fef928bba ("timer: Prepare to change timer
> >> callback argument type") in v4.14-rc3, but should be otherwise
> >> stand-alone.
> >
> > The conversions look straightforward, so I'm going to apply it (and
> > other two you posted). But now I wonder why only three were chosen.
> > Will you keep working on the rest usages in sound/*, or would you
> > expect us doing the rest?
>
> Hi, thanks for applying them!
>
> I'm working my way through the "non-trivial" changes first. I have a
> coccinelle script that will do a mass-conversion of the common cases.
> It's possible that those changes cover the other usages in sound/* or
> that I haven't made my way through the others yet (it's a very long
> list). I wouldn't object to other people helping with the conversions,
> of course. :)
OK, scripting is a better way, then I'd save my time and wait until
you get more systematic coverage, then :)
thanks,
Takashi
^ permalink raw reply [flat|nested] 6+ messages in thread
end of thread, other threads:[~2017-10-05 17:19 UTC | newest]
Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-10-05 0:53 [PATCH] ALSA: sh: aica: Convert timers to use timer_setup() Kees Cook
2017-10-05 6:22 ` Takashi Iwai
2017-10-05 6:22 ` Takashi Iwai
2017-10-05 17:17 ` Kees Cook
2017-10-05 17:19 ` Takashi Iwai
2017-10-05 17:19 ` Takashi Iwai
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.