* [PATCH v2 4/4] ALSA: usb-audio: qcom: Use PAGE_ALIGN macro for buffer size calculation
@ 2026-06-05 3:16 wangdich9700
2026-06-05 11:15 ` Takashi Iwai
0 siblings, 1 reply; 2+ messages in thread
From: wangdich9700 @ 2026-06-05 3:16 UTC (permalink / raw)
To: tiwai, perex, wangdicheng, wangdich9700; +Cc: linux-sound, linux-kernel
From: wangdicheng <wangdicheng@kylinos.cn>
Use the kernel's PAGE_ALIGN() macro instead of open-coding the page
alignment calculation. This improves code readability and follows
kernel coding style.
The manual calculation:
mult = len / PAGE_SIZE;
remainder = len % PAGE_SIZE;
len = mult * PAGE_SIZE;
len += remainder ? PAGE_SIZE : 0;
is equivalent to:
len = PAGE_ALIGN(len);
Signed-off-by: wangdicheng <wangdicheng@kylinos.cn>
---
v1->v2:
Remove unused variables 'remainder' and 'mult' to fix W=1 build warnings
reported by kernel test robot.
sound/usb/qcom/qc_audio_offload.c | 7 +------
1 file changed, 1 insertion(+), 6 deletions(-)
diff --git a/sound/usb/qcom/qc_audio_offload.c b/sound/usb/qcom/qc_audio_offload.c
index fa7ee61d6934..b2b719238b0b 100644
--- a/sound/usb/qcom/qc_audio_offload.c
+++ b/sound/usb/qcom/qc_audio_offload.c
@@ -1042,8 +1042,6 @@ static int uaudio_transfer_buffer_setup(struct snd_usb_substream *subs,
u32 len = xfer_buf_len;
bool dma_coherent;
dma_addr_t xfer_buf_dma_sysdev;
- u32 remainder;
- u32 mult;
int ret;
dma_coherent = dev_is_dma_coherent(subs->dev->bus->sysdev);
@@ -1052,10 +1050,7 @@ static int uaudio_transfer_buffer_setup(struct snd_usb_substream *subs,
if (!len)
len = PAGE_SIZE;
- mult = len / PAGE_SIZE;
- remainder = len % PAGE_SIZE;
- len = mult * PAGE_SIZE;
- len += remainder ? PAGE_SIZE : 0;
+ len = PAGE_ALIGN(len);
if (len > MAX_XFER_BUFF_LEN) {
dev_err(uaudio_qdev->data->dev,
--
2.25.1
^ permalink raw reply related [flat|nested] 2+ messages in thread* Re: [PATCH v2 4/4] ALSA: usb-audio: qcom: Use PAGE_ALIGN macro for buffer size calculation
2026-06-05 3:16 [PATCH v2 4/4] ALSA: usb-audio: qcom: Use PAGE_ALIGN macro for buffer size calculation wangdich9700
@ 2026-06-05 11:15 ` Takashi Iwai
0 siblings, 0 replies; 2+ messages in thread
From: Takashi Iwai @ 2026-06-05 11:15 UTC (permalink / raw)
To: wangdich9700; +Cc: tiwai, perex, wangdicheng, linux-sound, linux-kernel
On Fri, 05 Jun 2026 05:16:11 +0200,
wangdich9700@163.com wrote:
>
> From: wangdicheng <wangdicheng@kylinos.cn>
>
> Use the kernel's PAGE_ALIGN() macro instead of open-coding the page
> alignment calculation. This improves code readability and follows
> kernel coding style.
>
> The manual calculation:
> mult = len / PAGE_SIZE;
> remainder = len % PAGE_SIZE;
> len = mult * PAGE_SIZE;
> len += remainder ? PAGE_SIZE : 0;
>
> is equivalent to:
> len = PAGE_ALIGN(len);
>
> Signed-off-by: wangdicheng <wangdicheng@kylinos.cn>
> ---
> v1->v2:
> Remove unused variables 'remainder' and 'mult' to fix W=1 build warnings
> reported by kernel test robot.
This has been already addressed on for-next branch.
thanks,
Takashi
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2026-06-05 11:15 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-06-05 3:16 [PATCH v2 4/4] ALSA: usb-audio: qcom: Use PAGE_ALIGN macro for buffer size calculation wangdich9700
2026-06-05 11:15 ` Takashi Iwai
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox