Commit 70e90680 authored by Nam Cao's avatar Nam Cao Committed by Takashi Iwai
Browse files

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: default avatarZack Rusin <zack.rusin@broadcom.com>
Signed-off-by: default avatarNam Cao <namcao@linutronix.de>
Cc: Takashi Iwai <tiwai@suse.com>
Link: https://patch.msgid.link/598031332ce738c82286a158cb66eb7e735b2e79.1738746904.git.namcao@linutronix.de


Signed-off-by: default avatarTakashi Iwai <tiwai@suse.de>
parent d7e2447a
Loading
Loading
Loading
Loading
+1 −2
Original line number Diff line number Diff line
@@ -66,9 +66,8 @@ static int snd_hrtimer_open(struct snd_timer *t)
	stime = kzalloc(sizeof(*stime), GFP_KERNEL);
	if (!stime)
		return -ENOMEM;
	hrtimer_init(&stime->hrt, CLOCK_MONOTONIC, HRTIMER_MODE_REL);
	stime->timer = t;
	stime->hrt.function = snd_hrtimer_callback;
	hrtimer_setup(&stime->hrt, snd_hrtimer_callback, CLOCK_MONOTONIC, HRTIMER_MODE_REL);
	t->private_data = stime;
	return 0;
}
+1 −2
Original line number Diff line number Diff line
@@ -457,8 +457,7 @@ static int dummy_hrtimer_create(struct snd_pcm_substream *substream)
	if (!dpcm)
		return -ENOMEM;
	substream->runtime->private_data = dpcm;
	hrtimer_init(&dpcm->timer, CLOCK_MONOTONIC, HRTIMER_MODE_REL_SOFT);
	dpcm->timer.function = dummy_hrtimer_callback;
	hrtimer_setup(&dpcm->timer, dummy_hrtimer_callback, CLOCK_MONOTONIC, HRTIMER_MODE_REL_SOFT);
	dpcm->substream = substream;
	atomic_set(&dpcm->running, 0);
	return 0;
+1 −2
Original line number Diff line number Diff line
@@ -103,8 +103,7 @@ static int snd_card_pcsp_probe(int devnum, struct device *dev)
	if (devnum != 0)
		return -EINVAL;

	hrtimer_init(&pcsp_chip.timer, CLOCK_MONOTONIC, HRTIMER_MODE_REL);
	pcsp_chip.timer.function = pcsp_do_timer;
	hrtimer_setup(&pcsp_chip.timer, pcsp_do_timer, CLOCK_MONOTONIC, HRTIMER_MODE_REL);

	err = snd_devm_card_new(dev, index, id, THIS_MODULE, 0, &card);
	if (err < 0)
+1 −2
Original line number Diff line number Diff line
@@ -312,8 +312,7 @@ static int snd_sh_dac_create(struct snd_card *card,

	chip->card = card;

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

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