From nobody Wed Feb 11 03:02:38 2026 Received: from mailtransmit05.runbox.com (mailtransmit05.runbox.com [185.226.149.38]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 9A00721B9DB for ; Wed, 30 Apr 2025 09:11:29 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=185.226.149.38 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1746004291; cv=none; b=DD/h9JNLNuAYuaU3wyMrcbmDgBP8G+WRcu80wxQrykPKU4jPf68puy5EnVPhQuGYjoEKT/uUdXGkYCfAHs2NH8ep5qRPFQpsS2QUy78JJDjUWx34AgJJV2bYNqror12T9jhfdwYCW1V5A72bBvK1CAFqiY6Luto9mTs4r6boNLc= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1746004291; c=relaxed/simple; bh=QOwQWEPmSdsZ1l9v4+trXRCmhOBbQz5fJN9ec4tju+o=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=M63ub2ZJL2pnXgmuvAq4wn+Hn8HEsW3nJvY0wlWDqzg8PFK2B0FzsC1p+DAq69CokUdHR452iBfRW0yPsuVcifZjK0KvzLtwW+V7J/plfBzXWTwC8DOk0duMzCOOFu87e6s5W3RcDfMtpGbDnv/G1mkiY8TCW7iURxCJVZrcpB8= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=rbox.co; spf=pass smtp.mailfrom=rbox.co; dkim=pass (2048-bit key) header.d=rbox.co header.i=@rbox.co header.b=TWoSFyl9; arc=none smtp.client-ip=185.226.149.38 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=rbox.co Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=rbox.co Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=rbox.co header.i=@rbox.co header.b="TWoSFyl9" Received: from mailtransmit02.runbox ([10.9.9.162] helo=aibo.runbox.com) by mailtransmit05.runbox.com with esmtps (TLS1.2) tls TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256 (Exim 4.93) (envelope-from ) id 1uA3TN-008kiS-NS; Wed, 30 Apr 2025 11:11:21 +0200 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=rbox.co; s=selector1; h=Cc:To:In-Reply-To:References:Message-Id: Content-Transfer-Encoding:Content-Type:MIME-Version:Subject:Date:From; bh=+AFO0qPjos/NBG+JIX67V5Put3nuZOLxt4o4r9L7j7Q=; b=TWoSFyl9JCvkFqqVgMifYk2NCN V2SKHzuEZFd5KrOEnxRbTKosBvU+O2HzL+ctgTvj/4JEOo6zqIa1ueNucO4V2a6bAebkSWPqFYjT4 1Y2H58Sts+tYlWgw+aPCHTQtrKXGpj3r0yKCWENpXe70M3vstPALmUdtZ+xDkEPIXj//VC6B9iKRX Toku4ZPOeWDJk+K1h4HVvq4b9nKVq5xccuuGUPJWihDTZFlzyxrhmLlg/oKopkBaNAfgxb3OtRFAj Q6nTfuPguJBhb9yb76hyCZp4RlP1sEKbd7qncKJLDkS9/rESuTdtopRrS9X9xODpWNuRiScuBRaAL Ceujdtyw==; Received: from [10.9.9.72] (helo=submission01.runbox) by mailtransmit02.runbox with esmtp (Exim 4.86_2) (envelope-from ) id 1uA3TN-0006Ay-Bx; Wed, 30 Apr 2025 11:11:21 +0200 Received: by submission01.runbox with esmtpsa [Authenticated ID (604044)] (TLS1.2:ECDHE_SECP256R1__RSA_PSS_RSAE_SHA256__AES_256_GCM:256) (Exim 4.93) id 1uA3TH-00CDEV-HR; Wed, 30 Apr 2025 11:11:15 +0200 From: Michal Luczaj Date: Wed, 30 Apr 2025 11:10:28 +0200 Subject: [PATCH net-next v3 2/4] vsock/virtio: Reduce indentation in virtio_transport_wait_close() Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Message-Id: <20250430-vsock-linger-v3-2-ddbe73b53457@rbox.co> References: <20250430-vsock-linger-v3-0-ddbe73b53457@rbox.co> In-Reply-To: <20250430-vsock-linger-v3-0-ddbe73b53457@rbox.co> To: Stefano Garzarella , "David S. Miller" , Eric Dumazet , Jakub Kicinski , Paolo Abeni , Simon Horman , "Michael S. Tsirkin" , Jason Wang , Xuan Zhuo , =?utf-8?q?Eugenio_P=C3=A9rez?= , Stefan Hajnoczi Cc: virtualization@lists.linux.dev, netdev@vger.kernel.org, linux-kernel@vger.kernel.org, kvm@vger.kernel.org, Michal Luczaj X-Mailer: b4 0.14.2 Flatten the function. Remove the nested block by inverting the condition: return early on !timeout. No functional change intended. Suggested-by: Stefano Garzarella Signed-off-by: Michal Luczaj --- net/vmw_vsock/virtio_transport_common.c | 26 +++++++++++++------------- 1 file changed, 13 insertions(+), 13 deletions(-) diff --git a/net/vmw_vsock/virtio_transport_common.c b/net/vmw_vsock/virtio= _transport_common.c index 49c6617b467195ba385cc3db86caa4321b422d7a..4425802c5d718f65aaea425ea35= 886ad64e2fe6e 100644 --- a/net/vmw_vsock/virtio_transport_common.c +++ b/net/vmw_vsock/virtio_transport_common.c @@ -1194,23 +1194,23 @@ static void virtio_transport_remove_sock(struct vso= ck_sock *vsk) =20 static void virtio_transport_wait_close(struct sock *sk, long timeout) { - if (timeout) { - DEFINE_WAIT_FUNC(wait, woken_wake_function); - ssize_t (*unsent)(struct vsock_sock *vsk); - struct vsock_sock *vsk =3D vsock_sk(sk); + DEFINE_WAIT_FUNC(wait, woken_wake_function); + ssize_t (*unsent)(struct vsock_sock *vsk); + struct vsock_sock *vsk =3D vsock_sk(sk); =20 - unsent =3D vsk->transport->unsent_bytes; + if (!timeout) + return; =20 - add_wait_queue(sk_sleep(sk), &wait); + unsent =3D vsk->transport->unsent_bytes; =20 - do { - if (sk_wait_event(sk, &timeout, unsent(vsk) =3D=3D 0, - &wait)) - break; - } while (!signal_pending(current) && timeout); + add_wait_queue(sk_sleep(sk), &wait); =20 - remove_wait_queue(sk_sleep(sk), &wait); - } + do { + if (sk_wait_event(sk, &timeout, unsent(vsk) =3D=3D 0, &wait)) + break; + } while (!signal_pending(current) && timeout); + + remove_wait_queue(sk_sleep(sk), &wait); } =20 static void virtio_transport_cancel_close_work(struct vsock_sock *vsk, --=20 2.49.0