]> git.proxmox.com Git - mirror_ubuntu-jammy-kernel.git/commitdiff
ALSA: drivers: Convert timers to use timer_setup()
authorKees Cook <keescook@chromium.org>
Tue, 24 Oct 2017 15:34:29 +0000 (08:34 -0700)
committerTakashi Iwai <tiwai@suse.de>
Tue, 24 Oct 2017 19:01:16 +0000 (21:01 +0200)
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.

Signed-off-by: Kees Cook <keescook@chromium.org>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
sound/drivers/aloop.c
sound/drivers/dummy.c
sound/drivers/mpu401/mpu401_uart.c
sound/drivers/mtpav.c
sound/drivers/opl3/opl3_midi.c
sound/drivers/opl3/opl3_seq.c
sound/drivers/opl3/opl3_voice.h
sound/drivers/serial-u16550.c

index 135adb17703cc4992e127f9dc881db1b715206c4..afac886ffa28a7c7cef39bb3c4f5d1ba816e890a 100644 (file)
@@ -529,9 +529,9 @@ static unsigned int loopback_pos_update(struct loopback_cable *cable)
        return running;
 }
 
-static void loopback_timer_function(unsigned long data)
+static void loopback_timer_function(struct timer_list *t)
 {
-       struct loopback_pcm *dpcm = (struct loopback_pcm *)data;
+       struct loopback_pcm *dpcm = from_timer(dpcm, t, timer);
        unsigned long flags;
 
        spin_lock_irqsave(&dpcm->cable->lock, flags);
@@ -675,8 +675,7 @@ static int loopback_open(struct snd_pcm_substream *substream)
        }
        dpcm->loopback = loopback;
        dpcm->substream = substream;
-       setup_timer(&dpcm->timer, loopback_timer_function,
-                   (unsigned long)dpcm);
+       timer_setup(&dpcm->timer, loopback_timer_function, 0);
 
        cable = loopback->cables[substream->number][dev];
        if (!cable) {
index c0939a0164a6ff4c378ffe0863e5b7e265cf46c4..7b2b1f766b00153c7af74c327963ee3eb81ddbcf 100644 (file)
@@ -306,9 +306,9 @@ static int dummy_systimer_prepare(struct snd_pcm_substream *substream)
        return 0;
 }
 
-static void dummy_systimer_callback(unsigned long data)
+static void dummy_systimer_callback(struct timer_list *t)
 {
-       struct dummy_systimer_pcm *dpcm = (struct dummy_systimer_pcm *)data;
+       struct dummy_systimer_pcm *dpcm = from_timer(dpcm, t, timer);
        unsigned long flags;
        int elapsed = 0;
        
@@ -343,8 +343,7 @@ static int dummy_systimer_create(struct snd_pcm_substream *substream)
        if (!dpcm)
                return -ENOMEM;
        substream->runtime->private_data = dpcm;
-       setup_timer(&dpcm->timer, dummy_systimer_callback,
-                       (unsigned long) dpcm);
+       timer_setup(&dpcm->timer, dummy_systimer_callback, 0);
        spin_lock_init(&dpcm->lock);
        dpcm->substream = substream;
        return 0;
index b997222274bd96c4ea88aa0fc83cd6b2cc8567f7..3e745f47dd2fd6b6f0334accd289d5bfbdc7687b 100644 (file)
@@ -169,9 +169,9 @@ EXPORT_SYMBOL(snd_mpu401_uart_interrupt_tx);
  * timer callback
  * reprogram the timer and call the interrupt job
  */
-static void snd_mpu401_uart_timer(unsigned long data)
+static void snd_mpu401_uart_timer(struct timer_list *t)
 {
-       struct snd_mpu401 *mpu = (struct snd_mpu401 *)data;
+       struct snd_mpu401 *mpu = from_timer(mpu, t, timer);
        unsigned long flags;
 
        spin_lock_irqsave(&mpu->timer_lock, flags);
@@ -191,8 +191,7 @@ static void snd_mpu401_uart_add_timer (struct snd_mpu401 *mpu, int input)
 
        spin_lock_irqsave (&mpu->timer_lock, flags);
        if (mpu->timer_invoked == 0) {
-               setup_timer(&mpu->timer, snd_mpu401_uart_timer,
-                           (unsigned long)mpu);
+               timer_setup(&mpu->timer, snd_mpu401_uart_timer, 0);
                mod_timer(&mpu->timer, 1 + jiffies);
        } 
        mpu->timer_invoked |= input ? MPU401_MODE_INPUT_TIMER :
index 0f6392001e307ca008957d0760b76e1083d779ce..547662e02fcc0da1228289afe572b1c0ce416237 100644 (file)
@@ -406,10 +406,10 @@ static void snd_mtpav_input_trigger(struct snd_rawmidi_substream *substream, int
  * timer interrupt for outputs
  */
 
-static void snd_mtpav_output_timer(unsigned long data)
+static void snd_mtpav_output_timer(struct timer_list *t)
 {
        unsigned long flags;
-       struct mtpav *chip = (struct mtpav *)data;
+       struct mtpav *chip = from_timer(chip, t, timer);
        int p;
 
        spin_lock_irqsave(&chip->spinlock, flags);
@@ -707,8 +707,7 @@ static int snd_mtpav_probe(struct platform_device *dev)
        mtp_card->share_irq = 0;
        mtp_card->inmidistate = 0;
        mtp_card->outmidihwport = 0xffffffff;
-       setup_timer(&mtp_card->timer, snd_mtpav_output_timer,
-                   (unsigned long) mtp_card);
+       timer_setup(&mtp_card->timer, snd_mtpav_output_timer, 0);
 
        card->private_free = snd_mtpav_free;
 
index 13c0a7e1bc2b050c2d0a3e98bd1d08cbe5bf7f1a..bb3f3a5a69519c77fd06f7d6480607edf75d0f17 100644 (file)
@@ -238,10 +238,10 @@ static int opl3_get_voice(struct snd_opl3 *opl3, int instr_4op,
 /*
  * System timer interrupt function
  */
-void snd_opl3_timer_func(unsigned long data)
+void snd_opl3_timer_func(struct timer_list *t)
 {
 
-       struct snd_opl3 *opl3 = (struct snd_opl3 *)data;
+       struct snd_opl3 *opl3 = from_timer(opl3, t, tlist);
        unsigned long flags;
        int again = 0;
        int i;
index d3e91be8b23a56f9e08e7c5cabbd83fd82ad7c09..5f881c4cdf1f13043b99c5e1cd4f67773f253ea3 100644 (file)
@@ -248,7 +248,7 @@ static int snd_opl3_seq_probe(struct device *_dev)
        }
 
        /* setup system timer */
-       setup_timer(&opl3->tlist, snd_opl3_timer_func, (unsigned long) opl3);
+       timer_setup(&opl3->tlist, snd_opl3_timer_func, 0);
        spin_lock_init(&opl3->sys_timer_lock);
        opl3->sys_timer_status = 0;
 
index eaef435e0528da8c8112bf5ccfed99d7b634dc54..a2445163008ec14c155a193c93a9e25e4b974b41 100644 (file)
@@ -37,7 +37,7 @@ void snd_opl3_nrpn(void *p, struct snd_midi_channel *chan, struct snd_midi_chann
 void snd_opl3_sysex(void *p, unsigned char *buf, int len, int parsed, struct snd_midi_channel_set *chset);
 
 void snd_opl3_calc_volume(unsigned char *reg, int vel, struct snd_midi_channel *chan);
-void snd_opl3_timer_func(unsigned long data);
+void snd_opl3_timer_func(struct timer_list *t);
 
 /* Prototypes for opl3_drums.c */
 void snd_opl3_load_drums(struct snd_opl3 *opl3);
index 88e66ea0306dd820b82e6339c4e2640ffce426cc..0a67b8b9f176e3f9b7908e62f66c0720d6c642e1 100644 (file)
@@ -309,12 +309,12 @@ static irqreturn_t snd_uart16550_interrupt(int irq, void *dev_id)
 }
 
 /* When the polling mode, this function calls snd_uart16550_io_loop. */
-static void snd_uart16550_buffer_timer(unsigned long data)
+static void snd_uart16550_buffer_timer(struct timer_list *t)
 {
        unsigned long flags;
        struct snd_uart16550 *uart;
 
-       uart = (struct snd_uart16550 *)data;
+       uart = from_timer(uart, t, buffer_timer);
        spin_lock_irqsave(&uart->open_lock, flags);
        snd_uart16550_del_timer(uart);
        snd_uart16550_io_loop(uart);
@@ -828,8 +828,7 @@ static int snd_uart16550_create(struct snd_card *card,
        uart->prev_in = 0;
        uart->rstatus = 0;
        memset(uart->prev_status, 0x80, sizeof(unsigned char) * SNDRV_SERIAL_MAX_OUTS);
-       setup_timer(&uart->buffer_timer, snd_uart16550_buffer_timer,
-                   (unsigned long)uart);
+       timer_setup(&uart->buffer_timer, snd_uart16550_buffer_timer, 0);
        uart->timer_running = 0;
 
        /* Register device */