ALSA: sh: aica: 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. 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. Signed-off-by: Kees Cook <keescook@chromium.org> Signed-off-by: Takashi Iwai <tiwai@suse.de>
This commit is contained in:
parent
9e66317d3c
commit
d522bb6a10
@ -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 */
|
/*timer function - so cannot sleep */
|
||||||
int play_period;
|
int play_period;
|
||||||
struct snd_pcm_runtime *runtime;
|
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;
|
runtime = substream->runtime;
|
||||||
dreamcastcard = substream->pcm->private_data;
|
dreamcastcard = substream->pcm->private_data;
|
||||||
/* Have we played out an additional period? */
|
/* 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 */
|
/*get the queue to do the work */
|
||||||
schedule_work(&(dreamcastcard->spu_dma_work));
|
schedule_work(&(dreamcastcard->spu_dma_work));
|
||||||
/* Timer may already be running */
|
/* Timer may already be running */
|
||||||
if (unlikely(dreamcastcard->timer.data)) {
|
if (unlikely(dreamcastcard->timer_substream)) {
|
||||||
mod_timer(&dreamcastcard->timer, jiffies + 4);
|
mod_timer(&dreamcastcard->timer, jiffies + 4);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
setup_timer(&dreamcastcard->timer, aica_period_elapsed,
|
timer_setup(&dreamcastcard->timer, aica_period_elapsed, 0);
|
||||||
(unsigned long) substream);
|
dreamcastcard->timer_substream = substream;
|
||||||
mod_timer(&dreamcastcard->timer, jiffies + 4);
|
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;
|
struct snd_card_aica *dreamcastcard = substream->pcm->private_data;
|
||||||
flush_work(&(dreamcastcard->spu_dma_work));
|
flush_work(&(dreamcastcard->spu_dma_work));
|
||||||
if (dreamcastcard->timer.data)
|
if (dreamcastcard->timer_substream)
|
||||||
del_timer(&dreamcastcard->timer);
|
del_timer(&dreamcastcard->timer);
|
||||||
kfree(dreamcastcard->channel);
|
kfree(dreamcastcard->channel);
|
||||||
spu_disable();
|
spu_disable();
|
||||||
@ -600,7 +600,7 @@ static int snd_aica_probe(struct platform_device *devptr)
|
|||||||
{
|
{
|
||||||
int err;
|
int err;
|
||||||
struct snd_card_aica *dreamcastcard;
|
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))
|
if (unlikely(!dreamcastcard))
|
||||||
return -ENOMEM;
|
return -ENOMEM;
|
||||||
err = snd_card_new(&devptr->dev, index, SND_AICA_DRIVER,
|
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);
|
err = snd_aicapcmchip(dreamcastcard, 0);
|
||||||
if (unlikely(err < 0))
|
if (unlikely(err < 0))
|
||||||
goto freedreamcast;
|
goto freedreamcast;
|
||||||
dreamcastcard->timer.data = 0;
|
|
||||||
dreamcastcard->channel = NULL;
|
|
||||||
/* Add basic controls */
|
/* Add basic controls */
|
||||||
err = add_aicamixer_controls(dreamcastcard);
|
err = add_aicamixer_controls(dreamcastcard);
|
||||||
if (unlikely(err < 0))
|
if (unlikely(err < 0))
|
||||||
|
Loading…
Reference in New Issue
Block a user