From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (prime256v1) server-digest SHA256) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id A318B606A31A for ; Wed, 2 Dec 2026 09:22:27 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=lists.infradead.org header.i=@lists.infradead.org header.a=rsa-sha256 header.s=bombadil.20210309 header.b=BGFX1ZUV; dkim=pass (1024-bit key) header.d=suse.de header.i=@suse.de header.a=rsa-sha256 header.s=susede2_rsa header.b=meZ0I8VK; dkim=pass header.d=suse.de header.i=@suse.de header.a=ed25519-sha256 header.s=susede2_ed25519 header.b=XxD1kZyF; dkim=neutral header.d=suse.de header.i=@suse.de header.a=rsa-sha256 header.s=susede2_rsa header.b=meZ0I8VK; dkim=neutral header.d=suse.de header.i=@suse.de header.a=ed25519-sha256 header.s=susede2_ed25519 header.b=XxD1kZyF DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender:List-Subscribe:List-Help :List-Post:List-Archive:List-Unsubscribe:List-Id:Content-Type:MIME-Version: References:In-Reply-To:Subject:Cc:To:From:Message-ID:Date:Reply-To: Content-Transfer-Encoding:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Unsubscribe-Post:List-Owner; bh=WihMZVDacPe/ooe+XexEz3k4F5JQ5Qpxi+Mc1aZ+RKM=; b=BGFX1ZUVcemGMw/aYPM2q8Rkj+ PgfHjbBjtWHRf2vdBTN1NuNKlUj288vzSX9rKZwfSvraemCjIpym1Y5EW0DLT5+fCgdwnlSDcFBdS bEElzcz4kQ1Af8XRX0qflCQ5EnMoOkJMZzwPswJ45IuIVotcN3s2Gkgx3SofLjWdL3nT3zuZwbzfA Lb1AB5v/GXUmbFI4O6O6UHj5g3YP3HAFXdi0qTkjVnvNqHKpb/xsFYXLszd778OkMZLDC5/29kpRJ es0wpuN75Sh6sQBLSgJFQstMLJDBoqv6PxOVSKp0oHQJzs/IZhDMEis7405hJ7YwjAi9BzOiGNivp O+yV+CGg==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.100.1 #2 (Red Hat Linux)) id 1xYgKI-0000000Aliv-18Qj; Wed, 02 Dec 2026 09:08:34 +0000 Received: from smtp-out1.suse.de ([195.135.223.130]) by bombadil.infradead.org with esmtps (Exim 4.100.1 #2 (Red Hat Linux)) id 1xYgKE-0000000AliA-3ofF for linux-arm-kernel@lists.infradead.org; Wed, 02 Dec 2026 09:08:32 +0000 Received: from imap1.dmz-prg2.suse.org (imap1.dmz-prg2.suse.org [IPv6:2a07:de40:b281:104:10:150:64:97]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) by smtp-out1.suse.de (Postfix) with ESMTPS id A295E22096; Wed, 2 Dec 2026 09:08:26 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_rsa; t=1796202506; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version:content-type:content-type: in-reply-to:in-reply-to:references:references; bh=WihMZVDacPe/ooe+XexEz3k4F5JQ5Qpxi+Mc1aZ+RKM=; b=meZ0I8VKIZY2pbqOklnb4QwABRUgVuIJTPHr/NGt3AiGiI2tvANpkOqgL9ek0NZPgE6UXV zuHWlhYaOWYPxjKG6D+seZwye3DJTppXvLG7sh61ukmEpqTWNvkNOUjHxDZGwOsXEwoCLg xWYFsj+Knp0b8JJEF+g+hYmPzDh0/GY= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_ed25519; t=1796202506; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version:content-type:content-type: in-reply-to:in-reply-to:references:references; bh=WihMZVDacPe/ooe+XexEz3k4F5JQ5Qpxi+Mc1aZ+RKM=; b=XxD1kZyFifJBP5tfqWbrKUVcMABgElI6AHbJmF0mHCmVM8sh16jdqdyPJPhH3/b5pweKan gWEgAi9bLOKbAuDA== Authentication-Results: smtp-out1.suse.de; dkim=pass header.d=suse.de header.s=susede2_rsa header.b=meZ0I8VK; dkim=pass header.d=suse.de header.s=susede2_ed25519 header.b=XxD1kZyF DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_rsa; t=1796202506; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version:content-type:content-type: in-reply-to:in-reply-to:references:references; bh=WihMZVDacPe/ooe+XexEz3k4F5JQ5Qpxi+Mc1aZ+RKM=; b=meZ0I8VKIZY2pbqOklnb4QwABRUgVuIJTPHr/NGt3AiGiI2tvANpkOqgL9ek0NZPgE6UXV zuHWlhYaOWYPxjKG6D+seZwye3DJTppXvLG7sh61ukmEpqTWNvkNOUjHxDZGwOsXEwoCLg xWYFsj+Knp0b8JJEF+g+hYmPzDh0/GY= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_ed25519; t=1796202506; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version:content-type:content-type: in-reply-to:in-reply-to:references:references; bh=WihMZVDacPe/ooe+XexEz3k4F5JQ5Qpxi+Mc1aZ+RKM=; b=XxD1kZyFifJBP5tfqWbrKUVcMABgElI6AHbJmF0mHCmVM8sh16jdqdyPJPhH3/b5pweKan gWEgAi9bLOKbAuDA== Received: from imap1.dmz-prg2.suse.org (localhost [127.0.0.1]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) by imap1.dmz-prg2.suse.org (Postfix) with ESMTPS id E2E0913505; Wed, 2 Dec 2026 09:08:25 +0000 (UTC) Received: from dovecot-director2.suse.de ([2a07:de40:b281:106:10:150:64:167]) by imap1.dmz-prg2.suse.org with ESMTPSA id 8quLLQngD2vfFgAAD6G6ig (envelope-from ); Wed, 02 Dec 2026 09:08:25 +0000 Date: Wed, 02 Dec 2026 10:08:25 +0100 Message-ID: <87cxrkxd6e.wl-tiwai@suse.de> From: Takashi Iwai To: Eric Curtin Cc: linux-kernel@vger.kernel.org, Eric Curtin , Jaroslav Kysela , Takashi Iwai , Liam Girdwood , Mark Brown , Oder Chiou , Orson Zhai , Baolin Wang , Chunyan Zhang , Olivier Moysan , Arnaud Pouliquen , Maxime Coquelin , Alexandre Torgue , Clemens Ladisch , linux-sound@vger.kernel.org, linux-stm32@st-md-mailman.stormreply.com, linux-arm-kernel@lists.infradead.org Subject: Re: [RFC PATCH v2 1/3] ALSA: Handle run-time PAGE_SIZE in PCM hardware tables and #if checks In-Reply-To: <20261202031733.1704898-2-ericcurtin17@gmail.com> References: <20261202031733.1704898-1-ericcurtin17@gmail.com> <20261202031733.1704898-2-ericcurtin17@gmail.com> User-Agent: Wanderlust/2.15.9 (Almost Unreal) Emacs/30.2 Mule/6.0 X-Archived-By: MIME-Version: 1.0 (generated by SEMI-EPG 1.14.7 - "Harue") Content-Type: text/plain; charset=US-ASCII X-Spamd-Result: default: False [-11.01 / 50.00]; SUSE_INTERNAL_BYPASS(-9.00)[]; BAYES_HAM(-3.00)[100.00%]; SUSPICIOUS_RECIPS(1.50)[]; MID_CONTAINS_FROM(1.00)[]; NEURAL_HAM_LONG(-1.00)[-1.000]; R_DKIM_ALLOW(-0.20)[suse.de:s=susede2_rsa,suse.de:s=susede2_ed25519]; NEURAL_HAM_SHORT(-0.20)[-1.000]; MIME_GOOD(-0.10)[text/plain]; MX_GOOD(-0.01)[]; TO_MATCH_ENVRCPT_ALL(0.00)[]; MIME_TRACE(0.00)[0:+]; DKIM_SIGNED(0.00)[suse.de:s=susede2_rsa,suse.de:s=susede2_ed25519]; FREEMAIL_TO(0.00)[gmail.com]; RCPT_COUNT_TWELVE(0.00)[19]; ARC_NA(0.00)[]; RBL_SPAMHAUS_BLOCKED_OPENRESOLVER(0.00)[2a07:de40:b281:104:10:150:64:97:from]; FREEMAIL_ENVRCPT(0.00)[gmail.com]; FREEMAIL_CC(0.00)[vger.kernel.org,docker.com,perex.cz,suse.com,gmail.com,kernel.org,realtek.com,linux.alibaba.com,foss.st.com,ladisch.de,st-md-mailman.stormreply.com,lists.infradead.org]; RCVD_TLS_ALL(0.00)[]; RCVD_COUNT_TWO(0.00)[2]; FROM_EQ_ENVFROM(0.00)[]; FROM_HAS_DN(0.00)[]; TO_DN_SOME(0.00)[]; RECEIVED_SPAMHAUS_BLOCKED_OPENRESOLVER(0.00)[2a07:de40:b281:106:10:150:64:167:received]; RCVD_VIA_SMTP_AUTH(0.00)[]; TAGGED_RCPT(0.00)[]; DKIM_TRACE(0.00)[suse.de:+]; DBL_BLOCKED_OPENRESOLVER(0.00)[imap1.dmz-prg2.suse.org:rdns,imap1.dmz-prg2.suse.org:helo,suse.de:dkim] X-Rspamd-Server: rspamd1.dmz-prg2.suse.org X-Rspamd-Action: no action X-Spam-Score: -11.01 X-Spam-Level: X-Rspamd-Queue-Id: A295E22096 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.9.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20261202_010831_247836_AB6B836C X-CRM114-Status: GOOD ( 31.85 ) X-Spam-Score: -4.4 (----) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-arm-kernel" X-Spam-Status: No, score=-15.9 required=3.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF, HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER,INCLUDES_PATCH, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=4.0.1 X-Spam-Checker-Version: SpamAssassin 4.0.1 (2024-03-26) on aws-us-west-2-korg-listserv-alma10-1 On Wed, 02 Dec 2026 04:17:27 +0100, Eric Curtin wrote: > > From: Eric Curtin > > With arm64 boot-time page size selection PAGE_SIZE is not a compile-time > constant, so it cannot be used in #if, in static const initialisers, or > to initialise module parameter defaults. > > - seq_midi: define output_buffer_size and input_buffer_size with > DEFINE_GLOBAL_PAGE_SIZE_VAR(), so the module parameters default to the > run-time page size. I believe this should be rather replaced with a constant 4096 (better define some constant, of course). Those buffer sizes have nothing to do with the actual page size. > - Define the static snd_pcm_hardware tables in riptide, bcm63xx, > rt5677-spi, sprd, stm32 i2s, sai and spdifrx and adfsdm, and the > snd_dmaengine_pcm_config in stm32_i2s, with > DEFINE_GLOBAL_PAGE_SIZE_VAR_CONST(). I guess those could be replaced with PAGE_SIZE_MIN. It can be more consistent. thanks, Takashi > - echoaudio: test PAGE_SIZE_MIN in the page size #if. > - emu10k1 and trident: select the fixed-page-size fast paths only if > PAGE_SIZE_MIN and PAGE_SIZE_MAX both match the hardware page size. > - ua101: use PAGE_SIZE_MIN in MAX_MEMORY_BUFFERS, since the smallest > page needs the most buffers. > > No functional change for compile-time page sizes. > > Signed-off-by: Eric Curtin > --- > sound/core/seq/seq_midi.c | 4 ++-- > sound/pci/echoaudio/echoaudio_dsp.c | 2 +- > sound/pci/emu10k1/memory.c | 3 ++- > sound/pci/riptide/riptide.c | 10 ++++++---- > sound/pci/trident/trident_memory.c | 4 ++-- > sound/soc/bcm/bcm63xx-pcm-whistler.c | 5 +++-- > sound/soc/codecs/rt5677-spi.c | 5 +++-- > sound/soc/sprd/sprd-pcm-dma.c | 5 +++-- > sound/soc/stm/stm32_adfsdm.c | 5 +++-- > sound/soc/stm/stm32_i2s.c | 10 ++++++---- > sound/soc/stm/stm32_sai_sub.c | 10 ++++++---- > sound/soc/stm/stm32_spdifrx.c | 5 +++-- > sound/usb/misc/ua101.c | 2 +- > 13 files changed, 41 insertions(+), 29 deletions(-) > > diff --git a/sound/core/seq/seq_midi.c b/sound/core/seq/seq_midi.c > index a16a5debf339..7e03e55392d6 100644 > --- a/sound/core/seq/seq_midi.c > +++ b/sound/core/seq/seq_midi.c > @@ -29,10 +29,10 @@ Possible options for midisynth module: > MODULE_AUTHOR("Frank van de Pol , Jaroslav Kysela "); > MODULE_DESCRIPTION("Advanced Linux Sound Architecture sequencer MIDI synth."); > MODULE_LICENSE("GPL"); > -static int output_buffer_size = PAGE_SIZE; > +static DEFINE_GLOBAL_PAGE_SIZE_VAR(int, output_buffer_size, PAGE_SIZE); > module_param(output_buffer_size, int, 0644); > MODULE_PARM_DESC(output_buffer_size, "Output buffer size in bytes."); > -static int input_buffer_size = PAGE_SIZE; > +static DEFINE_GLOBAL_PAGE_SIZE_VAR(int, input_buffer_size, PAGE_SIZE); > module_param(input_buffer_size, int, 0644); > MODULE_PARM_DESC(input_buffer_size, "Input buffer size in bytes."); > > diff --git a/sound/pci/echoaudio/echoaudio_dsp.c b/sound/pci/echoaudio/echoaudio_dsp.c > index 4dd494508c9b..4ccf4e7de564 100644 > --- a/sound/pci/echoaudio/echoaudio_dsp.c > +++ b/sound/pci/echoaudio/echoaudio_dsp.c > @@ -13,7 +13,7 @@ > > ****************************************************************************/ > > -#if PAGE_SIZE < 4096 > +#if PAGE_SIZE_MIN < 4096 > #error PAGE_SIZE is < 4k > #endif > > diff --git a/sound/pci/emu10k1/memory.c b/sound/pci/emu10k1/memory.c > index be889a4ccf9a..37b2053aad5f 100644 > --- a/sound/pci/emu10k1/memory.c > +++ b/sound/pci/emu10k1/memory.c > @@ -32,7 +32,8 @@ > /* get offset address from aligned page */ > #define aligned_page_offset(page) ((page) << PAGE_SHIFT) > > -#if PAGE_SIZE == EMUPAGESIZE && !IS_ENABLED(CONFIG_DYNAMIC_DEBUG) > +#if PAGE_SIZE_MIN == EMUPAGESIZE && PAGE_SIZE_MAX == EMUPAGESIZE && \ > + !IS_ENABLED(CONFIG_DYNAMIC_DEBUG) > /* fill PTB entrie(s) corresponding to page with addr */ > #define set_ptb_entry(emu,page,addr) __set_ptb_entry(emu,page,addr) > /* fill PTB entrie(s) corresponding to page with silence pointer */ > diff --git a/sound/pci/riptide/riptide.c b/sound/pci/riptide/riptide.c > index 0d9110558ce4..aa10b70d789c 100644 > --- a/sound/pci/riptide/riptide.c > +++ b/sound/pci/riptide/riptide.c > @@ -1301,7 +1301,8 @@ static int riptide_reset(struct cmdif *cif, struct snd_riptide *chip) > return 0; > } > > -static const struct snd_pcm_hardware snd_riptide_playback = { > +static DEFINE_GLOBAL_PAGE_SIZE_VAR_CONST(struct snd_pcm_hardware, > + snd_riptide_playback, { > .info = (SNDRV_PCM_INFO_MMAP | SNDRV_PCM_INFO_INTERLEAVED | > SNDRV_PCM_INFO_BLOCK_TRANSFER | > SNDRV_PCM_INFO_PAUSE | SNDRV_PCM_INFO_MMAP_VALID), > @@ -1319,8 +1320,9 @@ static const struct snd_pcm_hardware snd_riptide_playback = { > .periods_min = 2, > .periods_max = 64, > .fifo_size = 0, > -}; > -static const struct snd_pcm_hardware snd_riptide_capture = { > +}); > +static DEFINE_GLOBAL_PAGE_SIZE_VAR_CONST(struct snd_pcm_hardware, > + snd_riptide_capture, { > .info = (SNDRV_PCM_INFO_MMAP | SNDRV_PCM_INFO_INTERLEAVED | > SNDRV_PCM_INFO_BLOCK_TRANSFER | > SNDRV_PCM_INFO_PAUSE | SNDRV_PCM_INFO_MMAP_VALID), > @@ -1338,7 +1340,7 @@ static const struct snd_pcm_hardware snd_riptide_capture = { > .periods_min = 2, > .periods_max = 64, > .fifo_size = 0, > -}; > +}); > > static snd_pcm_uframes_t snd_riptide_pointer(struct snd_pcm_substream > *substream) > diff --git a/sound/pci/trident/trident_memory.c b/sound/pci/trident/trident_memory.c > index 4ed0e7d68322..9460e9471e74 100644 > --- a/sound/pci/trident/trident_memory.c > +++ b/sound/pci/trident/trident_memory.c > @@ -24,7 +24,7 @@ > #define __tlb_to_addr(trident,page) \ > (dma_addr_t)le32_to_cpu((trident->tlb.entries[page]) & ~(SNDRV_TRIDENT_PAGE_SIZE - 1)) > > -#if PAGE_SIZE == 4096 > +#if PAGE_SIZE_MIN == 4096 && PAGE_SIZE_MAX == 4096 > /* page size == SNDRV_TRIDENT_PAGE_SIZE */ > #define ALIGN_PAGE_SIZE PAGE_SIZE /* minimum page size for allocation */ > #define MAX_ALIGN_PAGES SNDRV_TRIDENT_MAX_PAGES /* maximum aligned pages */ > @@ -39,7 +39,7 @@ > /* get PCI physical address from aligned page */ > #define page_to_addr(trident,page) __tlb_to_addr(trident, page) > > -#elif PAGE_SIZE == 8192 > +#elif PAGE_SIZE_MIN == 8192 && PAGE_SIZE_MAX == 8192 > /* page size == SNDRV_TRIDENT_PAGE_SIZE x 2*/ > #define ALIGN_PAGE_SIZE PAGE_SIZE > #define MAX_ALIGN_PAGES (SNDRV_TRIDENT_MAX_PAGES / 2) > diff --git a/sound/soc/bcm/bcm63xx-pcm-whistler.c b/sound/soc/bcm/bcm63xx-pcm-whistler.c > index a40f6bed69c6..94dcf2bf0402 100644 > --- a/sound/soc/bcm/bcm63xx-pcm-whistler.c > +++ b/sound/soc/bcm/bcm63xx-pcm-whistler.c > @@ -27,7 +27,8 @@ struct bcm63xx_runtime_data { > dma_addr_t dma_addr_next; > }; > > -static const struct snd_pcm_hardware bcm63xx_pcm_hardware = { > +static DEFINE_GLOBAL_PAGE_SIZE_VAR_CONST(struct snd_pcm_hardware, > + bcm63xx_pcm_hardware, { > .info = SNDRV_PCM_INFO_MMAP | > SNDRV_PCM_INFO_MMAP_VALID | > SNDRV_PCM_INFO_INTERLEAVED | > @@ -39,7 +40,7 @@ static const struct snd_pcm_hardware bcm63xx_pcm_hardware = { > .periods_max = PAGE_SIZE/sizeof(struct i2s_dma_desc), > .buffer_bytes_max = 128 * 1024, > .fifo_size = 32, > -}; > +}); > > static int bcm63xx_pcm_hw_params(struct snd_soc_component *component, > struct snd_pcm_substream *substream, > diff --git a/sound/soc/codecs/rt5677-spi.c b/sound/soc/codecs/rt5677-spi.c > index 0b2166082437..ebeab9ef6104 100644 > --- a/sound/soc/codecs/rt5677-spi.c > +++ b/sound/soc/codecs/rt5677-spi.c > @@ -72,7 +72,8 @@ struct rt5677_dsp { > bool new_hotword; /* a new hotword is fired */ > }; > > -static const struct snd_pcm_hardware rt5677_spi_pcm_hardware = { > +static DEFINE_GLOBAL_PAGE_SIZE_VAR_CONST(struct snd_pcm_hardware, > + rt5677_spi_pcm_hardware, { > .info = SNDRV_PCM_INFO_MMAP | > SNDRV_PCM_INFO_MMAP_VALID | > SNDRV_PCM_INFO_INTERLEAVED, > @@ -84,7 +85,7 @@ static const struct snd_pcm_hardware rt5677_spi_pcm_hardware = { > .channels_min = 1, > .channels_max = 1, > .buffer_bytes_max = RT5677_BUF_BYTES_TOTAL, > -}; > +}); > > static struct snd_soc_dai_driver rt5677_spi_dai = { > /* The DAI name "rt5677-dsp-cpu-dai" is not used. The actual DAI name > diff --git a/sound/soc/sprd/sprd-pcm-dma.c b/sound/soc/sprd/sprd-pcm-dma.c > index 9bc1fe956c89..e8164d312689 100644 > --- a/sound/soc/sprd/sprd-pcm-dma.c > +++ b/sound/soc/sprd/sprd-pcm-dma.c > @@ -34,7 +34,8 @@ struct sprd_pcm_dma_private { > int dma_addr_offset; > }; > > -static const struct snd_pcm_hardware sprd_pcm_hardware = { > +static DEFINE_GLOBAL_PAGE_SIZE_VAR_CONST(struct snd_pcm_hardware, > + sprd_pcm_hardware, { > .info = SNDRV_PCM_INFO_MMAP | SNDRV_PCM_INFO_MMAP_VALID | > SNDRV_PCM_INFO_INTERLEAVED | SNDRV_PCM_INFO_PAUSE | > SNDRV_PCM_INFO_RESUME | SNDRV_PCM_INFO_NO_PERIOD_WAKEUP, > @@ -44,7 +45,7 @@ static const struct snd_pcm_hardware sprd_pcm_hardware = { > .periods_min = 1, > .periods_max = PAGE_SIZE / SPRD_PCM_DMA_LINKLIST_SIZE, > .buffer_bytes_max = 64 * 1024, > -}; > +}); > > static int sprd_pcm_open(struct snd_soc_component *component, > struct snd_pcm_substream *substream) > diff --git a/sound/soc/stm/stm32_adfsdm.c b/sound/soc/stm/stm32_adfsdm.c > index a9917475e969..442f226542b9 100644 > --- a/sound/soc/stm/stm32_adfsdm.c > +++ b/sound/soc/stm/stm32_adfsdm.c > @@ -42,7 +42,8 @@ struct stm32_adfsdm_priv { > struct mutex lock; /* protect against race condition on iio state */ > }; > > -static const struct snd_pcm_hardware stm32_adfsdm_pcm_hw = { > +static DEFINE_GLOBAL_PAGE_SIZE_VAR_CONST(struct snd_pcm_hardware, > + stm32_adfsdm_pcm_hw, { > .info = SNDRV_PCM_INFO_INTERLEAVED | SNDRV_PCM_INFO_BLOCK_TRANSFER | > SNDRV_PCM_INFO_MMAP | SNDRV_PCM_INFO_PAUSE, > .formats = SNDRV_PCM_FMTBIT_S16_LE | SNDRV_PCM_FMTBIT_S32_LE, > @@ -55,7 +56,7 @@ static const struct snd_pcm_hardware stm32_adfsdm_pcm_hw = { > > .period_bytes_max = DFSDM_MAX_PERIOD_SIZE, > .buffer_bytes_max = DFSDM_MAX_PERIODS * DFSDM_MAX_PERIOD_SIZE > -}; > +}); > > static void stm32_adfsdm_shutdown(struct snd_pcm_substream *substream, > struct snd_soc_dai *dai) > diff --git a/sound/soc/stm/stm32_i2s.c b/sound/soc/stm/stm32_i2s.c > index 79465be82cb8..41fdb9fcd1b4 100644 > --- a/sound/soc/stm/stm32_i2s.c > +++ b/sound/soc/stm/stm32_i2s.c > @@ -1111,20 +1111,22 @@ static const struct snd_soc_dai_ops stm32_i2s_pcm_dai_ops = { > .num_auto_selectable_formats = 1, > }; > > -static const struct snd_pcm_hardware stm32_i2s_pcm_hw = { > +static DEFINE_GLOBAL_PAGE_SIZE_VAR_CONST(struct snd_pcm_hardware, > + stm32_i2s_pcm_hw, { > .info = SNDRV_PCM_INFO_INTERLEAVED | SNDRV_PCM_INFO_MMAP, > .buffer_bytes_max = 8 * PAGE_SIZE, > .period_bytes_min = 1024, > .period_bytes_max = 4 * PAGE_SIZE, > .periods_min = 2, > .periods_max = 8, > -}; > +}); > > -static const struct snd_dmaengine_pcm_config stm32_i2s_pcm_config = { > +static DEFINE_GLOBAL_PAGE_SIZE_VAR_CONST(struct snd_dmaengine_pcm_config, > + stm32_i2s_pcm_config, { > .pcm_hardware = &stm32_i2s_pcm_hw, > .prepare_slave_config = snd_dmaengine_pcm_prepare_slave_config, > .prealloc_buffer_size = PAGE_SIZE * 8, > -}; > +}); > > static const struct snd_soc_component_driver stm32_i2s_component = { > .name = "stm32-i2s", > diff --git a/sound/soc/stm/stm32_sai_sub.c b/sound/soc/stm/stm32_sai_sub.c > index 5d88507b4d0f..0f34f27041cb 100644 > --- a/sound/soc/stm/stm32_sai_sub.c > +++ b/sound/soc/stm/stm32_sai_sub.c > @@ -1433,23 +1433,25 @@ static int stm32_sai_pcm_process_spdif(struct snd_pcm_substream *substream, > } > > /* No support of mmap in S/PDIF mode */ > -static const struct snd_pcm_hardware stm32_sai_pcm_hw_spdif = { > +static DEFINE_GLOBAL_PAGE_SIZE_VAR_CONST(struct snd_pcm_hardware, > + stm32_sai_pcm_hw_spdif, { > .info = SNDRV_PCM_INFO_INTERLEAVED, > .buffer_bytes_max = 8 * PAGE_SIZE, > .period_bytes_min = 1024, > .period_bytes_max = PAGE_SIZE, > .periods_min = 2, > .periods_max = 8, > -}; > +}); > > -static const struct snd_pcm_hardware stm32_sai_pcm_hw = { > +static DEFINE_GLOBAL_PAGE_SIZE_VAR_CONST(struct snd_pcm_hardware, > + stm32_sai_pcm_hw, { > .info = SNDRV_PCM_INFO_INTERLEAVED | SNDRV_PCM_INFO_MMAP, > .buffer_bytes_max = 8 * PAGE_SIZE, > .period_bytes_min = 1024, /* 5ms at 48kHz */ > .period_bytes_max = PAGE_SIZE, > .periods_min = 2, > .periods_max = 8, > -}; > +}); > > static struct snd_soc_dai_driver stm32_sai_playback_dai = { > .id = 1, /* avoid call to fmt_single_name() */ > diff --git a/sound/soc/stm/stm32_spdifrx.c b/sound/soc/stm/stm32_spdifrx.c > index a743bf06fa54..8ee6bfb46d97 100644 > --- a/sound/soc/stm/stm32_spdifrx.c > +++ b/sound/soc/stm/stm32_spdifrx.c > @@ -864,14 +864,15 @@ static struct snd_soc_dai_driver stm32_spdifrx_dai[] = { > } > }; > > -static const struct snd_pcm_hardware stm32_spdifrx_pcm_hw = { > +static DEFINE_GLOBAL_PAGE_SIZE_VAR_CONST(struct snd_pcm_hardware, > + stm32_spdifrx_pcm_hw, { > .info = SNDRV_PCM_INFO_INTERLEAVED | SNDRV_PCM_INFO_MMAP, > .buffer_bytes_max = 8 * PAGE_SIZE, > .period_bytes_min = 1024, > .period_bytes_max = 4 * PAGE_SIZE, > .periods_min = 2, > .periods_max = 8, > -}; > +}); > > static const struct snd_soc_component_driver stm32_spdifrx_component = { > .name = "stm32-spdifrx", > diff --git a/sound/usb/misc/ua101.c b/sound/usb/misc/ua101.c > index bd8e0ed0ba5d..56eb1881d0bb 100644 > --- a/sound/usb/misc/ua101.c > +++ b/sound/usb/misc/ua101.c > @@ -37,7 +37,7 @@ MODULE_LICENSE("GPL v2"); > > #define MAX_PACKET_SIZE 672 /* hardware specific */ > #define MAX_MEMORY_BUFFERS DIV_ROUND_UP(MAX_QUEUE_LENGTH, \ > - PAGE_SIZE / MAX_PACKET_SIZE) > + PAGE_SIZE_MIN / MAX_PACKET_SIZE) > > static int index[SNDRV_CARDS] = SNDRV_DEFAULT_IDX; > static char *id[SNDRV_CARDS] = SNDRV_DEFAULT_STR;