]> git.ipfire.org Git - thirdparty/linux.git/commitdiff
ALSA: Switch to use hrtimer_setup()
authorNam Cao <namcao@linutronix.de>
Wed, 5 Feb 2025 10:46:33 +0000 (11:46 +0100)
committerTakashi Iwai <tiwai@suse.de>
Mon, 10 Feb 2025 08:26:31 +0000 (09:26 +0100)
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>
sound/core/hrtimer.c
sound/drivers/dummy.c
sound/drivers/pcsp/pcsp.c
sound/sh/sh_dac_audio.c

index 147c1fea4708efe3bb3d1f7faed8923633f49e9c..e9c60dce59fbfabcbf799450c8ca85d49fc2896c 100644 (file)
@@ -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;
 }
index 8f5df9b3aaaaa57922c312b7c088c3197d992e9c..c1a3efb633c53113292efe61a2274e9301ad7661 100644 (file)
@@ -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;
index 78c9b1c7590f51fdcd6682ea2c24a33b2ea56d77..e8482c2290c3dfbf1d3ed560380b152f67abf21c 100644 (file)
@@ -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)
index 3f5422145c5e248d19d50f383fd92e002e4e9eb0..84a4b17a0cc236695e7fb9c7c27b3ed1aa5d16e1 100644 (file)
@@ -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;