From: wangdicheng Date: Wed, 3 Jun 2026 09:11:02 +0000 (+0800) Subject: ALSA: usb-audio: qcom: Use PAGE_ALIGN macro for buffer size calculation X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=f1f16e1809c8f9e4a3c39f165efe114e0e292d8e;p=thirdparty%2Flinux.git ALSA: usb-audio: qcom: Use PAGE_ALIGN macro for buffer size calculation 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 Signed-off-by: Takashi Iwai Link: https://patch.msgid.link/20260603091102.231370-4-wangdich9700@163.com --- diff --git a/sound/usb/qcom/qc_audio_offload.c b/sound/usb/qcom/qc_audio_offload.c index fa7ee61d6934..32982318fbed 100644 --- a/sound/usb/qcom/qc_audio_offload.c +++ b/sound/usb/qcom/qc_audio_offload.c @@ -1052,10 +1052,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,