From: Ivan Orlov <ivan.orlov0322@gmail.com>
To: Christophe JAILLET <christophe.jaillet@wanadoo.fr>,
perex@perex.cz, tiwai@suse.com, corbet@lwn.net,
broonie@kernel.org, shuah@kernel.org
Cc: linux-kselftest@vger.kernel.org, linux-doc@vger.kernel.org,
linux-sound@vger.kernel.org, linux-kernel@vger.kernel.org,
aholzinger@gmx.de
Subject: Re: [PATCH 3/4] ALSA: timer: Introduce virtual userspace-driven timers
Date: Sun, 28 Jul 2024 09:49:03 +0100 [thread overview]
Message-ID: <b45e7719-3ffa-48d9-bac5-a33db3c4e589@gmail.com> (raw)
In-Reply-To: <6b0a39f4-1a0c-4e3e-955e-31bbb33ba54a@wanadoo.fr>
On 7/28/24 07:52, Christophe JAILLET wrote:
> Hi,
>
Hi Christophe,
> ...
>
>> diff --git a/sound/core/Kconfig b/sound/core/Kconfig
>> index b970a1734647..3cf82641fc67 100644
>> --- a/sound/core/Kconfig
>> +++ b/sound/core/Kconfig
>> @@ -251,6 +251,17 @@ config SND_JACK_INJECTION_DEBUG
>> Say Y if you are debugging via jack injection interface.
>> If unsure select "N".
>> +config SND_UTIMER
>> + bool "Enable support for userspace-controlled virtual timers"
>> + depends on SND_TIMER
>> + help
>> + Say Y to enable the support of userspace-controlled timers. These
>> + timers are purely virtual, and they are supposed to be triggered
>> + from userspace. They could be quite useful when synchronizing the
>> + sound timing with userspace applications (for instance, when
>> sending
>> + data through snd-aloop).
>> +
>
> Unneeded extra new line.
>
>> +
>> config SND_VMASTER
>> bool
>
> ...
>
>> +static void snd_utimer_free(struct snd_utimer *utimer)
>> +{
>> + snd_timer_free(utimer->timer);
>> + snd_utimer_put_id(utimer);
>
> Missing kfree(utimer->name); ?
>
Yeah, it definitely should be here... Thank you for finding this!
>> + kfree(utimer);
>> +}
>
> ...
>
>> +static int snd_utimer_create(struct snd_utimer_info *utimer_info,
>> + struct snd_utimer **r_utimer)
>> +{
>> + struct snd_utimer *utimer;
>> + struct snd_timer *timer;
>> + struct snd_timer_id tid;
>> + int utimer_id;
>> + int err = 0;
>> + char *timer_name;
>> +
>> + utimer = kzalloc(sizeof(*utimer), GFP_KERNEL);
>> + if (!utimer)
>> + return -ENOMEM;
>> +
>> + timer_name = kzalloc(SNDRV_UTIMER_NAME_LEN, GFP_KERNEL);
>
> kasprintf(GFP_KERNEL, "snd-utimer%d", utimer_id); ?
> and SNDRV_UTIMER_NAME_LEN becomes useless too.
>
> In snd_timer_new() it is copied in a char[64] anyway, and if utimer_id
> is small, we could even save a few bytes of memory.
>
Wow, cool, I haven't heard of kasprintf but now I'll use it here in V2.
Thanks!
--
Kind regards,
Ivan Orlov
next prev parent reply other threads:[~2024-07-28 8:49 UTC|newest]
Thread overview: 14+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-07-26 7:47 [PATCH 0/4] Introduce userspace-driven ALSA timers Ivan Orlov
2024-07-26 7:47 ` [PATCH 1/4] ALSA: aloop: Allow using global timers Ivan Orlov
2024-07-26 7:47 ` [PATCH 2/4] Docs/sound: Add documentation for userspace-driven ALSA timers Ivan Orlov
2024-07-26 7:47 ` [PATCH 3/4] ALSA: timer: Introduce virtual userspace-driven timers Ivan Orlov
2024-07-28 6:52 ` Christophe JAILLET
2024-07-28 8:49 ` Ivan Orlov [this message]
2024-07-28 6:59 ` Christophe JAILLET
2024-07-28 8:51 ` Ivan Orlov
2024-07-28 9:30 ` Christophe JAILLET
2024-07-28 9:42 ` Ivan Orlov
2024-07-28 10:29 ` Christophe JAILLET
2024-07-28 11:54 ` Ivan Orlov
2024-07-26 7:47 ` [PATCH 4/4] selftests: ALSA: Cover userspace-driven timers with test Ivan Orlov
2024-07-28 6:10 ` kernel test robot
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=b45e7719-3ffa-48d9-bac5-a33db3c4e589@gmail.com \
--to=ivan.orlov0322@gmail.com \
--cc=aholzinger@gmx.de \
--cc=broonie@kernel.org \
--cc=christophe.jaillet@wanadoo.fr \
--cc=corbet@lwn.net \
--cc=linux-doc@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-kselftest@vger.kernel.org \
--cc=linux-sound@vger.kernel.org \
--cc=perex@perex.cz \
--cc=shuah@kernel.org \
--cc=tiwai@suse.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.