From nobody Sat Jul 27 11:56:31 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 4WWNPq3wF0z5S6qj; Sat, 27 Jul 2024 11:56:31 +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 4WWNPq2fXPz42xQ; Sat, 27 Jul 2024 11:56:31 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1722081391; 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=ZN3hgcTwFaVtvXqKn2HhZfThC8xVuOO5btoLN6o2wQk=; b=AsfxC2JKnmitUZJzwPSJ1BcLRzDJAo5lTvRfhBrLcX4Xk808ZtUlGLWu3KeCXV1sh8UPJn wW5X6m3XpzmFvAg9+dYVFfk5XXxPC8tFzAbuYZ161BUpD3r4x6hTHQIWnrm39ezloG8vfC 2Ztg7i5vQJunZ7ZqwKhMvw1YL0bP9XuEe+g+Y87IwlDwv0BLgr2Jnkjq6/p4w6+eFafBfj BKpQIfxxTthJpiszXM4GHRMB6qkymzXyr1TOhgkFl/MKP5ogeU4CFql/RpiUOFB4Jahz/J aBI+jXr2nE1uQO6AhkruONUVARNxUOuUKJ/OE26D5pOdi8FigeZ/CeH1K1/WjA== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1722081391; a=rsa-sha256; cv=none; b=ClF0dZlQ3bWC0Zg+qVJ50TtU3qReQpob7+4892/cNYcv8Q/mdoAph8ddMoidloUd8GDBt9 cuUXePP1jKraLfjrFr6LV8R5IpfZTPEhXKEsvZgI93fODp+Z2XMTbCAiH09CnXcSB2ESpQ gA5UrP4wnqQMsRl99/jmoSNRhvEsfPjRBEViEfLhGfyTckkazrP0eTBfUftn/UZRQ/msAY XQvTj7Le0dwnvQJRCeUJccHVYg7MpyOP8i0Z7jXOeya3rrup7bo4X/HojuX6C2umZiin+j 90p/keTYs935SFKYFCt0bgAQlYGHMidK9EUPOQoSPbYk46QGL3ndBoyiG5gXKQ== 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=1722081391; 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=ZN3hgcTwFaVtvXqKn2HhZfThC8xVuOO5btoLN6o2wQk=; b=YwsYoJa4OtCqaW7OsmkhmAKOC/OMVqnV8gm4i9+b1aZ/LzYzAyt95oSyabGZIQ6GSy2LeB sZt2KNX+H2/f775ml3/Ht3iXc2TN7bTOYvhvGnQ0n0uWwXSc6hbeKlIBU6MGwhFQTc/BTO Q2DlC/DNzIVWb2twNlJl2EAitbRLDqdqkfiuFjbNS6ySiDE2dPcxeqmKSJgdGYHtMXe9S9 59r0HsfCrsB60asp3F6wfx0A4nCdavImSZwfpIRhV6rWlyy25S/YCtwS6eFMX7nsmpVd0g GbByZh7L9cAJ4wjq6cxfkXEuPIRLNMJu/MJkxHj6cNWjVq1IsKnSNZZJXy5vtg== 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 4WWNPq2Gfmz15dW; Sat, 27 Jul 2024 11:56:31 +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 46RBuVom040166; Sat, 27 Jul 2024 11:56:31 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.18.1/8.18.1/Submit) id 46RBuVav040163; Sat, 27 Jul 2024 11:56:31 GMT (envelope-from git) Date: Sat, 27 Jul 2024 11:56:31 GMT Message-Id: <202407271156.46RBuVav040163@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Christos Margiolis Subject: git: 00172d20070a - main - 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/main X-Git-Reftype: branch X-Git-Commit: 00172d20070a544e0514cce9f94475c5525fd15e Auto-Submitted: auto-generated The branch main has been updated by christos: URL: https://cgit.FreeBSD.org/src/commit/?id=00172d20070a544e0514cce9f94475c5525fd15e commit 00172d20070a544e0514cce9f94475c5525fd15e Author: Christos Margiolis AuthorDate: 2024-07-27 11:55:57 +0000 Commit: Christos Margiolis CommitDate: 2024-07-27 11:55:57 +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 --- 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"));