Received: by 2002:a05:6a10:af89:0:0:0:0 with SMTP id iu9csp4498980pxb; Tue, 25 Jan 2022 11:40:40 -0800 (PST) X-Google-Smtp-Source: ABdhPJzfPw1+uZL47PX2X1C6NqahmtYE5ulqAEXK4J9wT/LtLmP1SjNZKhGY6hRvx57Z5qW+NuE+ X-Received: by 2002:a17:90a:d584:: with SMTP id v4mr5152022pju.10.1643139640218; Tue, 25 Jan 2022 11:40:40 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1643139640; cv=none; d=google.com; s=arc-20160816; b=cNjS+LalVjG6eBUDgWFXFCL8Di6+vl/pf81UhDrXD2DmIq5WNOwTJB2Hn9P3u8W+KE qcjWcKwkE4f+u28wf4uSFMzh3Wq/CgJwRXYKjeayIMHxt/M/NM6cGvQDcFDBxsiEMiO+ xjr5Uf+Ixlov8qOR22eG+slIO7KJSV/uYIhOMs78Qk9a5dowsRLb1ZRkTzNXr1oQnMkj Heb8b9a/FdPX8a2drmF2CdLj853HRcc8EDm4AtZx9w1FF+Xu0b/3BYBXWXooZHh79SSK eYR3jsF7ZLkN4J/VRO9DIfsG0KHPYJ5QUGB1R70jGEe/Z7RAygCQFzSZPxitUQeCeJLN DGrw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:references:in-reply-to:message-id:date:subject :cc:to:from; bh=hEEDnbzTmxNATviAWAmQ6EHGb2YmHMpsMochY2JvoGg=; b=lmE26KmyUr4uPDyjR/rrOh2TsLcqLBpHsfinnRIfdcBc5qnzUHr3hWxkV5jVFJxx74 at5xnUAaXMXS6JbG6+lwyQGze+oU0MUyjgEuzcuP66xI2+r1z8YuCIW2hDcNxAPIriiB gA4jmDyUUYarDGY3q/zhEVk4WutFOXUnWie3adKIVh18mbFqUaRMklfHX3k7pmV3wd6q pJauJKfiAK/UBpM7uWoer5AwcLXvMFj56enl6Sdwen3T11U1uaUvw+RKBEW9B5xhnsQI OXKeVaw4akbBn8Z8phn79UBIDWMYfFma21DYTenlpLlSRIavO19x4wa2rPyg/zBYaqw0 +pUw== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=renesas.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id 20si15783374plk.412.2022.01.25.11.40.28; Tue, 25 Jan 2022 11:40:40 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=renesas.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1577251AbiAYN3q (ORCPT + 99 others); Tue, 25 Jan 2022 08:29:46 -0500 Received: from relmlor1.renesas.com ([210.160.252.171]:40774 "EHLO relmlie5.idc.renesas.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1386661AbiAYNZP (ORCPT ); Tue, 25 Jan 2022 08:25:15 -0500 X-IronPort-AV: E=Sophos;i="5.88,314,1635174000"; d="scan'208";a="107606147" Received: from unknown (HELO relmlir6.idc.renesas.com) ([10.200.68.152]) by relmlie5.idc.renesas.com with ESMTP; 25 Jan 2022 22:25:14 +0900 Received: from localhost.localdomain (unknown [10.226.36.204]) by relmlir6.idc.renesas.com (Postfix) with ESMTP id 486034295951; Tue, 25 Jan 2022 22:25:12 +0900 (JST) From: Lad Prabhakar To: Mark Brown , Liam Girdwood , Jaroslav Kysela , Takashi Iwai , alsa-devel@alsa-project.org, Pavel Machek Cc: linux-kernel@vger.kernel.org, linux-renesas-soc@vger.kernel.org, Biju Das , Prabhakar , Lad Prabhakar Subject: [PATCH 1/3] ASoC: sh: rz-ssi: Use a do-while loop in rz_ssi_pio_recv() Date: Tue, 25 Jan 2022 13:24:55 +0000 Message-Id: <20220125132457.14984-2-prabhakar.mahadev-lad.rj@bp.renesas.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20220125132457.14984-1-prabhakar.mahadev-lad.rj@bp.renesas.com> References: <20220125132457.14984-1-prabhakar.mahadev-lad.rj@bp.renesas.com> Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Use a do-while loop while reading the samples from RX FIFO. The "done" flag was only changed as an outcome of the last if-statement (last step) in this entire procedure. This patch moves the condition from if statement to while and drops the "done" variable for readability. While at it, also drop the unneeded parentheses around runtime->dma_area. Signed-off-by: Lad Prabhakar --- Hi All, This change was part of patch [0], as v1 series was applied I am just sending the cosmetic changes from v2 for readability. [0] https://patchwork.kernel.org/project/alsa-devel/patch/ 20220115012303.29651-6-prabhakar.mahadev-lad.rj@bp.renesas.com/ Cheers, Prabhakar --- sound/soc/sh/rz-ssi.c | 11 +++-------- 1 file changed, 3 insertions(+), 8 deletions(-) diff --git a/sound/soc/sh/rz-ssi.c b/sound/soc/sh/rz-ssi.c index 81e1786b827d..2c8775d37f50 100644 --- a/sound/soc/sh/rz-ssi.c +++ b/sound/soc/sh/rz-ssi.c @@ -408,7 +408,6 @@ static int rz_ssi_pio_recv(struct rz_ssi_priv *ssi, struct rz_ssi_stream *strm) { struct snd_pcm_substream *substream = strm->substream; struct snd_pcm_runtime *runtime; - bool done = false; u16 *buf; int fifo_samples; int frames_left; @@ -420,7 +419,7 @@ static int rz_ssi_pio_recv(struct rz_ssi_priv *ssi, struct rz_ssi_stream *strm) runtime = substream->runtime; - while (!done) { + do { /* frames left in this period */ frames_left = runtime->period_size - (strm->buffer_pos % runtime->period_size); @@ -444,7 +443,7 @@ static int rz_ssi_pio_recv(struct rz_ssi_priv *ssi, struct rz_ssi_stream *strm) break; /* calculate new buffer index */ - buf = (u16 *)(runtime->dma_area); + buf = (u16 *)runtime->dma_area; buf += strm->buffer_pos * runtime->channels; /* Note, only supports 16-bit samples */ @@ -453,11 +452,7 @@ static int rz_ssi_pio_recv(struct rz_ssi_priv *ssi, struct rz_ssi_stream *strm) rz_ssi_reg_mask_setl(ssi, SSIFSR, SSIFSR_RDF, 0); rz_ssi_pointer_update(strm, samples / runtime->channels); - - /* check if there are no more samples in the RX FIFO */ - if (!(!frames_left && fifo_samples >= runtime->channels)) - done = true; - } + } while (!frames_left && fifo_samples >= runtime->channels); return 0; } -- 2.17.1