g2d: improve readability of cmd alignment check
authorCho KyongHo <pullip.cho@samsung.com>
Tue, 13 Mar 2018 05:42:30 +0000 (14:42 +0900)
committerCosmin Tanislav <demonsingur@gmail.com>
Mon, 22 Apr 2024 17:22:15 +0000 (20:22 +0300)
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 <pullip.cho@samsung.com>
drivers/gpu/exynos/g2d/g2d_command.c

index 98327372620d3fbcff47fe738092c1a6f41694c9..b4928c45fbea44bc0aed28333d1142f83ea6930c 100644 (file)
@@ -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++;