git: 21e0d2aa35bf - stable/14 - sound: Return if the new speed/format is the same as the current one
- Go to: [ bottom of page ] [ top of archives ] [ this month ]
Date: Tue, 04 Mar 2025 15:47:04 UTC
The branch stable/14 has been updated by christos:
URL: https://cgit.FreeBSD.org/src/commit/?id=21e0d2aa35bf41951f1835eac0dd58be257cbc17
commit 21e0d2aa35bf41951f1835eac0dd58be257cbc17
Author: Christos Margiolis <christos@FreeBSD.org>
AuthorDate: 2025-02-25 11:44:12 +0000
Commit: Christos Margiolis <christos@FreeBSD.org>
CommitDate: 2025-03-04 15:46:06 +0000
sound: Return if the new speed/format is the same as the current one
This gives us a slight performance boost since we do not have to go
through chn_setparam() and the driver functions.
Sponsored by: The FreeBSD Foundation
MFC after: 1 week
Reviewed by: dev_submerge.ch, emaste
Differential Revision: https://reviews.freebsd.org/D48012
(cherry picked from commit 40616b7e41ff96b6d7522445b00f27f26d593a85)
---
sys/dev/sound/pcm/channel.c | 6 ++++++
1 file changed, 6 insertions(+)
diff --git a/sys/dev/sound/pcm/channel.c b/sys/dev/sound/pcm/channel.c
index 19b2db321cee..c3ee50d51c4b 100644
--- a/sys/dev/sound/pcm/channel.c
+++ b/sys/dev/sound/pcm/channel.c
@@ -2110,6 +2110,9 @@ chn_setspeed(struct pcm_channel *c, uint32_t speed)
oldformat = c->format;
oldspeed = c->speed;
+ if (c->speed == speed)
+ return (0);
+
ret = chn_setparam(c, c->format, speed);
if (ret != 0) {
if (snd_verbose > 3)
@@ -2138,6 +2141,9 @@ chn_setformat(struct pcm_channel *c, uint32_t format)
oldformat = c->format;
oldspeed = c->speed;
+ if (c->format == format)
+ return (0);
+
ret = chn_setparam(c, format, c->speed);
if (ret != 0) {
if (snd_verbose > 3)