ALSA: usb-audio: 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. Signed-off-by: Kees Cook <keescook@chromium.org> Signed-off-by: Takashi Iwai <tiwai@suse.de>
This commit is contained in:
Родитель
0011a33f09
Коммит
a6162afa71
|
@ -199,9 +199,9 @@ static int line6_send_raw_message_async_part(struct message *msg,
|
|||
Setup and start timer.
|
||||
*/
|
||||
void line6_start_timer(struct timer_list *timer, unsigned long msecs,
|
||||
void (*function)(unsigned long), unsigned long data)
|
||||
void (*function)(struct timer_list *t))
|
||||
{
|
||||
setup_timer(timer, function, data);
|
||||
timer->function = (TIMER_FUNC_TYPE)function;
|
||||
mod_timer(timer, jiffies + msecs_to_jiffies(msecs));
|
||||
}
|
||||
EXPORT_SYMBOL_GPL(line6_start_timer);
|
||||
|
|
|
@ -198,8 +198,7 @@ extern int line6_send_sysex_message(struct usb_line6 *line6,
|
|||
extern ssize_t line6_set_raw(struct device *dev, struct device_attribute *attr,
|
||||
const char *buf, size_t count);
|
||||
extern void line6_start_timer(struct timer_list *timer, unsigned long msecs,
|
||||
void (*function)(unsigned long),
|
||||
unsigned long data);
|
||||
void (*function)(struct timer_list *t));
|
||||
extern int line6_version_request_async(struct usb_line6 *line6);
|
||||
extern int line6_write_data(struct usb_line6 *line6, unsigned address,
|
||||
void *data, unsigned datalen);
|
||||
|
|
|
@ -174,7 +174,7 @@ static const char pod_version_header[] = {
|
|||
};
|
||||
|
||||
/* forward declarations: */
|
||||
static void pod_startup2(unsigned long data);
|
||||
static void pod_startup2(struct timer_list *t);
|
||||
static void pod_startup3(struct usb_line6_pod *pod);
|
||||
|
||||
static char *pod_alloc_sysex_buffer(struct usb_line6_pod *pod, int code,
|
||||
|
@ -286,13 +286,12 @@ static void pod_startup1(struct usb_line6_pod *pod)
|
|||
CHECK_STARTUP_PROGRESS(pod->startup_progress, POD_STARTUP_INIT);
|
||||
|
||||
/* delay startup procedure: */
|
||||
line6_start_timer(&pod->startup_timer, POD_STARTUP_DELAY, pod_startup2,
|
||||
(unsigned long)pod);
|
||||
line6_start_timer(&pod->startup_timer, POD_STARTUP_DELAY, pod_startup2);
|
||||
}
|
||||
|
||||
static void pod_startup2(unsigned long data)
|
||||
static void pod_startup2(struct timer_list *t)
|
||||
{
|
||||
struct usb_line6_pod *pod = (struct usb_line6_pod *)data;
|
||||
struct usb_line6_pod *pod = from_timer(pod, t, startup_timer);
|
||||
struct usb_line6 *line6 = &pod->line6;
|
||||
|
||||
CHECK_STARTUP_PROGRESS(pod->startup_progress, POD_STARTUP_VERSIONREQ);
|
||||
|
@ -413,7 +412,7 @@ static int pod_init(struct usb_line6 *line6,
|
|||
line6->process_message = line6_pod_process_message;
|
||||
line6->disconnect = line6_pod_disconnect;
|
||||
|
||||
init_timer(&pod->startup_timer);
|
||||
timer_setup(&pod->startup_timer, NULL, 0);
|
||||
INIT_WORK(&pod->startup_work, pod_startup4);
|
||||
|
||||
/* create sysfs entries: */
|
||||
|
|
|
@ -158,7 +158,7 @@ static struct line6_pcm_properties podx3_pcm_properties = {
|
|||
};
|
||||
static struct usb_driver podhd_driver;
|
||||
|
||||
static void podhd_startup_start_workqueue(unsigned long data);
|
||||
static void podhd_startup_start_workqueue(struct timer_list *t);
|
||||
static void podhd_startup_workqueue(struct work_struct *work);
|
||||
static int podhd_startup_finalize(struct usb_line6_podhd *pod);
|
||||
|
||||
|
@ -208,12 +208,12 @@ static void podhd_startup(struct usb_line6_podhd *pod)
|
|||
|
||||
/* delay startup procedure: */
|
||||
line6_start_timer(&pod->startup_timer, PODHD_STARTUP_DELAY,
|
||||
podhd_startup_start_workqueue, (unsigned long)pod);
|
||||
podhd_startup_start_workqueue);
|
||||
}
|
||||
|
||||
static void podhd_startup_start_workqueue(unsigned long data)
|
||||
static void podhd_startup_start_workqueue(struct timer_list *t)
|
||||
{
|
||||
struct usb_line6_podhd *pod = (struct usb_line6_podhd *)data;
|
||||
struct usb_line6_podhd *pod = from_timer(pod, t, startup_timer);
|
||||
|
||||
CHECK_STARTUP_PROGRESS(pod->startup_progress,
|
||||
PODHD_STARTUP_SCHEDULE_WORKQUEUE);
|
||||
|
@ -319,7 +319,7 @@ static int podhd_init(struct usb_line6 *line6,
|
|||
|
||||
line6->disconnect = podhd_disconnect;
|
||||
|
||||
init_timer(&pod->startup_timer);
|
||||
timer_setup(&pod->startup_timer, NULL, 0);
|
||||
INIT_WORK(&pod->startup_work, podhd_startup_workqueue);
|
||||
|
||||
if (pod->line6.properties->capabilities & LINE6_CAP_CONTROL) {
|
||||
|
|
|
@ -241,9 +241,9 @@ static int snd_toneport_source_put(struct snd_kcontrol *kcontrol,
|
|||
return 1;
|
||||
}
|
||||
|
||||
static void toneport_start_pcm(unsigned long arg)
|
||||
static void toneport_start_pcm(struct timer_list *t)
|
||||
{
|
||||
struct usb_line6_toneport *toneport = (struct usb_line6_toneport *)arg;
|
||||
struct usb_line6_toneport *toneport = from_timer(toneport, t, timer);
|
||||
struct usb_line6 *line6 = &toneport->line6;
|
||||
|
||||
line6_pcm_acquire(line6->line6pcm, LINE6_STREAM_MONITOR, true);
|
||||
|
@ -415,8 +415,7 @@ static int toneport_init(struct usb_line6 *line6,
|
|||
struct usb_line6_toneport *toneport = (struct usb_line6_toneport *) line6;
|
||||
|
||||
toneport->type = id->driver_info;
|
||||
setup_timer(&toneport->timer, toneport_start_pcm,
|
||||
(unsigned long)toneport);
|
||||
timer_setup(&toneport->timer, toneport_start_pcm, 0);
|
||||
|
||||
line6->disconnect = line6_toneport_disconnect;
|
||||
|
||||
|
|
|
@ -82,9 +82,9 @@ static const char variax_activate[] = {
|
|||
};
|
||||
|
||||
/* forward declarations: */
|
||||
static void variax_startup2(unsigned long data);
|
||||
static void variax_startup4(unsigned long data);
|
||||
static void variax_startup5(unsigned long data);
|
||||
static void variax_startup2(struct timer_list *t);
|
||||
static void variax_startup4(struct timer_list *t);
|
||||
static void variax_startup5(struct timer_list *t);
|
||||
|
||||
static void variax_activate_async(struct usb_line6_variax *variax, int a)
|
||||
{
|
||||
|
@ -106,12 +106,12 @@ static void variax_startup1(struct usb_line6_variax *variax)
|
|||
|
||||
/* delay startup procedure: */
|
||||
line6_start_timer(&variax->startup_timer1, VARIAX_STARTUP_DELAY1,
|
||||
variax_startup2, (unsigned long)variax);
|
||||
variax_startup2);
|
||||
}
|
||||
|
||||
static void variax_startup2(unsigned long data)
|
||||
static void variax_startup2(struct timer_list *t)
|
||||
{
|
||||
struct usb_line6_variax *variax = (struct usb_line6_variax *)data;
|
||||
struct usb_line6_variax *variax = from_timer(variax, t, startup_timer1);
|
||||
struct usb_line6 *line6 = &variax->line6;
|
||||
|
||||
/* schedule another startup procedure until startup is complete: */
|
||||
|
@ -120,7 +120,7 @@ static void variax_startup2(unsigned long data)
|
|||
|
||||
variax->startup_progress = VARIAX_STARTUP_VERSIONREQ;
|
||||
line6_start_timer(&variax->startup_timer1, VARIAX_STARTUP_DELAY1,
|
||||
variax_startup2, (unsigned long)variax);
|
||||
variax_startup2);
|
||||
|
||||
/* request firmware version: */
|
||||
line6_version_request_async(line6);
|
||||
|
@ -132,12 +132,12 @@ static void variax_startup3(struct usb_line6_variax *variax)
|
|||
|
||||
/* delay startup procedure: */
|
||||
line6_start_timer(&variax->startup_timer2, VARIAX_STARTUP_DELAY3,
|
||||
variax_startup4, (unsigned long)variax);
|
||||
variax_startup4);
|
||||
}
|
||||
|
||||
static void variax_startup4(unsigned long data)
|
||||
static void variax_startup4(struct timer_list *t)
|
||||
{
|
||||
struct usb_line6_variax *variax = (struct usb_line6_variax *)data;
|
||||
struct usb_line6_variax *variax = from_timer(variax, t, startup_timer2);
|
||||
|
||||
CHECK_STARTUP_PROGRESS(variax->startup_progress,
|
||||
VARIAX_STARTUP_ACTIVATE);
|
||||
|
@ -145,12 +145,12 @@ static void variax_startup4(unsigned long data)
|
|||
/* activate device: */
|
||||
variax_activate_async(variax, 1);
|
||||
line6_start_timer(&variax->startup_timer2, VARIAX_STARTUP_DELAY4,
|
||||
variax_startup5, (unsigned long)variax);
|
||||
variax_startup5);
|
||||
}
|
||||
|
||||
static void variax_startup5(unsigned long data)
|
||||
static void variax_startup5(struct timer_list *t)
|
||||
{
|
||||
struct usb_line6_variax *variax = (struct usb_line6_variax *)data;
|
||||
struct usb_line6_variax *variax = from_timer(variax, t, startup_timer2);
|
||||
|
||||
CHECK_STARTUP_PROGRESS(variax->startup_progress,
|
||||
VARIAX_STARTUP_WORKQUEUE);
|
||||
|
@ -190,7 +190,7 @@ static void line6_variax_process_message(struct usb_line6 *line6)
|
|||
} else if (memcmp(buf + 1, variax_init_done + 1,
|
||||
sizeof(variax_init_done) - 1) == 0) {
|
||||
/* notify of complete initialization: */
|
||||
variax_startup4((unsigned long)variax);
|
||||
variax_startup4(&variax->startup_timer2);
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
@ -222,8 +222,8 @@ static int variax_init(struct usb_line6 *line6,
|
|||
line6->process_message = line6_variax_process_message;
|
||||
line6->disconnect = line6_variax_disconnect;
|
||||
|
||||
init_timer(&variax->startup_timer1);
|
||||
init_timer(&variax->startup_timer2);
|
||||
timer_setup(&variax->startup_timer1, NULL, 0);
|
||||
timer_setup(&variax->startup_timer2, NULL, 0);
|
||||
INIT_WORK(&variax->startup_work, variax_startup6);
|
||||
|
||||
/* initialize USB buffers: */
|
||||
|
|
|
@ -352,9 +352,9 @@ static void snd_usbmidi_out_tasklet(unsigned long data)
|
|||
}
|
||||
|
||||
/* called after transfers had been interrupted due to some USB error */
|
||||
static void snd_usbmidi_error_timer(unsigned long data)
|
||||
static void snd_usbmidi_error_timer(struct timer_list *t)
|
||||
{
|
||||
struct snd_usb_midi *umidi = (struct snd_usb_midi *)data;
|
||||
struct snd_usb_midi *umidi = from_timer(umidi, t, error_timer);
|
||||
unsigned int i, j;
|
||||
|
||||
spin_lock(&umidi->disc_lock);
|
||||
|
@ -2369,8 +2369,7 @@ int __snd_usbmidi_create(struct snd_card *card,
|
|||
usb_id = USB_ID(le16_to_cpu(umidi->dev->descriptor.idVendor),
|
||||
le16_to_cpu(umidi->dev->descriptor.idProduct));
|
||||
umidi->usb_id = usb_id;
|
||||
setup_timer(&umidi->error_timer, snd_usbmidi_error_timer,
|
||||
(unsigned long)umidi);
|
||||
timer_setup(&umidi->error_timer, snd_usbmidi_error_timer, 0);
|
||||
|
||||
/* detect the endpoint(s) to use */
|
||||
memset(endpoints, 0, sizeof(endpoints));
|
||||
|
|
Загрузка…
Ссылка в новой задаче