Received: by 2002:ac0:a5a6:0:0:0:0:0 with SMTP id m35-v6csp2727601imm; Tue, 4 Sep 2018 09:04:10 -0700 (PDT) X-Google-Smtp-Source: ANB0VdZ/c/czDL90P/DYesH1xIfL/nsn4gwyT+PDTCMN5781UvsGTuRN86fdNLVv1AbDC/5UatTX X-Received: by 2002:a62:565c:: with SMTP id k89-v6mr35468024pfb.212.1536077050357; Tue, 04 Sep 2018 09:04:10 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1536077050; cv=none; d=google.com; s=arc-20160816; b=yaoJMru7kAkaRJZT6U1XNbpgxIiIpCKnEtWOjdx6b7rv9kBztIfICvA1PbAfWq304e 0JLXBHYR7qAjp7pEoDrbRW48Tgv86XHsGHiyyZLpkBzkW7nbKpr9Uth4C8PKa0SPXZWH WdiFtad3IWZYgNhhywObGcFgY32XZfg4bmGgeBdQjY8WaKLPgzYptwTQeugv1NOt5vZI EWbPlcNuhxwV2GSwgB1YfBRH2ZHeksuX41+YNvrLBU3P/+cflHVN3+n7skYM0u/qMBxd td3P+OuA6t5C9vMQ4dST32Es44ytgb0EwWbsgyckpNlqGu4pjB/sR9PIUEzwAXQOd7yb WT4w== 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=yzvdPJkRaHY49pjFuw0+hS40VfTF0odQ9T2szyodXW8=; b=dmixY35k0vi73vwQG34voS4jGFUmOEMw0z+2B6C2Hl9U8vvKfSNIyxg36FK/JpCgau 4w22uYeu3HYh2Mq/kr/tS+6k3VVttyaYS18SJRiF/uwXjwMezBS1g9ELoWP701IMOg7U ZbCz93459X6vThMdRuy9X0HUbZsDFiODDy3V29rRW0UXpQqHUJS3lagZVXog4nstBBQH 9PdyoIqqy621IBv9Oc2JVW26tqq1XcfFs/UNb4vN3xbjR6qrwZDpYPQbHclZf2RGrLJk dTanGmwS5Pux/JHqyWAPMP4J6ZZUyEvCLSwu3duOO5tyjTNPCPbiG43lYDHUYxNzTqUn N2QQ== 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 37-v6si3011360ple.491.2018.09.04.09.03.44; Tue, 04 Sep 2018 09:04:10 -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 S1728168AbeIDU0a (ORCPT + 99 others); Tue, 4 Sep 2018 16:26:30 -0400 Received: from mx2.suse.de ([195.135.220.15]:51016 "EHLO mx1.suse.de" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1727716AbeIDUYt (ORCPT ); Tue, 4 Sep 2018 16:24:49 -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 1F099B0A6; Tue, 4 Sep 2018 15:59:02 +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 11/29] staging: bcm2835-audio: Use PCM runtime values instead Date: Tue, 4 Sep 2018 17:58:40 +0200 Message-Id: <20180904155858.8001-12-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 Some fields in alsa_stream are the values we keep already in PCM runtime object, hence they are redundant. Use the standard PCM runtime values instead of the private copies. Signed-off-by: Takashi Iwai --- .../vc04_services/bcm2835-audio/bcm2835-pcm.c | 23 ++++--------------- .../vc04_services/bcm2835-audio/bcm2835.h | 4 ---- 2 files changed, 4 insertions(+), 23 deletions(-) diff --git a/drivers/staging/vc04_services/bcm2835-audio/bcm2835-pcm.c b/drivers/staging/vc04_services/bcm2835-audio/bcm2835-pcm.c index fc1b345d206c..a3605505cc20 100644 --- a/drivers/staging/vc04_services/bcm2835-audio/bcm2835-pcm.c +++ b/drivers/staging/vc04_services/bcm2835-audio/bcm2835-pcm.c @@ -206,22 +206,7 @@ static int snd_bcm2835_playback_close(struct snd_pcm_substream *substream) static int snd_bcm2835_pcm_hw_params(struct snd_pcm_substream *substream, struct snd_pcm_hw_params *params) { - struct snd_pcm_runtime *runtime = substream->runtime; - struct bcm2835_alsa_stream *alsa_stream = runtime->private_data; - int err; - - err = snd_pcm_lib_malloc_pages(substream, params_buffer_bytes(params)); - if (err < 0) { - audio_error - (" pcm_lib_malloc failed to allocated pages for buffers\n"); - return err; - } - - alsa_stream->channels = params_channels(params); - alsa_stream->params_rate = params_rate(params); - alsa_stream->pcm_format_width = snd_pcm_format_width(params_format(params)); - - return err; + return snd_pcm_lib_malloc_pages(substream, params_buffer_bytes(params)); } /* hw_free callback */ @@ -248,11 +233,11 @@ static int snd_bcm2835_pcm_prepare(struct snd_pcm_substream *substream) if (chip->spdif_status & IEC958_AES0_NONAUDIO) channels = 0; else - channels = alsa_stream->channels; + channels = runtime->channels; err = bcm2835_audio_set_params(alsa_stream, channels, - alsa_stream->params_rate, - alsa_stream->pcm_format_width); + runtime->rate, + snd_pcm_format_width(runtime->format)); if (err < 0) audio_error(" error setting hw params\n"); diff --git a/drivers/staging/vc04_services/bcm2835-audio/bcm2835.h b/drivers/staging/vc04_services/bcm2835-audio/bcm2835.h index 20f5ff1649e6..3bf128422a6f 100644 --- a/drivers/staging/vc04_services/bcm2835-audio/bcm2835.h +++ b/drivers/staging/vc04_services/bcm2835-audio/bcm2835.h @@ -121,10 +121,6 @@ struct bcm2835_alsa_stream { int draining; - int channels; - int params_rate; - int pcm_format_width; - unsigned int pos; unsigned int buffer_size; unsigned int period_size; -- 2.18.0