From: Cho KyongHo Date: Tue, 13 Mar 2018 05:42:30 +0000 (+0900) Subject: g2d: improve readability of cmd alignment check X-Git-Url: https://git.stricted.de/?a=commitdiff_plain;h=659152d14dc40efe194038e859966971e4f2ab5a;p=GitHub%2FLineageOS%2Fandroid_kernel_motorola_exynos9610.git g2d: improve readability of cmd alignment check The number of commands in a command list should be a multiple of 8. Calculating of the remainder of the division of the number of commands by 8 and adding dummy commands as many as the remainder is not that intuitive. Change-Id: I15134fd06be7ff71236c283369c9041b5e954977 Signed-off-by: Cho KyongHo --- diff --git a/drivers/gpu/exynos/g2d/g2d_command.c b/drivers/gpu/exynos/g2d/g2d_command.c index 98327372620d..b4928c45fbea 100644 --- a/drivers/gpu/exynos/g2d/g2d_command.c +++ b/drivers/gpu/exynos/g2d/g2d_command.c @@ -132,7 +132,6 @@ static void g2d_set_start_commands(struct g2d_task *task) { bool self_prot = task->g2d_dev->caps & G2D_DEVICE_CAPS_SELF_PROTECTION; struct g2d_reg *regs = page_address(task->cmd_page); - unsigned int n; if (!self_prot && IS_ENABLED(CONFIG_EXYNOS_CONTENT_PATH_PROTECTION)) return; @@ -141,9 +140,7 @@ static void g2d_set_start_commands(struct g2d_task *task) * Number of commands should be multiple of 8. * If it is not, then pad dummy commands with no side effect. */ - n = (8 - (task->cmd_count & 7)) & 7; - - while (n-- > 0) { + while ((task->cmd_count & 7) != 0) { regs[task->cmd_count].offset = G2D_LAYER_UPDATE_REG; regs[task->cmd_count].value = regs[TASK_REG_LAYER_UPDATE].value; task->cmd_count++;