From nobody Thu Dec 18 17:43:55 2025 Received: from mail.zeus03.de (www.zeus03.de [194.117.254.33]) (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 D81C613D247 for ; Tue, 30 Apr 2024 11:54:41 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=194.117.254.33 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1714478083; cv=none; b=EWo2/CsgBtsQG2PVVRibFucf0hSNqmr0oMM60AA4XwCKaG/3ODFPsy8F7JikF/+eESLKiXl9Csfw5tfaGiiO01iNG3iVr4HApjyCJBlT7/ZqfDVjSRfR6d7Vf1fxlWSxzu4GRv1sOXcvNzQG2cfmMFN3QFXt5KAj6V3S4s0r03s= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1714478083; c=relaxed/simple; bh=1ukMYFxzPfY1qsmq+J1Ewq78TfiLOMOqhtd5od5EB0c=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=Ehs41bZfERymN/7HNFILDRJp4/k+hax2WoPUO0AlHyiAxNRBkwZg7cNeY4PEP7sjc72CCmFHXqpcmBlocPWMJk9hVI6roCsVRsxODI5SV0f0nxVn+mYuKXPJ9J1FlgIN3Ti/Acvr3iuOWOZBU1GKquxj6s9ig01jelm59xV2tS0= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=sang-engineering.com; spf=pass smtp.mailfrom=sang-engineering.com; dkim=pass (2048-bit key) header.d=sang-engineering.com header.i=@sang-engineering.com header.b=jOZ2ihVM; arc=none smtp.client-ip=194.117.254.33 Authentication-Results: smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=sang-engineering.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=sang-engineering.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=sang-engineering.com header.i=@sang-engineering.com header.b="jOZ2ihVM" DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= sang-engineering.com; h=from:to:cc:subject:date:message-id :in-reply-to:references:mime-version:content-transfer-encoding; s=k1; bh=zwiSUDPpKEKl2A0JVQtlH+c9e9Co8VShhAKYP5+ABCA=; b=jOZ2ih VMtj+LpEO83K4WUH05bZJkKW2aIENuvPgJj6kMqSJkUJwVNzWGkBeQHzdS6Cwbtb LblUrnd60FpBxtCcNegap7qS86svKc+82Q4tGgaxOVbn6i9EXWK3psAGrvSv9aA2 gwePwEmqHPskdH3WSR6bwODgDdCOHPCn6+f4QFR3wSb98qJVPtQ/aZnZ7T1bw+SJ hcR2MswKtdaJOwTYlMf3iywl6kzN+nz30CNAkYPP+KEtvT6XKdaduFDELqKS7OSc xnT3A6EUSYGvqHIssmN0A8x120NvmnsX0xgfbV5KihL3uBn+lcUZ6W/Q8cVzf0ht 5SB0ql11qSVI3zeQ== Received: (qmail 2621497 invoked from network); 30 Apr 2024 13:54:39 +0200 Received: by mail.zeus03.de with ESMTPSA (TLS_AES_256_GCM_SHA384 encrypted, authenticated); 30 Apr 2024 13:54:39 +0200 X-UD-Smtp-Session: l3s3148p1@ds3jCE8XMqtehhrb From: Wolfram Sang To: alsa-devel@alsa-project.org Cc: Wolfram Sang , Liam Girdwood , Mark Brown , Jaroslav Kysela , Takashi Iwai , patches@opensource.cirrus.com, linux-sound@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH 1/4] ASoC: codecs: wm8962: use 'time_left' variable with wait_for_completion_timeout() Date: Tue, 30 Apr 2024 13:54:34 +0200 Message-ID: <20240430115438.29134-2-wsa+renesas@sang-engineering.com> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20240430115438.29134-1-wsa+renesas@sang-engineering.com> References: <20240430115438.29134-1-wsa+renesas@sang-engineering.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" There is a confusing pattern in the kernel to use a variable named 'timeout= ' to store the result of wait_for_completion_timeout() causing patterns like: timeout =3D wait_for_completion_timeout(...) if (!timeout) return -ETIMEDOUT; with all kinds of permutations. Use 'time_left' as a variable to make the c= ode self explaining. Signed-off-by: Wolfram Sang Reviewed-by: Charles Keepax --- sound/soc/codecs/wm8962.c | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/sound/soc/codecs/wm8962.c b/sound/soc/codecs/wm8962.c index 7c6ed2983128..3856e7a8eeff 100644 --- a/sound/soc/codecs/wm8962.c +++ b/sound/soc/codecs/wm8962.c @@ -2886,7 +2886,7 @@ static int wm8962_set_fll(struct snd_soc_component *c= omponent, int fll_id, int s { struct wm8962_priv *wm8962 =3D snd_soc_component_get_drvdata(component); struct _fll_div fll_div; - unsigned long timeout; + unsigned long time_left; int ret; int fll1 =3D 0; =20 @@ -2974,14 +2974,14 @@ static int wm8962_set_fll(struct snd_soc_component = *component, int fll_id, int s * higher if we'll error out */ if (wm8962->irq) - timeout =3D msecs_to_jiffies(5); + time_left =3D msecs_to_jiffies(5); else - timeout =3D msecs_to_jiffies(1); + time_left =3D msecs_to_jiffies(1); =20 - timeout =3D wait_for_completion_timeout(&wm8962->fll_lock, - timeout); + time_left =3D wait_for_completion_timeout(&wm8962->fll_lock, + time_left); =20 - if (timeout =3D=3D 0 && wm8962->irq) { + if (time_left =3D=3D 0 && wm8962->irq) { dev_err(component->dev, "FLL lock timed out"); snd_soc_component_update_bits(component, WM8962_FLL_CONTROL_1, WM8962_FLL_ENA, 0); --=20 2.43.0 From nobody Thu Dec 18 17:43:55 2025 Received: from mail.zeus03.de (www.zeus03.de [194.117.254.33]) (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 1D56213D26F for ; Tue, 30 Apr 2024 11:54:42 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=194.117.254.33 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1714478084; cv=none; b=OsIF7sCFTZT4ESOq0Jd6kbh2vsONsgARTrl+Aj0rZh/7sv9woB1ZB315XxQI8XqT73va2UfNnz2nrSbip9g18s24Zin8GI4Dbs1SN+hUnqoMqC7baQQSMW81BvQVGvGzd9HNbbtt+Wp+eWFZ5vTtKsNDPuK2ZAwgRLY7QPzgVsc= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1714478084; c=relaxed/simple; bh=MM2TeqomfLXF5s7OrDSUWwcq6LVqngUnCrjYhWJ7hBA=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=nqI1yhHiKwC/UjIoc8lniTuKxMKPHwffOredAkvVhhcjk4LXTz81QYTIvmqnmwt9cCK9/P+5GqQ8FnElEDMpMRMqkwB0qvqvgCveqvXJ8CK9QcGYwIuYPnU2eO0iaX0ccU2aqO1+qhLZjZnUcc7s3HY0EXj6RmNGiFxwYWnSfh0= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=sang-engineering.com; spf=pass smtp.mailfrom=sang-engineering.com; dkim=pass (2048-bit key) header.d=sang-engineering.com header.i=@sang-engineering.com header.b=Wd/kYC5C; arc=none smtp.client-ip=194.117.254.33 Authentication-Results: smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=sang-engineering.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=sang-engineering.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=sang-engineering.com header.i=@sang-engineering.com header.b="Wd/kYC5C" DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= sang-engineering.com; h=from:to:cc:subject:date:message-id :in-reply-to:references:mime-version:content-transfer-encoding; s=k1; bh=vYs2g0fBsI7wQB63+nPXWqKZGlsYANFKOFZ/hv64BS0=; b=Wd/kYC 5CQ6oeRH1lqxcink1OFkJq7SK9ydmWIuUkfwhtsubJG1896kvaWoX2vXY22Vy8mq 9gNjDiNQWVpSdWZdd+S8n5Nt5lNFD8AGaiP3U+ymnyw2DjvJw2zCq5FGFn6ugXbB 9IDqbeEss2MsSMJkXz1wNe6fi9pPlTgvic2iXNTfLiSCqPkulPLQ2C1XZdPZqLsL 0WcZXPESAZB+ucHhEG654zIVG7RRmBrcmc6ef+Csu6MKCW2wMxvByGw7FseR+sX2 5Dxob1ituo1N5ADvDIRK7gag83hNCNJUbTKrHMkPbzKUmezhz3vFIL7NT6E8kcD4 sEew3XPoKODvfVbA== Received: (qmail 2621543 invoked from network); 30 Apr 2024 13:54:40 +0200 Received: by mail.zeus03.de with ESMTPSA (TLS_AES_256_GCM_SHA384 encrypted, authenticated); 30 Apr 2024 13:54:40 +0200 X-UD-Smtp-Session: l3s3148p1@DWnvCE8XQqtehhrb From: Wolfram Sang To: alsa-devel@alsa-project.org Cc: Wolfram Sang , Liam Girdwood , Mark Brown , Jaroslav Kysela , Takashi Iwai , patches@opensource.cirrus.com, linux-sound@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH 2/4] ASoC: codecs: wm8993: use 'time_left' variable with wait_for_completion_timeout() Date: Tue, 30 Apr 2024 13:54:35 +0200 Message-ID: <20240430115438.29134-3-wsa+renesas@sang-engineering.com> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20240430115438.29134-1-wsa+renesas@sang-engineering.com> References: <20240430115438.29134-1-wsa+renesas@sang-engineering.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" There is a confusing pattern in the kernel to use a variable named 'timeout= ' to store the result of wait_for_completion_timeout() causing patterns like: timeout =3D wait_for_completion_timeout(...) if (!timeout) return -ETIMEDOUT; with all kinds of permutations. Use 'time_left' as a variable to make the c= ode self explaining. Fix to the proper variable type 'unsigned long' while here. Signed-off-by: Wolfram Sang Reviewed-by: Charles Keepax --- sound/soc/codecs/wm8993.c | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/sound/soc/codecs/wm8993.c b/sound/soc/codecs/wm8993.c index 5b788f35e5e4..dcc6301223bc 100644 --- a/sound/soc/codecs/wm8993.c +++ b/sound/soc/codecs/wm8993.c @@ -470,7 +470,7 @@ static int _wm8993_set_fll(struct snd_soc_component *co= mponent, int fll_id, int struct i2c_client *i2c =3D to_i2c_client(component->dev); u16 reg1, reg4, reg5; struct _fll_div fll_div; - unsigned int timeout; + unsigned long time_left; int ret; =20 /* Any change? */ @@ -543,19 +543,19 @@ static int _wm8993_set_fll(struct snd_soc_component *= component, int fll_id, int =20 /* If we've got an interrupt wired up make sure we get it */ if (i2c->irq) - timeout =3D msecs_to_jiffies(20); + time_left =3D msecs_to_jiffies(20); else if (Fref < 1000000) - timeout =3D msecs_to_jiffies(3); + time_left =3D msecs_to_jiffies(3); else - timeout =3D msecs_to_jiffies(1); + time_left =3D msecs_to_jiffies(1); =20 try_wait_for_completion(&wm8993->fll_lock); =20 /* Enable the FLL */ snd_soc_component_write(component, WM8993_FLL_CONTROL_1, reg1 | WM8993_FL= L_ENA); =20 - timeout =3D wait_for_completion_timeout(&wm8993->fll_lock, timeout); - if (i2c->irq && !timeout) + time_left =3D wait_for_completion_timeout(&wm8993->fll_lock, time_left); + if (i2c->irq && !time_left) dev_warn(component->dev, "Timed out waiting for FLL\n"); =20 dev_dbg(component->dev, "FLL enabled at %dHz->%dHz\n", Fref, Fout); --=20 2.43.0 From nobody Thu Dec 18 17:43:55 2025 Received: from mail.zeus03.de (www.zeus03.de [194.117.254.33]) (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 217D913D29C for ; Tue, 30 Apr 2024 11:54:43 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=194.117.254.33 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1714478085; cv=none; b=K8erRaBj8kKoei9Z2giwcYf+FFqzumyfcGSkZmtrK2W7/qNfQ303WBWr1/bRAx/DZp42Q81qvb1fdtk/gbgLUI5MAqe2BMa7b62FzKfXJcaSuh2An53wZZVspJJFvs8YdqkADNVxMqtGmhMY386I/7VBe1RmtczF7Yh8YViz/zw= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1714478085; c=relaxed/simple; bh=a+ld2ZZvv7tLr1Bh9lNHFCONf/H70v3VGrtqOfYridg=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=sYx+QMqI7ae38GtUNYmb+lNztPa22FMVBYmAoWCfbALToCo1WkqWBIHsAuRoJ8VuRTkgO5TjMO/gotnTiklx2d3uNpGo1Pw2vxQmNliJ/Fr/08MNMUnrGOdAPrb3MR07PijqpqjTmyMCzFj0YTlXoHkuppJpW7/HtAi7XiJ009M= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=sang-engineering.com; spf=pass smtp.mailfrom=sang-engineering.com; dkim=pass (2048-bit key) header.d=sang-engineering.com header.i=@sang-engineering.com header.b=DDY01gGn; arc=none smtp.client-ip=194.117.254.33 Authentication-Results: smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=sang-engineering.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=sang-engineering.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=sang-engineering.com header.i=@sang-engineering.com header.b="DDY01gGn" DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= sang-engineering.com; h=from:to:cc:subject:date:message-id :in-reply-to:references:mime-version:content-transfer-encoding; s=k1; bh=1NBwNIfTuCbQxkbHSRkHt/W+DlGXOXdraPP5tuRqp/M=; b=DDY01g GnhLWFUXavuTA87BFe2JQ2/EvQD2kgvTuQe4GQbFTiEyE/V2L7+o+ISIpvnOK8Ub B2enIIQxRPo8xZ9UdZbRRTLfAKpOUod5o/54v8zJitvaTNP71hVMUhzUJP9SnYhP +HNT2CPwCIQ/mo6JqwaoVOAhu0pu8T6So5A4E9kjCBhj1z5xmbJXWKhJWMVbOr7B bKitY6wV1yIo+BJQUcAqgmTNDtXux0a6O7yanJxKsfBRX46ihUEfx7hhf7R0YK9U gg1Ks7SHQ6FCrJamfNPH4b1u2+hksh4d3GOQVYfI518xTWRsAOS0Q5jUl20m6juB KEAA042pvMKbfZ1w== Received: (qmail 2621585 invoked from network); 30 Apr 2024 13:54:41 +0200 Received: by mail.zeus03.de with ESMTPSA (TLS_AES_256_GCM_SHA384 encrypted, authenticated); 30 Apr 2024 13:54:41 +0200 X-UD-Smtp-Session: l3s3148p1@VbX6CE8X7I9ehhrb From: Wolfram Sang To: alsa-devel@alsa-project.org Cc: Wolfram Sang , Liam Girdwood , Mark Brown , Jaroslav Kysela , Takashi Iwai , patches@opensource.cirrus.com, linux-sound@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH 3/4] ASoC: codecs: wm8994: use 'time_left' variable with wait_for_completion_timeout() Date: Tue, 30 Apr 2024 13:54:36 +0200 Message-ID: <20240430115438.29134-4-wsa+renesas@sang-engineering.com> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20240430115438.29134-1-wsa+renesas@sang-engineering.com> References: <20240430115438.29134-1-wsa+renesas@sang-engineering.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" There is a confusing pattern in the kernel to use a variable named 'timeout= ' to store the result of wait_for_completion_timeout() causing patterns like: timeout =3D wait_for_completion_timeout(...) if (!timeout) return -ETIMEDOUT; with all kinds of permutations. Use 'time_left' as a variable to make the c= ode self explaining. Signed-off-by: Wolfram Sang Reviewed-by: Charles Keepax --- sound/soc/codecs/wm8994.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/sound/soc/codecs/wm8994.c b/sound/soc/codecs/wm8994.c index fc9894975a1d..a99908582a50 100644 --- a/sound/soc/codecs/wm8994.c +++ b/sound/soc/codecs/wm8994.c @@ -2210,7 +2210,7 @@ static int _wm8994_set_fll(struct snd_soc_component *= component, int id, int src, int reg_offset, ret; struct fll_div fll; u16 reg, clk1, aif_reg, aif_src; - unsigned long timeout; + unsigned long time_left; bool was_enabled; struct clk *mclk; =20 @@ -2403,9 +2403,9 @@ static int _wm8994_set_fll(struct snd_soc_component *= component, int id, int src, WM8994_FLL1_FRAC, reg); =20 if (wm8994->fll_locked_irq) { - timeout =3D wait_for_completion_timeout(&wm8994->fll_locked[id], - msecs_to_jiffies(10)); - if (timeout =3D=3D 0) + time_left =3D wait_for_completion_timeout(&wm8994->fll_locked[id], + msecs_to_jiffies(10)); + if (time_left =3D=3D 0) dev_warn(component->dev, "Timed out waiting for FLL lock\n"); } else { --=20 2.43.0 From nobody Thu Dec 18 17:43:55 2025 Received: from mail.zeus03.de (www.zeus03.de [194.117.254.33]) (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 6F8E413D8A4 for ; Tue, 30 Apr 2024 11:54:44 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=194.117.254.33 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1714478087; cv=none; b=FdPfw3RhXVJtad+5030Dt4yY13fRa+G2SIFu0o1XC2oiUgPJBGQgSZiwbGF7rV12BE4AG/PjT+WOhLnJzBNvksN1LyZcLJG1QBE6RxcDqbako4LTxekpS3ac8P35SNBwOGWFMzTxIobeTEk5RjCyETYujj0CgELg1MiwZenuvDA= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1714478087; c=relaxed/simple; bh=xbu/88pNQJMGyYFWxPSQooiXbYc5BT6Brrv9un7SvOI=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=FG7/DS8HP/55twqM7dD30jTqf9GK4eJapwIiZV5ta1uRYG80ylVcWN5E0niycefOIVliodo4sEfT9aOcMMZyVPwoggnsc9yzHyg63uRAO/V4nPDshOOe0yESq7yMh7Cp2dEit/oK5I09v8GMb/YqpIDJ/pBqoJKBoejKdxujFhQ= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=sang-engineering.com; spf=pass smtp.mailfrom=sang-engineering.com; dkim=pass (2048-bit key) header.d=sang-engineering.com header.i=@sang-engineering.com header.b=DyJgcIQP; arc=none smtp.client-ip=194.117.254.33 Authentication-Results: smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=sang-engineering.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=sang-engineering.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=sang-engineering.com header.i=@sang-engineering.com header.b="DyJgcIQP" DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= sang-engineering.com; h=from:to:cc:subject:date:message-id :in-reply-to:references:mime-version:content-transfer-encoding; s=k1; bh=G48sT4e7XwBEsyu30MJVKv/f1vEN7+9RZstqd76uKpg=; b=DyJgcI QPLZNzmqWc4gK8ouVyVvZZnkmFDc9ZHTKQ11ZFWWgWM2SsDhsmGFj80ct+K1e9Ic qQx91APc1gBWezGCLTle2VROw11Qt+1Mt6ZAPgrzKLtMhn3YeZuo4g0zIWqqVB0z eGngZwayDBIVtTWV+tmVHlPE891cnFkcQCoArdAmh19y2R4+nHvBP4MA4a9owZDL 3MbDT+7K//EkHL5AHZE7aNF6wD7xtbt3wiog4JC/KeokmYCOfbOmOBzV0zRk0cwH UORzs+xgc+2bWYVbzwQZuxShvZ14BwCnwvbuvJg4tWTZUlKtLrvD7sAw1lVDj0YF RPh5c+RrsQKLY/RQ== Received: (qmail 2621617 invoked from network); 30 Apr 2024 13:54:41 +0200 Received: by mail.zeus03.de with ESMTPSA (TLS_AES_256_GCM_SHA384 encrypted, authenticated); 30 Apr 2024 13:54:41 +0200 X-UD-Smtp-Session: l3s3148p1@11IFCU8X9o9ehhrb From: Wolfram Sang To: alsa-devel@alsa-project.org Cc: Wolfram Sang , Liam Girdwood , Mark Brown , Jaroslav Kysela , Takashi Iwai , patches@opensource.cirrus.com, linux-sound@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH 4/4] ASoC: codecs: wm8996: use 'time_left' variable with wait_for_completion_timeout() Date: Tue, 30 Apr 2024 13:54:37 +0200 Message-ID: <20240430115438.29134-5-wsa+renesas@sang-engineering.com> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20240430115438.29134-1-wsa+renesas@sang-engineering.com> References: <20240430115438.29134-1-wsa+renesas@sang-engineering.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" There is a confusing pattern in the kernel to use a variable named 'timeout= ' to store the result of wait_for_completion_timeout() causing patterns like: timeout =3D wait_for_completion_timeout(...) if (!timeout) return -ETIMEDOUT; with all kinds of permutations. Use 'time_left' as a variable to make the c= ode self explaining. Signed-off-by: Wolfram Sang Reviewed-by: Charles Keepax --- sound/soc/codecs/wm8996.c | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/sound/soc/codecs/wm8996.c b/sound/soc/codecs/wm8996.c index e738326e33ed..66096e09c953 100644 --- a/sound/soc/codecs/wm8996.c +++ b/sound/soc/codecs/wm8996.c @@ -655,28 +655,28 @@ static void wait_for_dc_servo(struct snd_soc_componen= t *component, u16 mask) struct i2c_client *i2c =3D to_i2c_client(component->dev); struct wm8996_priv *wm8996 =3D snd_soc_component_get_drvdata(component); int ret; - unsigned long timeout =3D 200; + unsigned long time_left =3D 200; =20 snd_soc_component_write(component, WM8996_DC_SERVO_2, mask); =20 /* Use the interrupt if possible */ do { if (i2c->irq) { - timeout =3D wait_for_completion_timeout(&wm8996->dcs_done, - msecs_to_jiffies(200)); - if (timeout =3D=3D 0) + time_left =3D wait_for_completion_timeout(&wm8996->dcs_done, + msecs_to_jiffies(200)); + if (time_left =3D=3D 0) dev_err(component->dev, "DC servo timed out\n"); =20 } else { msleep(1); - timeout--; + time_left--; } =20 ret =3D snd_soc_component_read(component, WM8996_DC_SERVO_2); dev_dbg(component->dev, "DC servo state: %x\n", ret); - } while (timeout && ret & mask); + } while (time_left && ret & mask); =20 - if (timeout =3D=3D 0) + if (time_left =3D=3D 0) dev_err(component->dev, "DC servo timed out for %x\n", mask); else dev_dbg(component->dev, "DC servo complete for %x\n", mask); --=20 2.43.0