From mboxrd@z Thu Jan 1 00:00:00 1970 Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.remote-ip=100.103.45.18 ARC-Seal: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; cv=none; t=1796187392; b=d6QYrh7IFbu3e5r9h6+K7WQEtI/RPmUfOpfAw8DiZO2ZMNn1ZLiD6kgqF6QMzQ+ddifl SepAklgNxDhGpkjXaWgaTI/cv1zO0rRWOQ9YbUzGKm9tjyUZ9J267j0xPZMTeBXwjlodS zv6ENVI6vRFrnEVyMZUXmiDhdD7WBI1vdqprtM9iv/YVO0T933BF3HdS5Bq5sMYaCW0Qv cx7nIRDPkRPoLKvL6DRTfO1zgZP1pUFtPybwhtdKJSA3zL4nxWLyxCr+C5hejLOk2jvBO gguEzhhCu59QE8ccX/6RacUixYo8o+WxjWr6qken+0adj/zxr+G01RsiKSGggn5yCRg== ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1796187392; h=Received:DKIM-Signature:Date:From:To:Cc:Subject:Message-ID: References:MIME-Version:Content-Type:Content-Disposition:In-Reply-To; bh=0qRs4gdrJS+q0EsYW1/fxnxOUds1P9eB4jaPCBTdXPg=; b=sDbF2AscZCJ0agTtKNmrIXH2jSMw7rqJvJtWXENgE9fBFeUdx3XNI6MjdE3aGRy05tHg KhjIloO8HjpOzgYz3cSMBlYRCMtJOjLPwqQO/JTDpdVc+0YOLsA02r9FqBMbhirubK/4U X+vGmA5i4ledSpbDt8uBh8NE+XmDZTDLnJb7wacciEtu+P87w4oTyX7+ycj+ZEMMeaMUV kOpHsW2jGNyFi1mry5JASY82C4GTeeVK6AeaA3+e0mT8e7MvFikT77vANSS4Zjk1srIww nJYxE6CUL/SjF9ajY7JqrOljqyTEz1KyhIJ3zvFLna1YzXJl6pBtwP+FC6sTI9oktYA== ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass header.d=kernel.org header.i=@kernel.org header.a=rsa-sha256 header.s=k20260515 header.b=DBYH5WyJ; arc=none smtp.remote-ip=100.103.45.18 Received: from smtp.kernel.org (quasi.space.kernel.org [100.103.45.18]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (prime256v1)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id B8255606A31A; Wed, 2 Dec 2026 04:56:32 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.a=rsa-sha256 header.s=k20260515 header.b=DBYH5WyJ Received: by smtp.kernel.org (Postfix) with ESMTPSA id 604FB1F00893; Wed, 2 Dec 2026 04:56:30 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=kernel.org; s=k20260515; t=1796187392; bh=0qRs4gdrJS+q0EsYW1/fxnxOUds1P9eB4jaPCBTdXPg=; h=Date:From:To:Cc:Subject:References:In-Reply-To; b=DBYH5WyJaT80v2ayjXOlen5nbWBNMckO4B8gdQ8SQpDC9Ts+BIRize/P6oEAYTCvK 5D63C727ApOQmV5gomAYuaBjal1Gw/IJDPvd8YHbDfzpcUtUNkgewkY3IIokD9Q8ia Tm2jqor4KYnmHwUf+objIdhsstPiVKZYsv7dsCvfU/rI61kp9d5Tu1k3itmgVIx4nP EawpKDDwSPsQT9N9T3t3R7dAJ78olhPWe7Ww8LDFSZk2MPstNiMkYe2emar5XNPRkV ejovVmLFBglKcG9hVYNZY8gr5Q+/7aGSKSM8UZTrZ+EO6mFwqC3oIvjxXQsRLXRUWO 8bUyCkPEOh0Fg== Date: Wed, 2 Dec 2026 04:56:28 +0000 From: Tzung-Bi Shih To: Eric Curtin Cc: linux-kernel@vger.kernel.org, Ryan Roberts , Cheng-Yi Chiang , Guenter Roeck , Liam Girdwood , Mark Brown , Jaroslav Kysela , Takashi Iwai , Benson Leung , Oder Chiou , chrome-platform@lists.linux.dev, linux-sound@vger.kernel.org Subject: Re: [RFC PATCH v2 3/3] ASoC: codecs: Initialise PCM hardware tables at boot for page size Message-ID: References: <20261202031733.1704898-1-ericcurtin17@gmail.com> <20261202031733.1704898-4-ericcurtin17@gmail.com> X-Mailing-List: linux-sound@vger.kernel.org List-Id: List-Post: List-Help: List-Subscribe: List-Unsubscribe: List-Owner: Precedence: list MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20261202031733.1704898-4-ericcurtin17@gmail.com> On Wed, Dec 02, 2026 at 03:17:29AM +0000, Eric Curtin wrote: > From: Ryan Roberts > > The snd_pcm_hardware tables in cros_ec_codec.c and rt5514-spi.c use > PAGE_SIZE in their initialisers. That is not a constant expression with > arm64 boot-time page size selection, so the tables cannot be static > initialisers. > > Define them with DEFINE_GLOBAL_PAGE_SIZE_VAR_CONST(), which keeps a > normal const initialiser for a fixed page size and otherwise fills the > table in once the page size is known at boot. In cros_ec_codec.c the > table was local to wov_pcm_open(), so it moves to file scope. The cover letter [1] should be sent to the recipients of the patch as well, so the context is easier to find. [1] https://lore.kernel.org/all/20261202031733.1704898-1-ericcurtin17@gmail.com > diff --git a/sound/soc/codecs/cros_ec_codec.c b/sound/soc/codecs/cros_ec_codec.c > index b6f7016a324a..f6e0395d47a1 100644 > --- a/sound/soc/codecs/cros_ec_codec.c > +++ b/sound/soc/codecs/cros_ec_codec.c > @@ -874,24 +874,24 @@ static void wov_remove(struct snd_soc_component *component) > &priv->ec_device->event_notifier, &priv->wov_notifier); > } > > +static DEFINE_GLOBAL_PAGE_SIZE_VAR_CONST(struct snd_pcm_hardware, hw_param, { > + .info = SNDRV_PCM_INFO_MMAP | > + SNDRV_PCM_INFO_INTERLEAVED | > + SNDRV_PCM_INFO_MMAP_VALID, > + .formats = SNDRV_PCM_FMTBIT_S16_LE, > + .rates = SNDRV_PCM_RATE_16000, > + .channels_min = 1, > + .channels_max = 1, > + .period_bytes_min = PAGE_SIZE, > + .period_bytes_max = 0x20000 / 8, > + .periods_min = 8, > + .periods_max = 8, > + .buffer_bytes_max = 0x20000, > +}); If keeping it this way, hw_param is moved from function scope to file scope and needs a prefix, e.g., wov_hw_param. > + > static int wov_pcm_open(struct snd_soc_component *component, > struct snd_pcm_substream *substream) > { > - static const struct snd_pcm_hardware hw_param = { > - .info = SNDRV_PCM_INFO_MMAP | > - SNDRV_PCM_INFO_INTERLEAVED | > - SNDRV_PCM_INFO_MMAP_VALID, > - .formats = SNDRV_PCM_FMTBIT_S16_LE, > - .rates = SNDRV_PCM_RATE_16000, > - .channels_min = 1, > - .channels_max = 1, > - .period_bytes_min = PAGE_SIZE, > - .period_bytes_max = 0x20000 / 8, > - .periods_min = 8, > - .periods_max = 8, > - .buffer_bytes_max = 0x20000, > - }; > - Overall, I think this is overkill. Replacing PAGE_SIZE here with SZ_4K would be the simplest fix. At least cros_ec_codec was written and tested assuming PAGE_SIZE is 4K.