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>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
Link: https://patch.msgid.link/20260603091102.231370-4-wangdich9700@163.com
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,