Received: by 2002:a05:6a10:206:0:0:0:0 with SMTP id 6csp1075062pxj; Sat, 29 May 2021 02:22:24 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxN3SnG5b6mpnV4GEvvlywlrJF7DdzYpBcAP5JZc0FPy4EPiS4tmXbvOAsHZHxhpRhh41Zp X-Received: by 2002:aa7:db95:: with SMTP id u21mr14795013edt.152.1622280144564; Sat, 29 May 2021 02:22:24 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1622280144; cv=none; d=google.com; s=arc-20160816; b=bQVTGQE+0Oilu87Vr7U7ZsPf8zc9A0kHRrbbz13J0fv4nag+YK/Dd2EWHYkCzU1UOJ /RwZnZMreVcRJIZy/97cuFp+GYpMCT0Q3dVLYlncI7n0VOnvjdJM3zy79eRPLIMGSj9I EDR1BMmvIEFzrJubAVo9fY7fX9bvROj1d8n9sz6J/du5FVxKEbhWH+u22iThHIVzoDMD 2YdB0gJfEI5F+Hp5LaeR/JeD9bpgqZPkekln1++OoAT3B4IMCaFKmdAunu0/zDQ/I8n9 XQwzlf3h7d31I/61ZkdDMoCUYknSidtqYdsavFZlp0jCYERMC39wTLJcAeR3928owudv DNew== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :message-id:date:subject:cc:to:from; bh=HxGwaq1xv5wd2Xm9ZA3nOXgApfSyk7rY2Rxd53JPRuM=; b=asBi+fBvbTzETpsQ3PPjSTlfETyERf/p4m5UGTQWxiBc1C8YdQDFJEoPn9k+0erYch 8XzUgVsyBX3LoNPGoButboluaYGW+D9mhNeUdb8xB7eZpzEiiY3HgqYG2b1j9W/zljZu E63VkrpUyIH+gH8dwkWAfekmBqSDbZ4Vcb/c34rNHWDwDAQJ1Qq15MnB8upsUwb35bAY H0nK3sbJMDUNzxHu1/ep21RN4OVdFA2k9A+x5EnKIV9xiKvdl3CYvrPs8+m/XcbagYf5 VRmgx601pMZjHFVA5n/ZqDKZ7yOPmpiZ6LAdSxjfxqLouhB+bfkSBEHIhNXyaEt33Nas iZDA== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=huawei.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id q11si320920ejb.312.2021.05.29.02.22.01; Sat, 29 May 2021 02:22:24 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=huawei.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229690AbhE2JUd (ORCPT + 99 others); Sat, 29 May 2021 05:20:33 -0400 Received: from szxga01-in.huawei.com ([45.249.212.187]:2093 "EHLO szxga01-in.huawei.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229559AbhE2JUd (ORCPT ); Sat, 29 May 2021 05:20:33 -0400 Received: from dggemv704-chm.china.huawei.com (unknown [172.30.72.56]) by szxga01-in.huawei.com (SkyGuard) with ESMTP id 4FsbTk17yKzWp8R; Sat, 29 May 2021 17:14:18 +0800 (CST) Received: from dggema762-chm.china.huawei.com (10.1.198.204) by dggemv704-chm.china.huawei.com (10.3.19.47) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256) id 15.1.2176.2; Sat, 29 May 2021 17:18:55 +0800 Received: from huawei.com (10.175.127.227) by dggema762-chm.china.huawei.com (10.1.198.204) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256_P256) id 15.1.2176.2; Sat, 29 May 2021 17:18:55 +0800 From: Yu Kuai To: , , , , , , , , , CC: , , , , Subject: [PATCH] drm/amd/display: fix gcc set but not used warning of variable 'old_plane_state' Date: Sat, 29 May 2021 17:28:16 +0800 Message-ID: <20210529092816.3133745-1-yukuai3@huawei.com> X-Mailer: git-send-email 2.25.4 MIME-Version: 1.0 Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: 8bit X-Originating-IP: [10.175.127.227] X-ClientProxiedBy: dggems702-chm.china.huawei.com (10.3.19.179) To dggema762-chm.china.huawei.com (10.1.198.204) X-CFilter-Loop: Reflected Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org define a new macro for_each_new_plane_in_state_reverse to replace for_each_oldnew_plane_in_state_reverse, so that the unused variable 'old_plane_state' can be removed. Fix gcc warning: drivers/gpu/drm/amd/amdgpu/../display/amdgpu_dm/amdgpu_dm.c:10066:26: warning: variable ‘old_plane_state’ set but not used [-Wunused-but-set-variable] Signed-off-by: Yu Kuai --- drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c | 4 ++-- include/drm/drm_atomic.h | 12 ++++++++++++ 2 files changed, 14 insertions(+), 2 deletions(-) diff --git a/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c b/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c index f7a5e5b48ea6..9f4b334bc071 100644 --- a/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c +++ b/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c @@ -10063,11 +10063,11 @@ static int validate_overlay(struct drm_atomic_state *state) { int i; struct drm_plane *plane; - struct drm_plane_state *old_plane_state, *new_plane_state; + struct drm_plane_state *new_plane_state; struct drm_plane_state *primary_state, *cursor_state, *overlay_state = NULL; /* Check if primary plane is contained inside overlay */ - for_each_oldnew_plane_in_state_reverse(state, plane, old_plane_state, new_plane_state, i) { + for_each_new_plane_in_state_reverse(state, plane, new_plane_state, i) { if (plane->type == DRM_PLANE_TYPE_OVERLAY) { if (drm_atomic_plane_disabling(plane->state, new_plane_state)) return 0; diff --git a/include/drm/drm_atomic.h b/include/drm/drm_atomic.h index ac5a28eff2c8..8f1350e599eb 100644 --- a/include/drm/drm_atomic.h +++ b/include/drm/drm_atomic.h @@ -895,6 +895,18 @@ void drm_state_dump(struct drm_device *dev, struct drm_printer *p); (old_plane_state) = (__state)->planes[__i].old_state,\ (new_plane_state) = (__state)->planes[__i].new_state, 1)) +/** + * for_each_new_plane_in_state_reverse - other than only tracking new state, + * it's the same as for_each_oldnew_plane_in_state_reverse + */ +#define for_each_new_plane_in_state_reverse(__state, plane, new_plane_state, __i) \ + for ((__i) = ((__state)->dev->mode_config.num_total_plane - 1); \ + (__i) >= 0; \ + (__i)--) \ + for_each_if ((__state)->planes[__i].ptr && \ + ((plane) = (__state)->planes[__i].ptr, \ + (new_plane_state) = (__state)->planes[__i].new_state, 1)) + /** * for_each_old_plane_in_state - iterate over all planes in an atomic update * @__state: &struct drm_atomic_state pointer -- 2.25.4