Skip to content

Commit 70e9068

Browse files
covanamtiwai
authored andcommitted
ALSA: Switch to use hrtimer_setup()
hrtimer_setup() takes the callback function pointer as argument and initializes the timer completely. Replace hrtimer_init() and the open coded initialization of hrtimer::function with the new setup mechanism. Patch was created by using Coccinelle. Acked-by: Zack Rusin <zack.rusin@broadcom.com> Signed-off-by: Nam Cao <namcao@linutronix.de> Cc: Takashi Iwai <tiwai@suse.com> Link: https://patch.msgid.link/598031332ce738c82286a158cb66eb7e735b2e79.1738746904.git.namcao@linutronix.de Signed-off-by: Takashi Iwai <tiwai@suse.de>
1 parent d7e2447 commit 70e9068

File tree

4 files changed

+4
-8
lines changed

4 files changed

+4
-8
lines changed

sound/core/hrtimer.c

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -66,9 +66,8 @@ static int snd_hrtimer_open(struct snd_timer *t)
6666
stime = kzalloc(sizeof(*stime), GFP_KERNEL);
6767
if (!stime)
6868
return -ENOMEM;
69-
hrtimer_init(&stime->hrt, CLOCK_MONOTONIC, HRTIMER_MODE_REL);
7069
stime->timer = t;
71-
stime->hrt.function = snd_hrtimer_callback;
70+
hrtimer_setup(&stime->hrt, snd_hrtimer_callback, CLOCK_MONOTONIC, HRTIMER_MODE_REL);
7271
t->private_data = stime;
7372
return 0;
7473
}

sound/drivers/dummy.c

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -457,8 +457,7 @@ static int dummy_hrtimer_create(struct snd_pcm_substream *substream)
457457
if (!dpcm)
458458
return -ENOMEM;
459459
substream->runtime->private_data = dpcm;
460-
hrtimer_init(&dpcm->timer, CLOCK_MONOTONIC, HRTIMER_MODE_REL_SOFT);
461-
dpcm->timer.function = dummy_hrtimer_callback;
460+
hrtimer_setup(&dpcm->timer, dummy_hrtimer_callback, CLOCK_MONOTONIC, HRTIMER_MODE_REL_SOFT);
462461
dpcm->substream = substream;
463462
atomic_set(&dpcm->running, 0);
464463
return 0;

sound/drivers/pcsp/pcsp.c

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -103,8 +103,7 @@ static int snd_card_pcsp_probe(int devnum, struct device *dev)
103103
if (devnum != 0)
104104
return -EINVAL;
105105

106-
hrtimer_init(&pcsp_chip.timer, CLOCK_MONOTONIC, HRTIMER_MODE_REL);
107-
pcsp_chip.timer.function = pcsp_do_timer;
106+
hrtimer_setup(&pcsp_chip.timer, pcsp_do_timer, CLOCK_MONOTONIC, HRTIMER_MODE_REL);
108107

109108
err = snd_devm_card_new(dev, index, id, THIS_MODULE, 0, &card);
110109
if (err < 0)

sound/sh/sh_dac_audio.c

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -312,8 +312,7 @@ static int snd_sh_dac_create(struct snd_card *card,
312312

313313
chip->card = card;
314314

315-
hrtimer_init(&chip->hrtimer, CLOCK_MONOTONIC, HRTIMER_MODE_REL);
316-
chip->hrtimer.function = sh_dac_audio_timer;
315+
hrtimer_setup(&chip->hrtimer, sh_dac_audio_timer, CLOCK_MONOTONIC, HRTIMER_MODE_REL);
317316

318317
dac_audio_reset(chip);
319318
chip->rate = 8000;

0 commit comments

Comments
 (0)