From nobody Mon Jul 29 15:35:27 2024 X-Original-To: dev-commits-src-all@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 4WXj9X1dZMz5RSVJ; Mon, 29 Jul 2024 15:35:28 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R11" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4WXj9W6qYmz42SV; Mon, 29 Jul 2024 15:35:27 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1722267328; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=sGRJ6aRTsSjZ6KLwdM9LUlWj1kYGnzebEAjrwirOqk4=; b=sInxLJzd3i0w49mxp5JbRE9psBjh9t9UQpZrP8+/HvMUA3zdSJjuiuoodFLzF0JHW1UyNk BO3mKxXIZmTNu23XRLBD1lhs4eTmPcVXPUwsNyIoLt5lNWjVmPMBCLJy5HRVRbp+nrfFoO HmoLnYSlHNPQfRsT3mX9M4mAoDckoWVN60WCmk2k8oxKR0/cU2+K9o9zUJdkizwqD19HV5 T57/xP8xFfuxtSeUDjXpGjBH5ruE0vhyxpckk72w3mb+/PiUOGmjAovXyf+hehXoOETy5i 2thoWjyYutADzS4NJhB4vIc49qjmdbVQYDBvrCOItC0dbaSw2A2H0iYfapSeyw== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1722267328; a=rsa-sha256; cv=none; b=mKCxAtdaY8MtwNIAdAaoBK5sy2dXYk5Ze/E4M1dAXNk9e22CZkQrf3Fb4GoLN0jx7S5XSn j/MZaDrblKi7IMUJWjgJMR1TDPx+D5ZqxKpNXZ5oPsZlUGoULqMTmU0duxrlGGoIFolXJZ OTgDpBUdl8CecAWf3bgBl2YpMq+BXxUKgBwi6Ga71N5GdANh4ud9ET1fXTMRALC/5C9pNe +l6OIbrVdGKpmM4pPlAI5SKmndpIk6mtDLK9ikEWl0Nu+EzOUBllLIjuVH0es3VOHAuYfy 4zdzACXEYkmhd9jBbmSxurlgS4ZTJFH1cjoNna1gZhb29XObQSEIrbQiJ4TLHw== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1722267328; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=sGRJ6aRTsSjZ6KLwdM9LUlWj1kYGnzebEAjrwirOqk4=; b=crVnKsGLWDgLcSpNsw/amM0pwINr6RAh4wYsLFPS8JgtOaqBOxwktrNrhHbHsCNGmmG0/e OJcnwHSafnS4NMkT9Ww4Ye3EGBl8FVkSEVzGyNgUKT3a2oGIPo3RP1jCv7rlLEgKHyz5iA MMU0JJnXxZofwpjG8NbLLvdbHAwzFEQ16Nj3O+DOdMcTSm99dSvMX/zR0rw7WMMgLvz3zz 240sfVVe5QvX1NOHmQfEQPfI85peBRuRZGjjDZ1WN4scyVDGpEh+YmQRE9wOSeuHRWykTW hl0CFidb8inuwV5GQWBbjqBmDhPgIqYyRsuxg+ymacWD5HNjzHFMrXz5xycBow== Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 4WXj9W6Rqpzg3h; Mon, 29 Jul 2024 15:35:27 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.18.1/8.18.1) with ESMTP id 46TFZRWg002713; Mon, 29 Jul 2024 15:35:27 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.18.1/8.18.1/Submit) id 46TFZRNK002710; Mon, 29 Jul 2024 15:35:27 GMT (envelope-from git) Date: Mon, 29 Jul 2024 15:35:27 GMT Message-Id: <202407291535.46TFZRNK002710@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Christos Margiolis Subject: git: a9e27006db60 - stable/14 - sound: Simplify feeder_remove() List-Id: Commit messages for all branches of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-all List-Help: List-Post: List-Subscribe: List-Unsubscribe: X-BeenThere: dev-commits-src-all@freebsd.org Sender: owner-dev-commits-src-all@FreeBSD.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: christos X-Git-Repository: src X-Git-Refname: refs/heads/stable/14 X-Git-Reftype: branch X-Git-Commit: a9e27006db60edc60ffbe650b077abf64a42c025 Auto-Submitted: auto-generated The branch stable/14 has been updated by christos: URL: https://cgit.FreeBSD.org/src/commit/?id=a9e27006db60edc60ffbe650b077abf64a42c025 commit a9e27006db60edc60ffbe650b077abf64a42c025 Author: Christos Margiolis AuthorDate: 2024-07-27 11:55:57 +0000 Commit: Christos Margiolis CommitDate: 2024-07-29 15:34:55 +0000 sound: Simplify feeder_remove() Sponsored by: The FreeBSD Foundation MFC after: 2 days Reviewed by: dev_submerge.ch, markj, emaste Differential Revision: https://reviews.freebsd.org/D46100 (cherry picked from commit 00172d20070a544e0514cce9f94475c5525fd15e) --- sys/dev/sound/pcm/channel.c | 6 ++---- sys/dev/sound/pcm/feeder.c | 14 ++++++-------- sys/dev/sound/pcm/feeder.h | 2 +- sys/dev/sound/pcm/feeder_chain.c | 3 +-- 4 files changed, 10 insertions(+), 15 deletions(-) diff --git a/sys/dev/sound/pcm/channel.c b/sys/dev/sound/pcm/channel.c index ce4fb7222ddb..e0fd24805a21 100644 --- a/sys/dev/sound/pcm/channel.c +++ b/sys/dev/sound/pcm/channel.c @@ -1324,8 +1324,7 @@ chn_init(struct snddev_info *d, struct pcm_channel *parent, kobj_class_t cls, return (c); fail: - while (feeder_remove(c) == 0) - ; + feeder_remove(c); if (c->devinfo && CHANNEL_FREE(c->methods, c->devinfo)) sndbuf_free(b); if (bs) @@ -1356,8 +1355,7 @@ chn_kill(struct pcm_channel *c) chn_trigger(c, PCMTRIG_ABORT); CHN_UNLOCK(c); } - while (feeder_remove(c) == 0) - ; + feeder_remove(c); if (CHANNEL_FREE(c->methods, c->devinfo)) sndbuf_free(b); sndbuf_destroy(bs); diff --git a/sys/dev/sound/pcm/feeder.c b/sys/dev/sound/pcm/feeder.c index ad6966331f02..716eb07feaae 100644 --- a/sys/dev/sound/pcm/feeder.c +++ b/sys/dev/sound/pcm/feeder.c @@ -248,18 +248,16 @@ feeder_add(struct pcm_channel *c, struct feeder_class *fc, struct pcm_feederdesc return 0; } -int +void feeder_remove(struct pcm_channel *c) { struct pcm_feeder *f; - if (c->feeder == NULL) - return -1; - f = c->feeder; - c->feeder = c->feeder->source; - feeder_destroy(f); - - return 0; + while (c->feeder != NULL) { + f = c->feeder; + c->feeder = c->feeder->source; + feeder_destroy(f); + } } struct pcm_feeder * diff --git a/sys/dev/sound/pcm/feeder.h b/sys/dev/sound/pcm/feeder.h index f2a865d3d2f9..1e240d934e94 100644 --- a/sys/dev/sound/pcm/feeder.h +++ b/sys/dev/sound/pcm/feeder.h @@ -60,7 +60,7 @@ u_int32_t snd_fmtbest(u_int32_t fmt, u_int32_t *fmts); int feeder_add(struct pcm_channel *c, struct feeder_class *fc, struct pcm_feederdesc *desc); -int feeder_remove(struct pcm_channel *c); +void feeder_remove(struct pcm_channel *c); struct pcm_feeder *feeder_find(struct pcm_channel *c, u_int32_t type); void feeder_printchain(struct pcm_feeder *head); int feeder_chain(struct pcm_channel *); diff --git a/sys/dev/sound/pcm/feeder_chain.c b/sys/dev/sound/pcm/feeder_chain.c index 555cd86d60e5..588bae2ff281 100644 --- a/sys/dev/sound/pcm/feeder_chain.c +++ b/sys/dev/sound/pcm/feeder_chain.c @@ -588,8 +588,7 @@ feeder_chain(struct pcm_channel *c) CHN_LOCKASSERT(c); /* Remove everything first. */ - while (feeder_remove(c) == 0) - ; + feeder_remove(c); KASSERT(c->feeder == NULL, ("feeder chain not empty"));