Received: by 2002:ac0:a5a6:0:0:0:0:0 with SMTP id m35-v6csp2727163imm; Tue, 4 Sep 2018 09:03:47 -0700 (PDT) X-Google-Smtp-Source: ANB0VdZiBAMvak46UFbR17Z04YBApdTPhp6N0mLOBi0plMg3kPu4P5DR41h3iC5FS/wh0WO2ZYMt X-Received: by 2002:a24:52cd:: with SMTP id d196-v6mr8113909itb.58.1536077027442; Tue, 04 Sep 2018 09:03:47 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1536077027; cv=none; d=google.com; s=arc-20160816; b=x93QKu+bdmSi/C7K13qTxug1Ma8XzPoZRv/bjKxFpIfhbpbR/H00VwOXtc+weA9sqy +Do4fnLN1GE2SQ5eC5XV+7iGFCPqYJZKc58r75dqLF93AFt4rzeP8KW++iDtFjCmdy8n gT+3MUM0i/dVWm+qTyyppCkUJiAUyjtQ0cndXuuZ/Wk79bM9KUshdtT4IpTsnyFFI5OY mQ9WG22Z79eZVXxo2HNitCgKb94e+Rd8LG13IQC3hIiqFETyE2a3MHftpBKixP+ep/b7 /k4dqfCUzpKEkMfTXQJA0G2ZguV8FP8KSnEqLA/pwTV4EhA+u9ZD3L1eu+LLeL2iB0Jm XWww== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:references:in-reply-to:message-id:date :subject:cc:to:from:arc-authentication-results; bh=Q/rn3F/y2AaOakcdg1lG1VoMZe6Wp+xSFpZtFSCVQX0=; b=LSmkZSAKTZzQyjfT0jWh0zWBNP3bLc7aZNWNeTPu5EcXb3JYj3xP95hiHbrDKXLLrm cFUMBev3BUA2graKIbGybmeojvZo5Z8belmuP+GFlLIRGmrpOuzRA2G/CisiuKpQVRp2 3eFs+ybAdCOtcX0YWU740SzjcAbhBbCYPxkOXpKApfV9WHx8EUU+dmJvNX/l6OhuBb4f Gu98CxYb69yhbNOl9tYvMJkMgR0iXy9aeE+bYkgB2GFwMreFWfdPw7/JODQ6hVIm37qN JIphCc3MOyke1qhgOWm1fT5ffM4VPVfjr5YONRGVQx/TbnYPOLHwkO86QgTCUCoR7cjT wJLg== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id d19-v6si21629744pgk.92.2018.09.04.09.03.22; Tue, 04 Sep 2018 09:03:47 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728003AbeIDU04 (ORCPT + 99 others); Tue, 4 Sep 2018 16:26:56 -0400 Received: from mx2.suse.de ([195.135.220.15]:50974 "EHLO mx1.suse.de" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1727665AbeIDUYs (ORCPT ); Tue, 4 Sep 2018 16:24:48 -0400 X-Virus-Scanned: by amavisd-new at test-mx.suse.de Received: from relay1.suse.de (unknown [195.135.220.254]) by mx1.suse.de (Postfix) with ESMTP id E487EB0A3; Tue, 4 Sep 2018 15:59:01 +0000 (UTC) From: Takashi Iwai To: Greg Kroah-Hartman Cc: Eric Anholt , Stefan Wahren , linux-rpi-kernel@lists.infradead.org, linux-kernel@vger.kernel.org Subject: [PATCH 07/29] staging: bcm2835-audio: Remove superfluous open flag Date: Tue, 4 Sep 2018 17:58:36 +0200 Message-Id: <20180904155858.8001-8-tiwai@suse.de> X-Mailer: git-send-email 2.18.0 In-Reply-To: <20180904155858.8001-1-tiwai@suse.de> References: <20180904155858.8001-1-tiwai@suse.de> Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org All the alsa_stream->open flag checks in the current code are redundant, and they cannot be racy. For the code simplification, let's remove the flag and its check. Signed-off-by: Takashi Iwai --- .../staging/vc04_services/bcm2835-audio/bcm2835-pcm.c | 9 ++------- drivers/staging/vc04_services/bcm2835-audio/bcm2835.h | 1 - 2 files changed, 2 insertions(+), 8 deletions(-) diff --git a/drivers/staging/vc04_services/bcm2835-audio/bcm2835-pcm.c b/drivers/staging/vc04_services/bcm2835-audio/bcm2835-pcm.c index a3ab5bfea08a..2c2b6b70df63 100644 --- a/drivers/staging/vc04_services/bcm2835-audio/bcm2835-pcm.c +++ b/drivers/staging/vc04_services/bcm2835-audio/bcm2835-pcm.c @@ -57,8 +57,7 @@ void bcm2835_playback_fifo(struct bcm2835_alsa_stream *alsa_stream) audio_info("alsa_stream=%p substream=%p\n", alsa_stream, alsa_stream ? alsa_stream->substream : 0); - if (alsa_stream->open) - consumed = bcm2835_audio_retrieve_buffers(alsa_stream); + consumed = bcm2835_audio_retrieve_buffers(alsa_stream); /* We get called only if playback was triggered, So, the number of buffers we retrieve in * each iteration are the buffers that have been played out already @@ -154,7 +153,6 @@ static int snd_bcm2835_playback_open_generic( chip->alsa_stream[idx] = alsa_stream; chip->opened |= (1 << idx); - alsa_stream->open = 1; alsa_stream->draining = 1; out: @@ -205,10 +203,7 @@ static int snd_bcm2835_playback_close(struct snd_pcm_substream *substream) alsa_stream->period_size = 0; alsa_stream->buffer_size = 0; - if (alsa_stream->open) { - alsa_stream->open = 0; - bcm2835_audio_close(alsa_stream); - } + bcm2835_audio_close(alsa_stream); if (alsa_stream->chip) alsa_stream->chip->alsa_stream[alsa_stream->idx] = NULL; /* diff --git a/drivers/staging/vc04_services/bcm2835-audio/bcm2835.h b/drivers/staging/vc04_services/bcm2835-audio/bcm2835.h index d2441916960d..79363260ae34 100644 --- a/drivers/staging/vc04_services/bcm2835-audio/bcm2835.h +++ b/drivers/staging/vc04_services/bcm2835-audio/bcm2835.h @@ -121,7 +121,6 @@ struct bcm2835_alsa_stream { spinlock_t lock; - int open; int running; int draining; -- 2.18.0