dri-devel.lists.freedesktop.org archive mirror
 help / color / mirror / Atom feed
Search results ordered by [date|relevance]  view[summary|nested|Atom feed]
thread overview below | download mbox.gz: |
* Re: [PATCH -next] drm/amdgpu: Remove a lot of unnecessary ternary operators
  @ 2023-07-31 16:22 99% ` Tom Rix
  0 siblings, 0 replies; 180+ results
From: Tom Rix @ 2023-07-31 16:22 UTC (permalink / raw)
  To: Ruan Jinjie, alexander.deucher, christian.koenig, Xinhui.Pan,
	airlied, daniel, harry.wentland, sunpeng.li, Rodrigo.Siqueira,
	evan.quan, srinivasan.shanmugam, wangxiongfeng2, Hawking.Zhang,
	James.Zhu, Veerabadhran.Gopalakrishnan, saleemkhan.jamadar,
	le.ma, tao.zhou1, Jane.Jian, Hongkun.Zhang, leo.liu, lijo.lazar,
	mario.limonciello, Lang.Yu, ruijing.dong, Suresh.Guttula,
	David.Wu3, sonny.jiang, wenjing.liu, Jun.Lei, mripard,
	tzimmermann, drv, Shiwu.Zhang, aleksei.kodanev, ye.xingchen,
	amd-gfx, dri-devel

[-- Attachment #1: Type: text/plain, Size: 466 bytes --]


On 7/31/23 6:26 AM, Ruan Jinjie wrote:
> Ther are many ternary operators, the true or false judgement
> of which is unnecessary in C language semantics.
>
> Signed-off-by: Ruan Jinjie<ruanjinjie@huawei.com>
> ---

snip
>   	data->registry_data.avfs_support =
> -		hwmgr->feature_mask & PP_AVFS_MASK ? true : false;
> +		hwmgr->feature_mask & PP_AVFS_MASK;
>   	data->registry_data.led_dpm_enabled = 1;

These are not equivalent, consider 0xffff & 0x1000 != 1

Tom


[-- Attachment #2: Type: text/html, Size: 1175 bytes --]

^ permalink raw reply	[relevance 99%]

* [PATCH] drm/nouveau/acr: remove unused variable loc
@ 2023-05-25 21:10 99% Tom Rix
  0 siblings, 0 replies; 180+ results
From: Tom Rix @ 2023-05-25 21:10 UTC (permalink / raw)
  To: bskeggs, kherbst, lyude, airlied, daniel, gsamaiya
  Cc: nouveau, linux-kernel, dri-devel, Tom Rix

gcc with W=1 reports
drivers/gpu/drm/nouveau/nvkm/subdev/acr/lsfw.c:221:21: error: variable
  ‘loc’ set but not used [-Werror=unused-but-set-variable]
  221 |                 u32 loc, sig, cnt, *meta;
      |                     ^~~
This variable is not used so remove it.

Signed-off-by: Tom Rix <trix@redhat.com>
---
 drivers/gpu/drm/nouveau/nvkm/subdev/acr/lsfw.c | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

diff --git a/drivers/gpu/drm/nouveau/nvkm/subdev/acr/lsfw.c b/drivers/gpu/drm/nouveau/nvkm/subdev/acr/lsfw.c
index f36a359d4531..bd104a030243 100644
--- a/drivers/gpu/drm/nouveau/nvkm/subdev/acr/lsfw.c
+++ b/drivers/gpu/drm/nouveau/nvkm/subdev/acr/lsfw.c
@@ -218,7 +218,7 @@ nvkm_acr_lsfw_load_sig_image_desc_v2(struct nvkm_subdev *subdev,
 		const struct firmware *hsbl;
 		const struct nvfw_ls_hsbl_bin_hdr *hdr;
 		const struct nvfw_ls_hsbl_hdr *hshdr;
-		u32 loc, sig, cnt, *meta;
+		u32 sig, cnt, *meta;
 
 		ret = nvkm_firmware_load_name(subdev, path, "hs_bl_sig", ver, &hsbl);
 		if (ret)
@@ -227,7 +227,6 @@ nvkm_acr_lsfw_load_sig_image_desc_v2(struct nvkm_subdev *subdev,
 		hdr = nvfw_ls_hsbl_bin_hdr(subdev, hsbl->data);
 		hshdr = nvfw_ls_hsbl_hdr(subdev, hsbl->data + hdr->header_offset);
 		meta = (u32 *)(hsbl->data + hshdr->meta_data_offset);
-		loc = *(u32 *)(hsbl->data + hshdr->patch_loc);
 		sig = *(u32 *)(hsbl->data + hshdr->patch_sig);
 		cnt = *(u32 *)(hsbl->data + hshdr->num_sig);
 
-- 
2.27.0


^ permalink raw reply related	[relevance 99%]

* [PATCH] drm/radeon: remove unused variable rbo
@ 2023-05-25 21:00 99% Tom Rix
  0 siblings, 0 replies; 180+ results
From: Tom Rix @ 2023-05-25 21:00 UTC (permalink / raw)
  To: alexander.deucher, christian.koenig, Xinhui.Pan, airlied, daniel
  Cc: Tom Rix, dri-devel, amd-gfx, linux-kernel

gcc with W=1 reports
drivers/gpu/drm/radeon/radeon_ttm.c:200:27: error: variable
  ‘rbo’ set but not used [-Werror=unused-but-set-variable]
  200 |         struct radeon_bo *rbo;
      |                           ^~~
This variable is not used so remove it.

Signed-off-by: Tom Rix <trix@redhat.com>
---
 drivers/gpu/drm/radeon/radeon_ttm.c | 2 --
 1 file changed, 2 deletions(-)

diff --git a/drivers/gpu/drm/radeon/radeon_ttm.c b/drivers/gpu/drm/radeon/radeon_ttm.c
index 4eb83ccc4906..de4e6d78f1e1 100644
--- a/drivers/gpu/drm/radeon/radeon_ttm.c
+++ b/drivers/gpu/drm/radeon/radeon_ttm.c
@@ -197,7 +197,6 @@ static int radeon_bo_move(struct ttm_buffer_object *bo, bool evict,
 {
 	struct ttm_resource *old_mem = bo->resource;
 	struct radeon_device *rdev;
-	struct radeon_bo *rbo;
 	int r;
 
 	if (new_mem->mem_type == TTM_PL_TT) {
@@ -210,7 +209,6 @@ static int radeon_bo_move(struct ttm_buffer_object *bo, bool evict,
 	if (r)
 		return r;
 
-	rbo = container_of(bo, struct radeon_bo, tbo);
 	rdev = radeon_get_rdev(bo->bdev);
 	if (!old_mem || (old_mem->mem_type == TTM_PL_SYSTEM &&
 			 bo->ttm == NULL)) {
-- 
2.27.0


^ permalink raw reply related	[relevance 99%]

* [PATCH] drm/amdgpu: move gfx9_cs_data definition
@ 2023-05-25 20:35 96% Tom Rix
  0 siblings, 0 replies; 180+ results
From: Tom Rix @ 2023-05-25 20:35 UTC (permalink / raw)
  To: alexander.deucher, christian.koenig, Xinhui.Pan, airlied, daniel,
	Hawking.Zhang, le.ma, jesse.zhang, Jiadong.Zhu,
	mario.limonciello, Likun.Gao
  Cc: Tom Rix, dri-devel, amd-gfx, linux-kernel

gcc with W=1 reports
In file included from drivers/gpu/drm/amd/amdgpu/gfx_v9_4_3.c:32:
drivers/gpu/drm/amd/amdgpu/clearstate_gfx9.h:939:36: error:
  ‘gfx9_cs_data’ defined but not used [-Werror=unused-const-variable=]
  939 | static const struct cs_section_def gfx9_cs_data[] = {
      |                                    ^~~~~~~~~~~~

gfx9_cs_data is only used in gfx_v9_0.c, so move its definition there.

Signed-off-by: Tom Rix <trix@redhat.com>
---
 drivers/gpu/drm/amd/amdgpu/clearstate_gfx9.h | 4 ----
 drivers/gpu/drm/amd/amdgpu/gfx_v9_0.c        | 5 +++++
 2 files changed, 5 insertions(+), 4 deletions(-)

diff --git a/drivers/gpu/drm/amd/amdgpu/clearstate_gfx9.h b/drivers/gpu/drm/amd/amdgpu/clearstate_gfx9.h
index 567a904804bc..6de4778789ed 100644
--- a/drivers/gpu/drm/amd/amdgpu/clearstate_gfx9.h
+++ b/drivers/gpu/drm/amd/amdgpu/clearstate_gfx9.h
@@ -936,7 +936,3 @@ static const struct cs_extent_def gfx9_SECT_CONTEXT_defs[] =
     {gfx9_SECT_CONTEXT_def_8, 0x0000a2f5, 155 },
     { 0, 0, 0 }
 };
-static const struct cs_section_def gfx9_cs_data[] = {
-    { gfx9_SECT_CONTEXT_defs, SECT_CONTEXT },
-    { 0, SECT_NONE }
-};
diff --git a/drivers/gpu/drm/amd/amdgpu/gfx_v9_0.c b/drivers/gpu/drm/amd/amdgpu/gfx_v9_0.c
index 8bf95a6b0767..c97a68a39d93 100644
--- a/drivers/gpu/drm/amd/amdgpu/gfx_v9_0.c
+++ b/drivers/gpu/drm/amd/amdgpu/gfx_v9_0.c
@@ -56,6 +56,11 @@
 #include "asic_reg/pwr/pwr_10_0_sh_mask.h"
 #include "asic_reg/gc/gc_9_0_default.h"
 
+static const struct cs_section_def gfx9_cs_data[] = {
+    { gfx9_SECT_CONTEXT_defs, SECT_CONTEXT },
+    { 0, SECT_NONE }
+};
+
 #define GFX9_NUM_GFX_RINGS     1
 #define GFX9_NUM_SW_GFX_RINGS  2
 #define GFX9_MEC_HPD_SIZE 4096
-- 
2.27.0


^ permalink raw reply related	[relevance 96%]

* [PATCH] drm/amdkfd: remove unused function get_reserved_sdma_queues_bitmap
@ 2023-05-25 20:07 99% Tom Rix
  0 siblings, 0 replies; 180+ results
From: Tom Rix @ 2023-05-25 20:07 UTC (permalink / raw)
  To: Felix.Kuehling, alexander.deucher, christian.koenig, Xinhui.Pan,
	airlied, daniel, nathan, ndesaulniers
  Cc: Tom Rix, llvm, dri-devel, amd-gfx, linux-kernel

clang with W=1 reports
drivers/gpu/drm/amd/amdgpu/../amdkfd/kfd_device_queue_manager.c:122:24: error:
  unused function 'get_reserved_sdma_queues_bitmap' [-Werror,-Wunused-function]
static inline uint64_t get_reserved_sdma_queues_bitmap(struct device_queue_manager *dqm)
                       ^
This function is not used so remove it.

Signed-off-by: Tom Rix <trix@redhat.com>
---
 drivers/gpu/drm/amd/amdkfd/kfd_device_queue_manager.c | 5 -----
 1 file changed, 5 deletions(-)

diff --git a/drivers/gpu/drm/amd/amdkfd/kfd_device_queue_manager.c b/drivers/gpu/drm/amd/amdkfd/kfd_device_queue_manager.c
index 493b4b66f180..2fbd0a96424f 100644
--- a/drivers/gpu/drm/amd/amdkfd/kfd_device_queue_manager.c
+++ b/drivers/gpu/drm/amd/amdkfd/kfd_device_queue_manager.c
@@ -119,11 +119,6 @@ unsigned int get_num_xgmi_sdma_queues(struct device_queue_manager *dqm)
 		dqm->dev->kfd->device_info.num_sdma_queues_per_engine;
 }
 
-static inline uint64_t get_reserved_sdma_queues_bitmap(struct device_queue_manager *dqm)
-{
-	return dqm->dev->kfd->device_info.reserved_sdma_queues_bitmap;
-}
-
 static void init_sdma_bitmaps(struct device_queue_manager *dqm)
 {
 	bitmap_zero(dqm->sdma_bitmap, KFD_MAX_SDMA_QUEUES);
-- 
2.27.0


^ permalink raw reply related	[relevance 99%]

* [PATCH] drm/i915: simplify switch to if-elseif
@ 2023-05-23 12:51 94% Tom Rix
  0 siblings, 0 replies; 180+ results
From: Tom Rix @ 2023-05-23 12:51 UTC (permalink / raw)
  To: jani.nikula, joonas.lahtinen, rodrigo.vivi, tvrtko.ursulin,
	airlied, daniel, nathan, ndesaulniers, ville.syrjala, imre.deak,
	arun.r.murthy, lucas.demarchi
  Cc: Tom Rix, intel-gfx, llvm, linux-kernel, dri-devel

clang with W=1 reports
drivers/gpu/drm/i915/display/intel_display.c:6012:3: error: unannotated
  fall-through between switch labels [-Werror,-Wimplicit-fallthrough]
                case I915_FORMAT_MOD_X_TILED:
                ^

Only one case and the default does anything in this switch, so it should
be changed to an if-elseif.

Signed-off-by: Tom Rix <trix@redhat.com>
---
 drivers/gpu/drm/i915/display/intel_display.c | 14 +++++---------
 1 file changed, 5 insertions(+), 9 deletions(-)

diff --git a/drivers/gpu/drm/i915/display/intel_display.c b/drivers/gpu/drm/i915/display/intel_display.c
index 0490c6412ab5..1f852e49fc20 100644
--- a/drivers/gpu/drm/i915/display/intel_display.c
+++ b/drivers/gpu/drm/i915/display/intel_display.c
@@ -5994,8 +5994,7 @@ static int intel_async_flip_check_hw(struct intel_atomic_state *state, struct in
 		 * Need to verify this for all gen9 platforms to enable
 		 * this selectively if required.
 		 */
-		switch (new_plane_state->hw.fb->modifier) {
-		case DRM_FORMAT_MOD_LINEAR:
+		if (new_plane_state->hw.fb->modifier == DRM_FORMAT_MOD_LINEAR) {
 			/*
 			 * FIXME: Async on Linear buffer is supported on ICL as
 			 * but with additional alignment and fbc restrictions
@@ -6008,13 +6007,10 @@ static int intel_async_flip_check_hw(struct intel_atomic_state *state, struct in
 					    plane->base.base.id, plane->base.name);
 				return -EINVAL;
 			}
-
-		case I915_FORMAT_MOD_X_TILED:
-		case I915_FORMAT_MOD_Y_TILED:
-		case I915_FORMAT_MOD_Yf_TILED:
-		case I915_FORMAT_MOD_4_TILED:
-			break;
-		default:
+		} else if (!(new_plane_state->hw.fb->modifier == I915_FORMAT_MOD_X_TILED ||
+			     new_plane_state->hw.fb->modifier == I915_FORMAT_MOD_Y_TILED ||
+			     new_plane_state->hw.fb->modifier == I915_FORMAT_MOD_Yf_TILED ||
+			     new_plane_state->hw.fb->modifier == I915_FORMAT_MOD_4_TILED)) {
 			drm_dbg_kms(&i915->drm,
 				    "[PLANE:%d:%s] Modifier does not support async flips\n",
 				    plane->base.base.id, plane->base.name);
-- 
2.27.0


^ permalink raw reply related	[relevance 94%]

* [PATCH] drm/amd/display: remove unused variables res_create_maximus_funcs and debug_defaults_diags
@ 2023-05-23 11:49 95% Tom Rix
  0 siblings, 0 replies; 180+ results
From: Tom Rix @ 2023-05-23 11:49 UTC (permalink / raw)
  To: harry.wentland, sunpeng.li, Rodrigo.Siqueira, alexander.deucher,
	christian.koenig, Xinhui.Pan, airlied, daniel, qingqing.zhuo,
	wenjing.liu, aurabindo.pillai, Samson.Tam, gpiccoli
  Cc: Tom Rix, dri-devel, amd-gfx, linux-kernel

gcc with W=1 reports
drivers/gpu/drm/amd/amdgpu/../display/dc/dcn20/dcn20_resource.c:1069:43: error:
  ‘res_create_maximus_funcs’ defined but not used [-Werror=unused-const-variable=]
 1069 | static const struct resource_create_funcs res_create_maximus_funcs = {
      |                                           ^~~~~~~~~~~~~~~~~~~~~~~~
drivers/gpu/drm/amd/amdgpu/../display/dc/dcn20/dcn20_resource.c:727:38: error:
  ‘debug_defaults_diags’ defined but not used [-Werror=unused-const-variable=]
  727 | static const struct dc_debug_options debug_defaults_diags = {
      |                                      ^~~~~~~~~~~~~~~~~~~~

These variables are not used so remove them.

Signed-off-by: Tom Rix <trix@redhat.com>
---
 .../drm/amd/display/dc/dcn20/dcn20_resource.c | 23 -------------------
 1 file changed, 23 deletions(-)

diff --git a/drivers/gpu/drm/amd/display/dc/dcn20/dcn20_resource.c b/drivers/gpu/drm/amd/display/dc/dcn20/dcn20_resource.c
index 7dcae3183e07..6ef7e2634991 100644
--- a/drivers/gpu/drm/amd/display/dc/dcn20/dcn20_resource.c
+++ b/drivers/gpu/drm/amd/display/dc/dcn20/dcn20_resource.c
@@ -724,22 +724,6 @@ static const struct dc_debug_options debug_defaults_drv = {
 		.underflow_assert_delay_us = 0xFFFFFFFF,
 };
 
-static const struct dc_debug_options debug_defaults_diags = {
-		.disable_dmcu = false,
-		.force_abm_enable = false,
-		.timing_trace = true,
-		.clock_trace = true,
-		.disable_dpp_power_gate = true,
-		.disable_hubp_power_gate = true,
-		.disable_clock_gate = true,
-		.disable_pplib_clock_request = true,
-		.disable_pplib_wm_range = true,
-		.disable_stutter = true,
-		.scl_reset_length10 = true,
-		.underflow_assert_delay_us = 0xFFFFFFFF,
-		.enable_tri_buf = true,
-};
-
 void dcn20_dpp_destroy(struct dpp **dpp)
 {
 	kfree(TO_DCN20_DPP(*dpp));
@@ -1066,13 +1050,6 @@ static const struct resource_create_funcs res_create_funcs = {
 	.create_hwseq = dcn20_hwseq_create,
 };
 
-static const struct resource_create_funcs res_create_maximus_funcs = {
-	.read_dce_straps = NULL,
-	.create_audio = NULL,
-	.create_stream_encoder = NULL,
-	.create_hwseq = dcn20_hwseq_create,
-};
-
 static void dcn20_pp_smu_destroy(struct pp_smu_funcs **pp_smu);
 
 void dcn20_clock_source_destroy(struct clock_source **clk_src)
-- 
2.27.0


^ permalink raw reply related	[relevance 95%]

* [PATCH] drm/amdgpu: remove unused variable mmhub_v1_8_mmea_cgtt_clk_cntl_reg
@ 2023-05-22 13:00 99% Tom Rix
  0 siblings, 0 replies; 180+ results
From: Tom Rix @ 2023-05-22 13:00 UTC (permalink / raw)
  To: alexander.deucher, christian.koenig, Xinhui.Pan, airlied, daniel,
	Hawking.Zhang, tao.zhou1, le.ma, Felix.Kuehling, lijo.lazar,
	Amber.Lin
  Cc: Tom Rix, dri-devel, amd-gfx, linux-kernel

gcc with W=1 reports
drivers/gpu/drm/amd/amdgpu/mmhub_v1_8.c:760:23: error:
  ‘mmhub_v1_8_mmea_cgtt_clk_cntl_reg’ defined but not used [-Werror=unused-const-variable=]
  760 | static const uint32_t mmhub_v1_8_mmea_cgtt_clk_cntl_reg[] = {
      |                       ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

This variable is not used so remove it.

Signed-off-by: Tom Rix <trix@redhat.com>
---
 drivers/gpu/drm/amd/amdgpu/mmhub_v1_8.c | 8 --------
 1 file changed, 8 deletions(-)

diff --git a/drivers/gpu/drm/amd/amdgpu/mmhub_v1_8.c b/drivers/gpu/drm/amd/amdgpu/mmhub_v1_8.c
index 3648994724c2..00e7e5db7c28 100644
--- a/drivers/gpu/drm/amd/amdgpu/mmhub_v1_8.c
+++ b/drivers/gpu/drm/amd/amdgpu/mmhub_v1_8.c
@@ -757,14 +757,6 @@ static void mmhub_v1_8_query_ras_error_status(struct amdgpu_device *adev)
 		mmhub_v1_8_inst_query_ras_err_status(adev, i);
 }
 
-static const uint32_t mmhub_v1_8_mmea_cgtt_clk_cntl_reg[] = {
-	regMMEA0_CGTT_CLK_CTRL,
-	regMMEA1_CGTT_CLK_CTRL,
-	regMMEA2_CGTT_CLK_CTRL,
-	regMMEA3_CGTT_CLK_CTRL,
-	regMMEA4_CGTT_CLK_CTRL,
-};
-
 static void mmhub_v1_8_inst_reset_ras_err_status(struct amdgpu_device *adev,
 						 uint32_t mmhub_inst)
 {
-- 
2.27.0


^ permalink raw reply related	[relevance 99%]

* [PATCH] drm/amdgpu: remove unused variable num_xcc
@ 2023-05-22 12:30 99% Tom Rix
  0 siblings, 0 replies; 180+ results
From: Tom Rix @ 2023-05-22 12:30 UTC (permalink / raw)
  To: alexander.deucher, christian.koenig, Xinhui.Pan, airlied, daniel,
	Hawking.Zhang, le.ma, lijo.lazar, tao.zhou1, shiwu.zhang
  Cc: Tom Rix, dri-devel, amd-gfx, linux-kernel

gcc with W=1 reports
drivers/gpu/drm/amd/amdgpu/gfx_v9_4_3.c:2138:13: error: variable
  ‘num_xcc’ set but not used [-Werror=unused-but-set-variable]
 2138 |         int num_xcc;
      |             ^~~~~~~

This variable is not used so remove it.

Signed-off-by: Tom Rix <trix@redhat.com>
---
 drivers/gpu/drm/amd/amdgpu/gfx_v9_4_3.c | 3 ---
 1 file changed, 3 deletions(-)

diff --git a/drivers/gpu/drm/amd/amdgpu/gfx_v9_4_3.c b/drivers/gpu/drm/amd/amdgpu/gfx_v9_4_3.c
index e5cfb3adb3b3..63718cf02aa1 100644
--- a/drivers/gpu/drm/amd/amdgpu/gfx_v9_4_3.c
+++ b/drivers/gpu/drm/amd/amdgpu/gfx_v9_4_3.c
@@ -2135,9 +2135,6 @@ static void gfx_v9_4_3_ring_emit_gds_switch(struct amdgpu_ring *ring,
 static int gfx_v9_4_3_early_init(void *handle)
 {
 	struct amdgpu_device *adev = (struct amdgpu_device *)handle;
-	int num_xcc;
-
-	num_xcc = NUM_XCC(adev->gfx.xcc_mask);
 
 	adev->gfx.num_compute_rings = min(amdgpu_gfx_get_num_kcq(adev),
 					  AMDGPU_MAX_COMPUTE_RINGS);
-- 
2.27.0


^ permalink raw reply related	[relevance 99%]

* [PATCH] drm/mgag200: set variable mgag200_modeset storage-class-specifier to static
@ 2023-05-17 13:41 99% Tom Rix
  0 siblings, 0 replies; 180+ results
From: Tom Rix @ 2023-05-17 13:41 UTC (permalink / raw)
  To: airlied, tzimmermann, airlied, daniel; +Cc: Tom Rix, linux-kernel, dri-devel

smatch reports
drivers/gpu/drm/mgag200/mgag200_drv.c:23:5: warning: symbol
  'mgag200_modeset' was not declared. Should it be static?

This variable is only used in its defining file, so it should be static

Signed-off-by: Tom Rix <trix@redhat.com>
---
 drivers/gpu/drm/mgag200/mgag200_drv.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/gpu/drm/mgag200/mgag200_drv.c b/drivers/gpu/drm/mgag200/mgag200_drv.c
index 976f0ab2006b..abddf37f0ea1 100644
--- a/drivers/gpu/drm/mgag200/mgag200_drv.c
+++ b/drivers/gpu/drm/mgag200/mgag200_drv.c
@@ -20,7 +20,7 @@
 
 #include "mgag200_drv.h"
 
-int mgag200_modeset = -1;
+static int mgag200_modeset = -1;
 MODULE_PARM_DESC(modeset, "Disable/Enable modesetting");
 module_param_named(modeset, mgag200_modeset, int, 0400);
 
-- 
2.27.0


^ permalink raw reply related	[relevance 99%]

* [PATCH] drm/nouveau/acr/ga102: set variable ga102_gsps storage-class-specifier to static
@ 2023-05-17 13:31 99% Tom Rix
  0 siblings, 0 replies; 180+ results
From: Tom Rix @ 2023-05-17 13:31 UTC (permalink / raw)
  To: bskeggs, kherbst, lyude, airlied, daniel, gsamaiya
  Cc: nouveau, linux-kernel, dri-devel, Tom Rix

smatch reports
drivers/gpu/drm/nouveau/nvkm/subdev/gsp/ga102.c:49:1: warning: symbol
  'ga102_gsps' was not declared. Should it be static?

This variable is only used in its defining file, so it should be static

Signed-off-by: Tom Rix <trix@redhat.com>
---
 drivers/gpu/drm/nouveau/nvkm/subdev/gsp/ga102.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/gpu/drm/nouveau/nvkm/subdev/gsp/ga102.c b/drivers/gpu/drm/nouveau/nvkm/subdev/gsp/ga102.c
index 525267412c3e..a3996ceca995 100644
--- a/drivers/gpu/drm/nouveau/nvkm/subdev/gsp/ga102.c
+++ b/drivers/gpu/drm/nouveau/nvkm/subdev/gsp/ga102.c
@@ -45,7 +45,7 @@ ga102_gsp_nofw(struct nvkm_gsp *gsp, int ver, const struct nvkm_gsp_fwif *fwif)
 	return 0;
 }
 
-struct nvkm_gsp_fwif
+static struct nvkm_gsp_fwif
 ga102_gsps[] = {
 	{ -1, ga102_gsp_nofw, &ga102_gsp },
 	{}
-- 
2.27.0


^ permalink raw reply related	[relevance 99%]

* [PATCH v2] phy: mediatek: rework the floating point comparisons to fixed point
@ 2023-05-02 14:50 93% Tom Rix
  0 siblings, 0 replies; 180+ results
From: Tom Rix @ 2023-05-02 14:50 UTC (permalink / raw)
  To: chunkuang.hu, p.zabel, chunfeng.yun, vkoul, kishon, matthias.bgg,
	angelogioacchino.delregno
  Cc: Tom Rix, linux-kernel, dri-devel, linux-mediatek, linux-phy,
	linux-arm-kernel

gcc on aarch64 reports
drivers/phy/mediatek/phy-mtk-hdmi-mt8195.c: In function ‘mtk_hdmi_pll_set_rate’:
drivers/phy/mediatek/phy-mtk-hdmi-mt8195.c:240:52: error: ‘-mgeneral-regs-only’
  is incompatible with the use of floating-point types
  240 |         else if (tmds_clk >= 54 * MEGA && tmds_clk < 148.35 * MEGA)

Floating point should not be used, so rework the floating point comparisons
to fixed point.

Signed-off-by: Tom Rix <trix@redhat.com>
---
v2: silence robot by casting types to u64

---
drivers/phy/mediatek/phy-mtk-hdmi-mt8195.c | 10 +++++-----
 1 file changed, 5 insertions(+), 5 deletions(-)

diff --git a/drivers/phy/mediatek/phy-mtk-hdmi-mt8195.c b/drivers/phy/mediatek/phy-mtk-hdmi-mt8195.c
index abfc077fb0a8..093c4d1da557 100644
--- a/drivers/phy/mediatek/phy-mtk-hdmi-mt8195.c
+++ b/drivers/phy/mediatek/phy-mtk-hdmi-mt8195.c
@@ -237,11 +237,11 @@ static int mtk_hdmi_pll_calc(struct mtk_hdmi_phy *hdmi_phy, struct clk_hw *hw,
 	 */
 	if (tmds_clk < 54 * MEGA)
 		txposdiv = 8;
-	else if (tmds_clk >= 54 * MEGA && tmds_clk < 148.35 * MEGA)
+	else if (tmds_clk >= 54 * MEGA && (tmds_clk * 100) < 14835 * MEGA)
 		txposdiv = 4;
-	else if (tmds_clk >= 148.35 * MEGA && tmds_clk < 296.7 * MEGA)
+	else if ((tmds_clk * 100) >= 14835 * MEGA && (tmds_clk * 10) < 2967 * MEGA)
 		txposdiv = 2;
-	else if (tmds_clk >= 296.7 * MEGA && tmds_clk <= 594 * MEGA)
+	else if ((tmds_clk * 10) >= 2967 * MEGA && tmds_clk <= 594 * MEGA)
 		txposdiv = 1;
 	else
 		return -EINVAL;
@@ -328,12 +328,12 @@ static int mtk_hdmi_pll_drv_setting(struct clk_hw *hw)
 		clk_channel_bias = 0x34; /* 20mA */
 		impedance_en = 0xf;
 		impedance = 0x36; /* 100ohm */
-	} else if (pixel_clk >= 74.175 * MEGA && pixel_clk <= 300 * MEGA) {
+	} else if (((u64)pixel_clk * 1000) >= 74175 * MEGA && pixel_clk <= 300 * MEGA) {
 		data_channel_bias = 0x34; /* 20mA */
 		clk_channel_bias = 0x2c; /* 16mA */
 		impedance_en = 0xf;
 		impedance = 0x36; /* 100ohm */
-	} else if (pixel_clk >= 27 * MEGA && pixel_clk < 74.175 * MEGA) {
+	} else if (pixel_clk >= 27 * MEGA && ((u64)pixel_clk * 1000) < 74175 * MEGA) {
 		data_channel_bias = 0x14; /* 10mA */
 		clk_channel_bias = 0x14; /* 10mA */
 		impedance_en = 0x0;
-- 
2.27.0


^ permalink raw reply related	[relevance 93%]

* [PATCH] phy: mediatek: rework the floating point comparisons to fixed point
@ 2023-05-01  2:57 94% Tom Rix
  0 siblings, 0 replies; 180+ results
From: Tom Rix @ 2023-05-01  2:57 UTC (permalink / raw)
  To: chunkuang.hu, p.zabel, chunfeng.yun, vkoul, kishon, matthias.bgg,
	angelogioacchino.delregno
  Cc: Tom Rix, linux-kernel, dri-devel, linux-mediatek, linux-phy,
	linux-arm-kernel

gcc on aarch64 reports
drivers/phy/mediatek/phy-mtk-hdmi-mt8195.c: In function ‘mtk_hdmi_pll_set_rate’:
drivers/phy/mediatek/phy-mtk-hdmi-mt8195.c:240:52: error: ‘-mgeneral-regs-only’
  is incompatible with the use of floating-point types
  240 |         else if (tmds_clk >= 54 * MEGA && tmds_clk < 148.35 * MEGA)

Floating point should not be used, so rework the floating point comparisons
to fixed point.

Signed-off-by: Tom Rix <trix@redhat.com>
---
 drivers/phy/mediatek/phy-mtk-hdmi-mt8195.c | 10 +++++-----
 1 file changed, 5 insertions(+), 5 deletions(-)

diff --git a/drivers/phy/mediatek/phy-mtk-hdmi-mt8195.c b/drivers/phy/mediatek/phy-mtk-hdmi-mt8195.c
index abfc077fb0a8..c9501a3d90a5 100644
--- a/drivers/phy/mediatek/phy-mtk-hdmi-mt8195.c
+++ b/drivers/phy/mediatek/phy-mtk-hdmi-mt8195.c
@@ -237,11 +237,11 @@ static int mtk_hdmi_pll_calc(struct mtk_hdmi_phy *hdmi_phy, struct clk_hw *hw,
 	 */
 	if (tmds_clk < 54 * MEGA)
 		txposdiv = 8;
-	else if (tmds_clk >= 54 * MEGA && tmds_clk < 148.35 * MEGA)
+	else if (tmds_clk >= 54 * MEGA && (tmds_clk * 100) < 14835 * MEGA)
 		txposdiv = 4;
-	else if (tmds_clk >= 148.35 * MEGA && tmds_clk < 296.7 * MEGA)
+	else if ((tmds_clk * 100) >= 14835 * MEGA && (tmds_clk * 10) < 2967 * MEGA)
 		txposdiv = 2;
-	else if (tmds_clk >= 296.7 * MEGA && tmds_clk <= 594 * MEGA)
+	else if ((tmds_clk * 10) >= 2967 * MEGA && tmds_clk <= 594 * MEGA)
 		txposdiv = 1;
 	else
 		return -EINVAL;
@@ -328,12 +328,12 @@ static int mtk_hdmi_pll_drv_setting(struct clk_hw *hw)
 		clk_channel_bias = 0x34; /* 20mA */
 		impedance_en = 0xf;
 		impedance = 0x36; /* 100ohm */
-	} else if (pixel_clk >= 74.175 * MEGA && pixel_clk <= 300 * MEGA) {
+	} else if ((pixel_clk * 1000) >= 74175 * MEGA && pixel_clk <= 300 * MEGA) {
 		data_channel_bias = 0x34; /* 20mA */
 		clk_channel_bias = 0x2c; /* 16mA */
 		impedance_en = 0xf;
 		impedance = 0x36; /* 100ohm */
-	} else if (pixel_clk >= 27 * MEGA && pixel_clk < 74.175 * MEGA) {
+	} else if (pixel_clk >= 27 * MEGA && (pixel_clk * 1000) < 74175 * MEGA) {
 		data_channel_bias = 0x14; /* 10mA */
 		clk_channel_bias = 0x14; /* 10mA */
 		impedance_en = 0x0;
-- 
2.27.0


^ permalink raw reply related	[relevance 94%]

* [PATCH] agp/uninorth: remove unused variable size
@ 2023-04-29  1:13 99% Tom Rix
  0 siblings, 0 replies; 180+ results
From: Tom Rix @ 2023-04-29  1:13 UTC (permalink / raw)
  To: airlied; +Cc: Tom Rix, linux-kernel, dri-devel

For ppc64, gcc with W=1 reports
drivers/char/agp/uninorth-agp.c: In function 'uninorth_create_gatt_table':
drivers/char/agp/uninorth-agp.c:372:13: error: variable
  'size' set but not used [-Werror=unused-but-set-variable]
  372 |         int size;
      |             ^~~~

This variable is not used so remove it.

Signed-off-by: Tom Rix <trix@redhat.com>
---
 drivers/char/agp/uninorth-agp.c | 3 ---
 1 file changed, 3 deletions(-)

diff --git a/drivers/char/agp/uninorth-agp.c b/drivers/char/agp/uninorth-agp.c
index 62de7f4ba864..ee67d587cad1 100644
--- a/drivers/char/agp/uninorth-agp.c
+++ b/drivers/char/agp/uninorth-agp.c
@@ -369,7 +369,6 @@ static int uninorth_create_gatt_table(struct agp_bridge_data *bridge)
 {
 	char *table;
 	char *table_end;
-	int size;
 	int page_order;
 	int num_entries;
 	int i;
@@ -383,10 +382,8 @@ static int uninorth_create_gatt_table(struct agp_bridge_data *bridge)
 	table = NULL;
 	i = bridge->aperture_size_idx;
 	temp = bridge->current_size;
-	size = page_order = num_entries = 0;
 
 	do {
-		size = A_SIZE_32(temp)->size;
 		page_order = A_SIZE_32(temp)->page_order;
 		num_entries = A_SIZE_32(temp)->num_entries;
 
-- 
2.27.0


^ permalink raw reply related	[relevance 99%]

* [PATCH] drm/amd/display: set variable custom_backlight_curve0 storage-class-specifier to static
@ 2023-04-26 11:18 98% Tom Rix
  0 siblings, 0 replies; 180+ results
From: Tom Rix @ 2023-04-26 11:18 UTC (permalink / raw)
  To: harry.wentland, sunpeng.li, Rodrigo.Siqueira, alexander.deucher,
	christian.koenig, Xinhui.Pan, airlied, daniel, qingqing.zhuo,
	hamza.mahfooz, Josip.Pavic, robin.chen, alex.hung,
	dingchen.zhang, jiapeng.chong
  Cc: Tom Rix, dri-devel, amd-gfx, linux-kernel

smatch reports
drivers/gpu/drm/amd/amdgpu/../display/modules/power/power_helpers.c:119:31:
  warning: symbol 'custom_backlight_curve0' was not declared. Should it be static?

This variable is only used in its defining file, so it should be static
Signed-off-by: Tom Rix <trix@redhat.com>
---
 drivers/gpu/drm/amd/display/modules/power/power_helpers.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/gpu/drm/amd/display/modules/power/power_helpers.c b/drivers/gpu/drm/amd/display/modules/power/power_helpers.c
index 68d95b92df76..30349881a283 100644
--- a/drivers/gpu/drm/amd/display/modules/power/power_helpers.c
+++ b/drivers/gpu/drm/amd/display/modules/power/power_helpers.c
@@ -116,7 +116,7 @@ static const struct abm_parameters * const abm_settings[] = {
 	abm_settings_config2,
 };
 
-const struct dm_bl_data_point custom_backlight_curve0[] = {
+static const struct dm_bl_data_point custom_backlight_curve0[] = {
 		{2, 14}, {4, 16}, {6, 18}, {8, 21}, {10, 23}, {12, 26}, {14, 29}, {16, 32}, {18, 35},
 		{20, 38}, {22, 41}, {24, 44}, {26, 48}, {28, 52}, {30, 55}, {32, 59}, {34, 62},
 		{36, 67}, {38, 71}, {40, 75}, {42, 80}, {44, 84}, {46, 88}, {48, 93}, {50, 98},
-- 
2.27.0


^ permalink raw reply related	[relevance 98%]

* Re: [PATCH] drm/amd/display: return status of dmub_srv_get_fw_boot_status
  @ 2023-04-24 18:14 99%   ` Tom Rix
  0 siblings, 0 replies; 180+ results
From: Tom Rix @ 2023-04-24 18:14 UTC (permalink / raw)
  To: Hamza Mahfooz, harry.wentland, sunpeng.li, Rodrigo.Siqueira,
	alexander.deucher, christian.koenig, Xinhui.Pan, airlied, daniel,
	Alvin.Lee2, Jun.Lei, qingqing.zhuo, Max.Tseng, Josip.Pavic,
	Eric.Yang2, aurabindo.pillai
  Cc: amd-gfx, dri-devel, linux-kernel


On 4/24/23 10:02 AM, Hamza Mahfooz wrote:
>
> On 4/20/23 09:59, Tom Rix wrote:
>> gcc with W=1 reports
>> drivers/gpu/drm/amd/amdgpu/../display/dc/dc_dmub_srv.c:
>>    In function ‘dc_dmub_srv_optimized_init_done’:
>> drivers/gpu/drm/amd/amdgpu/../display/dc/dc_dmub_srv.c:184:26:
>>    error: variable ‘dmub’ set but not used 
>> [-Werror=unused-but-set-variable]
>>    184 |         struct dmub_srv *dmub;
>>        |                          ^~~~
>>
>> The return status is never set.
>> It looks like a call to dmub_srv_get_fw_boot_status is missing.
>>
>> Fixes: 499e4b1c722e ("drm/amd/display: add mechanism to skip DCN init")
>
> What tree is this based on? I am unable to find that exact commit on
> amd-staging-drm-next.

linux-next

Tom


>
>> Signed-off-by: Tom Rix <trix@redhat.com>
>> ---
>>   drivers/gpu/drm/amd/display/dc/dc_dmub_srv.c | 13 +++++++++++--
>>   1 file changed, 11 insertions(+), 2 deletions(-)
>>
>> diff --git a/drivers/gpu/drm/amd/display/dc/dc_dmub_srv.c 
>> b/drivers/gpu/drm/amd/display/dc/dc_dmub_srv.c
>> index d15ec32243e2..36d936ab4300 100644
>> --- a/drivers/gpu/drm/amd/display/dc/dc_dmub_srv.c
>> +++ b/drivers/gpu/drm/amd/display/dc/dc_dmub_srv.c
>> @@ -182,14 +182,23 @@ bool dc_dmub_srv_cmd_run_list(struct 
>> dc_dmub_srv *dc_dmub_srv, unsigned int coun
>>   bool dc_dmub_srv_optimized_init_done(struct dc_dmub_srv *dc_dmub_srv)
>>   {
>>       struct dmub_srv *dmub;
>> -    union dmub_fw_boot_status status;
>> +    struct dc_context *dc_ctx;
>> +    union dmub_fw_boot_status boot_status;
>> +    enum dmub_status status;
>>         if (!dc_dmub_srv || !dc_dmub_srv->dmub)
>>           return false;
>>         dmub = dc_dmub_srv->dmub;
>> +    dc_ctx = dc_dmub_srv->ctx;
>> +
>> +    status = dmub_srv_get_fw_boot_status(dmub, &boot_status);
>> +    if (status != DMUB_STATUS_OK) {
>> +        DC_ERROR("Error querying DMUB boot status: error=%d\n", 
>> status);
>> +        return false;
>> +    }
>>   -    return status.bits.optimized_init_done;
>> +    return boot_status.bits.optimized_init_done;
>>   }
>>     bool dc_dmub_srv_notify_stream_mask(struct dc_dmub_srv *dc_dmub_srv,


^ permalink raw reply	[relevance 99%]

* [PATCH] drm/meson: set variables meson_hdmi_* storage-class-specifier to static
@ 2023-04-23 14:53 90% Tom Rix
  0 siblings, 0 replies; 180+ results
From: Tom Rix @ 2023-04-23 14:53 UTC (permalink / raw)
  To: neil.armstrong, airlied, daniel, khilman, jbrunet, martin.blumenstingl
  Cc: linux-amlogic, Tom Rix, linux-arm-kernel, dri-devel, linux-kernel

smatch has several simailar warnings to
drivers/gpu/drm/meson/meson_venc.c:189:28: warning: symbol
  'meson_hdmi_enci_mode_480i' was not declared. Should it be static?

These variables are only used in their defining file so should be static

Signed-off-by: Tom Rix <trix@redhat.com>
---
 drivers/gpu/drm/meson/meson_venc.c | 32 +++++++++++++++---------------
 1 file changed, 16 insertions(+), 16 deletions(-)

diff --git a/drivers/gpu/drm/meson/meson_venc.c b/drivers/gpu/drm/meson/meson_venc.c
index fcd532db19c1..27ef9f88e4ff 100644
--- a/drivers/gpu/drm/meson/meson_venc.c
+++ b/drivers/gpu/drm/meson/meson_venc.c
@@ -186,7 +186,7 @@ union meson_hdmi_venc_mode {
 	} encp;
 };
 
-union meson_hdmi_venc_mode meson_hdmi_enci_mode_480i = {
+static union meson_hdmi_venc_mode meson_hdmi_enci_mode_480i = {
 	.enci = {
 		.hso_begin = 5,
 		.hso_end = 129,
@@ -206,7 +206,7 @@ union meson_hdmi_venc_mode meson_hdmi_enci_mode_480i = {
 	},
 };
 
-union meson_hdmi_venc_mode meson_hdmi_enci_mode_576i = {
+static union meson_hdmi_venc_mode meson_hdmi_enci_mode_576i = {
 	.enci = {
 		.hso_begin = 3,
 		.hso_end = 129,
@@ -226,7 +226,7 @@ union meson_hdmi_venc_mode meson_hdmi_enci_mode_576i = {
 	},
 };
 
-union meson_hdmi_venc_mode meson_hdmi_encp_mode_480p = {
+static union meson_hdmi_venc_mode meson_hdmi_encp_mode_480p = {
 	.encp = {
 		.dvi_settings = 0x21,
 		.video_mode = 0x4000,
@@ -272,7 +272,7 @@ union meson_hdmi_venc_mode meson_hdmi_encp_mode_480p = {
 	},
 };
 
-union meson_hdmi_venc_mode meson_hdmi_encp_mode_576p = {
+static union meson_hdmi_venc_mode meson_hdmi_encp_mode_576p = {
 	.encp = {
 		.dvi_settings = 0x21,
 		.video_mode = 0x4000,
@@ -318,7 +318,7 @@ union meson_hdmi_venc_mode meson_hdmi_encp_mode_576p = {
 	},
 };
 
-union meson_hdmi_venc_mode meson_hdmi_encp_mode_720p60 = {
+static union meson_hdmi_venc_mode meson_hdmi_encp_mode_720p60 = {
 	.encp = {
 		.dvi_settings = 0x2029,
 		.video_mode = 0x4040,
@@ -360,7 +360,7 @@ union meson_hdmi_venc_mode meson_hdmi_encp_mode_720p60 = {
 	},
 };
 
-union meson_hdmi_venc_mode meson_hdmi_encp_mode_720p50 = {
+static union meson_hdmi_venc_mode meson_hdmi_encp_mode_720p50 = {
 	.encp = {
 		.dvi_settings = 0x202d,
 		.video_mode = 0x4040,
@@ -405,7 +405,7 @@ union meson_hdmi_venc_mode meson_hdmi_encp_mode_720p50 = {
 	},
 };
 
-union meson_hdmi_venc_mode meson_hdmi_encp_mode_1080i60 = {
+static union meson_hdmi_venc_mode meson_hdmi_encp_mode_1080i60 = {
 	.encp = {
 		.dvi_settings = 0x2029,
 		.video_mode = 0x5ffc,
@@ -454,7 +454,7 @@ union meson_hdmi_venc_mode meson_hdmi_encp_mode_1080i60 = {
 	},
 };
 
-union meson_hdmi_venc_mode meson_hdmi_encp_mode_1080i50 = {
+static union meson_hdmi_venc_mode meson_hdmi_encp_mode_1080i50 = {
 	.encp = {
 		.dvi_settings = 0x202d,
 		.video_mode = 0x5ffc,
@@ -503,7 +503,7 @@ union meson_hdmi_venc_mode meson_hdmi_encp_mode_1080i50 = {
 	},
 };
 
-union meson_hdmi_venc_mode meson_hdmi_encp_mode_1080p24 = {
+static union meson_hdmi_venc_mode meson_hdmi_encp_mode_1080p24 = {
 	.encp = {
 		.dvi_settings = 0xd,
 		.video_mode = 0x4040,
@@ -552,7 +552,7 @@ union meson_hdmi_venc_mode meson_hdmi_encp_mode_1080p24 = {
 	},
 };
 
-union meson_hdmi_venc_mode meson_hdmi_encp_mode_1080p30 = {
+static union meson_hdmi_venc_mode meson_hdmi_encp_mode_1080p30 = {
 	.encp = {
 		.dvi_settings = 0x1,
 		.video_mode = 0x4040,
@@ -596,7 +596,7 @@ union meson_hdmi_venc_mode meson_hdmi_encp_mode_1080p30 = {
 	},
 };
 
-union meson_hdmi_venc_mode meson_hdmi_encp_mode_1080p50 = {
+static union meson_hdmi_venc_mode meson_hdmi_encp_mode_1080p50 = {
 	.encp = {
 		.dvi_settings = 0xd,
 		.video_mode = 0x4040,
@@ -644,7 +644,7 @@ union meson_hdmi_venc_mode meson_hdmi_encp_mode_1080p50 = {
 	},
 };
 
-union meson_hdmi_venc_mode meson_hdmi_encp_mode_1080p60 = {
+static union meson_hdmi_venc_mode meson_hdmi_encp_mode_1080p60 = {
 	.encp = {
 		.dvi_settings = 0x1,
 		.video_mode = 0x4040,
@@ -688,7 +688,7 @@ union meson_hdmi_venc_mode meson_hdmi_encp_mode_1080p60 = {
 	},
 };
 
-union meson_hdmi_venc_mode meson_hdmi_encp_mode_2160p24 = {
+static union meson_hdmi_venc_mode meson_hdmi_encp_mode_2160p24 = {
 	.encp = {
 		.dvi_settings = 0x1,
 		.video_mode = 0x4040,
@@ -730,7 +730,7 @@ union meson_hdmi_venc_mode meson_hdmi_encp_mode_2160p24 = {
 	},
 };
 
-union meson_hdmi_venc_mode meson_hdmi_encp_mode_2160p25 = {
+static union meson_hdmi_venc_mode meson_hdmi_encp_mode_2160p25 = {
 	.encp = {
 		.dvi_settings = 0x1,
 		.video_mode = 0x4040,
@@ -772,7 +772,7 @@ union meson_hdmi_venc_mode meson_hdmi_encp_mode_2160p25 = {
 	},
 };
 
-union meson_hdmi_venc_mode meson_hdmi_encp_mode_2160p30 = {
+static union meson_hdmi_venc_mode meson_hdmi_encp_mode_2160p30 = {
 	.encp = {
 		.dvi_settings = 0x1,
 		.video_mode = 0x4040,
@@ -814,7 +814,7 @@ union meson_hdmi_venc_mode meson_hdmi_encp_mode_2160p30 = {
 	},
 };
 
-struct meson_hdmi_venc_vic_mode {
+static struct meson_hdmi_venc_vic_mode {
 	unsigned int vic;
 	union meson_hdmi_venc_mode *mode;
 } meson_hdmi_venc_vic_modes[] = {
-- 
2.27.0


^ permalink raw reply related	[relevance 90%]

* [PATCH] drm/amd/display: remove unused variables dispclk_delay_subtotal and dout
@ 2023-04-20 18:07 93% Tom Rix
  0 siblings, 0 replies; 180+ results
From: Tom Rix @ 2023-04-20 18:07 UTC (permalink / raw)
  To: harry.wentland, sunpeng.li, Rodrigo.Siqueira, alexander.deucher,
	christian.koenig, Xinhui.Pan, airlied, daniel, nathan,
	ndesaulniers, hamza.mahfooz, drv, roman.li, mairacanal,
	jiapeng.chong, caionovais, gabe.teeger
  Cc: Tom Rix, llvm, dri-devel, amd-gfx, linux-kernel

clang with W=1 reports
drivers/gpu/drm/amd/amdgpu/../display/dc/dml/dcn314/display_rq_dlg_calc_314.c:1003:15:
  error: variable 'dispclk_delay_subtotal' set but not used [-Werror,-Wunused-but-set-variable]
        unsigned int dispclk_delay_subtotal;
                     ^
This variable is not used, so remove it.
Which made dout unused, so also remove.

Signed-off-by: Tom Rix <trix@redhat.com>
---
 .../display/dc/dml/dcn314/display_rq_dlg_calc_314.c    | 10 ----------
 1 file changed, 10 deletions(-)

diff --git a/drivers/gpu/drm/amd/display/dc/dml/dcn314/display_rq_dlg_calc_314.c b/drivers/gpu/drm/amd/display/dc/dml/dcn314/display_rq_dlg_calc_314.c
index ea4eb66066c4..239cb8160c77 100644
--- a/drivers/gpu/drm/amd/display/dc/dml/dcn314/display_rq_dlg_calc_314.c
+++ b/drivers/gpu/drm/amd/display/dc/dml/dcn314/display_rq_dlg_calc_314.c
@@ -951,7 +951,6 @@ static void dml_rq_dlg_get_dlg_params(
 {
 	const display_pipe_source_params_st *src = &e2e_pipe_param[pipe_idx].pipe.src;
 	const display_pipe_dest_params_st *dst = &e2e_pipe_param[pipe_idx].pipe.dest;
-	const display_output_params_st *dout = &e2e_pipe_param[pipe_idx].dout;
 	const display_clocks_and_cfg_st *clks = &e2e_pipe_param[pipe_idx].clks_cfg;
 	const scaler_ratio_depth_st *scl = &e2e_pipe_param[pipe_idx].pipe.scale_ratio_depth;
 	const scaler_taps_st *taps = &e2e_pipe_param[pipe_idx].pipe.scale_taps;
@@ -1000,8 +999,6 @@ static void dml_rq_dlg_get_dlg_params(
 	unsigned int vupdate_width;
 	unsigned int vready_offset;
 
-	unsigned int dispclk_delay_subtotal;
-
 	unsigned int vstartup_start;
 	unsigned int dst_x_after_scaler;
 	unsigned int dst_y_after_scaler;
@@ -1127,13 +1124,6 @@ static void dml_rq_dlg_get_dlg_params(
 	vupdate_offset = dst->vupdate_offset;
 	vupdate_width = dst->vupdate_width;
 	vready_offset = dst->vready_offset;
-	dispclk_delay_subtotal = mode_lib->ip.dispclk_delay_subtotal;
-
-	if (dout->dsc_enable) {
-		double dsc_delay = get_dsc_delay(mode_lib, e2e_pipe_param, num_pipes, pipe_idx); // FROM VBA
-
-		dispclk_delay_subtotal += dsc_delay;
-	}
 
 	vstartup_start = dst->vstartup_start;
 	if (interlaced) {
-- 
2.27.0


^ permalink raw reply related	[relevance 93%]

* [PATCH] drm/amdgpu: remove unused variable j
@ 2023-04-20 14:29 84% Tom Rix
  0 siblings, 0 replies; 180+ results
From: Tom Rix @ 2023-04-20 14:29 UTC (permalink / raw)
  To: alexander.deucher, christian.koenig, Xinhui.Pan, airlied, daniel,
	Hawking.Zhang, le.ma, Jack.Xiao, YiPeng.Chai, Lang.Yu, Likun.Gao,
	Arunpravin.PaneerSelvam, andrealmeid
  Cc: Tom Rix, dri-devel, amd-gfx, linux-kernel

gcc with W=1 reports
drivers/gpu/drm/amd/amdgpu/amdgpu_gfx.c: In function
  ‘amdgpu_gfx_mqd_sw_fini’:
drivers/gpu/drm/amd/amdgpu/amdgpu_gfx.c:451:16: error: variable
  ‘j’ set but not used [-Werror=unused-but-set-variable]
  451 |         int i, j;
      |                ^
drivers/gpu/drm/amd/amdgpu/amdgpu_gfx.c: In function
  ‘amdgpu_gfx_disable_kcq’:
drivers/gpu/drm/amd/amdgpu/amdgpu_gfx.c:486:13: error: variable
  ‘j’ set but not used [-Werror=unused-but-set-variable]
  486 |         int j;
      |             ^
drivers/gpu/drm/amd/amdgpu/amdgpu_gfx.c: In function
  ‘amdgpu_gfx_enable_kcq’:
drivers/gpu/drm/amd/amdgpu/amdgpu_gfx.c:529:19: error: variable
  ‘j’ set but not used [-Werror=unused-but-set-variable]
  529 |         int r, i, j;
      |                   ^

These variables are not used, so remove them.

Signed-off-by: Tom Rix <trix@redhat.com>
---
 drivers/gpu/drm/amd/amdgpu/amdgpu_gfx.c | 14 ++++----------
 1 file changed, 4 insertions(+), 10 deletions(-)

diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_gfx.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_gfx.c
index 7f5c60381103..ac6fd8620279 100644
--- a/drivers/gpu/drm/amd/amdgpu/amdgpu_gfx.c
+++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_gfx.c
@@ -448,7 +448,7 @@ int amdgpu_gfx_mqd_sw_init(struct amdgpu_device *adev,
 void amdgpu_gfx_mqd_sw_fini(struct amdgpu_device *adev, int xcc_id)
 {
 	struct amdgpu_ring *ring = NULL;
-	int i, j;
+	int i;
 	struct amdgpu_kiq *kiq = &adev->gfx.kiq[xcc_id];
 
 	if (adev->asic_type >= CHIP_NAVI10 && amdgpu_async_gfx_ring) {
@@ -462,7 +462,6 @@ void amdgpu_gfx_mqd_sw_fini(struct amdgpu_device *adev, int xcc_id)
 	}
 
 	for (i = 0; i < adev->gfx.num_compute_rings; i++) {
-		j = i + xcc_id * adev->gfx.num_compute_rings;
 		ring = &adev->gfx.compute_ring[i];
 		kfree(adev->gfx.mec.mqd_backup[i]);
 		amdgpu_bo_free_kernel(&ring->mqd_obj,
@@ -483,7 +482,6 @@ int amdgpu_gfx_disable_kcq(struct amdgpu_device *adev, int xcc_id)
 	struct amdgpu_kiq *kiq = &adev->gfx.kiq[xcc_id];
 	struct amdgpu_ring *kiq_ring = &kiq->ring;
 	int i, r = 0;
-	int j;
 
 	if (!kiq->pmf || !kiq->pmf->kiq_unmap_queues)
 		return -EINVAL;
@@ -495,11 +493,9 @@ int amdgpu_gfx_disable_kcq(struct amdgpu_device *adev, int xcc_id)
 		return -ENOMEM;
 	}
 
-	for (i = 0; i < adev->gfx.num_compute_rings; i++) {
-		j = i + xcc_id * adev->gfx.num_compute_rings;
+	for (i = 0; i < adev->gfx.num_compute_rings; i++)
 		kiq->pmf->kiq_unmap_queues(kiq_ring, &adev->gfx.compute_ring[i],
 					   RESET_QUEUES, 0, 0);
-	}
 
 	if (adev->gfx.kiq[0].ring.sched.ready && !adev->job_hang)
 		r = amdgpu_ring_test_helper(kiq_ring);
@@ -526,7 +522,7 @@ int amdgpu_gfx_enable_kcq(struct amdgpu_device *adev, int xcc_id)
 	struct amdgpu_kiq *kiq = &adev->gfx.kiq[xcc_id];
 	struct amdgpu_ring *kiq_ring = &kiq->ring;
 	uint64_t queue_mask = 0;
-	int r, i, j;
+	int r, i;
 
 	if (!kiq->pmf || !kiq->pmf->kiq_map_queues || !kiq->pmf->kiq_set_resources)
 		return -EINVAL;
@@ -562,10 +558,8 @@ int amdgpu_gfx_enable_kcq(struct amdgpu_device *adev, int xcc_id)
 		queue_mask = ~0ULL;
 
 	kiq->pmf->kiq_set_resources(kiq_ring, queue_mask);
-	for (i = 0; i < adev->gfx.num_compute_rings; i++) {
-		j = i + xcc_id * adev->gfx.num_compute_rings;
+	for (i = 0; i < adev->gfx.num_compute_rings; i++)
 		kiq->pmf->kiq_map_queues(kiq_ring, &adev->gfx.compute_ring[i]);
-	}
 
 	r = amdgpu_ring_test_helper(kiq_ring);
 	spin_unlock(&kiq->ring_lock);
-- 
2.27.0


^ permalink raw reply related	[relevance 84%]

* [PATCH] drm/amd/display: return status of dmub_srv_get_fw_boot_status
@ 2023-04-20 13:59 94% Tom Rix
    0 siblings, 1 reply; 180+ results
From: Tom Rix @ 2023-04-20 13:59 UTC (permalink / raw)
  To: harry.wentland, sunpeng.li, Rodrigo.Siqueira, alexander.deucher,
	christian.koenig, Xinhui.Pan, airlied, daniel, Alvin.Lee2,
	Jun.Lei, qingqing.zhuo, Max.Tseng, Josip.Pavic, Eric.Yang2,
	aurabindo.pillai
  Cc: Tom Rix, dri-devel, amd-gfx, linux-kernel

gcc with W=1 reports
drivers/gpu/drm/amd/amdgpu/../display/dc/dc_dmub_srv.c:
  In function ‘dc_dmub_srv_optimized_init_done’:
drivers/gpu/drm/amd/amdgpu/../display/dc/dc_dmub_srv.c:184:26:
  error: variable ‘dmub’ set but not used [-Werror=unused-but-set-variable]
  184 |         struct dmub_srv *dmub;
      |                          ^~~~

The return status is never set.
It looks like a call to dmub_srv_get_fw_boot_status is missing.

Fixes: 499e4b1c722e ("drm/amd/display: add mechanism to skip DCN init")
Signed-off-by: Tom Rix <trix@redhat.com>
---
 drivers/gpu/drm/amd/display/dc/dc_dmub_srv.c | 13 +++++++++++--
 1 file changed, 11 insertions(+), 2 deletions(-)

diff --git a/drivers/gpu/drm/amd/display/dc/dc_dmub_srv.c b/drivers/gpu/drm/amd/display/dc/dc_dmub_srv.c
index d15ec32243e2..36d936ab4300 100644
--- a/drivers/gpu/drm/amd/display/dc/dc_dmub_srv.c
+++ b/drivers/gpu/drm/amd/display/dc/dc_dmub_srv.c
@@ -182,14 +182,23 @@ bool dc_dmub_srv_cmd_run_list(struct dc_dmub_srv *dc_dmub_srv, unsigned int coun
 bool dc_dmub_srv_optimized_init_done(struct dc_dmub_srv *dc_dmub_srv)
 {
 	struct dmub_srv *dmub;
-	union dmub_fw_boot_status status;
+	struct dc_context *dc_ctx;
+	union dmub_fw_boot_status boot_status;
+	enum dmub_status status;
 
 	if (!dc_dmub_srv || !dc_dmub_srv->dmub)
 		return false;
 
 	dmub = dc_dmub_srv->dmub;
+	dc_ctx = dc_dmub_srv->ctx;
+
+	status = dmub_srv_get_fw_boot_status(dmub, &boot_status);
+	if (status != DMUB_STATUS_OK) {
+		DC_ERROR("Error querying DMUB boot status: error=%d\n", status);
+		return false;
+	}
 
-	return status.bits.optimized_init_done;
+	return boot_status.bits.optimized_init_done;
 }
 
 bool dc_dmub_srv_notify_stream_mask(struct dc_dmub_srv *dc_dmub_srv,
-- 
2.27.0


^ permalink raw reply related	[relevance 94%]

* [PATCH] drm/amd/display: return status of abm_feature_support
@ 2023-04-20 13:21 96% Tom Rix
  0 siblings, 0 replies; 180+ results
From: Tom Rix @ 2023-04-20 13:21 UTC (permalink / raw)
  To: harry.wentland, sunpeng.li, Rodrigo.Siqueira, alexander.deucher,
	christian.koenig, Xinhui.Pan, airlied, daniel, Leon.Huang1,
	wenjing.liu, qingqing.zhuo
  Cc: Tom Rix, dri-devel, amd-gfx, linux-kernel

gcc with W=1 reports
drivers/gpu/drm/amd/amdgpu/../display/dc/dce/dmub_abm.c:
  In function ‘dmub_abm_set_event_ex’:
drivers/gpu/drm/amd/amdgpu/../display/dc/dce/dmub_abm.c:138:22: error: variable
  ‘feature_support’ set but not used [-Werror=unused-but-set-variable]
  138 |         unsigned int feature_support;
      |                      ^~~~~~~~~~~~~~~

This variable is not used so remove it.
The status of amb_feature_support should have been returned, so
set ret and return it.

Fixes: b8fe56375f78 ("drm/amd/display: Refactor ABM feature")
Signed-off-by: Tom Rix <trix@redhat.com>
---
 drivers/gpu/drm/amd/display/dc/dce/dmub_abm.c | 5 ++---
 1 file changed, 2 insertions(+), 3 deletions(-)

diff --git a/drivers/gpu/drm/amd/display/dc/dce/dmub_abm.c b/drivers/gpu/drm/amd/display/dc/dce/dmub_abm.c
index a66f83a61402..8f285c3be4c6 100644
--- a/drivers/gpu/drm/amd/display/dc/dce/dmub_abm.c
+++ b/drivers/gpu/drm/amd/display/dc/dce/dmub_abm.c
@@ -134,10 +134,9 @@ static bool dmub_abm_set_pipe_ex(struct abm *abm, uint32_t otg_inst, uint32_t op
 static bool dmub_abm_set_event_ex(struct abm *abm, unsigned int full_screen, unsigned int video_mode,
 		unsigned int hdr_mode, unsigned int panel_inst)
 {
-	bool ret = false;
-	unsigned int feature_support;
+	bool ret;
 
-	feature_support = abm_feature_support(abm, panel_inst);
+	ret = abm_feature_support(abm, panel_inst);
 
 	return ret;
 }
-- 
2.27.0


^ permalink raw reply related	[relevance 96%]

* [PATCH] drm/amd/display: remove unused variables otg_inst and cmd
@ 2023-04-20  2:04 95% Tom Rix
  0 siblings, 0 replies; 180+ results
From: Tom Rix @ 2023-04-20  2:04 UTC (permalink / raw)
  To: harry.wentland, sunpeng.li, Rodrigo.Siqueira, alexander.deucher,
	christian.koenig, Xinhui.Pan, airlied, daniel, qingqing.zhuo,
	wenjing.liu, Jun.Lei, Josip.Pavic, Leon.Huang1,
	Nicholas.Kazlauskas
  Cc: Tom Rix, dri-devel, amd-gfx, linux-kernel

gcc reports
drivers/gpu/drm/amd/amdgpu/../display/dc/dcn21/dcn21_hwseq.c:
  In function ‘dcn21_set_backlight_level’:
drivers/gpu/drm/amd/amdgpu/../display/dc/dcn21/dcn21_hwseq.c:229:18:
  error: unused variable ‘otg_inst’ [-Werror=unused-variable]
  229 |         uint32_t otg_inst = pipe_ctx->stream_res.tg->inst;
      |                  ^~~~~~~~
drivers/gpu/drm/amd/amdgpu/../display/dc/dcn21/dcn21_hwseq.c:226:27:
  error: unused variable ‘cmd’ [-Werror=unused-variable]
  226 |         union dmub_rb_cmd cmd;
      |                           ^~~

These variables are not used, so remove them.

Fixes: e97cc04fe0fb ("drm/amd/display: refactor dmub commands into single function")
Signed-off-by: Tom Rix <trix@redhat.com>
---
 drivers/gpu/drm/amd/display/dc/dcn21/dcn21_hwseq.c | 2 --
 1 file changed, 2 deletions(-)

diff --git a/drivers/gpu/drm/amd/display/dc/dcn21/dcn21_hwseq.c b/drivers/gpu/drm/amd/display/dc/dcn21/dcn21_hwseq.c
index 55a464a39529..43463d08f21b 100644
--- a/drivers/gpu/drm/amd/display/dc/dcn21/dcn21_hwseq.c
+++ b/drivers/gpu/drm/amd/display/dc/dcn21/dcn21_hwseq.c
@@ -223,10 +223,8 @@ bool dcn21_set_backlight_level(struct pipe_ctx *pipe_ctx,
 		uint32_t backlight_pwm_u16_16,
 		uint32_t frame_ramp)
 {
-	union dmub_rb_cmd cmd;
 	struct dc_context *dc = pipe_ctx->stream->ctx;
 	struct abm *abm = pipe_ctx->stream_res.abm;
-	uint32_t otg_inst = pipe_ctx->stream_res.tg->inst;
 	struct panel_cntl *panel_cntl = pipe_ctx->stream->link->panel_cntl;
 
 	if (dc->dc->res_pool->dmcu) {
-- 
2.27.0


^ permalink raw reply related	[relevance 95%]

* [PATCH] accel/qaic: initialize ret variable to 0
@ 2023-04-18 19:20 99% Tom Rix
  0 siblings, 0 replies; 180+ results
From: Tom Rix @ 2023-04-18 19:20 UTC (permalink / raw)
  To: quic_jhugo, ogabbay, nathan, ndesaulniers, jacek.lawrynowicz,
	quic_carlv, stanislaw.gruszka, quic_pkanojiy
  Cc: linux-arm-msm, llvm, linux-kernel, dri-devel, Tom Rix

clang static analysis reports
drivers/accel/qaic/qaic_data.c:610:2: warning: Undefined or garbage
  value returned to caller [core.uninitialized.UndefReturn]
        return ret;
        ^~~~~~~~~~

The ret variable is only set some of the time but is always returned.
So initialize ret to 0.

Fixes: ff13be830333 ("accel/qaic: Add datapath")
Signed-off-by: Tom Rix <trix@redhat.com>
---
 drivers/accel/qaic/qaic_data.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/accel/qaic/qaic_data.c b/drivers/accel/qaic/qaic_data.c
index c0a574cd1b35..b46a16fb3080 100644
--- a/drivers/accel/qaic/qaic_data.c
+++ b/drivers/accel/qaic/qaic_data.c
@@ -591,7 +591,7 @@ static int qaic_gem_object_mmap(struct drm_gem_object *obj, struct vm_area_struc
 	struct qaic_bo *bo = to_qaic_bo(obj);
 	unsigned long offset = 0;
 	struct scatterlist *sg;
-	int ret;
+	int ret = 0;
 
 	if (obj->import_attach)
 		return -EINVAL;
-- 
2.27.0


^ permalink raw reply related	[relevance 99%]

* [PATCH] drm/amd/display: set variable dccg314_init storage-class-specifier to static
@ 2023-04-15 15:17 99% Tom Rix
  0 siblings, 0 replies; 180+ results
From: Tom Rix @ 2023-04-15 15:17 UTC (permalink / raw)
  To: harry.wentland, sunpeng.li, Rodrigo.Siqueira, alexander.deucher,
	christian.koenig, Xinhui.Pan, airlied, daniel,
	nicholas.kazlauskas, Syed.Hassan, jdhillon, alex.hung,
	michael.strauss, aurabindo.pillai
  Cc: Tom Rix, dri-devel, amd-gfx, linux-kernel

smatch reports
drivers/gpu/drm/amd/amdgpu/../display/dc/dcn314/dcn314_dccg.c:277:6: warning: symbol
  'dccg314_init' was not declared. Should it be static?

This variable is only used in one file so should be static.

Signed-off-by: Tom Rix <trix@redhat.com>
---
 drivers/gpu/drm/amd/display/dc/dcn314/dcn314_dccg.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/gpu/drm/amd/display/dc/dcn314/dcn314_dccg.c b/drivers/gpu/drm/amd/display/dc/dcn314/dcn314_dccg.c
index 6f879265ad9c..de7bfba2c179 100644
--- a/drivers/gpu/drm/amd/display/dc/dcn314/dcn314_dccg.c
+++ b/drivers/gpu/drm/amd/display/dc/dcn314/dcn314_dccg.c
@@ -274,7 +274,7 @@ static void dccg314_set_dpstreamclk(
 	}
 }
 
-void dccg314_init(struct dccg *dccg)
+static void dccg314_init(struct dccg *dccg)
 {
 	int otg_inst;
 
-- 
2.27.0


^ permalink raw reply related	[relevance 99%]

* [PATCH] drm/amd/display: remove unused variable oldest_index
@ 2023-04-14 15:08 99% Tom Rix
  0 siblings, 0 replies; 180+ results
From: Tom Rix @ 2023-04-14 15:08 UTC (permalink / raw)
  To: harry.wentland, sunpeng.li, Rodrigo.Siqueira, alexander.deucher,
	christian.koenig, Xinhui.Pan, airlied, daniel, HaoPing.Liu,
	aric.cyr, qingqing.zhuo, hanghong.ma, felipe.clark,
	Dillon.Varone, Mike.Hsieh
  Cc: Tom Rix, dri-devel, amd-gfx, linux-kernel

cpp_check reports
drivers/gpu/drm/amd/display/modules/freesync/freesync.c:1143:17: style: Variable
  'oldest_index' is assigned a value that is never used. [unreadVariable]
   oldest_index = 0;
                ^

This variable is not used so remove.

Signed-off-by: Tom Rix <trix@redhat.com>
---
 drivers/gpu/drm/amd/display/modules/freesync/freesync.c | 4 ----
 1 file changed, 4 deletions(-)

diff --git a/drivers/gpu/drm/amd/display/modules/freesync/freesync.c b/drivers/gpu/drm/amd/display/modules/freesync/freesync.c
index 5c41a4751db4..5798c0eafa1f 100644
--- a/drivers/gpu/drm/amd/display/modules/freesync/freesync.c
+++ b/drivers/gpu/drm/amd/display/modules/freesync/freesync.c
@@ -1137,10 +1137,6 @@ void mod_freesync_handle_preflip(struct mod_freesync *mod_freesync,
 
 	if (in_out_vrr->supported &&
 			in_out_vrr->state == VRR_STATE_ACTIVE_VARIABLE) {
-		unsigned int oldest_index = plane->time.index + 1;
-
-		if (oldest_index >= DC_PLANE_UPDATE_TIMES_MAX)
-			oldest_index = 0;
 
 		last_render_time_in_us = curr_time_stamp_in_us -
 				plane->time.prev_update_time_in_us;
-- 
2.27.0


^ permalink raw reply related	[relevance 99%]

* [PATCH] phy: mediatek: fix returning garbage
@ 2023-04-14 12:22 99% Tom Rix
  0 siblings, 0 replies; 180+ results
From: Tom Rix @ 2023-04-14 12:22 UTC (permalink / raw)
  To: chunkuang.hu, p.zabel, chunfeng.yun, vkoul, kishon, matthias.bgg,
	angelogioacchino.delregno, nathan, ndesaulniers, granquet
  Cc: Tom Rix, llvm, linux-kernel, dri-devel, linux-mediatek,
	linux-phy, linux-arm-kernel

clang reports
drivers/phy/mediatek/phy-mtk-hdmi-mt8195.c:298:6: error: variable
  'ret' is uninitialized when used here [-Werror,-Wuninitialized]
        if (ret)
            ^~~
ret should have been set by the preceding call to mtk_hdmi_pll_set_hw.

Fixes: 45810d486bb4 ("phy: mediatek: add support for phy-mtk-hdmi-mt8195")
Signed-off-by: Tom Rix <trix@redhat.com>
---
 drivers/phy/mediatek/phy-mtk-hdmi-mt8195.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/drivers/phy/mediatek/phy-mtk-hdmi-mt8195.c b/drivers/phy/mediatek/phy-mtk-hdmi-mt8195.c
index abfc077fb0a8..c63294e451d6 100644
--- a/drivers/phy/mediatek/phy-mtk-hdmi-mt8195.c
+++ b/drivers/phy/mediatek/phy-mtk-hdmi-mt8195.c
@@ -292,9 +292,9 @@ static int mtk_hdmi_pll_calc(struct mtk_hdmi_phy *hdmi_phy, struct clk_hw *hw,
 	if (!(digital_div <= 32 && digital_div >= 1))
 		return -EINVAL;
 
-	mtk_hdmi_pll_set_hw(hw, PLL_PREDIV, fbkdiv_high, fbkdiv_low,
-			    PLL_FBKDIV_HS3, posdiv1, posdiv2, txprediv,
-			    txposdiv, digital_div);
+	ret = mtk_hdmi_pll_set_hw(hw, PLL_PREDIV, fbkdiv_high, fbkdiv_low,
+				  PLL_FBKDIV_HS3, posdiv1, posdiv2, txprediv,
+				  txposdiv, digital_div);
 	if (ret)
 		return -EINVAL;
 
-- 
2.27.0


^ permalink raw reply related	[relevance 99%]

* [PATCH] drm/amd/pm: change pmfw_decoded_link_width, speed variables to globals
@ 2023-04-14 12:03 90% Tom Rix
  0 siblings, 0 replies; 180+ results
From: Tom Rix @ 2023-04-14 12:03 UTC (permalink / raw)
  To: evan.quan, alexander.deucher, christian.koenig, Xinhui.Pan,
	airlied, daniel, Hawking.Zhang, kenneth.feng, tim.huang,
	lijo.lazar, mario.limonciello
  Cc: Tom Rix, dri-devel, amd-gfx, linux-kernel

gcc with W=1 reports
In file included from drivers/gpu/drm/amd/amdgpu/../pm/swsmu/smu13/smu_v13_0.c:36:
./drivers/gpu/drm/amd/amdgpu/../pm/swsmu/inc/smu_v13_0.h:66:18: error:
  ‘pmfw_decoded_link_width’ defined but not used [-Werror=unused-const-variable=]
   66 | static const int pmfw_decoded_link_width[7] = {0, 1, 2, 4, 8, 12, 16};
      |                  ^~~~~~~~~~~~~~~~~~~~~~~
./drivers/gpu/drm/amd/amdgpu/../pm/swsmu/inc/smu_v13_0.h:65:18: error:
  ‘pmfw_decoded_link_speed’ defined but not used [-Werror=unused-const-variable=]
   65 | static const int pmfw_decoded_link_speed[5] = {1, 2, 3, 4, 5};
      |                  ^~~~~~~~~~~~~~~~~~~~~~~

These variables are defined and used in smu_v13_0_7_ppt.c and smu_v13_0_0_ppt.c.
There should be only one definition.  So define the variables as globals
in smu_v13_0.c

Signed-off-by: Tom Rix <trix@redhat.com>
---
 drivers/gpu/drm/amd/pm/swsmu/inc/smu_v13_0.h   | 4 ++--
 drivers/gpu/drm/amd/pm/swsmu/smu13/smu_v13_0.c | 3 +++
 2 files changed, 5 insertions(+), 2 deletions(-)

diff --git a/drivers/gpu/drm/amd/pm/swsmu/inc/smu_v13_0.h b/drivers/gpu/drm/amd/pm/swsmu/inc/smu_v13_0.h
index 7944ce80e5c3..df3baaab0037 100644
--- a/drivers/gpu/drm/amd/pm/swsmu/inc/smu_v13_0.h
+++ b/drivers/gpu/drm/amd/pm/swsmu/inc/smu_v13_0.h
@@ -62,8 +62,8 @@
 #define CTF_OFFSET_HOTSPOT		5
 #define CTF_OFFSET_MEM			5
 
-static const int pmfw_decoded_link_speed[5] = {1, 2, 3, 4, 5};
-static const int pmfw_decoded_link_width[7] = {0, 1, 2, 4, 8, 12, 16};
+extern const int pmfw_decoded_link_speed[5];
+extern const int pmfw_decoded_link_width[7];
 
 #define DECODE_GEN_SPEED(gen_speed_idx)		(pmfw_decoded_link_speed[gen_speed_idx])
 #define DECODE_LANE_WIDTH(lane_width_idx)	(pmfw_decoded_link_width[lane_width_idx])
diff --git a/drivers/gpu/drm/amd/pm/swsmu/smu13/smu_v13_0.c b/drivers/gpu/drm/amd/pm/swsmu/smu13/smu_v13_0.c
index 73175c993da9..393c6a7b9609 100644
--- a/drivers/gpu/drm/amd/pm/swsmu/smu13/smu_v13_0.c
+++ b/drivers/gpu/drm/amd/pm/swsmu/smu13/smu_v13_0.c
@@ -85,6 +85,9 @@ MODULE_FIRMWARE("amdgpu/smu_13_0_10.bin");
 static const int link_width[] = {0, 1, 2, 4, 8, 12, 16};
 static const int link_speed[] = {25, 50, 80, 160};
 
+const int pmfw_decoded_link_speed[5] = {1, 2, 3, 4, 5};
+const int pmfw_decoded_link_width[7] = {0, 1, 2, 4, 8, 12, 16};
+
 int smu_v13_0_init_microcode(struct smu_context *smu)
 {
 	struct amdgpu_device *adev = smu->adev;
-- 
2.27.0


^ permalink raw reply related	[relevance 90%]

* [PATCH] accel/habanalabs: remove variable gaudi_irq_name
@ 2023-04-11 14:08 99% Tom Rix
  0 siblings, 0 replies; 180+ results
From: Tom Rix @ 2023-04-11 14:08 UTC (permalink / raw)
  To: ogabbay, gregkh, osharabi, talcohen, dhirschfeld, obitton
  Cc: Tom Rix, linux-kernel, dri-devel

gcc with W=1 reports
drivers/accel/habanalabs/gaudi/gaudi.c:117:19: error:
  ‘gaudi_irq_name’ defined but not used [-Werror=unused-const-variable=]
  117 | static const char gaudi_irq_name[GAUDI_MSI_ENTRIES][GAUDI_MAX_STRING_LEN] = {
      |                   ^~~~~~~~~~~~~~

This variable is not used so remove it.

Signed-off-by: Tom Rix <trix@redhat.com>
---
 drivers/accel/habanalabs/gaudi/gaudi.c | 7 -------
 1 file changed, 7 deletions(-)

diff --git a/drivers/accel/habanalabs/gaudi/gaudi.c b/drivers/accel/habanalabs/gaudi/gaudi.c
index a29aa8f7b6f3..a1697581c218 100644
--- a/drivers/accel/habanalabs/gaudi/gaudi.c
+++ b/drivers/accel/habanalabs/gaudi/gaudi.c
@@ -114,13 +114,6 @@ static u32 gaudi_stream_master[GAUDI_STREAM_MASTER_ARR_SIZE] = {
 	GAUDI_QUEUE_ID_DMA_1_3
 };
 
-static const char gaudi_irq_name[GAUDI_MSI_ENTRIES][GAUDI_MAX_STRING_LEN] = {
-		"gaudi cq 0_0", "gaudi cq 0_1", "gaudi cq 0_2", "gaudi cq 0_3",
-		"gaudi cq 1_0", "gaudi cq 1_1", "gaudi cq 1_2", "gaudi cq 1_3",
-		"gaudi cq 5_0", "gaudi cq 5_1", "gaudi cq 5_2", "gaudi cq 5_3",
-		"gaudi cpu eq"
-};
-
 static const u8 gaudi_dma_assignment[GAUDI_DMA_MAX] = {
 	[GAUDI_PCI_DMA_1] = GAUDI_ENGINE_ID_DMA_0,
 	[GAUDI_PCI_DMA_2] = GAUDI_ENGINE_ID_DMA_1,
-- 
2.27.0


^ permalink raw reply related	[relevance 99%]

* [PATCH] drm/qxl: remove variable count
@ 2023-04-08 16:50 99% Tom Rix
  0 siblings, 0 replies; 180+ results
From: Tom Rix @ 2023-04-08 16:50 UTC (permalink / raw)
  To: airlied, kraxel, airlied, daniel, nathan, ndesaulniers
  Cc: Tom Rix, llvm, linux-kernel, dri-devel, virtualization, spice-devel

clang with W=1 reports
drivers/gpu/drm/qxl/qxl_cmd.c:424:6: error: variable
  'count' set but not used [-Werror,-Wunused-but-set-variable]
        int count = 0;
            ^
This variable is not used so remove it.

Signed-off-by: Tom Rix <trix@redhat.com>
---
 drivers/gpu/drm/qxl/qxl_cmd.c | 2 --
 1 file changed, 2 deletions(-)

diff --git a/drivers/gpu/drm/qxl/qxl_cmd.c b/drivers/gpu/drm/qxl/qxl_cmd.c
index 281edab518cd..d6ea01f3797b 100644
--- a/drivers/gpu/drm/qxl/qxl_cmd.c
+++ b/drivers/gpu/drm/qxl/qxl_cmd.c
@@ -421,7 +421,6 @@ int qxl_surface_id_alloc(struct qxl_device *qdev,
 {
 	uint32_t handle;
 	int idr_ret;
-	int count = 0;
 again:
 	idr_preload(GFP_ATOMIC);
 	spin_lock(&qdev->surf_id_idr_lock);
@@ -433,7 +432,6 @@ int qxl_surface_id_alloc(struct qxl_device *qdev,
 	handle = idr_ret;
 
 	if (handle >= qdev->rom->n_surfaces) {
-		count++;
 		spin_lock(&qdev->surf_id_idr_lock);
 		idr_remove(&qdev->surf_id_idr, handle);
 		spin_unlock(&qdev->surf_id_idr_lock);
-- 
2.27.0


^ permalink raw reply related	[relevance 99%]

* [PATCH] drm/amd/display: set variables dml*_funcs storage-class-specifier to static
@ 2023-04-08 13:43 86% Tom Rix
  0 siblings, 0 replies; 180+ results
From: Tom Rix @ 2023-04-08 13:43 UTC (permalink / raw)
  To: harry.wentland, sunpeng.li, Rodrigo.Siqueira, alexander.deucher,
	christian.koenig, Xinhui.Pan, airlied, daniel, Pavle.Kotarac,
	Jun.Lei, nicholas.kazlauskas, Charlene.Liu, aurabindo.pillai,
	Dmytro.Laktyushkin
  Cc: Tom Rix, dri-devel, amd-gfx, linux-kernel

smatch reports
drivers/gpu/drm/amd/amdgpu/../display/dc/dml/display_mode_lib.c:44:24: warning: symbol
  'dml20_funcs' was not declared. Should it be static?
drivers/gpu/drm/amd/amdgpu/../display/dc/dml/display_mode_lib.c:51:24: warning: symbol
  'dml20v2_funcs' was not declared. Should it be static?
drivers/gpu/drm/amd/amdgpu/../display/dc/dml/display_mode_lib.c:58:24: warning: symbol
  'dml21_funcs' was not declared. Should it be static?
drivers/gpu/drm/amd/amdgpu/../display/dc/dml/display_mode_lib.c:65:24: warning: symbol
  'dml30_funcs' was not declared. Should it be static?
drivers/gpu/drm/amd/amdgpu/../display/dc/dml/display_mode_lib.c:72:24: warning: symbol
  'dml31_funcs' was not declared. Should it be static?
drivers/gpu/drm/amd/amdgpu/../display/dc/dml/display_mode_lib.c:79:24: warning: symbol
  'dml314_funcs' was not declared. Should it be static?
drivers/gpu/drm/amd/amdgpu/../display/dc/dml/display_mode_lib.c:86:24: warning: symbol
  'dml32_funcs' was not declared. Should it be static?

These variables are only used in one file so should be static.
Cleanup whitespace, use tabs consistently for indents.

Signed-off-by: Tom Rix <trix@redhat.com>
---
 .../drm/amd/display/dc/dml/display_mode_lib.c | 24 +++++++++----------
 1 file changed, 12 insertions(+), 12 deletions(-)

diff --git a/drivers/gpu/drm/amd/display/dc/dml/display_mode_lib.c b/drivers/gpu/drm/amd/display/dc/dml/display_mode_lib.c
index 4125d3d111d1..bdf3ac6cadd5 100644
--- a/drivers/gpu/drm/amd/display/dc/dml/display_mode_lib.c
+++ b/drivers/gpu/drm/amd/display/dc/dml/display_mode_lib.c
@@ -41,51 +41,51 @@
 #include "dcn32/display_rq_dlg_calc_32.h"
 #include "dml_logger.h"
 
-const struct dml_funcs dml20_funcs = {
+static const struct dml_funcs dml20_funcs = {
 	.validate = dml20_ModeSupportAndSystemConfigurationFull,
 	.recalculate = dml20_recalculate,
 	.rq_dlg_get_dlg_reg = dml20_rq_dlg_get_dlg_reg,
 	.rq_dlg_get_rq_reg = dml20_rq_dlg_get_rq_reg
 };
 
-const struct dml_funcs dml20v2_funcs = {
+static const struct dml_funcs dml20v2_funcs = {
 	.validate = dml20v2_ModeSupportAndSystemConfigurationFull,
 	.recalculate = dml20v2_recalculate,
 	.rq_dlg_get_dlg_reg = dml20v2_rq_dlg_get_dlg_reg,
 	.rq_dlg_get_rq_reg = dml20v2_rq_dlg_get_rq_reg
 };
 
-const struct dml_funcs dml21_funcs = {
-        .validate = dml21_ModeSupportAndSystemConfigurationFull,
-        .recalculate = dml21_recalculate,
-        .rq_dlg_get_dlg_reg = dml21_rq_dlg_get_dlg_reg,
-        .rq_dlg_get_rq_reg = dml21_rq_dlg_get_rq_reg
+static const struct dml_funcs dml21_funcs = {
+	.validate = dml21_ModeSupportAndSystemConfigurationFull,
+	.recalculate = dml21_recalculate,
+	.rq_dlg_get_dlg_reg = dml21_rq_dlg_get_dlg_reg,
+	.rq_dlg_get_rq_reg = dml21_rq_dlg_get_rq_reg
 };
 
-const struct dml_funcs dml30_funcs = {
+static const struct dml_funcs dml30_funcs = {
 	.validate = dml30_ModeSupportAndSystemConfigurationFull,
 	.recalculate = dml30_recalculate,
 	.rq_dlg_get_dlg_reg = dml30_rq_dlg_get_dlg_reg,
 	.rq_dlg_get_rq_reg = dml30_rq_dlg_get_rq_reg
 };
 
-const struct dml_funcs dml31_funcs = {
+static const struct dml_funcs dml31_funcs = {
 	.validate = dml31_ModeSupportAndSystemConfigurationFull,
 	.recalculate = dml31_recalculate,
 	.rq_dlg_get_dlg_reg = dml31_rq_dlg_get_dlg_reg,
 	.rq_dlg_get_rq_reg = dml31_rq_dlg_get_rq_reg
 };
 
-const struct dml_funcs dml314_funcs = {
+static const struct dml_funcs dml314_funcs = {
 	.validate = dml314_ModeSupportAndSystemConfigurationFull,
 	.recalculate = dml314_recalculate,
 	.rq_dlg_get_dlg_reg = dml314_rq_dlg_get_dlg_reg,
 	.rq_dlg_get_rq_reg = dml314_rq_dlg_get_rq_reg
 };
 
-const struct dml_funcs dml32_funcs = {
+static const struct dml_funcs dml32_funcs = {
 	.validate = dml32_ModeSupportAndSystemConfigurationFull,
-    .recalculate = dml32_recalculate,
+	.recalculate = dml32_recalculate,
 	.rq_dlg_get_dlg_reg_v2 = dml32_rq_dlg_get_dlg_reg,
 	.rq_dlg_get_rq_reg_v2 = dml32_rq_dlg_get_rq_reg
 };
-- 
2.27.0


^ permalink raw reply related	[relevance 86%]

* [PATCH] drm/amd/display: set variables aperture_default_system and context0_default_system storage-class-specifier to static
@ 2023-04-06 19:58 97% Tom Rix
  0 siblings, 0 replies; 180+ results
From: Tom Rix @ 2023-04-06 19:58 UTC (permalink / raw)
  To: harry.wentland, sunpeng.li, Rodrigo.Siqueira, alexander.deucher,
	christian.koenig, Xinhui.Pan, airlied, daniel, Brian.Chang,
	Martin.Leung, David.Galiffi, Ethan.Wellenreiter, martin.tsai,
	tales.aparecida
  Cc: Tom Rix, dri-devel, amd-gfx, linux-kernel

smatch reports
drivers/gpu/drm/amd/amdgpu/../display/dc/dcn10/dcn10_hubp.c:758:10: warning: symbol
  'aperture_default_system' was not declared. Should it be static?
drivers/gpu/drm/amd/amdgpu/../display/dc/dcn10/dcn10_hubp.c:759:10: warning: symbol
  'context0_default_system' was not declared. Should it be static?

These variables are only used in one file so should be static.

Signed-off-by: Tom Rix <trix@redhat.com>
---
 drivers/gpu/drm/amd/display/dc/dcn10/dcn10_hubp.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/gpu/drm/amd/display/dc/dcn10/dcn10_hubp.c b/drivers/gpu/drm/amd/display/dc/dcn10/dcn10_hubp.c
index a142a00bc432..bf399819ca80 100644
--- a/drivers/gpu/drm/amd/display/dc/dcn10/dcn10_hubp.c
+++ b/drivers/gpu/drm/amd/display/dc/dcn10/dcn10_hubp.c
@@ -755,8 +755,8 @@ bool hubp1_is_flip_pending(struct hubp *hubp)
 	return false;
 }
 
-uint32_t aperture_default_system = 1;
-uint32_t context0_default_system; /* = 0;*/
+static uint32_t aperture_default_system = 1;
+static uint32_t context0_default_system; /* = 0;*/
 
 static void hubp1_set_vm_system_aperture_settings(struct hubp *hubp,
 		struct vm_system_aperture_param *apt)
-- 
2.27.0


^ permalink raw reply related	[relevance 97%]

* [PATCH] drm/amd/display: set variable dcn3_14_soc storage-class-specifier to static
@ 2023-04-06 18:44 99% Tom Rix
  0 siblings, 0 replies; 180+ results
From: Tom Rix @ 2023-04-06 18:44 UTC (permalink / raw)
  To: harry.wentland, sunpeng.li, Rodrigo.Siqueira, alexander.deucher,
	christian.koenig, Xinhui.Pan, airlied, daniel,
	nicholas.kazlauskas, Jun.Lei, Pavle.Kotarac, chiahsuan.chung,
	duncan.ma, Charlene.Liu, muansari
  Cc: Tom Rix, dri-devel, amd-gfx, linux-kernel

smatch reports
drivers/gpu/drm/amd/amdgpu/../display/dc/dml/dcn314/dcn314_fpu.c:100:37: warning: symbol
  'dcn3_14_soc' was not declared. Should it be static?

This variable is only used in one file so should be static.

Signed-off-by: Tom Rix <trix@redhat.com>
---
 drivers/gpu/drm/amd/display/dc/dml/dcn314/dcn314_fpu.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/gpu/drm/amd/display/dc/dml/dcn314/dcn314_fpu.c b/drivers/gpu/drm/amd/display/dc/dml/dcn314/dcn314_fpu.c
index c52b76610bd2..44082f65de1f 100644
--- a/drivers/gpu/drm/amd/display/dc/dml/dcn314/dcn314_fpu.c
+++ b/drivers/gpu/drm/amd/display/dc/dml/dcn314/dcn314_fpu.c
@@ -97,7 +97,7 @@ struct _vcs_dpi_ip_params_st dcn3_14_ip = {
 	.dcc_supported = true,
 };
 
-struct _vcs_dpi_soc_bounding_box_st dcn3_14_soc = {
+static struct _vcs_dpi_soc_bounding_box_st dcn3_14_soc = {
 		/*TODO: correct dispclk/dppclk voltage level determination*/
 	.clock_limits = {
 		{
-- 
2.27.0


^ permalink raw reply related	[relevance 99%]

* [PATCH] drm/vc4: remove unused render_wait variable
@ 2023-04-06 15:12 99% Tom Rix
  0 siblings, 0 replies; 180+ results
From: Tom Rix @ 2023-04-06 15:12 UTC (permalink / raw)
  To: emma, mripard, airlied, daniel; +Cc: Tom Rix, linux-kernel, dri-devel

smatch reports
drivers/gpu/drm/vc4/vc4_irq.c:60:1: warning: symbol
  'render_wait' was not declared. Should it be static?

This variable is not used so remove it.

Signed-off-by: Tom Rix <trix@redhat.com>
---
 drivers/gpu/drm/vc4/vc4_irq.c | 2 --
 1 file changed, 2 deletions(-)

diff --git a/drivers/gpu/drm/vc4/vc4_irq.c b/drivers/gpu/drm/vc4/vc4_irq.c
index 1e6db0121ccd..563b3dfeb9b9 100644
--- a/drivers/gpu/drm/vc4/vc4_irq.c
+++ b/drivers/gpu/drm/vc4/vc4_irq.c
@@ -57,8 +57,6 @@
 			 V3D_INT_FLDONE | \
 			 V3D_INT_FRDONE)
 
-DECLARE_WAIT_QUEUE_HEAD(render_wait);
-
 static void
 vc4_overflow_mem_work(struct work_struct *work)
 {
-- 
2.27.0


^ permalink raw reply related	[relevance 99%]

* [PATCH] drm/nouveau/gr/tu102: remove unused tu102_gr_load function
@ 2023-04-06 12:51 99% Tom Rix
  0 siblings, 0 replies; 180+ results
From: Tom Rix @ 2023-04-06 12:51 UTC (permalink / raw)
  To: bskeggs, kherbst, lyude, airlied, daniel, gsamaiya
  Cc: nouveau, linux-kernel, dri-devel, Tom Rix

smatch reports
drivers/gpu/drm/nouveau/nvkm/engine/gr/tu102.c:210:1: warning: symbol
  'tu102_gr_load' was not declared. Should it be static?

This function is not used so remove it.

Signed-off-by: Tom Rix <trix@redhat.com>
---
 drivers/gpu/drm/nouveau/nvkm/engine/gr/tu102.c | 13 -------------
 1 file changed, 13 deletions(-)

diff --git a/drivers/gpu/drm/nouveau/nvkm/engine/gr/tu102.c b/drivers/gpu/drm/nouveau/nvkm/engine/gr/tu102.c
index 3b6c8100a242..a7775aa18541 100644
--- a/drivers/gpu/drm/nouveau/nvkm/engine/gr/tu102.c
+++ b/drivers/gpu/drm/nouveau/nvkm/engine/gr/tu102.c
@@ -206,19 +206,6 @@ tu102_gr_av_to_init_veid(struct nvkm_blob *blob, struct gf100_gr_pack **ppack)
 	return gk20a_gr_av_to_init_(blob, 64, 0x00100000, ppack);
 }
 
-int
-tu102_gr_load(struct gf100_gr *gr, int ver, const struct gf100_gr_fwif *fwif)
-{
-	int ret;
-
-	ret = gm200_gr_load(gr, ver, fwif);
-	if (ret)
-		return ret;
-
-	return gk20a_gr_load_net(gr, "gr/", "sw_veid_bundle_init", ver, tu102_gr_av_to_init_veid,
-				 &gr->bundle_veid);
-}
-
 static const struct gf100_gr_fwif
 tu102_gr_fwif[] = {
 	{  0, gm200_gr_load, &tu102_gr, &gp108_gr_fecs_acr, &gp108_gr_gpccs_acr },
-- 
2.27.0


^ permalink raw reply related	[relevance 99%]

* [PATCH] drm/msm/mdp5: set varaiable msm8x76_config storage-class-specifier to static
@ 2023-04-04 18:53 99% Tom Rix
  0 siblings, 0 replies; 180+ results
From: Tom Rix @ 2023-04-04 18:53 UTC (permalink / raw)
  To: robdclark, quic_abhinavk, dmitry.baryshkov, sean, airlied,
	daniel, vladimir.lypak
  Cc: linux-arm-msm, freedreno, linux-kernel, dri-devel, Tom Rix

smatch reports
drivers/gpu/drm/msm/disp/mdp5/mdp5_cfg.c:658:26: warning: symbol
  'msm8x76_config' was not declared. Should it be static?

This variable is only used in one file so should be static.

Signed-off-by: Tom Rix <trix@redhat.com>
---
 drivers/gpu/drm/msm/disp/mdp5/mdp5_cfg.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/gpu/drm/msm/disp/mdp5/mdp5_cfg.c b/drivers/gpu/drm/msm/disp/mdp5/mdp5_cfg.c
index 1f1555aa02d2..2eec2d78f32a 100644
--- a/drivers/gpu/drm/msm/disp/mdp5/mdp5_cfg.c
+++ b/drivers/gpu/drm/msm/disp/mdp5/mdp5_cfg.c
@@ -655,7 +655,7 @@ static const struct mdp5_cfg_hw msm8x96_config = {
 	.max_clk = 412500000,
 };
 
-const struct mdp5_cfg_hw msm8x76_config = {
+static const struct mdp5_cfg_hw msm8x76_config = {
 	.name = "msm8x76",
 	.mdp = {
 		.count = 1,
-- 
2.27.0


^ permalink raw reply related	[relevance 99%]

* [PATCH] drm/nouveau/disp: set varaiable gv100_disp_core_mthd_base storage-class-specifier to static
@ 2023-04-04  1:28 99% Tom Rix
  0 siblings, 0 replies; 180+ results
From: Tom Rix @ 2023-04-04  1:28 UTC (permalink / raw)
  To: bskeggs, kherbst, lyude, airlied, daniel, airlied
  Cc: nouveau, linux-kernel, dri-devel, Tom Rix

smatch reports
drivers/gpu/drm/nouveau/nvkm/engine/disp/gv100.c:610:1: warning: symbol
  'gv100_disp_core_mthd_base' was not declared. Should it be static?

This variable is only used in one file so it should be static.

Signed-off-by: Tom Rix <trix@redhat.com>
---
 drivers/gpu/drm/nouveau/nvkm/engine/disp/gv100.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/gpu/drm/nouveau/nvkm/engine/disp/gv100.c b/drivers/gpu/drm/nouveau/nvkm/engine/disp/gv100.c
index 115d0997fd62..4ebc030e40d1 100644
--- a/drivers/gpu/drm/nouveau/nvkm/engine/disp/gv100.c
+++ b/drivers/gpu/drm/nouveau/nvkm/engine/disp/gv100.c
@@ -606,7 +606,7 @@ gv100_disp_curs = {
 	.user = 73,
 };
 
-const struct nvkm_disp_mthd_list
+static const struct nvkm_disp_mthd_list
 gv100_disp_core_mthd_base = {
 	.mthd = 0x0000,
 	.addr = 0x000000,
-- 
2.27.0


^ permalink raw reply related	[relevance 99%]

* [PATCH] drm/nouveau/acr: remove unused loc variable
@ 2023-03-31 20:42 98% Tom Rix
  0 siblings, 0 replies; 180+ results
From: Tom Rix @ 2023-03-31 20:42 UTC (permalink / raw)
  To: bskeggs, kherbst, lyude, airlied, daniel, nathan, ndesaulniers, gsamaiya
  Cc: nouveau, llvm, linux-kernel, dri-devel, Tom Rix

clang with W=1 reports
drivers/gpu/drm/nouveau/nvkm/subdev/acr/lsfw.c:221:7: error: variable
  'loc' set but not used [-Werror,-Wunused-but-set-variable]
                u32 loc, sig, cnt, *meta;
                    ^
This variable is not used so remove it.

Signed-off-by: Tom Rix <trix@redhat.com>
---
 drivers/gpu/drm/nouveau/nvkm/subdev/acr/lsfw.c | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

diff --git a/drivers/gpu/drm/nouveau/nvkm/subdev/acr/lsfw.c b/drivers/gpu/drm/nouveau/nvkm/subdev/acr/lsfw.c
index f36a359d4531..bd104a030243 100644
--- a/drivers/gpu/drm/nouveau/nvkm/subdev/acr/lsfw.c
+++ b/drivers/gpu/drm/nouveau/nvkm/subdev/acr/lsfw.c
@@ -218,7 +218,7 @@ nvkm_acr_lsfw_load_sig_image_desc_v2(struct nvkm_subdev *subdev,
 		const struct firmware *hsbl;
 		const struct nvfw_ls_hsbl_bin_hdr *hdr;
 		const struct nvfw_ls_hsbl_hdr *hshdr;
-		u32 loc, sig, cnt, *meta;
+		u32 sig, cnt, *meta;
 
 		ret = nvkm_firmware_load_name(subdev, path, "hs_bl_sig", ver, &hsbl);
 		if (ret)
@@ -227,7 +227,6 @@ nvkm_acr_lsfw_load_sig_image_desc_v2(struct nvkm_subdev *subdev,
 		hdr = nvfw_ls_hsbl_bin_hdr(subdev, hsbl->data);
 		hshdr = nvfw_ls_hsbl_hdr(subdev, hsbl->data + hdr->header_offset);
 		meta = (u32 *)(hsbl->data + hshdr->meta_data_offset);
-		loc = *(u32 *)(hsbl->data + hshdr->patch_loc);
 		sig = *(u32 *)(hsbl->data + hshdr->patch_sig);
 		cnt = *(u32 *)(hsbl->data + hshdr->num_sig);
 
-- 
2.27.0


^ permalink raw reply related	[relevance 98%]

* [PATCH] drm/qxl: remove unused num_relocs variable
@ 2023-03-31 17:24 98% Tom Rix
  0 siblings, 0 replies; 180+ results
From: Tom Rix @ 2023-03-31 17:24 UTC (permalink / raw)
  To: airlied, kraxel, airlied, daniel, nathan, ndesaulniers
  Cc: Tom Rix, llvm, linux-kernel, dri-devel, virtualization, spice-devel

clang with W=1 reports
drivers/gpu/drm/qxl/qxl_ioctl.c:149:14: error: variable
  'num_relocs' set but not used [-Werror,-Wunused-but-set-variable]
        int i, ret, num_relocs;
                    ^
This variable is not used so remove it.

Signed-off-by: Tom Rix <trix@redhat.com>
---
 drivers/gpu/drm/qxl/qxl_ioctl.c | 4 +---
 1 file changed, 1 insertion(+), 3 deletions(-)

diff --git a/drivers/gpu/drm/qxl/qxl_ioctl.c b/drivers/gpu/drm/qxl/qxl_ioctl.c
index 30f58b21372a..3422206d59d4 100644
--- a/drivers/gpu/drm/qxl/qxl_ioctl.c
+++ b/drivers/gpu/drm/qxl/qxl_ioctl.c
@@ -146,7 +146,7 @@ static int qxl_process_single_command(struct qxl_device *qdev,
 	struct qxl_release *release;
 	struct qxl_bo *cmd_bo;
 	void *fb_cmd;
-	int i, ret, num_relocs;
+	int i, ret;
 	int unwritten;
 
 	switch (cmd->type) {
@@ -201,7 +201,6 @@ static int qxl_process_single_command(struct qxl_device *qdev,
 	}
 
 	/* fill out reloc info structs */
-	num_relocs = 0;
 	for (i = 0; i < cmd->relocs_num; ++i) {
 		struct drm_qxl_reloc reloc;
 		struct drm_qxl_reloc __user *u = u64_to_user_ptr(cmd->relocs);
@@ -231,7 +230,6 @@ static int qxl_process_single_command(struct qxl_device *qdev,
 			reloc_info[i].dst_bo = cmd_bo;
 			reloc_info[i].dst_offset = reloc.dst_offset + release->release_offset;
 		}
-		num_relocs++;
 
 		/* reserve and validate the reloc dst bo */
 		if (reloc.reloc_type == QXL_RELOC_TYPE_BO || reloc.src_handle) {
-- 
2.27.0


^ permalink raw reply related	[relevance 98%]

* [PATCH] drm/amd/pm: remove unused num_of_active_display variable
@ 2023-03-31 16:40 97% Tom Rix
  0 siblings, 0 replies; 180+ results
From: Tom Rix @ 2023-03-31 16:40 UTC (permalink / raw)
  To: evan.quan, alexander.deucher, christian.koenig, Xinhui.Pan,
	airlied, daniel, nathan, ndesaulniers, Hawking.Zhang,
	kenneth.feng, lijo.lazar, KevinYang.Wang, tim.huang, andrealmeid,
	Kun.Liu2, mario.limonciello
  Cc: Tom Rix, llvm, dri-devel, amd-gfx, linux-kernel

clang with W=1 reports
drivers/gpu/drm/amd/amdgpu/../pm/swsmu/amdgpu_smu.c:1700:6: error: variable
  'num_of_active_display' set but not used [-Werror,-Wunused-but-set-variable]
        int num_of_active_display = 0;
            ^
This variable is not used so remove it.

Signed-off-by: Tom Rix <trix@redhat.com>
---
 drivers/gpu/drm/amd/pm/swsmu/amdgpu_smu.c | 7 -------
 1 file changed, 7 deletions(-)

diff --git a/drivers/gpu/drm/amd/pm/swsmu/amdgpu_smu.c b/drivers/gpu/drm/amd/pm/swsmu/amdgpu_smu.c
index b5d64749990e..f93f7a9ed631 100644
--- a/drivers/gpu/drm/amd/pm/swsmu/amdgpu_smu.c
+++ b/drivers/gpu/drm/amd/pm/swsmu/amdgpu_smu.c
@@ -1696,8 +1696,6 @@ static int smu_display_configuration_change(void *handle,
 					    const struct amd_pp_display_configuration *display_config)
 {
 	struct smu_context *smu = handle;
-	int index = 0;
-	int num_of_active_display = 0;
 
 	if (!smu->pm_enabled || !smu->adev->pm.dpm_enabled)
 		return -EOPNOTSUPP;
@@ -1708,11 +1706,6 @@ static int smu_display_configuration_change(void *handle,
 	smu_set_min_dcef_deep_sleep(smu,
 				    display_config->min_dcef_deep_sleep_set_clk / 100);
 
-	for (index = 0; index < display_config->num_path_including_non_display; index++) {
-		if (display_config->displays[index].controller_id != 0)
-			num_of_active_display++;
-	}
-
 	return 0;
 }
 
-- 
2.27.0


^ permalink raw reply related	[relevance 97%]

* [PATCH] drm/amd/display: remove unused average_render_time_in_us and i variables
@ 2023-03-31  0:10 94% Tom Rix
  0 siblings, 0 replies; 180+ results
From: Tom Rix @ 2023-03-31  0:10 UTC (permalink / raw)
  To: harry.wentland, sunpeng.li, Rodrigo.Siqueira, alexander.deucher,
	christian.koenig, Xinhui.Pan, airlied, daniel, nathan,
	ndesaulniers, aric.cyr, HaoPing.Liu, Anthony.Koo, hanghong.ma,
	Angus.Wang, Dillon.Varone
  Cc: Tom Rix, llvm, dri-devel, amd-gfx, linux-kernel

clang with W=1 reports
drivers/gpu/drm/amd/amdgpu/../display/modules/freesync/freesync.c:1132:15: error: variable
  'average_render_time_in_us' set but not used [-Werror,-Wunused-but-set-variable]
        unsigned int average_render_time_in_us = 0;
                     ^
This variable is not used so remove it, which caused i to be unused so remove that as well.

Signed-off-by: Tom Rix <trix@redhat.com>
---
 .../drm/amd/display/modules/freesync/freesync.c    | 14 --------------
 1 file changed, 14 deletions(-)

diff --git a/drivers/gpu/drm/amd/display/modules/freesync/freesync.c b/drivers/gpu/drm/amd/display/modules/freesync/freesync.c
index 315da61ee897..5c41a4751db4 100644
--- a/drivers/gpu/drm/amd/display/modules/freesync/freesync.c
+++ b/drivers/gpu/drm/amd/display/modules/freesync/freesync.c
@@ -1129,7 +1129,6 @@ void mod_freesync_handle_preflip(struct mod_freesync *mod_freesync,
 {
 	struct core_freesync *core_freesync = NULL;
 	unsigned int last_render_time_in_us = 0;
-	unsigned int average_render_time_in_us = 0;
 
 	if (mod_freesync == NULL)
 		return;
@@ -1138,7 +1137,6 @@ void mod_freesync_handle_preflip(struct mod_freesync *mod_freesync,
 
 	if (in_out_vrr->supported &&
 			in_out_vrr->state == VRR_STATE_ACTIVE_VARIABLE) {
-		unsigned int i = 0;
 		unsigned int oldest_index = plane->time.index + 1;
 
 		if (oldest_index >= DC_PLANE_UPDATE_TIMES_MAX)
@@ -1147,18 +1145,6 @@ void mod_freesync_handle_preflip(struct mod_freesync *mod_freesync,
 		last_render_time_in_us = curr_time_stamp_in_us -
 				plane->time.prev_update_time_in_us;
 
-		/* Sum off all entries except oldest one */
-		for (i = 0; i < DC_PLANE_UPDATE_TIMES_MAX; i++) {
-			average_render_time_in_us +=
-					plane->time.time_elapsed_in_us[i];
-		}
-		average_render_time_in_us -=
-				plane->time.time_elapsed_in_us[oldest_index];
-
-		/* Add render time for current flip */
-		average_render_time_in_us += last_render_time_in_us;
-		average_render_time_in_us /= DC_PLANE_UPDATE_TIMES_MAX;
-
 		if (in_out_vrr->btr.btr_enabled) {
 			apply_below_the_range(core_freesync,
 					stream,
-- 
2.27.0


^ permalink raw reply related	[relevance 94%]

* [PATCH] drm/amd/display: remove unused average_render_time_in_us and i variables
@ 2023-03-30 23:43 93% Tom Rix
  0 siblings, 0 replies; 180+ results
From: Tom Rix @ 2023-03-30 23:43 UTC (permalink / raw)
  To: harry.wentland, sunpeng.li, Rodrigo.Siqueira, alexander.deucher,
	christian.koenig, Xinhui.Pan, airlied, daniel, nathan,
	ndesaulniers, HaoPing.Liu, aric.cyr, chiahsuan.chung,
	felipe.clark, Angus.Wang, hanghong.ma, lv.ruyi, Dillon.Varone
  Cc: Tom Rix, llvm, dri-devel, amd-gfx, linux-kernel

clang with W=1 reports
drivers/gpu/drm/amd/amdgpu/../display/modules/freesync/freesync.c:1132:15: error: variable
  'average_render_time_in_us' set but not used [-Werror,-Wunused-but-set-variable]
        unsigned int average_render_time_in_us = 0;
                     ^
This variable is not used so remove it, which caused i to be unused so remove that as well.

Signed-off-by: Tom Rix <trix@redhat.com>
---
 .../drm/amd/display/modules/freesync/freesync.c    | 14 --------------
 1 file changed, 14 deletions(-)

diff --git a/drivers/gpu/drm/amd/display/modules/freesync/freesync.c b/drivers/gpu/drm/amd/display/modules/freesync/freesync.c
index 315da61ee897..5c41a4751db4 100644
--- a/drivers/gpu/drm/amd/display/modules/freesync/freesync.c
+++ b/drivers/gpu/drm/amd/display/modules/freesync/freesync.c
@@ -1129,7 +1129,6 @@ void mod_freesync_handle_preflip(struct mod_freesync *mod_freesync,
 {
 	struct core_freesync *core_freesync = NULL;
 	unsigned int last_render_time_in_us = 0;
-	unsigned int average_render_time_in_us = 0;
 
 	if (mod_freesync == NULL)
 		return;
@@ -1138,7 +1137,6 @@ void mod_freesync_handle_preflip(struct mod_freesync *mod_freesync,
 
 	if (in_out_vrr->supported &&
 			in_out_vrr->state == VRR_STATE_ACTIVE_VARIABLE) {
-		unsigned int i = 0;
 		unsigned int oldest_index = plane->time.index + 1;
 
 		if (oldest_index >= DC_PLANE_UPDATE_TIMES_MAX)
@@ -1147,18 +1145,6 @@ void mod_freesync_handle_preflip(struct mod_freesync *mod_freesync,
 		last_render_time_in_us = curr_time_stamp_in_us -
 				plane->time.prev_update_time_in_us;
 
-		/* Sum off all entries except oldest one */
-		for (i = 0; i < DC_PLANE_UPDATE_TIMES_MAX; i++) {
-			average_render_time_in_us +=
-					plane->time.time_elapsed_in_us[i];
-		}
-		average_render_time_in_us -=
-				plane->time.time_elapsed_in_us[oldest_index];
-
-		/* Add render time for current flip */
-		average_render_time_in_us += last_render_time_in_us;
-		average_render_time_in_us /= DC_PLANE_UPDATE_TIMES_MAX;
-
 		if (in_out_vrr->btr.btr_enabled) {
 			apply_below_the_range(core_freesync,
 					stream,
-- 
2.27.0


^ permalink raw reply related	[relevance 93%]

* [PATCH] drm/amdkfd: remove unused sq_int_priv variable
@ 2023-03-30 15:20 99% Tom Rix
  0 siblings, 0 replies; 180+ results
From: Tom Rix @ 2023-03-30 15:20 UTC (permalink / raw)
  To: Felix.Kuehling, alexander.deucher, christian.koenig, Xinhui.Pan,
	airlied, daniel, nathan, ndesaulniers
  Cc: Tom Rix, llvm, dri-devel, amd-gfx, linux-kernel

clang with W=1 reports
drivers/gpu/drm/amd/amdgpu/../amdkfd/kfd_int_process_v11.c:282:38: error: variable
  'sq_int_priv' set but not used [-Werror,-Wunused-but-set-variable]
        uint8_t sq_int_enc, sq_int_errtype, sq_int_priv;
                                            ^
This variable is not used so remove it.

Signed-off-by: Tom Rix <trix@redhat.com>
---
 drivers/gpu/drm/amd/amdkfd/kfd_int_process_v11.c | 9 +--------
 1 file changed, 1 insertion(+), 8 deletions(-)

diff --git a/drivers/gpu/drm/amd/amdkfd/kfd_int_process_v11.c b/drivers/gpu/drm/amd/amdkfd/kfd_int_process_v11.c
index 0d53f6067422..bbd646c0dee7 100644
--- a/drivers/gpu/drm/amd/amdkfd/kfd_int_process_v11.c
+++ b/drivers/gpu/drm/amd/amdkfd/kfd_int_process_v11.c
@@ -279,7 +279,7 @@ static void event_interrupt_wq_v11(struct kfd_dev *dev,
 {
 	uint16_t source_id, client_id, ring_id, pasid, vmid;
 	uint32_t context_id0, context_id1;
-	uint8_t sq_int_enc, sq_int_errtype, sq_int_priv;
+	uint8_t sq_int_enc, sq_int_errtype;
 	struct kfd_vm_fault_info info = {0};
 	struct kfd_hsa_memory_exception_data exception_data;
 
@@ -348,13 +348,6 @@ static void event_interrupt_wq_v11(struct kfd_dev *dev,
 				break;
 			case SQ_INTERRUPT_WORD_ENCODING_INST:
 				print_sq_intr_info_inst(context_id0, context_id1);
-				sq_int_priv = REG_GET_FIELD(context_id0,
-						SQ_INTERRUPT_WORD_WAVE_CTXID0, PRIV);
-				/*if (sq_int_priv && (kfd_set_dbg_ev_from_interrupt(dev, pasid,
-						KFD_CTXID0_DOORBELL_ID(context_id0),
-						KFD_CTXID0_TRAP_CODE(context_id0),
-						NULL, 0)))
-					return;*/
 				break;
 			case SQ_INTERRUPT_WORD_ENCODING_ERROR:
 				print_sq_intr_info_error(context_id0, context_id1);
-- 
2.27.0


^ permalink raw reply related	[relevance 99%]

* [PATCH] drm/nouveau/svm: remove unused ret variable
@ 2023-03-29 23:14 99% Tom Rix
  0 siblings, 0 replies; 180+ results
From: Tom Rix @ 2023-03-29 23:14 UTC (permalink / raw)
  To: bskeggs, kherbst, lyude, airlied, daniel, nathan, ndesaulniers
  Cc: nouveau, llvm, linux-kernel, dri-devel, Tom Rix

clang with W=1 reports
drivers/gpu/drm/nouveau/nouveau_svm.c:929:6: error: variable
  'ret' set but not used [-Werror,-Wunused-but-set-variable]
        int ret;
            ^
This variable is not used so remove it.

Signed-off-by: Tom Rix <trix@redhat.com>
---
 drivers/gpu/drm/nouveau/nouveau_svm.c | 5 ++---
 1 file changed, 2 insertions(+), 3 deletions(-)

diff --git a/drivers/gpu/drm/nouveau/nouveau_svm.c b/drivers/gpu/drm/nouveau/nouveau_svm.c
index a74ba8d84ba7..e072d610f2f9 100644
--- a/drivers/gpu/drm/nouveau/nouveau_svm.c
+++ b/drivers/gpu/drm/nouveau/nouveau_svm.c
@@ -926,15 +926,14 @@ nouveau_pfns_map(struct nouveau_svmm *svmm, struct mm_struct *mm,
 		 unsigned long addr, u64 *pfns, unsigned long npages)
 {
 	struct nouveau_pfnmap_args *args = nouveau_pfns_to_args(pfns);
-	int ret;
 
 	args->p.addr = addr;
 	args->p.size = npages << PAGE_SHIFT;
 
 	mutex_lock(&svmm->mutex);
 
-	ret = nvif_object_ioctl(&svmm->vmm->vmm.object, args,
-				struct_size(args, p.phys, npages), NULL);
+	nvif_object_ioctl(&svmm->vmm->vmm.object, args,
+			  struct_size(args, p.phys, npages), NULL);
 
 	mutex_unlock(&svmm->mutex);
 }
-- 
2.27.0


^ permalink raw reply related	[relevance 99%]

* [PATCH] drm/amd/display: remove unused matching_stream_ptrs variable
@ 2023-03-25 13:45 97% Tom Rix
  0 siblings, 0 replies; 180+ results
From: Tom Rix @ 2023-03-25 13:45 UTC (permalink / raw)
  To: harry.wentland, sunpeng.li, Rodrigo.Siqueira, alexander.deucher,
	christian.koenig, Xinhui.Pan, airlied, daniel, nathan,
	ndesaulniers, Jun.Lei, wenjing.liu, Jimmy.Kizito, Cruise.Hung
  Cc: Tom Rix, llvm, dri-devel, amd-gfx, linux-kernel

clang with W=1 reports
drivers/gpu/drm/amd/amdgpu/../display/dc/core/dc_link_enc_cfg.c:625:6: error:
  variable 'matching_stream_ptrs' set but not used [-Werror,-Wunused-but-set-variable]
        int matching_stream_ptrs = 0;
            ^
This variable is not used so remove it.

Signed-off-by: Tom Rix <trix@redhat.com>
---
 drivers/gpu/drm/amd/display/dc/core/dc_link_enc_cfg.c | 5 +----
 1 file changed, 1 insertion(+), 4 deletions(-)

diff --git a/drivers/gpu/drm/amd/display/dc/core/dc_link_enc_cfg.c b/drivers/gpu/drm/amd/display/dc/core/dc_link_enc_cfg.c
index 41198c729d90..30c0644d4418 100644
--- a/drivers/gpu/drm/amd/display/dc/core/dc_link_enc_cfg.c
+++ b/drivers/gpu/drm/amd/display/dc/core/dc_link_enc_cfg.c
@@ -622,7 +622,6 @@ bool link_enc_cfg_validate(struct dc *dc, struct dc_state *state)
 	int i, j;
 	uint8_t valid_count = 0;
 	uint8_t dig_stream_count = 0;
-	int matching_stream_ptrs = 0;
 	int eng_ids_per_ep_id[MAX_PIPES] = {0};
 	int ep_ids_per_eng_id[MAX_PIPES] = {0};
 	int valid_bitmap = 0;
@@ -645,9 +644,7 @@ bool link_enc_cfg_validate(struct dc *dc, struct dc_state *state)
 		struct link_enc_assignment assignment = state->res_ctx.link_enc_cfg_ctx.link_enc_assignments[i];
 
 		if (assignment.valid) {
-			if (assignment.stream == state->streams[i])
-				matching_stream_ptrs++;
-			else
+			if (assignment.stream != state->streams[i])
 				valid_stream_ptrs = false;
 		}
 	}
-- 
2.27.0


^ permalink raw reply related	[relevance 97%]

* [PATCH] drm/vmwgfx: remove unused mksstat_init_record function
@ 2023-03-24 19:54 96% Tom Rix
  0 siblings, 0 replies; 180+ results
From: Tom Rix @ 2023-03-24 19:54 UTC (permalink / raw)
  To: zackr, linux-graphics-maintainer, airlied, daniel, nathan, ndesaulniers
  Cc: Tom Rix, llvm, linux-kernel, dri-devel

clang with W=1 reports
drivers/gpu/drm/vmwgfx/vmwgfx_msg.c:716:21: error: unused function
  'mksstat_init_record' [-Werror,-Wunused-function]
static inline char *mksstat_init_record(mksstat_kern_stats_t stat_idx,
                    ^
This function is not used so remove it.

Signed-off-by: Tom Rix <trix@redhat.com>
---
 drivers/gpu/drm/vmwgfx/vmwgfx_msg.c | 26 --------------------------
 1 file changed, 26 deletions(-)

diff --git a/drivers/gpu/drm/vmwgfx/vmwgfx_msg.c b/drivers/gpu/drm/vmwgfx/vmwgfx_msg.c
index e76976a95a1e..ca1a3fe44fa5 100644
--- a/drivers/gpu/drm/vmwgfx/vmwgfx_msg.c
+++ b/drivers/gpu/drm/vmwgfx/vmwgfx_msg.c
@@ -702,32 +702,6 @@ static inline void hypervisor_ppn_remove(PPN64 pfn)
 /* Header to the text description of mksGuestStat instance descriptor */
 #define MKSSTAT_KERNEL_DESCRIPTION "vmwgfx"
 
-/**
- * mksstat_init_record: Initializes an MKSGuestStatCounter-based record
- * for the respective mksGuestStat index.
- *
- * @stat_idx: Index of the MKSGuestStatCounter-based mksGuestStat record.
- * @pstat: Pointer to array of MKSGuestStatCounterTime.
- * @pinfo: Pointer to array of MKSGuestStatInfoEntry.
- * @pstrs: Pointer to current end of the name/description sequence.
- * Return: Pointer to the new end of the names/description sequence.
- */
-
-static inline char *mksstat_init_record(mksstat_kern_stats_t stat_idx,
-	MKSGuestStatCounterTime *pstat, MKSGuestStatInfoEntry *pinfo, char *pstrs)
-{
-	char *const pstrd = pstrs + strlen(mksstat_kern_name_desc[stat_idx][0]) + 1;
-	strcpy(pstrs, mksstat_kern_name_desc[stat_idx][0]);
-	strcpy(pstrd, mksstat_kern_name_desc[stat_idx][1]);
-
-	pinfo[stat_idx].name.s = pstrs;
-	pinfo[stat_idx].description.s = pstrd;
-	pinfo[stat_idx].flags = MKS_GUEST_STAT_FLAG_NONE;
-	pinfo[stat_idx].stat.counter = (MKSGuestStatCounter *)&pstat[stat_idx];
-
-	return pstrd + strlen(mksstat_kern_name_desc[stat_idx][1]) + 1;
-}
-
 /**
  * mksstat_init_record_time: Initializes an MKSGuestStatCounterTime-based record
  * for the respective mksGuestStat index.
-- 
2.27.0


^ permalink raw reply related	[relevance 96%]

* [PATCH] drm/vmwgfx: remove unused vmw_overlay function
@ 2023-03-21 18:24 99% Tom Rix
  0 siblings, 0 replies; 180+ results
From: Tom Rix @ 2023-03-21 18:24 UTC (permalink / raw)
  To: zackr, linux-graphics-maintainer, airlied, daniel, nathan, ndesaulniers
  Cc: Tom Rix, llvm, linux-kernel, dri-devel

clang with W=1 reports
drivers/gpu/drm/vmwgfx/vmwgfx_overlay.c:56:35: error:
  unused function 'vmw_overlay' [-Werror,-Wunused-function]
static inline struct vmw_overlay *vmw_overlay(struct drm_device *dev)
                                  ^
This function is not used, so remove it.

Signed-off-by: Tom Rix <trix@redhat.com>
---
 drivers/gpu/drm/vmwgfx/vmwgfx_overlay.c | 6 ------
 1 file changed, 6 deletions(-)

diff --git a/drivers/gpu/drm/vmwgfx/vmwgfx_overlay.c b/drivers/gpu/drm/vmwgfx/vmwgfx_overlay.c
index 8d171d71cb8a..7e112319a23c 100644
--- a/drivers/gpu/drm/vmwgfx/vmwgfx_overlay.c
+++ b/drivers/gpu/drm/vmwgfx/vmwgfx_overlay.c
@@ -53,12 +53,6 @@ struct vmw_overlay {
 	struct vmw_stream stream[VMW_MAX_NUM_STREAMS];
 };
 
-static inline struct vmw_overlay *vmw_overlay(struct drm_device *dev)
-{
-	struct vmw_private *dev_priv = vmw_priv(dev);
-	return dev_priv ? dev_priv->overlay_priv : NULL;
-}
-
 struct vmw_escape_header {
 	uint32_t cmd;
 	SVGAFifoCmdEscape body;
-- 
2.27.0


^ permalink raw reply related	[relevance 99%]

* [PATCH] drm/gma500: remove unused gma_pipe_event function
@ 2023-03-19 14:23 99% Tom Rix
  0 siblings, 0 replies; 180+ results
From: Tom Rix @ 2023-03-19 14:23 UTC (permalink / raw)
  To: patrik.r.jakobsson, airlied, daniel, nathan, ndesaulniers
  Cc: Tom Rix, llvm, linux-kernel, dri-devel

clang with W=1 reports
drivers/gpu/drm/gma500/psb_irq.c:35:19: error: unused function
  'gma_pipe_event' [-Werror,-Wunused-function]
static inline u32 gma_pipe_event(int pipe)
                  ^
This function is not used, so remove it.

Signed-off-by: Tom Rix <trix@redhat.com>
---
 drivers/gpu/drm/gma500/psb_irq.c | 11 -----------
 1 file changed, 11 deletions(-)

diff --git a/drivers/gpu/drm/gma500/psb_irq.c b/drivers/gpu/drm/gma500/psb_irq.c
index d421031462df..343c51250207 100644
--- a/drivers/gpu/drm/gma500/psb_irq.c
+++ b/drivers/gpu/drm/gma500/psb_irq.c
@@ -32,17 +32,6 @@ static inline u32 gma_pipestat(int pipe)
 	BUG();
 }
 
-static inline u32 gma_pipe_event(int pipe)
-{
-	if (pipe == 0)
-		return _PSB_PIPEA_EVENT_FLAG;
-	if (pipe == 1)
-		return _MDFLD_PIPEB_EVENT_FLAG;
-	if (pipe == 2)
-		return _MDFLD_PIPEC_EVENT_FLAG;
-	BUG();
-}
-
 static inline u32 gma_pipeconf(int pipe)
 {
 	if (pipe == 0)
-- 
2.27.0


^ permalink raw reply related	[relevance 99%]

* [PATCH] drm/kmb: remove unused set_test_mode_src_osc_freq_target_low, hi_bits functions
@ 2023-03-18 13:39 98% Tom Rix
  0 siblings, 0 replies; 180+ results
From: Tom Rix @ 2023-03-18 13:39 UTC (permalink / raw)
  To: anitha.chrisanthus, edmund.j.dea, airlied, daniel, nathan, ndesaulniers
  Cc: Tom Rix, llvm, linux-kernel, dri-devel

clang with W=1 reports
drivers/gpu/drm/kmb/kmb_dsi.c:822:2: error: unused function
  'set_test_mode_src_osc_freq_target_low_bits' [-Werror,-Wunused-function]
        set_test_mode_src_osc_freq_target_low_bits(struct kmb_dsi *kmb_dsi,
        ^
drivers/gpu/drm/kmb/kmb_dsi.c:834:2: error: unused function
  'set_test_mode_src_osc_freq_target_hi_bits' [-Werror,-Wunused-function]
        set_test_mode_src_osc_freq_target_hi_bits(struct kmb_dsi *kmb_dsi,
        ^
These static functions are not used, so remove them.

Signed-off-by: Tom Rix <trix@redhat.com>
---
 drivers/gpu/drm/kmb/kmb_dsi.c | 28 ----------------------------
 1 file changed, 28 deletions(-)

diff --git a/drivers/gpu/drm/kmb/kmb_dsi.c b/drivers/gpu/drm/kmb/kmb_dsi.c
index cf7cf0b07541..ed99b14375aa 100644
--- a/drivers/gpu/drm/kmb/kmb_dsi.c
+++ b/drivers/gpu/drm/kmb/kmb_dsi.c
@@ -818,34 +818,6 @@ static void test_mode_send(struct kmb_dsi *kmb_dsi, u32 dphy_no,
 	}
 }
 
-static inline void
-	set_test_mode_src_osc_freq_target_low_bits(struct kmb_dsi *kmb_dsi,
-						   u32 dphy_no,
-						   u32 freq)
-{
-	/* Typical rise/fall time=166, refer Table 1207 databook,
-	 * sr_osc_freq_target[7:0]
-	 */
-	test_mode_send(kmb_dsi, dphy_no, TEST_CODE_SLEW_RATE_DDL_CYCLES,
-		       (freq & 0x7f));
-}
-
-static inline void
-	set_test_mode_src_osc_freq_target_hi_bits(struct kmb_dsi *kmb_dsi,
-						  u32 dphy_no,
-						  u32 freq)
-{
-	u32 data;
-
-	/* Flag this as high nibble */
-	data = ((freq >> 6) & 0x1f) | (1 << 7);
-
-	/* Typical rise/fall time=166, refer Table 1207 databook,
-	 * sr_osc_freq_target[11:7]
-	 */
-	test_mode_send(kmb_dsi, dphy_no, TEST_CODE_SLEW_RATE_DDL_CYCLES, data);
-}
-
 static void mipi_tx_get_vco_params(struct vco_params *vco)
 {
 	int i;
-- 
2.27.0


^ permalink raw reply related	[relevance 98%]

* [PATCH] gpu: drm: bridge: sii9234: remove unused bridge_to_sii9234 function
@ 2023-03-18  0:23 99% Tom Rix
  0 siblings, 0 replies; 180+ results
From: Tom Rix @ 2023-03-18  0:23 UTC (permalink / raw)
  To: andrzej.hajda, neil.armstrong, rfoss, Laurent.pinchart, jonas,
	jernej.skrabec, airlied, daniel, nathan, ndesaulniers
  Cc: Tom Rix, llvm, linux-kernel, dri-devel

clang with W=1 reports
drivers/gpu/drm/bridge/sii9234.c:870:31: error:
  unused function 'bridge_to_sii9234' [-Werror,-Wunused-function]
static inline struct sii9234 *bridge_to_sii9234(struct drm_bridge *bridge)
                              ^
This static function is not used, so remove it.

Signed-off-by: Tom Rix <trix@redhat.com>
---
 drivers/gpu/drm/bridge/sii9234.c | 5 -----
 1 file changed, 5 deletions(-)

diff --git a/drivers/gpu/drm/bridge/sii9234.c b/drivers/gpu/drm/bridge/sii9234.c
index 099b510ff285..2d17f227867b 100644
--- a/drivers/gpu/drm/bridge/sii9234.c
+++ b/drivers/gpu/drm/bridge/sii9234.c
@@ -867,11 +867,6 @@ static int sii9234_init_resources(struct sii9234 *ctx,
 	return 0;
 }
 
-static inline struct sii9234 *bridge_to_sii9234(struct drm_bridge *bridge)
-{
-	return container_of(bridge, struct sii9234, bridge);
-}
-
 static enum drm_mode_status sii9234_mode_valid(struct drm_bridge *bridge,
 					 const struct drm_display_info *info,
 					 const struct drm_display_mode *mode)
-- 
2.27.0


^ permalink raw reply related	[relevance 99%]

* [PATCH] drm/rockchip: vop2: fix uninitialized variable possible_crtcs
@ 2023-03-16 13:23 93% Tom Rix
  0 siblings, 0 replies; 180+ results
From: Tom Rix @ 2023-03-16 13:23 UTC (permalink / raw)
  To: hjc, heiko, airlied, daniel, nathan, ndesaulniers,
	michael.riesch, s.hauer
  Cc: Tom Rix, llvm, linux-kernel, dri-devel, linux-rockchip, linux-arm-kernel

clang reportes this error
drivers/gpu/drm/rockchip/rockchip_drm_vop2.c:2322:8: error:
  variable 'possible_crtcs' is used uninitialized whenever 'if'
  condition is false [-Werror,-Wsometimes-uninitialized]
                        if (vp) {
                            ^~
drivers/gpu/drm/rockchip/rockchip_drm_vop2.c:2336:36: note:
  uninitialized use occurs here
                ret = vop2_plane_init(vop2, win, possible_crtcs);
                                                 ^~~~~~~~~~~~~~
drivers/gpu/drm/rockchip/rockchip_drm_vop2.c:2322:4:
  note: remove the 'if' if its condition is always true
                        if (vp) {
                        ^~~~~~~~

The else-statement changes the win->type to OVERLAY without setting the
possible_crtcs variable.  Rework the block, initialize possible_crtcs to
0 to remove the else-statement.  Split the else-if-statement out to its
own if-statement so the OVERLAY check will catch when the win-type has
been changed.

Fixes: 368419a2d429 ("drm/rockchip: vop2: initialize possible_crtcs properly")
Signed-off-by: Tom Rix <trix@redhat.com>
---
 drivers/gpu/drm/rockchip/rockchip_drm_vop2.c | 9 ++++-----
 1 file changed, 4 insertions(+), 5 deletions(-)

diff --git a/drivers/gpu/drm/rockchip/rockchip_drm_vop2.c b/drivers/gpu/drm/rockchip/rockchip_drm_vop2.c
index 03ca32cd2050..fce992c3506f 100644
--- a/drivers/gpu/drm/rockchip/rockchip_drm_vop2.c
+++ b/drivers/gpu/drm/rockchip/rockchip_drm_vop2.c
@@ -2301,7 +2301,7 @@ static int vop2_create_crtcs(struct vop2 *vop2)
 	nvp = 0;
 	for (i = 0; i < vop2->registered_num_wins; i++) {
 		struct vop2_win *win = &vop2->win[i];
-		u32 possible_crtcs;
+		u32 possible_crtcs = 0;
 
 		if (vop2->data->soc_id == 3566) {
 			/*
@@ -2327,12 +2327,11 @@ static int vop2_create_crtcs(struct vop2 *vop2)
 				/* change the unused primary window to overlay window */
 				win->type = DRM_PLANE_TYPE_OVERLAY;
 			}
-		} else if (win->type == DRM_PLANE_TYPE_OVERLAY) {
-			possible_crtcs = (1 << nvps) - 1;
-		} else {
-			possible_crtcs = 0;
 		}
 
+		if (win->type == DRM_PLANE_TYPE_OVERLAY)
+			possible_crtcs = (1 << nvps) - 1;
+
 		ret = vop2_plane_init(vop2, win, possible_crtcs);
 		if (ret) {
 			drm_err(vop2->drm, "failed to init plane %s: %d\n",
-- 
2.27.0


^ permalink raw reply related	[relevance 93%]

* [PATCH] drm/radeon: remove unused variable rbo
@ 2023-03-14 13:06 99% Tom Rix
  0 siblings, 0 replies; 180+ results
From: Tom Rix @ 2023-03-14 13:06 UTC (permalink / raw)
  To: alexander.deucher, christian.koenig, Xinhui.Pan, airlied, daniel
  Cc: Tom Rix, dri-devel, amd-gfx, linux-kernel

gcc with W=1 reports this error
drivers/gpu/drm/radeon/radeon_ttm.c:201:27: error:
  variable ‘rbo’ set but not used [-Werror=unused-but-set-variable]
  201 |         struct radeon_bo *rbo;
      |                           ^~~

rbo use was removed with
commit f87c1f0b7b79 ("drm/ttm: prevent moving of pinned BOs")
Since the variable is not used, remove it.

Signed-off-by: Tom Rix <trix@redhat.com>
---
 drivers/gpu/drm/radeon/radeon_ttm.c | 2 --
 1 file changed, 2 deletions(-)

diff --git a/drivers/gpu/drm/radeon/radeon_ttm.c b/drivers/gpu/drm/radeon/radeon_ttm.c
index 2220cdf6a3f6..0ea430ee5256 100644
--- a/drivers/gpu/drm/radeon/radeon_ttm.c
+++ b/drivers/gpu/drm/radeon/radeon_ttm.c
@@ -198,7 +198,6 @@ static int radeon_bo_move(struct ttm_buffer_object *bo, bool evict,
 {
 	struct ttm_resource *old_mem = bo->resource;
 	struct radeon_device *rdev;
-	struct radeon_bo *rbo;
 	int r;
 
 	if (new_mem->mem_type == TTM_PL_TT) {
@@ -211,7 +210,6 @@ static int radeon_bo_move(struct ttm_buffer_object *bo, bool evict,
 	if (r)
 		return r;
 
-	rbo = container_of(bo, struct radeon_bo, tbo);
 	rdev = radeon_get_rdev(bo->bdev);
 	if (!old_mem || (old_mem->mem_type == TTM_PL_SYSTEM &&
 			 bo->ttm == NULL)) {
-- 
2.27.0


^ permalink raw reply related	[relevance 99%]

* [PATCH] drm/nouveau/mc: set ga100_mc_device storage-class-specifier to static
@ 2023-03-12 11:23 99% Tom Rix
  0 siblings, 0 replies; 180+ results
From: Tom Rix @ 2023-03-12 11:23 UTC (permalink / raw)
  To: bskeggs, kherbst, lyude, airlied, daniel
  Cc: nouveau, linux-kernel, dri-devel, Tom Rix

smatch reports
drivers/gpu/drm/nouveau/nvkm/subdev/mc/ga100.c:51:1:
  warning: symbol 'ga100_mc_device' was not declared. Should it be static?

ga100_mc_device is only used in ga100.c, so it should be static

Signed-off-by: Tom Rix <trix@redhat.com>
---
 drivers/gpu/drm/nouveau/nvkm/subdev/mc/ga100.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/gpu/drm/nouveau/nvkm/subdev/mc/ga100.c b/drivers/gpu/drm/nouveau/nvkm/subdev/mc/ga100.c
index 1e2eabec1a76..5d28d30d09d5 100644
--- a/drivers/gpu/drm/nouveau/nvkm/subdev/mc/ga100.c
+++ b/drivers/gpu/drm/nouveau/nvkm/subdev/mc/ga100.c
@@ -47,7 +47,7 @@ ga100_mc_device_enabled(struct nvkm_mc *mc, u32 mask)
 	return (nvkm_rd32(mc->subdev.device, 0x000600) & mask) == mask;
 }
 
-const struct nvkm_mc_device_func
+static const struct nvkm_mc_device_func
 ga100_mc_device = {
 	.enabled = ga100_mc_device_enabled,
 	.enable = ga100_mc_device_enable,
-- 
2.27.0


^ permalink raw reply related	[relevance 99%]

* [PATCH] drm/amd/display: remove unused variable available
@ 2023-03-08 14:10 93% Tom Rix
  0 siblings, 0 replies; 180+ results
From: Tom Rix @ 2023-03-08 14:10 UTC (permalink / raw)
  To: harry.wentland, sunpeng.li, Rodrigo.Siqueira, alexander.deucher,
	christian.koenig, Xinhui.Pan, airlied, daniel, wenjing.liu,
	qingqing.zhuo, Jun.Lei, mghaddar, candice.li, aric.cyr
  Cc: Tom Rix, dri-devel, amd-gfx, linux-kernel

With gcc and W=1, there is this error
drivers/gpu/drm/amd/amdgpu/../display/dc/link/protocols/link_dp_dpia_bw.c:297:13: error:
  variable ‘available’ set but not used [-Werror=unused-but-set-variable]
  297 |         int available = 0;
      |             ^~~~~~~~~

Since available is unused, remove it.

Signed-off-by: Tom Rix <trix@redhat.com>
---
 .../drm/amd/display/dc/link/protocols/link_dp_dpia_bw.c   | 8 --------
 1 file changed, 8 deletions(-)

diff --git a/drivers/gpu/drm/amd/display/dc/link/protocols/link_dp_dpia_bw.c b/drivers/gpu/drm/amd/display/dc/link/protocols/link_dp_dpia_bw.c
index f14217cc16fd..2f0311c42f90 100644
--- a/drivers/gpu/drm/amd/display/dc/link/protocols/link_dp_dpia_bw.c
+++ b/drivers/gpu/drm/amd/display/dc/link/protocols/link_dp_dpia_bw.c
@@ -294,7 +294,6 @@ bool link_dp_dpia_set_dptx_usb4_bw_alloc_support(struct dc_link *link)
 void dpia_handle_bw_alloc_response(struct dc_link *link, uint8_t bw, uint8_t result)
 {
 	int bw_needed = 0;
-	int available = 0;
 	int estimated = 0;
 	int host_router_total_estimated_bw = 0;
 
@@ -373,20 +372,13 @@ void dpia_handle_bw_alloc_response(struct dc_link *link, uint8_t bw, uint8_t res
 
 		// 1. If due to unplug of other sink
 		if (estimated == host_router_total_estimated_bw) {
-
 			// First update the estimated & max_bw fields
 			if (link->dpia_bw_alloc_config.estimated_bw < estimated) {
-				available = estimated - link->dpia_bw_alloc_config.estimated_bw;
 				link->dpia_bw_alloc_config.estimated_bw = estimated;
 			}
 		}
 		// 2. If due to realloc bw btw 2 dpia due to plug OR realloc unused Bw
 		else {
-
-			// We took from another unplugged/problematic sink to give to us
-			if (link->dpia_bw_alloc_config.estimated_bw < estimated)
-				available = estimated - link->dpia_bw_alloc_config.estimated_bw;
-
 			// We lost estimated bw usually due to plug event of other dpia
 			link->dpia_bw_alloc_config.estimated_bw = estimated;
 		}
-- 
2.27.0


^ permalink raw reply related	[relevance 93%]

* [PATCH] drm/amd/display: remove unused variable res_pool
@ 2023-03-08 14:09 98% Tom Rix
  0 siblings, 0 replies; 180+ results
From: Tom Rix @ 2023-03-08 14:09 UTC (permalink / raw)
  To: harry.wentland, sunpeng.li, Rodrigo.Siqueira, alexander.deucher,
	christian.koenig, Xinhui.Pan, airlied, daniel, lyude, Wayne.Lin,
	hersenxs.wu, hamza.mahfooz, Jerry.Zuo
  Cc: Tom Rix, dri-devel, amd-gfx, linux-kernel

With gcc and W=1, there is this error
drivers/gpu/drm/amd/amdgpu/../display/amdgpu_dm/amdgpu_dm_mst_types.c:1214:31:
  error: variable ‘res_pool’ set but not used [-Werror=unused-but-set-variable]
 1214 |         struct resource_pool *res_pool;
      |                               ^~~~~~~~

Since res_pool is unused, remove it.

Signed-off-by: Tom Rix <trix@redhat.com>
---
 drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm_mst_types.c | 2 --
 1 file changed, 2 deletions(-)

diff --git a/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm_mst_types.c b/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm_mst_types.c
index 2739bef9b90c..4b9b5e4050fc 100644
--- a/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm_mst_types.c
+++ b/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm_mst_types.c
@@ -1211,7 +1211,6 @@ static int pre_compute_mst_dsc_configs_for_state(struct drm_atomic_state *state,
 	bool computed_streams[MAX_PIPES];
 	struct amdgpu_dm_connector *aconnector;
 	struct drm_dp_mst_topology_mgr *mst_mgr;
-	struct resource_pool *res_pool;
 	int link_vars_start_index = 0;
 	int ret = 0;
 
@@ -1220,7 +1219,6 @@ static int pre_compute_mst_dsc_configs_for_state(struct drm_atomic_state *state,
 
 	for (i = 0; i < dc_state->stream_count; i++) {
 		stream = dc_state->streams[i];
-		res_pool = stream->ctx->dc->res_pool;
 
 		if (stream->signal != SIGNAL_TYPE_DISPLAY_PORT_MST)
 			continue;
-- 
2.27.0


^ permalink raw reply related	[relevance 98%]

* [PATCH] drm/amd/display: change several dcn30 variables storage-class-specifier to static
@ 2023-03-05 12:52 89% Tom Rix
  0 siblings, 0 replies; 180+ results
From: Tom Rix @ 2023-03-05 12:52 UTC (permalink / raw)
  To: harry.wentland, sunpeng.li, Rodrigo.Siqueira, alexander.deucher,
	christian.koenig, Xinhui.Pan, airlied, daniel, jiapeng.chong,
	aurabindo.pillai
  Cc: Tom Rix, dri-devel, amd-gfx, linux-kernel

smatch reports these similar problems in dcn30
drivers/gpu/drm/amd/amdgpu/../display/dc/dcn30/dcn30_dwb.c:223:25:
  warning: symbol 'dcn30_dwbc_funcs' was not declared. Should it be static?
drivers/gpu/drm/amd/amdgpu/../display/dc/dcn30/dcn30_mmhubbub.c:214:28:
  warning: symbol 'dcn30_mmhubbub_funcs' was not declared. Should it be static?
drivers/gpu/drm/amd/amdgpu/../display/dc/dcn30/dcn30_mpc.c:1402:24:
  warning: symbol 'dcn30_mpc_funcs' was not declared. Should it be static?

All of these are only used in their definition file, so they should be static

Signed-off-by: Tom Rix <trix@redhat.com>
---
 drivers/gpu/drm/amd/display/dc/dcn30/dcn30_dwb.c      | 2 +-
 drivers/gpu/drm/amd/display/dc/dcn30/dcn30_mmhubbub.c | 2 +-
 drivers/gpu/drm/amd/display/dc/dcn30/dcn30_mpc.c      | 2 +-
 3 files changed, 3 insertions(+), 3 deletions(-)

diff --git a/drivers/gpu/drm/amd/display/dc/dcn30/dcn30_dwb.c b/drivers/gpu/drm/amd/display/dc/dcn30/dcn30_dwb.c
index f14f69616692..0d98918bf0fc 100644
--- a/drivers/gpu/drm/amd/display/dc/dcn30/dcn30_dwb.c
+++ b/drivers/gpu/drm/amd/display/dc/dcn30/dcn30_dwb.c
@@ -220,7 +220,7 @@ void dwb3_set_denorm(struct dwbc *dwbc, struct dc_dwb_params *params)
 }
 
 
-const struct dwbc_funcs dcn30_dwbc_funcs = {
+static const struct dwbc_funcs dcn30_dwbc_funcs = {
 	.get_caps		= dwb3_get_caps,
 	.enable			= dwb3_enable,
 	.disable		= dwb3_disable,
diff --git a/drivers/gpu/drm/amd/display/dc/dcn30/dcn30_mmhubbub.c b/drivers/gpu/drm/amd/display/dc/dcn30/dcn30_mmhubbub.c
index 7a93eff183d9..6f2a0d5d963b 100644
--- a/drivers/gpu/drm/amd/display/dc/dcn30/dcn30_mmhubbub.c
+++ b/drivers/gpu/drm/amd/display/dc/dcn30/dcn30_mmhubbub.c
@@ -211,7 +211,7 @@ static void mmhubbub3_config_mcif_arb(struct mcif_wb *mcif_wb,
 	REG_UPDATE(MCIF_WB_ARBITRATION_CONTROL, MCIF_WB_CLIENT_ARBITRATION_SLICE,  params->arbitration_slice);
 }
 
-const struct mcif_wb_funcs dcn30_mmhubbub_funcs = {
+static const struct mcif_wb_funcs dcn30_mmhubbub_funcs = {
 	.warmup_mcif		= mmhubbub3_warmup_mcif,
 	.enable_mcif		= mmhubbub2_enable_mcif,
 	.disable_mcif		= mmhubbub2_disable_mcif,
diff --git a/drivers/gpu/drm/amd/display/dc/dcn30/dcn30_mpc.c b/drivers/gpu/drm/amd/display/dc/dcn30/dcn30_mpc.c
index ad1c1b703874..6cf40c1332bc 100644
--- a/drivers/gpu/drm/amd/display/dc/dcn30/dcn30_mpc.c
+++ b/drivers/gpu/drm/amd/display/dc/dcn30/dcn30_mpc.c
@@ -1399,7 +1399,7 @@ static void mpc3_set_mpc_mem_lp_mode(struct mpc *mpc)
 	}
 }
 
-const struct mpc_funcs dcn30_mpc_funcs = {
+static const struct mpc_funcs dcn30_mpc_funcs = {
 	.read_mpcc_state = mpc1_read_mpcc_state,
 	.insert_plane = mpc1_insert_plane,
 	.remove_mpcc = mpc1_remove_mpcc,
-- 
2.27.0


^ permalink raw reply related	[relevance 89%]

* [PATCH] drm/amd/display: change several dcn20 variables storage-class-specifier to static
@ 2023-03-04 16:22 82% Tom Rix
  0 siblings, 0 replies; 180+ results
From: Tom Rix @ 2023-03-04 16:22 UTC (permalink / raw)
  To: harry.wentland, sunpeng.li, Rodrigo.Siqueira, alexander.deucher,
	christian.koenig, Xinhui.Pan, airlied, daniel, alvin.lee2,
	javierm, hamza.mahfooz, eric.bernstein, roman.li, wenjing.liu,
	praful.swarnakar, tzimmermann, jiapeng.chong, Pavle.Kotarac,
	hansen.dsouza, Charlene.Liu, Josip.Pavic, Jun.Lei,
	chiahsuan.chung
  Cc: Tom Rix, dri-devel, amd-gfx, linux-kernel

smatch reports these similar problems in dcn20
drivers/gpu/drm/amd/amdgpu/../display/dc/dcn20/dcn20_dsc.c:53:24:
  warning: symbol 'dcn20_dsc_funcs' was not declared. Should it be static?
drivers/gpu/drm/amd/amdgpu/../display/dc/dcn20/dcn20_dwb.c:304:25:
  warning: symbol 'dcn20_dwbc_funcs' was not declared. Should it be static?
drivers/gpu/drm/amd/amdgpu/../display/dc/dcn20/dcn20_mmhubbub.c:300:28:
  warning: symbol 'dcn20_mmhubbub_funcs' was not declared. Should it be static?
drivers/gpu/drm/amd/amdgpu/../display/dc/dcn20/dcn20_mpc.c:545:24:
  warning: symbol 'dcn20_mpc_funcs' was not declared. Should it be static?

All of these are only used in their definition file, so they should be static

Signed-off-by: Tom Rix <trix@redhat.com>
---
 drivers/gpu/drm/amd/display/dc/dcn20/dcn20_dsc.c      | 2 +-
 drivers/gpu/drm/amd/display/dc/dcn20/dcn20_dwb.c      | 2 +-
 drivers/gpu/drm/amd/display/dc/dcn20/dcn20_mmhubbub.c | 2 +-
 drivers/gpu/drm/amd/display/dc/dcn20/dcn20_mpc.c      | 2 +-
 4 files changed, 4 insertions(+), 4 deletions(-)

diff --git a/drivers/gpu/drm/amd/display/dc/dcn20/dcn20_dsc.c b/drivers/gpu/drm/amd/display/dc/dcn20/dcn20_dsc.c
index 42344aec60d6..5bd698cd6d20 100644
--- a/drivers/gpu/drm/amd/display/dc/dcn20/dcn20_dsc.c
+++ b/drivers/gpu/drm/amd/display/dc/dcn20/dcn20_dsc.c
@@ -50,7 +50,7 @@ static void dsc2_enable(struct display_stream_compressor *dsc, int opp_pipe);
 static void dsc2_disable(struct display_stream_compressor *dsc);
 static void dsc2_disconnect(struct display_stream_compressor *dsc);
 
-const struct dsc_funcs dcn20_dsc_funcs = {
+static const struct dsc_funcs dcn20_dsc_funcs = {
 	.dsc_get_enc_caps = dsc2_get_enc_caps,
 	.dsc_read_state = dsc2_read_state,
 	.dsc_validate_stream = dsc2_validate_stream,
diff --git a/drivers/gpu/drm/amd/display/dc/dcn20/dcn20_dwb.c b/drivers/gpu/drm/amd/display/dc/dcn20/dcn20_dwb.c
index f1490e97b6ce..f8667be57046 100644
--- a/drivers/gpu/drm/amd/display/dc/dcn20/dcn20_dwb.c
+++ b/drivers/gpu/drm/amd/display/dc/dcn20/dcn20_dwb.c
@@ -301,7 +301,7 @@ void dwb2_set_scaler(struct dwbc *dwbc, struct dc_dwb_params *params)
 
 }
 
-const struct dwbc_funcs dcn20_dwbc_funcs = {
+static const struct dwbc_funcs dcn20_dwbc_funcs = {
 	.get_caps		= dwb2_get_caps,
 	.enable			= dwb2_enable,
 	.disable		= dwb2_disable,
diff --git a/drivers/gpu/drm/amd/display/dc/dcn20/dcn20_mmhubbub.c b/drivers/gpu/drm/amd/display/dc/dcn20/dcn20_mmhubbub.c
index ccd91792991b..259a98e4ee2c 100644
--- a/drivers/gpu/drm/amd/display/dc/dcn20/dcn20_mmhubbub.c
+++ b/drivers/gpu/drm/amd/display/dc/dcn20/dcn20_mmhubbub.c
@@ -297,7 +297,7 @@ void mcifwb2_dump_frame(struct mcif_wb *mcif_wb,
 	dump_info->size		= dest_height * (mcif_params->luma_pitch + mcif_params->chroma_pitch);
 }
 
-const struct mcif_wb_funcs dcn20_mmhubbub_funcs = {
+static const struct mcif_wb_funcs dcn20_mmhubbub_funcs = {
 	.enable_mcif		= mmhubbub2_enable_mcif,
 	.disable_mcif		= mmhubbub2_disable_mcif,
 	.config_mcif_buf	= mmhubbub2_config_mcif_buf,
diff --git a/drivers/gpu/drm/amd/display/dc/dcn20/dcn20_mpc.c b/drivers/gpu/drm/amd/display/dc/dcn20/dcn20_mpc.c
index 116f67a0b989..5da6e44f284a 100644
--- a/drivers/gpu/drm/amd/display/dc/dcn20/dcn20_mpc.c
+++ b/drivers/gpu/drm/amd/display/dc/dcn20/dcn20_mpc.c
@@ -542,7 +542,7 @@ static struct mpcc *mpc2_get_mpcc_for_dpp(struct mpc_tree *tree, int dpp_id)
 	return NULL;
 }
 
-const struct mpc_funcs dcn20_mpc_funcs = {
+static const struct mpc_funcs dcn20_mpc_funcs = {
 	.read_mpcc_state = mpc1_read_mpcc_state,
 	.insert_plane = mpc1_insert_plane,
 	.remove_mpcc = mpc1_remove_mpcc,
-- 
2.27.0


^ permalink raw reply related	[relevance 82%]

* [PATCH] drm/amd/display: change several dcn201 variables storage-class-specifier to static
@ 2023-03-04 15:26 87% Tom Rix
  0 siblings, 0 replies; 180+ results
From: Tom Rix @ 2023-03-04 15:26 UTC (permalink / raw)
  To: harry.wentland, sunpeng.li, Rodrigo.Siqueira, alexander.deucher,
	christian.koenig, Xinhui.Pan, airlied, daniel, jiapeng.chong,
	Pavle.Kotarac, oliver.logush, alex.hung, aurabindo.pillai,
	HaoPing.Liu
  Cc: Tom Rix, dri-devel, amd-gfx, linux-kernel

smatch reports these similar problems in dcn201
drivers/gpu/drm/amd/amdgpu/../display/dc/clk_mgr/dcn201/dcn201_clk_mgr.c:165:22:
  warning: symbol 'dcn201_funcs' was not declared. Should it be static?
drivers/gpu/drm/amd/amdgpu/../display/dc/dcn201/dcn201_resource.c:77:30:
  warning: symbol 'dcn201_ip' was not declared. Should it be static?
drivers/gpu/drm/amd/amdgpu/../display/dc/dcn201/dcn201_resource.c:139:37:
  warning: symbol 'dcn201_soc' was not declared. Should it be static?
drivers/gpu/drm/amd/amdgpu/../display/dc/dcn201/dcn201_mpc.c:79:24:
  warning: symbol 'dcn201_mpc_funcs' was not declared. Should it be static?

All of these are only used in their definition file, so they should be static

Signed-off-by: Tom Rix <trix@redhat.com>
---
 .../gpu/drm/amd/display/dc/clk_mgr/dcn201/dcn201_clk_mgr.c    | 2 +-
 drivers/gpu/drm/amd/display/dc/dcn201/dcn201_mpc.c            | 2 +-
 drivers/gpu/drm/amd/display/dc/dcn201/dcn201_resource.c       | 4 ++--
 3 files changed, 4 insertions(+), 4 deletions(-)

diff --git a/drivers/gpu/drm/amd/display/dc/clk_mgr/dcn201/dcn201_clk_mgr.c b/drivers/gpu/drm/amd/display/dc/clk_mgr/dcn201/dcn201_clk_mgr.c
index f0577dcd1af6..811720749faf 100644
--- a/drivers/gpu/drm/amd/display/dc/clk_mgr/dcn201/dcn201_clk_mgr.c
+++ b/drivers/gpu/drm/amd/display/dc/clk_mgr/dcn201/dcn201_clk_mgr.c
@@ -162,7 +162,7 @@ static void dcn201_update_clocks(struct clk_mgr *clk_mgr_base,
 	}
 }
 
-struct clk_mgr_funcs dcn201_funcs = {
+static struct clk_mgr_funcs dcn201_funcs = {
 	.get_dp_ref_clk_frequency = dce12_get_dp_ref_freq_khz,
 	.update_clocks = dcn201_update_clocks,
 	.init_clocks = dcn201_init_clocks,
diff --git a/drivers/gpu/drm/amd/display/dc/dcn201/dcn201_mpc.c b/drivers/gpu/drm/amd/display/dc/dcn201/dcn201_mpc.c
index 95c4c55f067c..1af03a86ec9b 100644
--- a/drivers/gpu/drm/amd/display/dc/dcn201/dcn201_mpc.c
+++ b/drivers/gpu/drm/amd/display/dc/dcn201/dcn201_mpc.c
@@ -76,7 +76,7 @@ static void mpc201_init_mpcc(struct mpcc *mpcc, int mpcc_inst)
 	mpcc->shared_bottom = false;
 }
 
-const struct mpc_funcs dcn201_mpc_funcs = {
+static const struct mpc_funcs dcn201_mpc_funcs = {
 	.read_mpcc_state = mpc1_read_mpcc_state,
 	.insert_plane = mpc1_insert_plane,
 	.remove_mpcc = mpc1_remove_mpcc,
diff --git a/drivers/gpu/drm/amd/display/dc/dcn201/dcn201_resource.c b/drivers/gpu/drm/amd/display/dc/dcn201/dcn201_resource.c
index 407d995bfa99..cd46701398d9 100644
--- a/drivers/gpu/drm/amd/display/dc/dcn201/dcn201_resource.c
+++ b/drivers/gpu/drm/amd/display/dc/dcn201/dcn201_resource.c
@@ -74,7 +74,7 @@
 #define MIN_DISP_CLK_KHZ 100000
 #define MIN_DPP_CLK_KHZ 100000
 
-struct _vcs_dpi_ip_params_st dcn201_ip = {
+static struct _vcs_dpi_ip_params_st dcn201_ip = {
 	.gpuvm_enable = 0,
 	.hostvm_enable = 0,
 	.gpuvm_max_page_table_levels = 4,
@@ -136,7 +136,7 @@ struct _vcs_dpi_ip_params_st dcn201_ip = {
 	.number_of_cursors = 1,
 };
 
-struct _vcs_dpi_soc_bounding_box_st dcn201_soc = {
+static struct _vcs_dpi_soc_bounding_box_st dcn201_soc = {
 	.clock_limits = {
 			{
 				.state = 0,
-- 
2.27.0


^ permalink raw reply related	[relevance 87%]

* [PATCH] drm/nouveau/fifo: set gf100_fifo_nonstall_block_dump storage-class-specifier to static
@ 2023-03-03 13:27 99% Tom Rix
  0 siblings, 0 replies; 180+ results
From: Tom Rix @ 2023-03-03 13:27 UTC (permalink / raw)
  To: bskeggs, kherbst, lyude, airlied, daniel
  Cc: nouveau, linux-kernel, dri-devel, Tom Rix

gcc with W=1 reports
drivers/gpu/drm/nouveau/nvkm/engine/fifo/gf100.c:451:1: error:
  no previous prototype for ‘gf100_fifo_nonstall_block’ [-Werror=missing-prototypes]
  451 | gf100_fifo_nonstall_block(struct nvkm_event *event, int type, int index)
      | ^~~~~~~~~~~~~~~~~~~~~~~~~

gf100_fifo_nonstall_block is only used in gf100.c, so it should be static

Signed-off-by: Tom Rix <trix@redhat.com>
---
 drivers/gpu/drm/nouveau/nvkm/engine/fifo/gf100.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/gpu/drm/nouveau/nvkm/engine/fifo/gf100.c b/drivers/gpu/drm/nouveau/nvkm/engine/fifo/gf100.c
index 5bb65258c36d..6c94451d0faa 100644
--- a/drivers/gpu/drm/nouveau/nvkm/engine/fifo/gf100.c
+++ b/drivers/gpu/drm/nouveau/nvkm/engine/fifo/gf100.c
@@ -447,7 +447,7 @@ gf100_fifo_nonstall_allow(struct nvkm_event *event, int type, int index)
 	spin_unlock_irqrestore(&fifo->lock, flags);
 }
 
-void
+static void
 gf100_fifo_nonstall_block(struct nvkm_event *event, int type, int index)
 {
 	struct nvkm_fifo *fifo = container_of(event, typeof(*fifo), nonstall.event);
-- 
2.27.0


^ permalink raw reply related	[relevance 99%]

* [PATCH] drm/nouveau/nvfw/acr: set wpr_generic_header_dump storage-class-specifier to static
@ 2023-03-02 12:48 99% Tom Rix
  0 siblings, 0 replies; 180+ results
From: Tom Rix @ 2023-03-02 12:48 UTC (permalink / raw)
  To: bskeggs, kherbst, lyude, airlied, daniel, gsamaiya
  Cc: nouveau, linux-kernel, dri-devel, Tom Rix

gcc with W=1 reports
drivers/gpu/drm/nouveau/nvkm/nvfw/acr.c:49:1: error: no previous
  prototype for ‘wpr_generic_header_dump’ [-Werror=missing-prototypes]
   49 | wpr_generic_header_dump(struct nvkm_subdev *subdev,
      | ^~~~~~~~~~~~~~~~~~~~~~~

wpr_generic_header_dump is only used in acr.c, so it should be static

Signed-off-by: Tom Rix <trix@redhat.com>
---
 drivers/gpu/drm/nouveau/nvkm/nvfw/acr.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/gpu/drm/nouveau/nvkm/nvfw/acr.c b/drivers/gpu/drm/nouveau/nvkm/nvfw/acr.c
index 83a9c48bc58c..7ac90c495737 100644
--- a/drivers/gpu/drm/nouveau/nvkm/nvfw/acr.c
+++ b/drivers/gpu/drm/nouveau/nvkm/nvfw/acr.c
@@ -45,7 +45,7 @@ wpr_header_v1_dump(struct nvkm_subdev *subdev, const struct wpr_header_v1 *hdr)
 	nvkm_debug(subdev, "\tstatus        : %d\n", hdr->status);
 }
 
-void
+static void
 wpr_generic_header_dump(struct nvkm_subdev *subdev, const struct wpr_generic_header *hdr)
 {
 	nvkm_debug(subdev, "wprGenericHeader\n");
-- 
2.27.0


^ permalink raw reply related	[relevance 99%]

* [PATCH] drm/amd/pm: set vangogh_set_apu_thermal_limit storage-class-specifier to static
@ 2023-03-01 14:00 99% Tom Rix
  0 siblings, 0 replies; 180+ results
From: Tom Rix @ 2023-03-01 14:00 UTC (permalink / raw)
  To: evan.quan, alexander.deucher, christian.koenig, Xinhui.Pan,
	airlied, daniel, andrealmeid, kevinyang.wang, li.ma, Kun.Liu2
  Cc: Tom Rix, dri-devel, amd-gfx, linux-kernel

gcc with W=1 reports
drivers/gpu/drm/amd/amdgpu/../pm/swsmu/smu11/vangogh_ppt.c:1600:5:
  error: no previous prototype for ‘vangogh_set_apu_thermal_limit’ [-Werror=missing-prototypes]
 1600 | int vangogh_set_apu_thermal_limit(struct smu_context *smu, uint32_t limit)
      |     ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~

vangogh_set_apu_thermal_limit is only used in vangogh_ppt.c, so it should be static

Signed-off-by: Tom Rix <trix@redhat.com>
---
 drivers/gpu/drm/amd/pm/swsmu/smu11/vangogh_ppt.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/gpu/drm/amd/pm/swsmu/smu11/vangogh_ppt.c b/drivers/gpu/drm/amd/pm/swsmu/smu11/vangogh_ppt.c
index 016d5621e0b3..24046af60933 100644
--- a/drivers/gpu/drm/amd/pm/swsmu/smu11/vangogh_ppt.c
+++ b/drivers/gpu/drm/amd/pm/swsmu/smu11/vangogh_ppt.c
@@ -1597,7 +1597,7 @@ static int vangogh_get_apu_thermal_limit(struct smu_context *smu, uint32_t *limi
 					      0, limit);
 }
 
-int vangogh_set_apu_thermal_limit(struct smu_context *smu, uint32_t limit)
+static int vangogh_set_apu_thermal_limit(struct smu_context *smu, uint32_t limit)
 {
 	return smu_cmn_send_smc_msg_with_param(smu,
 					      SMU_MSG_SetReducedThermalLimit,
-- 
2.27.0


^ permalink raw reply related	[relevance 99%]

* [PATCH] drm/nouveau/fifo: set nvkm_engn_cgrp_get storage-class-specifier to static
@ 2023-02-28 22:15 99% Tom Rix
  0 siblings, 0 replies; 180+ results
From: Tom Rix @ 2023-02-28 22:15 UTC (permalink / raw)
  To: bskeggs, kherbst, lyude, airlied, daniel
  Cc: nouveau, linux-kernel, dri-devel, Tom Rix

smatch reports
drivers/gpu/drm/nouveau/nvkm/engine/fifo/runl.c:33:18:
  warning: symbol 'nvkm_engn_cgrp_get' was not declared. Should it be static?

nvkm_engn_cgrp_get is only used in runl.c, so it should be static

Signed-off-by: Tom Rix <trix@redhat.com>
---
 drivers/gpu/drm/nouveau/nvkm/engine/fifo/runl.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/gpu/drm/nouveau/nvkm/engine/fifo/runl.c b/drivers/gpu/drm/nouveau/nvkm/engine/fifo/runl.c
index b5836cbc29aa..93d628d7d508 100644
--- a/drivers/gpu/drm/nouveau/nvkm/engine/fifo/runl.c
+++ b/drivers/gpu/drm/nouveau/nvkm/engine/fifo/runl.c
@@ -30,7 +30,7 @@
 #include <subdev/timer.h>
 #include <subdev/top.h>
 
-struct nvkm_cgrp *
+static struct nvkm_cgrp *
 nvkm_engn_cgrp_get(struct nvkm_engn *engn, unsigned long *pirqflags)
 {
 	struct nvkm_cgrp *cgrp = NULL;
-- 
2.27.0


^ permalink raw reply related	[relevance 99%]

* [PATCH] drm/amdgpu: remove unused variable ring
@ 2023-02-24 16:45 98% Tom Rix
  0 siblings, 0 replies; 180+ results
From: Tom Rix @ 2023-02-24 16:45 UTC (permalink / raw)
  To: alexander.deucher, christian.koenig, Xinhui.Pan, airlied, daniel,
	ruijing.dong, Jane.Jian, James.Zhu, tao.zhou1, sonny.jiang,
	leo.liu
  Cc: Tom Rix, dri-devel, amd-gfx, linux-kernel

building with gcc and W=1 reports
drivers/gpu/drm/amd/amdgpu/vcn_v4_0.c:81:29: error: variable
  ‘ring’ set but not used [-Werror=unused-but-set-variable]
   81 |         struct amdgpu_ring *ring;
      |                             ^~~~

ring is not used so remove it.

Signed-off-by: Tom Rix <trix@redhat.com>
---
 drivers/gpu/drm/amd/amdgpu/vcn_v4_0.c | 2 --
 1 file changed, 2 deletions(-)

diff --git a/drivers/gpu/drm/amd/amdgpu/vcn_v4_0.c b/drivers/gpu/drm/amd/amdgpu/vcn_v4_0.c
index 213b43670f23..023a1fffa6a9 100644
--- a/drivers/gpu/drm/amd/amdgpu/vcn_v4_0.c
+++ b/drivers/gpu/drm/amd/amdgpu/vcn_v4_0.c
@@ -78,12 +78,10 @@ static void vcn_v4_0_set_ras_funcs(struct amdgpu_device *adev);
 static int vcn_v4_0_early_init(void *handle)
 {
 	struct amdgpu_device *adev = (struct amdgpu_device *)handle;
-	struct amdgpu_ring *ring;
 
 	if (amdgpu_sriov_vf(adev)) {
 		adev->vcn.harvest_config = VCN_HARVEST_MMSCH;
 		for (int i = 0; i < adev->vcn.num_vcn_inst; ++i) {
-			ring = &adev->vcn.inst[i].ring_enc[0];
 			if (amdgpu_vcn_is_disabled_vcn(adev, VCN_ENCODE_RING, i)) {
 				adev->vcn.harvest_config |= 1 << i;
 				dev_info(adev->dev, "VCN%d is disabled by hypervisor\n", i);
-- 
2.27.0


^ permalink raw reply related	[relevance 98%]

* [PATCH] drm/amdgpu: remove unused variable channel_index
@ 2023-02-24 16:06 99% Tom Rix
  0 siblings, 0 replies; 180+ results
From: Tom Rix @ 2023-02-24 16:06 UTC (permalink / raw)
  To: alexander.deucher, christian.koenig, Xinhui.Pan, airlied, daniel,
	tao.zhou1, Hawking.Zhang, candice.li, Stanley.Yang, YiPeng.Chai
  Cc: Tom Rix, dri-devel, amd-gfx, linux-kernel

building with gcc and W=1 reports
drivers/gpu/drm/amd/amdgpu/umc_v8_10.c:437:37: error: variable ‘channel_index’
  set but not used [-Werror=unused-but-set-variable]
  437 |         uint32_t eccinfo_table_idx, channel_index;
      |                                     ^~~~~~~~~~~~~

channel_index is not used so remove it.

Signed-off-by: Tom Rix <trix@redhat.com>
---
 drivers/gpu/drm/amd/amdgpu/umc_v8_10.c | 7 +------
 1 file changed, 1 insertion(+), 6 deletions(-)

diff --git a/drivers/gpu/drm/amd/amdgpu/umc_v8_10.c b/drivers/gpu/drm/amd/amdgpu/umc_v8_10.c
index 66158219f791..3f051dec56e9 100644
--- a/drivers/gpu/drm/amd/amdgpu/umc_v8_10.c
+++ b/drivers/gpu/drm/amd/amdgpu/umc_v8_10.c
@@ -434,7 +434,7 @@ static void umc_v8_10_ecc_info_query_error_address(struct amdgpu_device *adev,
 					uint32_t umc_inst,
 					uint32_t node_inst)
 {
-	uint32_t eccinfo_table_idx, channel_index;
+	uint32_t eccinfo_table_idx;
 	uint64_t mc_umc_status, err_addr;
 
 	struct amdgpu_ras *ras = amdgpu_ras_get_context(adev);
@@ -443,11 +443,6 @@ static void umc_v8_10_ecc_info_query_error_address(struct amdgpu_device *adev,
 				  adev->umc.channel_inst_num +
 				  umc_inst * adev->umc.channel_inst_num +
 				  ch_inst;
-	channel_index =
-		adev->umc.channel_idx_tbl[node_inst * adev->umc.umc_inst_num *
-						  adev->umc.channel_inst_num +
-						  umc_inst * adev->umc.channel_inst_num +
-						  ch_inst];
 
 	mc_umc_status = ras->umc_ecc.ecc[eccinfo_table_idx].mca_umc_status;
 
-- 
2.27.0


^ permalink raw reply related	[relevance 99%]

* [PATCH] drm/msm: return early when allocating fbdev fails
@ 2023-02-22 15:56 99% Tom Rix
  0 siblings, 0 replies; 180+ results
From: Tom Rix @ 2023-02-22 15:56 UTC (permalink / raw)
  To: robdclark, quic_abhinavk, dmitry.baryshkov, sean, airlied,
	daniel, nathan, ndesaulniers, tzimmermann, javierm
  Cc: linux-arm-msm, llvm, linux-kernel, dri-devel, Tom Rix, freedreno

building with clang and W=1 reports
drivers/gpu/drm/msm/msm_fbdev.c:144:6: error: variable 'helper' is used
  uninitialized whenever 'if' condition is true [-Werror,-Wsometimes-uninitialized]
  if (!fbdev)
      ^~~~~~

helper is only initialized after fbdev succeeds, so is in a garbage state at
the fail: label.  There is nothing to unwinded if fbdev alloaction fails,
return NULL.

Fixes: 3fb1f62f80a1 ("drm/fb-helper: Remove drm_fb_helper_unprepare() from drm_fb_helper_fini()")
Signed-off-by: Tom Rix <trix@redhat.com>
---
 drivers/gpu/drm/msm/msm_fbdev.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/gpu/drm/msm/msm_fbdev.c b/drivers/gpu/drm/msm/msm_fbdev.c
index c804e5ba682a..c1356aff87da 100644
--- a/drivers/gpu/drm/msm/msm_fbdev.c
+++ b/drivers/gpu/drm/msm/msm_fbdev.c
@@ -142,7 +142,7 @@ struct drm_fb_helper *msm_fbdev_init(struct drm_device *dev)
 
 	fbdev = kzalloc(sizeof(*fbdev), GFP_KERNEL);
 	if (!fbdev)
-		goto fail;
+		return NULL;
 
 	helper = &fbdev->base;
 
-- 
2.27.0


^ permalink raw reply related	[relevance 99%]

* [PATCH] habanalabs: set hl_capture_*_err storage-class-specifier to static
@ 2023-02-13 14:48 99% Tom Rix
  0 siblings, 0 replies; 180+ results
From: Tom Rix @ 2023-02-13 14:48 UTC (permalink / raw)
  To: ogabbay, ttayar, gregkh, dliberman, osharabi, dhirschfeld
  Cc: Tom Rix, linux-kernel, dri-devel

smatch reports
drivers/accel/habanalabs/common/device.c:2619:6: warning:
  symbol 'hl_capture_hw_err' was not declared. Should it be static?
drivers/accel/habanalabs/common/device.c:2641:6: warning:
  symbol 'hl_capture_fw_err' was not declared. Should it be static?

both are only used in device.c, so they should be static

Signed-off-by: Tom Rix <trix@redhat.com>
---
 drivers/accel/habanalabs/common/device.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/accel/habanalabs/common/device.c b/drivers/accel/habanalabs/common/device.c
index fefe70bbbede..a5f5ee102823 100644
--- a/drivers/accel/habanalabs/common/device.c
+++ b/drivers/accel/habanalabs/common/device.c
@@ -2616,7 +2616,7 @@ void hl_handle_page_fault(struct hl_device *hdev, u64 addr, u16 eng_id, bool is_
 		*event_mask |=  HL_NOTIFIER_EVENT_PAGE_FAULT;
 }
 
-void hl_capture_hw_err(struct hl_device *hdev, u16 event_id)
+static void hl_capture_hw_err(struct hl_device *hdev, u16 event_id)
 {
 	struct hw_err_info *info = &hdev->captured_err_info.hw_err;
 
@@ -2638,7 +2638,7 @@ void hl_handle_critical_hw_err(struct hl_device *hdev, u16 event_id, u64 *event_
 		*event_mask |= HL_NOTIFIER_EVENT_CRITICL_HW_ERR;
 }
 
-void hl_capture_fw_err(struct hl_device *hdev, struct hl_info_fw_err_info *fw_info)
+static void hl_capture_fw_err(struct hl_device *hdev, struct hl_info_fw_err_info *fw_info)
 {
 	struct fw_err_info *info = &hdev->captured_err_info.fw_err;
 
-- 
2.26.3


^ permalink raw reply related	[relevance 99%]

* [PATCH] drm/amd/display: set should_disable_otg storage-class-specifier to static
@ 2023-02-09 13:40 99% Tom Rix
  0 siblings, 0 replies; 180+ results
From: Tom Rix @ 2023-02-09 13:40 UTC (permalink / raw)
  To: harry.wentland, sunpeng.li, Rodrigo.Siqueira, alexander.deucher,
	christian.koenig, Xinhui.Pan, airlied, daniel,
	Dmytro.Laktyushkin, qingqing.zhuo, Charlene.Liu,
	nicholas.kazlauskas, meenakshikumar.somasundaram
  Cc: Tom Rix, dri-devel, amd-gfx, linux-kernel

smatch reports
drivers/gpu/drm/amd/amdgpu/../display/dc/clk_mgr/dcn315/dcn315_clk_mgr.c:90:6:
  warning: symbol 'should_disable_otg' was not declared. Should it be static?

should_disable_otg() is only used in dcn315_clk_mgr.c, so it should be static

Signed-off-by: Tom Rix <trix@redhat.com>
---
 drivers/gpu/drm/amd/display/dc/clk_mgr/dcn315/dcn315_clk_mgr.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/gpu/drm/amd/display/dc/clk_mgr/dcn315/dcn315_clk_mgr.c b/drivers/gpu/drm/amd/display/dc/clk_mgr/dcn315/dcn315_clk_mgr.c
index 8c368bcc8e7e..a737782b2840 100644
--- a/drivers/gpu/drm/amd/display/dc/clk_mgr/dcn315/dcn315_clk_mgr.c
+++ b/drivers/gpu/drm/amd/display/dc/clk_mgr/dcn315/dcn315_clk_mgr.c
@@ -87,7 +87,7 @@ static int dcn315_get_active_display_cnt_wa(
 	return display_count;
 }
 
-bool should_disable_otg(struct pipe_ctx *pipe)
+static bool should_disable_otg(struct pipe_ctx *pipe)
 {
 	bool ret = true;
 
-- 
2.26.3


^ permalink raw reply related	[relevance 99%]

* [PATCH] habanalabs: change unused extern decl of hdev to forward decl of hl_device
@ 2023-02-08 15:54 98% Tom Rix
  0 siblings, 0 replies; 180+ results
From: Tom Rix @ 2023-02-08 15:54 UTC (permalink / raw)
  To: ogabbay, nathan, ndesaulniers, kelbaz
  Cc: Tom Rix, llvm, linux-kernel, dri-devel

Building with clang W=2 has several similar warnings
drivers/accel/habanalabs/common/decoder.c:46:51: error: declaration shadows a variable in the global scope [-Werror,-Wshadow]
static void dec_error_intr_work(struct hl_device *hdev, u32 base_addr, u32 core_id)
                                                  ^
drivers/accel/habanalabs/common/security.h:13:26: note: previous declaration is here
extern struct hl_device *hdev;
                         ^

There is no global definition of hdev, so the extern is not needed.
Searched with
grep -r '^struct' . | grep hl_dev

Change to an forward decl to resolve these issues
drivers/accel/habanalabs/common/mmu/../security.h:133:40: error: ‘struct hl_device’ declared inside parameter list will not be visible outside of this definition or declaration [-Werror]
  133 |         bool (*skip_block_hook)(struct hl_device *hdev,
      |                                        ^~~~~~~~~

Signed-off-by: Tom Rix <trix@redhat.com>
---
 drivers/accel/habanalabs/common/security.h | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/accel/habanalabs/common/security.h b/drivers/accel/habanalabs/common/security.h
index 234b4a6ed8bc..d7a3b3e82ea4 100644
--- a/drivers/accel/habanalabs/common/security.h
+++ b/drivers/accel/habanalabs/common/security.h
@@ -10,7 +10,7 @@
 
 #include <linux/io-64-nonatomic-lo-hi.h>
 
-extern struct hl_device *hdev;
+struct hl_device;
 
 /* special blocks */
 #define HL_MAX_NUM_OF_GLBL_ERR_CAUSE		10
-- 
2.26.3


^ permalink raw reply related	[relevance 98%]

* [PATCH] drm/amd/display: reduce else-if to else in dcn10_blank_pixel_data()
@ 2023-01-27  1:38 93% Tom Rix
  0 siblings, 0 replies; 180+ results
From: Tom Rix @ 2023-01-27  1:38 UTC (permalink / raw)
  To: harry.wentland, sunpeng.li, Rodrigo.Siqueira, alexander.deucher,
	christian.koenig, Xinhui.Pan, airlied, daniel, Anthony.Koo,
	alex.hung, aurabindo.pillai, Roman.Li, wenjing.liu,
	Dillon.Varone, mwen, dingchen.zhang, martin.tsai, aric.cyr,
	Wesley.Chalmers, Max.Tseng, sivapiriyan.kumarasamy, Tony.Cheng
  Cc: Tom Rix, dri-devel, amd-gfx, linux-kernel

checkpatch reports
drivers/gpu/drm/amd/display/dc/dcn10/dcn10_hw_sequencer.c:2902:13: style:
  Expression is always true because 'else if' condition is opposite to previous condition at line 2895. [multiCondition]
 } else if (blank) {
            ^
drivers/gpu/drm/amd/display/dc/dcn10/dcn10_hw_sequencer.c:2895:6: note: first condition
 if (!blank) {
     ^
drivers/gpu/drm/amd/display/dc/dcn10/dcn10_hw_sequencer.c:2902:13: note: else if condition is opposite to first condition
 } else if (blank) {

It is not necessary to explicitly the check != condition, an else is simplier.

Fixes: aa5a57773042 ("drm/amd/display: Vari-bright looks disabled near end of MM14")
Signed-off-by: Tom Rix <trix@redhat.com>
---
 drivers/gpu/drm/amd/display/dc/dcn10/dcn10_hw_sequencer.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/gpu/drm/amd/display/dc/dcn10/dcn10_hw_sequencer.c b/drivers/gpu/drm/amd/display/dc/dcn10/dcn10_hw_sequencer.c
index bb155734ac93..f735ae5e045f 100644
--- a/drivers/gpu/drm/amd/display/dc/dcn10/dcn10_hw_sequencer.c
+++ b/drivers/gpu/drm/amd/display/dc/dcn10/dcn10_hw_sequencer.c
@@ -2899,7 +2899,7 @@ void dcn10_blank_pixel_data(
 			dc->hwss.set_pipe(pipe_ctx);
 			stream_res->abm->funcs->set_abm_level(stream_res->abm, stream->abm_level);
 		}
-	} else if (blank) {
+	} else {
 		dc->hwss.set_abm_immediate_disable(pipe_ctx);
 		if (stream_res->tg->funcs->set_blank) {
 			stream_res->tg->funcs->wait_for_state(stream_res->tg, CRTC_STATE_VBLANK);
-- 
2.26.3


^ permalink raw reply related	[relevance 93%]

* [PATCH] drm/amd/display: reduce else-if to else in dcn32_calculate_dlg_params()
@ 2023-01-26 20:49 92% Tom Rix
  0 siblings, 0 replies; 180+ results
From: Tom Rix @ 2023-01-26 20:49 UTC (permalink / raw)
  To: harry.wentland, sunpeng.li, Rodrigo.Siqueira, alexander.deucher,
	christian.koenig, Xinhui.Pan, airlied, daniel, jun.lei,
	Alvin.Lee2, Nevenko.Stupar, Dillon.Varone, george.shen, rdunlap,
	David.Galiffi
  Cc: Tom Rix, dri-devel, amd-gfx, linux-kernel

cppcheck reports
drivers/gpu/drm/amd/display/dc/dml/dcn32/dcn32_fpu.c:1403:76: style:
  Expression is always true because 'else if' condition is opposite to previous condition at line 1396. [multiCondition]
   } else if (context->res_ctx.pipe_ctx[i].stream->mall_stream_config.type == SUBVP_PHANTOM) {
                                                                           ^
drivers/gpu/drm/amd/display/dc/dml/dcn32/dcn32_fpu.c:1396:69: note: first condition
   if (context->res_ctx.pipe_ctx[i].stream->mall_stream_config.type != SUBVP_PHANTOM) {
                                                                    ^
drivers/gpu/drm/amd/display/dc/dml/dcn32/dcn32_fpu.c:1403:76: note: else if condition is opposite to first condition
   } else if (context->res_ctx.pipe_ctx[i].stream->mall_stream_config.type == SUBVP_PHANTOM) {

It is not necessary to explicitly the check != condition, an else is simplier.

Fixes: 238debcaebe4 ("drm/amd/display: Use DML for MALL SS and Subvp allocation calculations")
Signed-off-by: Tom Rix <trix@redhat.com>
---
 drivers/gpu/drm/amd/display/dc/dml/dcn32/dcn32_fpu.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/gpu/drm/amd/display/dc/dml/dcn32/dcn32_fpu.c b/drivers/gpu/drm/amd/display/dc/dml/dcn32/dcn32_fpu.c
index 0dc1a03999b6..c96cbd88e20d 100644
--- a/drivers/gpu/drm/amd/display/dc/dml/dcn32/dcn32_fpu.c
+++ b/drivers/gpu/drm/amd/display/dc/dml/dcn32/dcn32_fpu.c
@@ -1400,7 +1400,7 @@ static void dcn32_calculate_dlg_params(struct dc *dc, struct dc_state *context,
 					/* SS PSR On: all active surfaces part of streams not supporting PSR stored in MALL */
 					context->bw_ctx.bw.dcn.mall_ss_psr_active_size_bytes += context->res_ctx.pipe_ctx[i].surface_size_in_mall_bytes;
 				}
-			} else if (context->res_ctx.pipe_ctx[i].stream->mall_stream_config.type == SUBVP_PHANTOM) {
+			} else {
 				/* SUBVP: phantom surfaces only stored in MALL */
 				context->bw_ctx.bw.dcn.mall_subvp_size_bytes += context->res_ctx.pipe_ctx[i].surface_size_in_mall_bytes;
 			}
-- 
2.26.3


^ permalink raw reply related	[relevance 92%]

* [PATCH] habanalabs: remove redundant memset
@ 2023-01-07 18:48 99% Tom Rix
  0 siblings, 0 replies; 180+ results
From: Tom Rix @ 2023-01-07 18:48 UTC (permalink / raw)
  To: ogabbay, gregkh, dliberman, osharabi, obitton, talcohen
  Cc: Tom Rix, linux-kernel, dri-devel

From reviewing the code, the line
  memset(kdata, 0, usize);
is not needed because kdata is either zeroed by
  kdata = kzalloc(asize, GFP_KERNEL);
when allocated at runtime or by
  char stack_kdata[128] = {0};
at compile time.

Signed-off-by: Tom Rix <trix@redhat.com>
---
 drivers/accel/habanalabs/common/habanalabs_ioctl.c | 2 --
 1 file changed, 2 deletions(-)

diff --git a/drivers/accel/habanalabs/common/habanalabs_ioctl.c b/drivers/accel/habanalabs/common/habanalabs_ioctl.c
index 619d56c40b30..949d38527160 100644
--- a/drivers/accel/habanalabs/common/habanalabs_ioctl.c
+++ b/drivers/accel/habanalabs/common/habanalabs_ioctl.c
@@ -1123,8 +1123,6 @@ static long _hl_ioctl(struct file *filep, unsigned int cmd, unsigned long arg,
 			retcode = -EFAULT;
 			goto out_err;
 		}
-	} else if (cmd & IOC_OUT) {
-		memset(kdata, 0, usize);
 	}
 
 	retcode = func(hpriv, kdata);
-- 
2.27.0


^ permalink raw reply related	[relevance 99%]

* [PATCH] drm/amd/display: remove redundant CalculateRemoteSurfaceFlipDelay's
@ 2022-09-19 17:27 80% Tom Rix
  0 siblings, 0 replies; 180+ results
From: Tom Rix @ 2022-09-19 17:27 UTC (permalink / raw)
  To: harry.wentland, sunpeng.li, Rodrigo.Siqueira, alexander.deucher,
	christian.koenig, Xinhui.Pan, airlied, daniel, Nevenko.Stupar,
	Pavle.Kotarac, aric.cyr
  Cc: Tom Rix, dri-devel, amd-gfx, linux-kernel

There are several copies of CalculateRemoteSurfaceFlipDelay.
Reduce to one instance.

Signed-off-by: Tom Rix <trix@redhat.com>
---
 .../dc/dml/dcn20/display_mode_vba_20.c        |  4 +-
 .../dc/dml/dcn20/display_mode_vba_20v2.c      | 40 +------------------
 .../dc/dml/dcn21/display_mode_vba_21.c        | 40 +------------------
 3 files changed, 4 insertions(+), 80 deletions(-)

diff --git a/drivers/gpu/drm/amd/display/dc/dml/dcn20/display_mode_vba_20.c b/drivers/gpu/drm/amd/display/dc/dml/dcn20/display_mode_vba_20.c
index 4ca080950924..8e5d58336bc5 100644
--- a/drivers/gpu/drm/amd/display/dc/dml/dcn20/display_mode_vba_20.c
+++ b/drivers/gpu/drm/amd/display/dc/dml/dcn20/display_mode_vba_20.c
@@ -158,7 +158,7 @@ double CalculateTWait(
 		double DRAMClockChangeLatency,
 		double UrgentLatency,
 		double SREnterPlusExitTime);
-static double CalculateRemoteSurfaceFlipDelay(
+double CalculateRemoteSurfaceFlipDelay(
 		struct display_mode_lib *mode_lib,
 		double VRatio,
 		double SwathWidth,
@@ -2909,7 +2909,7 @@ double CalculateTWait(
 	}
 }
 
-static double CalculateRemoteSurfaceFlipDelay(
+double CalculateRemoteSurfaceFlipDelay(
 		struct display_mode_lib *mode_lib,
 		double VRatio,
 		double SwathWidth,
diff --git a/drivers/gpu/drm/amd/display/dc/dml/dcn20/display_mode_vba_20v2.c b/drivers/gpu/drm/amd/display/dc/dml/dcn20/display_mode_vba_20v2.c
index 2b4dcae4e432..e9ebc81adc71 100644
--- a/drivers/gpu/drm/amd/display/dc/dml/dcn20/display_mode_vba_20v2.c
+++ b/drivers/gpu/drm/amd/display/dc/dml/dcn20/display_mode_vba_20v2.c
@@ -182,7 +182,7 @@ double CalculateTWait(
 		double DRAMClockChangeLatency,
 		double UrgentLatency,
 		double SREnterPlusExitTime);
-static double CalculateRemoteSurfaceFlipDelay(
+double CalculateRemoteSurfaceFlipDelay(
 		struct display_mode_lib *mode_lib,
 		double VRatio,
 		double SwathWidth,
@@ -2967,44 +2967,6 @@ static void dml20v2_DisplayPipeConfiguration(struct display_mode_lib *mode_lib)
 	}
 }
 
-static double CalculateRemoteSurfaceFlipDelay(
-		struct display_mode_lib *mode_lib,
-		double VRatio,
-		double SwathWidth,
-		double Bpp,
-		double LineTime,
-		double XFCTSlvVupdateOffset,
-		double XFCTSlvVupdateWidth,
-		double XFCTSlvVreadyOffset,
-		double XFCXBUFLatencyTolerance,
-		double XFCFillBWOverhead,
-		double XFCSlvChunkSize,
-		double XFCBusTransportTime,
-		double TCalc,
-		double TWait,
-		double *SrcActiveDrainRate,
-		double *TInitXFill,
-		double *TslvChk)
-{
-	double TSlvSetup, AvgfillRate, result;
-
-	*SrcActiveDrainRate = VRatio * SwathWidth * Bpp / LineTime;
-	TSlvSetup = XFCTSlvVupdateOffset + XFCTSlvVupdateWidth + XFCTSlvVreadyOffset;
-	*TInitXFill = XFCXBUFLatencyTolerance / (1 + XFCFillBWOverhead / 100);
-	AvgfillRate = *SrcActiveDrainRate * (1 + XFCFillBWOverhead / 100);
-	*TslvChk = XFCSlvChunkSize / AvgfillRate;
-	dml_print(
-			"DML::CalculateRemoteSurfaceFlipDelay: SrcActiveDrainRate: %f\n",
-			*SrcActiveDrainRate);
-	dml_print("DML::CalculateRemoteSurfaceFlipDelay: TSlvSetup: %f\n", TSlvSetup);
-	dml_print("DML::CalculateRemoteSurfaceFlipDelay: TInitXFill: %f\n", *TInitXFill);
-	dml_print("DML::CalculateRemoteSurfaceFlipDelay: AvgfillRate: %f\n", AvgfillRate);
-	dml_print("DML::CalculateRemoteSurfaceFlipDelay: TslvChk: %f\n", *TslvChk);
-	result = 2 * XFCBusTransportTime + TSlvSetup + TCalc + TWait + *TslvChk + *TInitXFill; // TODO: This doesn't seem to match programming guide
-	dml_print("DML::CalculateRemoteSurfaceFlipDelay: RemoteSurfaceFlipDelay: %f\n", result);
-	return result;
-}
-
 static void CalculateActiveRowBandwidth(
 		bool GPUVMEnable,
 		enum source_format_class SourcePixelFormat,
diff --git a/drivers/gpu/drm/amd/display/dc/dml/dcn21/display_mode_vba_21.c b/drivers/gpu/drm/amd/display/dc/dml/dcn21/display_mode_vba_21.c
index a3ef3638d979..d94aaf899f9b 100644
--- a/drivers/gpu/drm/amd/display/dc/dml/dcn21/display_mode_vba_21.c
+++ b/drivers/gpu/drm/amd/display/dc/dml/dcn21/display_mode_vba_21.c
@@ -210,7 +210,7 @@ double CalculateTWait(
 		double DRAMClockChangeLatency,
 		double UrgentLatency,
 		double SREnterPlusExitTime);
-static double CalculateRemoteSurfaceFlipDelay(
+double CalculateRemoteSurfaceFlipDelay(
 		struct display_mode_lib *mode_lib,
 		double VRatio,
 		double SwathWidth,
@@ -2980,44 +2980,6 @@ static void DisplayPipeConfiguration(struct display_mode_lib *mode_lib)
 	}
 }
 
-static double CalculateRemoteSurfaceFlipDelay(
-		struct display_mode_lib *mode_lib,
-		double VRatio,
-		double SwathWidth,
-		double Bpp,
-		double LineTime,
-		double XFCTSlvVupdateOffset,
-		double XFCTSlvVupdateWidth,
-		double XFCTSlvVreadyOffset,
-		double XFCXBUFLatencyTolerance,
-		double XFCFillBWOverhead,
-		double XFCSlvChunkSize,
-		double XFCBusTransportTime,
-		double TCalc,
-		double TWait,
-		double *SrcActiveDrainRate,
-		double *TInitXFill,
-		double *TslvChk)
-{
-	double TSlvSetup, AvgfillRate, result;
-
-	*SrcActiveDrainRate = VRatio * SwathWidth * Bpp / LineTime;
-	TSlvSetup = XFCTSlvVupdateOffset + XFCTSlvVupdateWidth + XFCTSlvVreadyOffset;
-	*TInitXFill = XFCXBUFLatencyTolerance / (1 + XFCFillBWOverhead / 100);
-	AvgfillRate = *SrcActiveDrainRate * (1 + XFCFillBWOverhead / 100);
-	*TslvChk = XFCSlvChunkSize / AvgfillRate;
-	dml_print(
-			"DML::CalculateRemoteSurfaceFlipDelay: SrcActiveDrainRate: %f\n",
-			*SrcActiveDrainRate);
-	dml_print("DML::CalculateRemoteSurfaceFlipDelay: TSlvSetup: %f\n", TSlvSetup);
-	dml_print("DML::CalculateRemoteSurfaceFlipDelay: TInitXFill: %f\n", *TInitXFill);
-	dml_print("DML::CalculateRemoteSurfaceFlipDelay: AvgfillRate: %f\n", AvgfillRate);
-	dml_print("DML::CalculateRemoteSurfaceFlipDelay: TslvChk: %f\n", *TslvChk);
-	result = 2 * XFCBusTransportTime + TSlvSetup + TCalc + TWait + *TslvChk + *TInitXFill; // TODO: This doesn't seem to match programming guide
-	dml_print("DML::CalculateRemoteSurfaceFlipDelay: RemoteSurfaceFlipDelay: %f\n", result);
-	return result;
-}
-
 static void CalculateActiveRowBandwidth(
 		bool GPUVMEnable,
 		enum source_format_class SourcePixelFormat,
-- 
2.27.0


^ permalink raw reply related	[relevance 80%]

* [PATCH] drm/amd/display: remove redundant CalculateTWait's
@ 2022-09-19  2:37 69% Tom Rix
  0 siblings, 0 replies; 180+ results
From: Tom Rix @ 2022-09-19  2:37 UTC (permalink / raw)
  To: harry.wentland, sunpeng.li, Rodrigo.Siqueira, alexander.deucher,
	christian.koenig, Xinhui.Pan, airlied, daniel, aric.cyr,
	Nevenko.Stupar, Pavle.Kotarac, mairacanal, aurabindo.pillai,
	Bing.Guo, hamza.mahfooz, nicholas.kazlauskas, agustin.gutierrez,
	nathan, mdaenzer, Charlene.Liu
  Cc: Tom Rix, dri-devel, amd-gfx, linux-kernel

There are several copies of CalculateTwait.
Reduce to one instance and change local variable name to match common usage.

Signed-off-by: Tom Rix <trix@redhat.com>
---
 .../dc/dml/dcn20/display_mode_vba_20.c        | 16 +++++++-------
 .../dc/dml/dcn20/display_mode_vba_20v2.c      | 21 ++-----------------
 .../dc/dml/dcn21/display_mode_vba_21.c        | 19 +----------------
 .../dc/dml/dcn30/display_mode_vba_30.c        | 18 +---------------
 .../dc/dml/dcn31/display_mode_vba_31.c        | 13 +-----------
 .../dc/dml/dcn314/display_mode_vba_314.c      | 13 +-----------
 6 files changed, 14 insertions(+), 86 deletions(-)

diff --git a/drivers/gpu/drm/amd/display/dc/dml/dcn20/display_mode_vba_20.c b/drivers/gpu/drm/amd/display/dc/dml/dcn20/display_mode_vba_20.c
index 6e9d7e2b5243..4ca080950924 100644
--- a/drivers/gpu/drm/amd/display/dc/dml/dcn20/display_mode_vba_20.c
+++ b/drivers/gpu/drm/amd/display/dc/dml/dcn20/display_mode_vba_20.c
@@ -153,10 +153,10 @@ static unsigned int CalculateVMAndRowBytes(
 		bool *PTEBufferSizeNotExceeded,
 		unsigned int *dpte_row_height,
 		unsigned int *meta_row_height);
-static double CalculateTWait(
+double CalculateTWait(
 		unsigned int PrefetchMode,
 		double DRAMClockChangeLatency,
-		double UrgentLatencyPixelDataOnly,
+		double UrgentLatency,
 		double SREnterPlusExitTime);
 static double CalculateRemoteSurfaceFlipDelay(
 		struct display_mode_lib *mode_lib,
@@ -2892,20 +2892,20 @@ static void dml20_DisplayPipeConfiguration(struct display_mode_lib *mode_lib)
 	}
 }
 
-static double CalculateTWait(
+double CalculateTWait(
 		unsigned int PrefetchMode,
 		double DRAMClockChangeLatency,
-		double UrgentLatencyPixelDataOnly,
+		double UrgentLatency,
 		double SREnterPlusExitTime)
 {
 	if (PrefetchMode == 0) {
 		return dml_max(
-				DRAMClockChangeLatency + UrgentLatencyPixelDataOnly,
-				dml_max(SREnterPlusExitTime, UrgentLatencyPixelDataOnly));
+				DRAMClockChangeLatency + UrgentLatency,
+				dml_max(SREnterPlusExitTime, UrgentLatency));
 	} else if (PrefetchMode == 1) {
-		return dml_max(SREnterPlusExitTime, UrgentLatencyPixelDataOnly);
+		return dml_max(SREnterPlusExitTime, UrgentLatency);
 	} else {
-		return UrgentLatencyPixelDataOnly;
+		return UrgentLatency;
 	}
 }
 
diff --git a/drivers/gpu/drm/amd/display/dc/dml/dcn20/display_mode_vba_20v2.c b/drivers/gpu/drm/amd/display/dc/dml/dcn20/display_mode_vba_20v2.c
index b02dda8ce70f..2b4dcae4e432 100644
--- a/drivers/gpu/drm/amd/display/dc/dml/dcn20/display_mode_vba_20v2.c
+++ b/drivers/gpu/drm/amd/display/dc/dml/dcn20/display_mode_vba_20v2.c
@@ -177,10 +177,10 @@ static unsigned int CalculateVMAndRowBytes(
 		bool *PTEBufferSizeNotExceeded,
 		unsigned int *dpte_row_height,
 		unsigned int *meta_row_height);
-static double CalculateTWait(
+double CalculateTWait(
 		unsigned int PrefetchMode,
 		double DRAMClockChangeLatency,
-		double UrgentLatencyPixelDataOnly,
+		double UrgentLatency,
 		double SREnterPlusExitTime);
 static double CalculateRemoteSurfaceFlipDelay(
 		struct display_mode_lib *mode_lib,
@@ -2967,23 +2967,6 @@ static void dml20v2_DisplayPipeConfiguration(struct display_mode_lib *mode_lib)
 	}
 }
 
-static double CalculateTWait(
-		unsigned int PrefetchMode,
-		double DRAMClockChangeLatency,
-		double UrgentLatencyPixelDataOnly,
-		double SREnterPlusExitTime)
-{
-	if (PrefetchMode == 0) {
-		return dml_max(
-				DRAMClockChangeLatency + UrgentLatencyPixelDataOnly,
-				dml_max(SREnterPlusExitTime, UrgentLatencyPixelDataOnly));
-	} else if (PrefetchMode == 1) {
-		return dml_max(SREnterPlusExitTime, UrgentLatencyPixelDataOnly);
-	} else {
-		return UrgentLatencyPixelDataOnly;
-	}
-}
-
 static double CalculateRemoteSurfaceFlipDelay(
 		struct display_mode_lib *mode_lib,
 		double VRatio,
diff --git a/drivers/gpu/drm/amd/display/dc/dml/dcn21/display_mode_vba_21.c b/drivers/gpu/drm/amd/display/dc/dml/dcn21/display_mode_vba_21.c
index 6be14f55c78d..a3ef3638d979 100644
--- a/drivers/gpu/drm/amd/display/dc/dml/dcn21/display_mode_vba_21.c
+++ b/drivers/gpu/drm/amd/display/dc/dml/dcn21/display_mode_vba_21.c
@@ -205,7 +205,7 @@ static unsigned int CalculateVMAndRowBytes(
 		unsigned int *DPDE0BytesFrame,
 		unsigned int *MetaPTEBytesFrame);
 
-static double CalculateTWait(
+double CalculateTWait(
 		unsigned int PrefetchMode,
 		double DRAMClockChangeLatency,
 		double UrgentLatency,
@@ -2980,23 +2980,6 @@ static void DisplayPipeConfiguration(struct display_mode_lib *mode_lib)
 	}
 }
 
-static double CalculateTWait(
-		unsigned int PrefetchMode,
-		double DRAMClockChangeLatency,
-		double UrgentLatency,
-		double SREnterPlusExitTime)
-{
-	if (PrefetchMode == 0) {
-		return dml_max(
-				DRAMClockChangeLatency + UrgentLatency,
-				dml_max(SREnterPlusExitTime, UrgentLatency));
-	} else if (PrefetchMode == 1) {
-		return dml_max(SREnterPlusExitTime, UrgentLatency);
-	} else {
-		return UrgentLatency;
-	}
-}
-
 static double CalculateRemoteSurfaceFlipDelay(
 		struct display_mode_lib *mode_lib,
 		double VRatio,
diff --git a/drivers/gpu/drm/amd/display/dc/dml/dcn30/display_mode_vba_30.c b/drivers/gpu/drm/amd/display/dc/dml/dcn30/display_mode_vba_30.c
index 229548733177..74f5d9742f59 100644
--- a/drivers/gpu/drm/amd/display/dc/dml/dcn30/display_mode_vba_30.c
+++ b/drivers/gpu/drm/amd/display/dc/dml/dcn30/display_mode_vba_30.c
@@ -216,7 +216,7 @@ static unsigned int CalculateVMAndRowBytes(
 		unsigned int *PTERequestSize,
 		unsigned int *DPDE0BytesFrame,
 		unsigned int *MetaPTEBytesFrame);
-static double CalculateTWait(
+double CalculateTWait(
 		unsigned int PrefetchMode,
 		double DRAMClockChangeLatency,
 		double UrgentLatency,
@@ -3191,22 +3191,6 @@ void dml30_CalculateBytePerPixelAnd256BBlockSizes(
 	}
 }
 
-static double CalculateTWait(
-		unsigned int PrefetchMode,
-		double DRAMClockChangeLatency,
-		double UrgentLatency,
-		double SREnterPlusExitTime)
-{
-	if (PrefetchMode == 0) {
-		return dml_max(DRAMClockChangeLatency + UrgentLatency,
-				dml_max(SREnterPlusExitTime, UrgentLatency));
-	} else if (PrefetchMode == 1) {
-		return dml_max(SREnterPlusExitTime, UrgentLatency);
-	} else {
-		return UrgentLatency;
-	}
-}
-
 double dml30_CalculateWriteBackDISPCLK(
 		enum source_format_class WritebackPixelFormat,
 		double PixelClock,
diff --git a/drivers/gpu/drm/amd/display/dc/dml/dcn31/display_mode_vba_31.c b/drivers/gpu/drm/amd/display/dc/dml/dcn31/display_mode_vba_31.c
index 58dc4c046cf4..4563342275f1 100644
--- a/drivers/gpu/drm/amd/display/dc/dml/dcn31/display_mode_vba_31.c
+++ b/drivers/gpu/drm/amd/display/dc/dml/dcn31/display_mode_vba_31.c
@@ -230,7 +230,7 @@ static unsigned int CalculateVMAndRowBytes(
 		unsigned int *PTERequestSize,
 		int *DPDE0BytesFrame,
 		int *MetaPTEBytesFrame);
-static double CalculateTWait(unsigned int PrefetchMode, double DRAMClockChangeLatency, double UrgentLatency, double SREnterPlusExitTime);
+double CalculateTWait(unsigned int PrefetchMode, double DRAMClockChangeLatency, double UrgentLatency, double SREnterPlusExitTime);
 static void CalculateRowBandwidth(
 		bool GPUVMEnable,
 		enum source_format_class SourcePixelFormat,
@@ -3323,17 +3323,6 @@ static void DisplayPipeConfiguration(struct display_mode_lib *mode_lib)
 			&dummysinglestring);
 }
 
-static double CalculateTWait(unsigned int PrefetchMode, double DRAMClockChangeLatency, double UrgentLatency, double SREnterPlusExitTime)
-{
-	if (PrefetchMode == 0) {
-		return dml_max(DRAMClockChangeLatency + UrgentLatency, dml_max(SREnterPlusExitTime, UrgentLatency));
-	} else if (PrefetchMode == 1) {
-		return dml_max(SREnterPlusExitTime, UrgentLatency);
-	} else {
-		return UrgentLatency;
-	}
-}
-
 double dml31_CalculateWriteBackDISPCLK(
 		enum source_format_class WritebackPixelFormat,
 		double PixelClock,
diff --git a/drivers/gpu/drm/amd/display/dc/dml/dcn314/display_mode_vba_314.c b/drivers/gpu/drm/amd/display/dc/dml/dcn314/display_mode_vba_314.c
index 7024412fe441..89a80eef42f4 100644
--- a/drivers/gpu/drm/amd/display/dc/dml/dcn314/display_mode_vba_314.c
+++ b/drivers/gpu/drm/amd/display/dc/dml/dcn314/display_mode_vba_314.c
@@ -244,7 +244,7 @@ static unsigned int CalculateVMAndRowBytes(
 		unsigned int *PTERequestSize,
 		int *DPDE0BytesFrame,
 		int *MetaPTEBytesFrame);
-static double CalculateTWait(unsigned int PrefetchMode, double DRAMClockChangeLatency, double UrgentLatency, double SREnterPlusExitTime);
+double CalculateTWait(unsigned int PrefetchMode, double DRAMClockChangeLatency, double UrgentLatency, double SREnterPlusExitTime);
 static void CalculateRowBandwidth(
 		bool GPUVMEnable,
 		enum source_format_class SourcePixelFormat,
@@ -3547,17 +3547,6 @@ static bool CalculateBytePerPixelAnd256BBlockSizes(
 	return true;
 }
 
-static double CalculateTWait(unsigned int PrefetchMode, double DRAMClockChangeLatency, double UrgentLatency, double SREnterPlusExitTime)
-{
-	if (PrefetchMode == 0) {
-		return dml_max(DRAMClockChangeLatency + UrgentLatency, dml_max(SREnterPlusExitTime, UrgentLatency));
-	} else if (PrefetchMode == 1) {
-		return dml_max(SREnterPlusExitTime, UrgentLatency);
-	} else {
-		return UrgentLatency;
-	}
-}
-
 double dml314_CalculateWriteBackDISPCLK(
 		enum source_format_class WritebackPixelFormat,
 		double PixelClock,
-- 
2.27.0


^ permalink raw reply related	[relevance 69%]

* [PATCH] drm/amd/display: refactor CalculateWriteBackDelay to use vba_vars_st ptr
@ 2022-09-17 18:37 32% Tom Rix
  0 siblings, 0 replies; 180+ results
From: Tom Rix @ 2022-09-17 18:37 UTC (permalink / raw)
  To: harry.wentland, sunpeng.li, Rodrigo.Siqueira, alexander.deucher,
	christian.koenig, Xinhui.Pan, airlied, daniel, aric.cyr,
	Pavle.Kotarac, Nevenko.Stupar, aurabindo.pillai, mairacanal,
	Bing.Guo, nathan, hamza.mahfooz, nicholas.kazlauskas,
	agustin.gutierrez, mdaenzer, Charlene.Liu, roman.li,
	Wesley.Chalmers, alvin.lee2, Jun.Lei, yang.lee, Syed.Hassan
  Cc: Tom Rix, dri-devel, amd-gfx, linux-kernel

Mimimize the function signature by passing a pointer and an index instead
of passing several elements of the pointer.

The dml2x,dml3x families uses the same algorithm.  Remove the duplicates.
Use dml20_ and dml30_ prefix to distinguish the two variants.

Signed-off-by: Tom Rix <trix@redhat.com>
---
 .../dc/dml/dcn20/display_mode_vba_20.c        |  78 +++---------
 .../dc/dml/dcn20/display_mode_vba_20v2.c      | 115 ++----------------
 .../dc/dml/dcn21/display_mode_vba_21.c        | 114 +----------------
 .../dc/dml/dcn30/display_mode_vba_30.c        |  74 +++--------
 .../dc/dml/dcn31/display_mode_vba_31.c        |  76 +-----------
 .../dc/dml/dcn314/display_mode_vba_314.c      |  76 +-----------
 .../dc/dml/dcn32/display_mode_vba_32.c        |  42 +------
 .../dc/dml/dcn32/display_mode_vba_util_32.c   |  30 -----
 .../dc/dml/dcn32/display_mode_vba_util_32.h   |  10 +-
 9 files changed, 63 insertions(+), 552 deletions(-)

diff --git a/drivers/gpu/drm/amd/display/dc/dml/dcn20/display_mode_vba_20.c b/drivers/gpu/drm/amd/display/dc/dml/dcn20/display_mode_vba_20.c
index d3b5b6fedf04..6e9d7e2b5243 100644
--- a/drivers/gpu/drm/amd/display/dc/dml/dcn20/display_mode_vba_20.c
+++ b/drivers/gpu/drm/amd/display/dc/dml/dcn20/display_mode_vba_20.c
@@ -217,16 +217,8 @@ static void CalculateFlipSchedule(
 		double *DestinationLinesToRequestRowInImmediateFlip,
 		double *final_flip_bw,
 		bool *ImmediateFlipSupportedForPipe);
-static double CalculateWriteBackDelay(
-		enum source_format_class WritebackPixelFormat,
-		double WritebackHRatio,
-		double WritebackVRatio,
-		unsigned int WritebackLumaHTaps,
-		unsigned int WritebackLumaVTaps,
-		unsigned int WritebackChromaHTaps,
-		unsigned int WritebackChromaVTaps,
-		unsigned int WritebackDestinationWidth);
 
+double dlm20_CalculateWriteBackDelay(struct vba_vars_st *vba, unsigned int i);
 static void dml20_DisplayPipeConfiguration(struct display_mode_lib *mode_lib);
 static void dml20_DISPCLKDPPCLKDCFCLKDeepSleepPrefetchParametersWatermarksAndPerformanceCalculation(
 		struct display_mode_lib *mode_lib);
@@ -1085,6 +1077,7 @@ static unsigned int CalculateVMAndRowBytes(
 static void dml20_DISPCLKDPPCLKDCFCLKDeepSleepPrefetchParametersWatermarksAndPerformanceCalculation(
 		struct display_mode_lib *mode_lib)
 {
+	struct vba_vars_st *v = &mode_lib->vba;
 	unsigned int j, k;
 
 	mode_lib->vba.WritebackDISPCLK = 0.0;
@@ -1980,36 +1973,15 @@ static void dml20_DISPCLKDPPCLKDCFCLKDeepSleepPrefetchParametersWatermarksAndPer
 		if (mode_lib->vba.BlendingAndTiming[k] == k) {
 			if (mode_lib->vba.WritebackEnable[k] == true) {
 				mode_lib->vba.WritebackDelay[mode_lib->vba.VoltageLevel][k] =
-						mode_lib->vba.WritebackLatency
-								+ CalculateWriteBackDelay(
-										mode_lib->vba.WritebackPixelFormat[k],
-										mode_lib->vba.WritebackHRatio[k],
-										mode_lib->vba.WritebackVRatio[k],
-										mode_lib->vba.WritebackLumaHTaps[k],
-										mode_lib->vba.WritebackLumaVTaps[k],
-										mode_lib->vba.WritebackChromaHTaps[k],
-										mode_lib->vba.WritebackChromaVTaps[k],
-										mode_lib->vba.WritebackDestinationWidth[k])
-										/ mode_lib->vba.DISPCLK;
+					mode_lib->vba.WritebackLatency + dlm20_CalculateWriteBackDelay(v, k) / mode_lib->vba.DISPCLK;
 			} else
 				mode_lib->vba.WritebackDelay[mode_lib->vba.VoltageLevel][k] = 0;
 			for (j = 0; j < mode_lib->vba.NumberOfActivePlanes; ++j) {
 				if (mode_lib->vba.BlendingAndTiming[j] == k
 						&& mode_lib->vba.WritebackEnable[j] == true) {
 					mode_lib->vba.WritebackDelay[mode_lib->vba.VoltageLevel][k] =
-							dml_max(
-									mode_lib->vba.WritebackDelay[mode_lib->vba.VoltageLevel][k],
-									mode_lib->vba.WritebackLatency
-											+ CalculateWriteBackDelay(
-													mode_lib->vba.WritebackPixelFormat[j],
-													mode_lib->vba.WritebackHRatio[j],
-													mode_lib->vba.WritebackVRatio[j],
-													mode_lib->vba.WritebackLumaHTaps[j],
-													mode_lib->vba.WritebackLumaVTaps[j],
-													mode_lib->vba.WritebackChromaHTaps[j],
-													mode_lib->vba.WritebackChromaVTaps[j],
-													mode_lib->vba.WritebackDestinationWidth[j])
-													/ mode_lib->vba.DISPCLK);
+							dml_max(mode_lib->vba.WritebackDelay[mode_lib->vba.VoltageLevel][k],
+								mode_lib->vba.WritebackLatency + dlm20_CalculateWriteBackDelay(v, j) / mode_lib->vba.DISPCLK);
 				}
 			}
 		}
@@ -2975,16 +2947,17 @@ static double CalculateRemoteSurfaceFlipDelay(
 	return result;
 }
 
-static double CalculateWriteBackDelay(
-		enum source_format_class WritebackPixelFormat,
-		double WritebackHRatio,
-		double WritebackVRatio,
-		unsigned int WritebackLumaHTaps,
-		unsigned int WritebackLumaVTaps,
-		unsigned int WritebackChromaHTaps,
-		unsigned int WritebackChromaVTaps,
-		unsigned int WritebackDestinationWidth)
+double dlm20_CalculateWriteBackDelay(struct vba_vars_st *vba, unsigned int i)
 {
+	const enum source_format_class WritebackPixelFormat = vba->WritebackPixelFormat[i];
+	const double WritebackHRatio = vba->WritebackHRatio[i];
+	const double WritebackVRatio = vba->WritebackVRatio[i];
+	const unsigned int WritebackLumaHTaps = vba->WritebackLumaHTaps[i];
+	const unsigned int WritebackLumaVTaps = vba->WritebackLumaVTaps[i];
+	const unsigned int WritebackChromaHTaps = vba->WritebackChromaHTaps[i];
+	const unsigned int WritebackChromaVTaps = vba->WritebackChromaVTaps[i];
+	const unsigned int WritebackDestinationWidth = vba->WritebackDestinationWidth[i];
+
 	double CalculateWriteBackDelay =
 			dml_max(
 					dml_ceil(WritebackLumaHTaps / 4.0, 1) / WritebackHRatio,
@@ -4619,15 +4592,7 @@ void dml20_ModeSupportAndSystemConfigurationFull(struct display_mode_lib *mode_l
 				if (mode_lib->vba.BlendingAndTiming[k] == k) {
 					if (mode_lib->vba.WritebackEnable[k] == true) {
 						locals->WritebackDelay[i][k] = mode_lib->vba.WritebackLatency
-								+ CalculateWriteBackDelay(
-										mode_lib->vba.WritebackPixelFormat[k],
-										mode_lib->vba.WritebackHRatio[k],
-										mode_lib->vba.WritebackVRatio[k],
-										mode_lib->vba.WritebackLumaHTaps[k],
-										mode_lib->vba.WritebackLumaVTaps[k],
-										mode_lib->vba.WritebackChromaHTaps[k],
-										mode_lib->vba.WritebackChromaVTaps[k],
-										mode_lib->vba.WritebackDestinationWidth[k]) / locals->RequiredDISPCLK[i][j];
+							+ dlm20_CalculateWriteBackDelay(locals, k) / locals->RequiredDISPCLK[i][j];
 					} else {
 						locals->WritebackDelay[i][k] = 0.0;
 					}
@@ -4636,15 +4601,8 @@ void dml20_ModeSupportAndSystemConfigurationFull(struct display_mode_lib *mode_l
 								&& mode_lib->vba.WritebackEnable[m]
 										== true) {
 							locals->WritebackDelay[i][k] = dml_max(locals->WritebackDelay[i][k],
-											mode_lib->vba.WritebackLatency + CalculateWriteBackDelay(
-													mode_lib->vba.WritebackPixelFormat[m],
-													mode_lib->vba.WritebackHRatio[m],
-													mode_lib->vba.WritebackVRatio[m],
-													mode_lib->vba.WritebackLumaHTaps[m],
-													mode_lib->vba.WritebackLumaVTaps[m],
-													mode_lib->vba.WritebackChromaHTaps[m],
-													mode_lib->vba.WritebackChromaVTaps[m],
-													mode_lib->vba.WritebackDestinationWidth[m]) / locals->RequiredDISPCLK[i][j]);
+											       mode_lib->vba.WritebackLatency +
+											       dlm20_CalculateWriteBackDelay(locals, m) / locals->RequiredDISPCLK[i][j]);
 						}
 					}
 				}
diff --git a/drivers/gpu/drm/amd/display/dc/dml/dcn20/display_mode_vba_20v2.c b/drivers/gpu/drm/amd/display/dc/dml/dcn20/display_mode_vba_20v2.c
index edd098c7eb92..b02dda8ce70f 100644
--- a/drivers/gpu/drm/amd/display/dc/dml/dcn20/display_mode_vba_20v2.c
+++ b/drivers/gpu/drm/amd/display/dc/dml/dcn20/display_mode_vba_20v2.c
@@ -241,15 +241,7 @@ static void CalculateFlipSchedule(
 		double *DestinationLinesToRequestRowInImmediateFlip,
 		double *final_flip_bw,
 		bool *ImmediateFlipSupportedForPipe);
-static double CalculateWriteBackDelay(
-		enum source_format_class WritebackPixelFormat,
-		double WritebackHRatio,
-		double WritebackVRatio,
-		unsigned int WritebackLumaHTaps,
-		unsigned int WritebackLumaVTaps,
-		unsigned int WritebackChromaHTaps,
-		unsigned int WritebackChromaVTaps,
-		unsigned int WritebackDestinationWidth);
+double dlm20_CalculateWriteBackDelay(struct vba_vars_st *vba, unsigned int i);
 
 static void dml20v2_DisplayPipeConfiguration(struct display_mode_lib *mode_lib);
 static void dml20v2_DISPCLKDPPCLKDCFCLKDeepSleepPrefetchParametersWatermarksAndPerformanceCalculation(
@@ -1145,6 +1137,7 @@ static unsigned int CalculateVMAndRowBytes(
 static void dml20v2_DISPCLKDPPCLKDCFCLKDeepSleepPrefetchParametersWatermarksAndPerformanceCalculation(
 		struct display_mode_lib *mode_lib)
 {
+	struct vba_vars_st *v = &mode_lib->vba;
 	unsigned int j, k;
 
 	mode_lib->vba.WritebackDISPCLK = 0.0;
@@ -2016,17 +2009,7 @@ static void dml20v2_DISPCLKDPPCLKDCFCLKDeepSleepPrefetchParametersWatermarksAndP
 		if (mode_lib->vba.BlendingAndTiming[k] == k) {
 			if (mode_lib->vba.WritebackEnable[k] == true) {
 				mode_lib->vba.WritebackDelay[mode_lib->vba.VoltageLevel][k] =
-						mode_lib->vba.WritebackLatency
-								+ CalculateWriteBackDelay(
-										mode_lib->vba.WritebackPixelFormat[k],
-										mode_lib->vba.WritebackHRatio[k],
-										mode_lib->vba.WritebackVRatio[k],
-										mode_lib->vba.WritebackLumaHTaps[k],
-										mode_lib->vba.WritebackLumaVTaps[k],
-										mode_lib->vba.WritebackChromaHTaps[k],
-										mode_lib->vba.WritebackChromaVTaps[k],
-										mode_lib->vba.WritebackDestinationWidth[k])
-										/ mode_lib->vba.DISPCLK;
+					mode_lib->vba.WritebackLatency + dlm20_CalculateWriteBackDelay(v, k) / mode_lib->vba.DISPCLK;
 			} else
 				mode_lib->vba.WritebackDelay[mode_lib->vba.VoltageLevel][k] = 0;
 			for (j = 0; j < mode_lib->vba.NumberOfActivePlanes; ++j) {
@@ -2036,16 +2019,7 @@ static void dml20v2_DISPCLKDPPCLKDCFCLKDeepSleepPrefetchParametersWatermarksAndP
 							dml_max(
 									mode_lib->vba.WritebackDelay[mode_lib->vba.VoltageLevel][k],
 									mode_lib->vba.WritebackLatency
-											+ CalculateWriteBackDelay(
-													mode_lib->vba.WritebackPixelFormat[j],
-													mode_lib->vba.WritebackHRatio[j],
-													mode_lib->vba.WritebackVRatio[j],
-													mode_lib->vba.WritebackLumaHTaps[j],
-													mode_lib->vba.WritebackLumaVTaps[j],
-													mode_lib->vba.WritebackChromaHTaps[j],
-													mode_lib->vba.WritebackChromaVTaps[j],
-													mode_lib->vba.WritebackDestinationWidth[j])
-													/ mode_lib->vba.DISPCLK);
+									+ dlm20_CalculateWriteBackDelay(v, j) / mode_lib->vba.DISPCLK);
 				}
 			}
 		}
@@ -3048,66 +3022,6 @@ static double CalculateRemoteSurfaceFlipDelay(
 	return result;
 }
 
-static double CalculateWriteBackDelay(
-		enum source_format_class WritebackPixelFormat,
-		double WritebackHRatio,
-		double WritebackVRatio,
-		unsigned int WritebackLumaHTaps,
-		unsigned int WritebackLumaVTaps,
-		unsigned int WritebackChromaHTaps,
-		unsigned int WritebackChromaVTaps,
-		unsigned int WritebackDestinationWidth)
-{
-	double CalculateWriteBackDelay =
-			dml_max(
-					dml_ceil(WritebackLumaHTaps / 4.0, 1) / WritebackHRatio,
-					WritebackLumaVTaps * dml_ceil(1.0 / WritebackVRatio, 1)
-							* dml_ceil(
-									WritebackDestinationWidth
-											/ 4.0,
-									1)
-							+ dml_ceil(1.0 / WritebackVRatio, 1)
-									* (dml_ceil(
-											WritebackLumaVTaps
-													/ 4.0,
-											1) + 4));
-
-	if (WritebackPixelFormat != dm_444_32) {
-		CalculateWriteBackDelay =
-				dml_max(
-						CalculateWriteBackDelay,
-						dml_max(
-								dml_ceil(
-										WritebackChromaHTaps
-												/ 2.0,
-										1)
-										/ (2
-												* WritebackHRatio),
-								WritebackChromaVTaps
-										* dml_ceil(
-												1
-														/ (2
-																* WritebackVRatio),
-												1)
-										* dml_ceil(
-												WritebackDestinationWidth
-														/ 2.0
-														/ 2.0,
-												1)
-										+ dml_ceil(
-												1
-														/ (2
-																* WritebackVRatio),
-												1)
-												* (dml_ceil(
-														WritebackChromaVTaps
-																/ 4.0,
-														1)
-														+ 4)));
-	}
-	return CalculateWriteBackDelay;
-}
-
 static void CalculateActiveRowBandwidth(
 		bool GPUVMEnable,
 		enum source_format_class SourcePixelFormat,
@@ -4745,15 +4659,7 @@ void dml20v2_ModeSupportAndSystemConfigurationFull(struct display_mode_lib *mode
 				if (mode_lib->vba.BlendingAndTiming[k] == k) {
 					if (mode_lib->vba.WritebackEnable[k] == true) {
 						locals->WritebackDelay[i][k] = mode_lib->vba.WritebackLatency
-								+ CalculateWriteBackDelay(
-										mode_lib->vba.WritebackPixelFormat[k],
-										mode_lib->vba.WritebackHRatio[k],
-										mode_lib->vba.WritebackVRatio[k],
-										mode_lib->vba.WritebackLumaHTaps[k],
-										mode_lib->vba.WritebackLumaVTaps[k],
-										mode_lib->vba.WritebackChromaHTaps[k],
-										mode_lib->vba.WritebackChromaVTaps[k],
-										mode_lib->vba.WritebackDestinationWidth[k]) / locals->RequiredDISPCLK[i][j];
+							+ dlm20_CalculateWriteBackDelay(locals, k) / locals->RequiredDISPCLK[i][j];
 					} else {
 						locals->WritebackDelay[i][k] = 0.0;
 					}
@@ -4762,15 +4668,8 @@ void dml20v2_ModeSupportAndSystemConfigurationFull(struct display_mode_lib *mode
 								&& mode_lib->vba.WritebackEnable[m]
 										== true) {
 							locals->WritebackDelay[i][k] = dml_max(locals->WritebackDelay[i][k],
-											mode_lib->vba.WritebackLatency + CalculateWriteBackDelay(
-													mode_lib->vba.WritebackPixelFormat[m],
-													mode_lib->vba.WritebackHRatio[m],
-													mode_lib->vba.WritebackVRatio[m],
-													mode_lib->vba.WritebackLumaHTaps[m],
-													mode_lib->vba.WritebackLumaVTaps[m],
-													mode_lib->vba.WritebackChromaHTaps[m],
-													mode_lib->vba.WritebackChromaVTaps[m],
-													mode_lib->vba.WritebackDestinationWidth[m]) / locals->RequiredDISPCLK[i][j]);
+											       mode_lib->vba.WritebackLatency +
+											       dlm20_CalculateWriteBackDelay(locals, m) / locals->RequiredDISPCLK[i][j]);
 						}
 					}
 				}
diff --git a/drivers/gpu/drm/amd/display/dc/dml/dcn21/display_mode_vba_21.c b/drivers/gpu/drm/amd/display/dc/dml/dcn21/display_mode_vba_21.c
index d40d32e380f4..6be14f55c78d 100644
--- a/drivers/gpu/drm/amd/display/dc/dml/dcn21/display_mode_vba_21.c
+++ b/drivers/gpu/drm/amd/display/dc/dml/dcn21/display_mode_vba_21.c
@@ -273,15 +273,7 @@ static void CalculateFlipSchedule(
 		double *DestinationLinesToRequestRowInImmediateFlip,
 		double *final_flip_bw,
 		bool *ImmediateFlipSupportedForPipe);
-static double CalculateWriteBackDelay(
-		enum source_format_class WritebackPixelFormat,
-		double WritebackHRatio,
-		double WritebackVRatio,
-		unsigned int WritebackLumaHTaps,
-		unsigned int WritebackLumaVTaps,
-		unsigned int WritebackChromaHTaps,
-		unsigned int WritebackChromaVTaps,
-		unsigned int WritebackDestinationWidth);
+double dlm20_CalculateWriteBackDelay(struct vba_vars_st *vba, unsigned int i);
 static void CalculateWatermarksAndDRAMSpeedChangeSupport(
 		struct display_mode_lib *mode_lib,
 		unsigned int PrefetchMode,
@@ -2042,17 +2034,7 @@ static void DISPCLKDPPCLKDCFCLKDeepSleepPrefetchParametersWatermarksAndPerforman
 		if (mode_lib->vba.BlendingAndTiming[k] == k) {
 			if (mode_lib->vba.WritebackEnable[k] == true) {
 				locals->WritebackDelay[mode_lib->vba.VoltageLevel][k] =
-						mode_lib->vba.WritebackLatency
-								+ CalculateWriteBackDelay(
-										mode_lib->vba.WritebackPixelFormat[k],
-										mode_lib->vba.WritebackHRatio[k],
-										mode_lib->vba.WritebackVRatio[k],
-										mode_lib->vba.WritebackLumaHTaps[k],
-										mode_lib->vba.WritebackLumaVTaps[k],
-										mode_lib->vba.WritebackChromaHTaps[k],
-										mode_lib->vba.WritebackChromaVTaps[k],
-										mode_lib->vba.WritebackDestinationWidth[k])
-										/ mode_lib->vba.DISPCLK;
+					mode_lib->vba.WritebackLatency + dlm20_CalculateWriteBackDelay(locals, k) / mode_lib->vba.DISPCLK;
 			} else
 				locals->WritebackDelay[mode_lib->vba.VoltageLevel][k] = 0;
 			for (j = 0; j < mode_lib->vba.NumberOfActivePlanes; ++j) {
@@ -2062,16 +2044,7 @@ static void DISPCLKDPPCLKDCFCLKDeepSleepPrefetchParametersWatermarksAndPerforman
 							dml_max(
 									locals->WritebackDelay[mode_lib->vba.VoltageLevel][k],
 									mode_lib->vba.WritebackLatency
-											+ CalculateWriteBackDelay(
-													mode_lib->vba.WritebackPixelFormat[j],
-													mode_lib->vba.WritebackHRatio[j],
-													mode_lib->vba.WritebackVRatio[j],
-													mode_lib->vba.WritebackLumaHTaps[j],
-													mode_lib->vba.WritebackLumaVTaps[j],
-													mode_lib->vba.WritebackChromaHTaps[j],
-													mode_lib->vba.WritebackChromaVTaps[j],
-													mode_lib->vba.WritebackDestinationWidth[j])
-													/ mode_lib->vba.DISPCLK);
+									+ dlm20_CalculateWriteBackDelay(locals, j) / mode_lib->vba.DISPCLK);
 				}
 			}
 		}
@@ -3062,66 +3035,6 @@ static double CalculateRemoteSurfaceFlipDelay(
 	return result;
 }
 
-static double CalculateWriteBackDelay(
-		enum source_format_class WritebackPixelFormat,
-		double WritebackHRatio,
-		double WritebackVRatio,
-		unsigned int WritebackLumaHTaps,
-		unsigned int WritebackLumaVTaps,
-		unsigned int WritebackChromaHTaps,
-		unsigned int WritebackChromaVTaps,
-		unsigned int WritebackDestinationWidth)
-{
-	double CalculateWriteBackDelay =
-			dml_max(
-					dml_ceil(WritebackLumaHTaps / 4.0, 1) / WritebackHRatio,
-					WritebackLumaVTaps * dml_ceil(1.0 / WritebackVRatio, 1)
-							* dml_ceil(
-									WritebackDestinationWidth
-											/ 4.0,
-									1)
-							+ dml_ceil(1.0 / WritebackVRatio, 1)
-									* (dml_ceil(
-											WritebackLumaVTaps
-													/ 4.0,
-											1) + 4));
-
-	if (WritebackPixelFormat != dm_444_32) {
-		CalculateWriteBackDelay =
-				dml_max(
-						CalculateWriteBackDelay,
-						dml_max(
-								dml_ceil(
-										WritebackChromaHTaps
-												/ 2.0,
-										1)
-										/ (2
-												* WritebackHRatio),
-								WritebackChromaVTaps
-										* dml_ceil(
-												1
-														/ (2
-																* WritebackVRatio),
-												1)
-										* dml_ceil(
-												WritebackDestinationWidth
-														/ 2.0
-														/ 2.0,
-												1)
-										+ dml_ceil(
-												1
-														/ (2
-																* WritebackVRatio),
-												1)
-												* (dml_ceil(
-														WritebackChromaVTaps
-																/ 4.0,
-														1)
-														+ 4)));
-	}
-	return CalculateWriteBackDelay;
-}
-
 static void CalculateActiveRowBandwidth(
 		bool GPUVMEnable,
 		enum source_format_class SourcePixelFormat,
@@ -4744,15 +4657,7 @@ void dml21_ModeSupportAndSystemConfigurationFull(struct display_mode_lib *mode_l
 				if (mode_lib->vba.BlendingAndTiming[k] == k) {
 					if (mode_lib->vba.WritebackEnable[k] == true) {
 						locals->WritebackDelay[i][k] = mode_lib->vba.WritebackLatency
-								+ CalculateWriteBackDelay(
-										mode_lib->vba.WritebackPixelFormat[k],
-										mode_lib->vba.WritebackHRatio[k],
-										mode_lib->vba.WritebackVRatio[k],
-										mode_lib->vba.WritebackLumaHTaps[k],
-										mode_lib->vba.WritebackLumaVTaps[k],
-										mode_lib->vba.WritebackChromaHTaps[k],
-										mode_lib->vba.WritebackChromaVTaps[k],
-										mode_lib->vba.WritebackDestinationWidth[k]) / locals->RequiredDISPCLK[i][j];
+							+ dlm20_CalculateWriteBackDelay(locals, k) / locals->RequiredDISPCLK[i][j];
 					} else {
 						locals->WritebackDelay[i][k] = 0.0;
 					}
@@ -4761,15 +4666,8 @@ void dml21_ModeSupportAndSystemConfigurationFull(struct display_mode_lib *mode_l
 								&& mode_lib->vba.WritebackEnable[m]
 										== true) {
 							locals->WritebackDelay[i][k] = dml_max(locals->WritebackDelay[i][k],
-											mode_lib->vba.WritebackLatency + CalculateWriteBackDelay(
-													mode_lib->vba.WritebackPixelFormat[m],
-													mode_lib->vba.WritebackHRatio[m],
-													mode_lib->vba.WritebackVRatio[m],
-													mode_lib->vba.WritebackLumaHTaps[m],
-													mode_lib->vba.WritebackLumaVTaps[m],
-													mode_lib->vba.WritebackChromaHTaps[m],
-													mode_lib->vba.WritebackChromaVTaps[m],
-													mode_lib->vba.WritebackDestinationWidth[m]) / locals->RequiredDISPCLK[i][j]);
+											mode_lib->vba.WritebackLatency +
+											       dlm20_CalculateWriteBackDelay(locals, m) / locals->RequiredDISPCLK[i][j]);
 						}
 					}
 				}
diff --git a/drivers/gpu/drm/amd/display/dc/dml/dcn30/display_mode_vba_30.c b/drivers/gpu/drm/amd/display/dc/dml/dcn30/display_mode_vba_30.c
index 479e2c1a1301..229548733177 100644
--- a/drivers/gpu/drm/amd/display/dc/dml/dcn30/display_mode_vba_30.c
+++ b/drivers/gpu/drm/amd/display/dc/dml/dcn30/display_mode_vba_30.c
@@ -268,15 +268,7 @@ static void CalculateFlipSchedule(
 		double *DestinationLinesToRequestRowInImmediateFlip,
 		double *final_flip_bw,
 		bool *ImmediateFlipSupportedForPipe);
-static double CalculateWriteBackDelay(
-		enum source_format_class WritebackPixelFormat,
-		double WritebackHRatio,
-		double WritebackVRatio,
-		unsigned int WritebackVTaps,
-		long WritebackDestinationWidth,
-		long WritebackDestinationHeight,
-		long WritebackSourceHeight,
-		unsigned int HTotal);
+double dml30_CalculateWriteBackDelay(struct vba_vars_st *vba, unsigned int i, unsigned int HTotal);
 static void CalculateDynamicMetadataParameters(
 		int MaxInterDCNTileRepeaters,
 		double DPPCLK,
@@ -2360,29 +2352,15 @@ static void DISPCLKDPPCLKDCFCLKDeepSleepPrefetchParametersWatermarksAndPerforman
 		if (v->BlendingAndTiming[k] == k) {
 			if (v->WritebackEnable[k] == true) {
 				v->WritebackDelay[v->VoltageLevel][k] = v->WritebackLatency +
-						CalculateWriteBackDelay(v->WritebackPixelFormat[k],
-									v->WritebackHRatio[k],
-									v->WritebackVRatio[k],
-									v->WritebackVTaps[k],
-									v->WritebackDestinationWidth[k],
-									v->WritebackDestinationHeight[k],
-									v->WritebackSourceHeight[k],
-									v->HTotal[k]) / v->DISPCLK;
+					dml30_CalculateWriteBackDelay(v, k, v->HTotal[k]) / v->DISPCLK;
 			} else
 				v->WritebackDelay[v->VoltageLevel][k] = 0;
 			for (j = 0; j < v->NumberOfActivePlanes; ++j) {
 				if (v->BlendingAndTiming[j] == k
 						&& v->WritebackEnable[j] == true) {
 					v->WritebackDelay[v->VoltageLevel][k] = dml_max(v->WritebackDelay[v->VoltageLevel][k],
-							v->WritebackLatency + CalculateWriteBackDelay(
-											v->WritebackPixelFormat[j],
-											v->WritebackHRatio[j],
-											v->WritebackVRatio[j],
-											v->WritebackVTaps[j],
-											v->WritebackDestinationWidth[j],
-											v->WritebackDestinationHeight[j],
-											v->WritebackSourceHeight[j],
-											v->HTotal[k]) / v->DISPCLK);
+											v->WritebackLatency +
+											dml30_CalculateWriteBackDelay(v, j, v->HTotal[k]) / v->DISPCLK);
 				}
 			}
 		}
@@ -3249,20 +3227,18 @@ double dml30_CalculateWriteBackDISPCLK(
 	return dml_max3(DISPCLK_H, DISPCLK_V, DISPCLK_HB);
 }
 
-static double CalculateWriteBackDelay(
-		enum source_format_class WritebackPixelFormat,
-		double WritebackHRatio,
-		double WritebackVRatio,
-		unsigned int WritebackVTaps,
-		long         WritebackDestinationWidth,
-		long         WritebackDestinationHeight,
-		long         WritebackSourceHeight,
-		unsigned int HTotal)
+double dml30_CalculateWriteBackDelay(struct vba_vars_st *vba, unsigned int i, unsigned int HTotal)
 {
-	double CalculateWriteBackDelay = 0;
-	double Line_length = 0;
-	double Output_lines_last_notclamped = 0;
-	double WritebackVInit = 0;
+	const double WritebackVRatio = vba->WritebackVRatio[i];
+	const unsigned int WritebackVTaps = vba->WritebackVTaps[i];
+	const long WritebackDestinationWidth = vba->WritebackDestinationWidth[i];
+	const long WritebackDestinationHeight = vba->WritebackDestinationHeight[i];
+	const long WritebackSourceHeight = vba->WritebackSourceHeight[i];
+
+	double CalculateWriteBackDelay;
+	double Line_length;
+	double Output_lines_last_notclamped;
+	double WritebackVInit;
 
 	WritebackVInit = (WritebackVRatio + WritebackVTaps + 1) / 2;
 	Line_length = dml_max((double) WritebackDestinationWidth, dml_ceil(WritebackDestinationWidth / 6.0, 1) * WritebackVTaps);
@@ -4578,15 +4554,7 @@ void dml30_ModeSupportAndSystemConfigurationFull(struct display_mode_lib *mode_l
 				if (v->BlendingAndTiming[k] == k) {
 					if (v->WritebackEnable[k] == true) {
 						v->WritebackDelayTime[k] = v->WritebackLatency
-								+ CalculateWriteBackDelay(
-										v->WritebackPixelFormat[k],
-										v->WritebackHRatio[k],
-										v->WritebackVRatio[k],
-										v->WritebackVTaps[k],
-										v->WritebackDestinationWidth[k],
-										v->WritebackDestinationHeight[k],
-										v->WritebackSourceHeight[k],
-										v->HTotal[k]) / v->RequiredDISPCLK[i][j];
+							+ dml30_CalculateWriteBackDelay(v, k, v->HTotal[k]) / v->RequiredDISPCLK[i][j];
 					} else {
 						v->WritebackDelayTime[k] = 0.0;
 					}
@@ -4595,15 +4563,7 @@ void dml30_ModeSupportAndSystemConfigurationFull(struct display_mode_lib *mode_l
 							v->WritebackDelayTime[k] = dml_max(
 									v->WritebackDelayTime[k],
 									v->WritebackLatency
-											+ CalculateWriteBackDelay(
-													v->WritebackPixelFormat[m],
-													v->WritebackHRatio[m],
-													v->WritebackVRatio[m],
-													v->WritebackVTaps[m],
-													v->WritebackDestinationWidth[m],
-													v->WritebackDestinationHeight[m],
-													v->WritebackSourceHeight[m],
-													v->HTotal[m]) / v->RequiredDISPCLK[i][j]);
+									+ dml30_CalculateWriteBackDelay(v, m, v->HTotal[m]) / v->RequiredDISPCLK[i][j]);
 						}
 					}
 				}
diff --git a/drivers/gpu/drm/amd/display/dc/dml/dcn31/display_mode_vba_31.c b/drivers/gpu/drm/amd/display/dc/dml/dcn31/display_mode_vba_31.c
index 4e3356d12147..58dc4c046cf4 100644
--- a/drivers/gpu/drm/amd/display/dc/dml/dcn31/display_mode_vba_31.c
+++ b/drivers/gpu/drm/amd/display/dc/dml/dcn31/display_mode_vba_31.c
@@ -258,15 +258,7 @@ static void CalculateFlipSchedule(
 		double PDEAndMetaPTEBytesPerFrame,
 		double MetaRowBytes,
 		double DPTEBytesPerRow);
-static double CalculateWriteBackDelay(
-		enum source_format_class WritebackPixelFormat,
-		double WritebackHRatio,
-		double WritebackVRatio,
-		unsigned int WritebackVTaps,
-		int WritebackDestinationWidth,
-		int WritebackDestinationHeight,
-		int WritebackSourceHeight,
-		unsigned int HTotal);
+double dml30_CalculateWriteBackDelay(struct vba_vars_st *vba, unsigned int i, unsigned int HTotal);
 
 static void CalculateVupdateAndDynamicMetadataParameters(
 		int MaxInterDCNTileRepeaters,
@@ -2508,15 +2500,7 @@ static void DISPCLKDPPCLKDCFCLKDeepSleepPrefetchParametersWatermarksAndPerforman
 		if (v->BlendingAndTiming[k] == k) {
 			if (v->WritebackEnable[k] == true) {
 				v->WritebackDelay[v->VoltageLevel][k] = v->WritebackLatency
-						+ CalculateWriteBackDelay(
-								v->WritebackPixelFormat[k],
-								v->WritebackHRatio[k],
-								v->WritebackVRatio[k],
-								v->WritebackVTaps[k],
-								v->WritebackDestinationWidth[k],
-								v->WritebackDestinationHeight[k],
-								v->WritebackSourceHeight[k],
-								v->HTotal[k]) / v->DISPCLK;
+					+ dml30_CalculateWriteBackDelay(v, k, v->HTotal[k]) / v->DISPCLK;
 			} else
 				v->WritebackDelay[v->VoltageLevel][k] = 0;
 			for (j = 0; j < v->NumberOfActivePlanes; ++j) {
@@ -2524,15 +2508,7 @@ static void DISPCLKDPPCLKDCFCLKDeepSleepPrefetchParametersWatermarksAndPerforman
 					v->WritebackDelay[v->VoltageLevel][k] = dml_max(
 							v->WritebackDelay[v->VoltageLevel][k],
 							v->WritebackLatency
-									+ CalculateWriteBackDelay(
-											v->WritebackPixelFormat[j],
-											v->WritebackHRatio[j],
-											v->WritebackVRatio[j],
-											v->WritebackVTaps[j],
-											v->WritebackDestinationWidth[j],
-											v->WritebackDestinationHeight[j],
-											v->WritebackSourceHeight[j],
-											v->HTotal[k]) / v->DISPCLK);
+							+ dml30_CalculateWriteBackDelay(v, j, v->HTotal[k]) / v->DISPCLK);
 				}
 			}
 		}
@@ -3378,32 +3354,6 @@ double dml31_CalculateWriteBackDISPCLK(
 	return dml_max3(DISPCLK_H, DISPCLK_V, DISPCLK_HB);
 }
 
-static double CalculateWriteBackDelay(
-		enum source_format_class WritebackPixelFormat,
-		double WritebackHRatio,
-		double WritebackVRatio,
-		unsigned int WritebackVTaps,
-		int WritebackDestinationWidth,
-		int WritebackDestinationHeight,
-		int WritebackSourceHeight,
-		unsigned int HTotal)
-{
-	double CalculateWriteBackDelay;
-	double Line_length;
-	double Output_lines_last_notclamped;
-	double WritebackVInit;
-
-	WritebackVInit = (WritebackVRatio + WritebackVTaps + 1) / 2;
-	Line_length = dml_max((double) WritebackDestinationWidth, dml_ceil(WritebackDestinationWidth / 6.0, 1) * WritebackVTaps);
-	Output_lines_last_notclamped = WritebackDestinationHeight - 1 - dml_ceil((WritebackSourceHeight - WritebackVInit) / WritebackVRatio, 1);
-	if (Output_lines_last_notclamped < 0) {
-		CalculateWriteBackDelay = 0;
-	} else {
-		CalculateWriteBackDelay = Output_lines_last_notclamped * Line_length + (HTotal - WritebackDestinationWidth) + 80;
-	}
-	return CalculateWriteBackDelay;
-}
-
 static void CalculateVupdateAndDynamicMetadataParameters(
 		int MaxInterDCNTileRepeaters,
 		double DPPCLK,
@@ -4848,15 +4798,7 @@ void dml31_ModeSupportAndSystemConfigurationFull(struct display_mode_lib *mode_l
 				if (v->BlendingAndTiming[k] == k) {
 					if (v->WritebackEnable[k] == true) {
 						v->WritebackDelayTime[k] = v->WritebackLatency
-								+ CalculateWriteBackDelay(
-										v->WritebackPixelFormat[k],
-										v->WritebackHRatio[k],
-										v->WritebackVRatio[k],
-										v->WritebackVTaps[k],
-										v->WritebackDestinationWidth[k],
-										v->WritebackDestinationHeight[k],
-										v->WritebackSourceHeight[k],
-										v->HTotal[k]) / v->RequiredDISPCLK[i][j];
+							+ dml30_CalculateWriteBackDelay(v, k, v->HTotal[k]) / v->RequiredDISPCLK[i][j];
 					} else {
 						v->WritebackDelayTime[k] = 0.0;
 					}
@@ -4865,15 +4807,7 @@ void dml31_ModeSupportAndSystemConfigurationFull(struct display_mode_lib *mode_l
 							v->WritebackDelayTime[k] = dml_max(
 									v->WritebackDelayTime[k],
 									v->WritebackLatency
-											+ CalculateWriteBackDelay(
-													v->WritebackPixelFormat[m],
-													v->WritebackHRatio[m],
-													v->WritebackVRatio[m],
-													v->WritebackVTaps[m],
-													v->WritebackDestinationWidth[m],
-													v->WritebackDestinationHeight[m],
-													v->WritebackSourceHeight[m],
-													v->HTotal[m]) / v->RequiredDISPCLK[i][j]);
+									+ dml30_CalculateWriteBackDelay(v, m, v->HTotal[m]) / v->RequiredDISPCLK[i][j]);
 						}
 					}
 				}
diff --git a/drivers/gpu/drm/amd/display/dc/dml/dcn314/display_mode_vba_314.c b/drivers/gpu/drm/amd/display/dc/dml/dcn314/display_mode_vba_314.c
index 2829f179f982..7024412fe441 100644
--- a/drivers/gpu/drm/amd/display/dc/dml/dcn314/display_mode_vba_314.c
+++ b/drivers/gpu/drm/amd/display/dc/dml/dcn314/display_mode_vba_314.c
@@ -292,15 +292,7 @@ static void CalculateFlipSchedule(
 		double *DestinationLinesToRequestRowInImmediateFlip,
 		double *final_flip_bw,
 		bool *ImmediateFlipSupportedForPipe);
-static double CalculateWriteBackDelay(
-		enum source_format_class WritebackPixelFormat,
-		double WritebackHRatio,
-		double WritebackVRatio,
-		unsigned int WritebackVTaps,
-		int WritebackDestinationWidth,
-		int WritebackDestinationHeight,
-		int WritebackSourceHeight,
-		unsigned int HTotal);
+double dml30_CalculateWriteBackDelay(struct vba_vars_st *vba, unsigned int i, unsigned int HTotal);
 
 static void CalculateVupdateAndDynamicMetadataParameters(
 		int MaxInterDCNTileRepeaters,
@@ -2588,15 +2580,7 @@ static void DISPCLKDPPCLKDCFCLKDeepSleepPrefetchParametersWatermarksAndPerforman
 		if (v->BlendingAndTiming[k] == k) {
 			if (v->WritebackEnable[k] == true) {
 				v->WritebackDelay[v->VoltageLevel][k] = v->WritebackLatency
-						+ CalculateWriteBackDelay(
-								v->WritebackPixelFormat[k],
-								v->WritebackHRatio[k],
-								v->WritebackVRatio[k],
-								v->WritebackVTaps[k],
-								v->WritebackDestinationWidth[k],
-								v->WritebackDestinationHeight[k],
-								v->WritebackSourceHeight[k],
-								v->HTotal[k]) / v->DISPCLK;
+					+ dml30_CalculateWriteBackDelay(v, k, v->HTotal[k]) / v->DISPCLK;
 			} else
 				v->WritebackDelay[v->VoltageLevel][k] = 0;
 			for (j = 0; j < v->NumberOfActivePlanes; ++j) {
@@ -2604,15 +2588,7 @@ static void DISPCLKDPPCLKDCFCLKDeepSleepPrefetchParametersWatermarksAndPerforman
 					v->WritebackDelay[v->VoltageLevel][k] = dml_max(
 							v->WritebackDelay[v->VoltageLevel][k],
 							v->WritebackLatency
-									+ CalculateWriteBackDelay(
-											v->WritebackPixelFormat[j],
-											v->WritebackHRatio[j],
-											v->WritebackVRatio[j],
-											v->WritebackVTaps[j],
-											v->WritebackDestinationWidth[j],
-											v->WritebackDestinationHeight[j],
-											v->WritebackSourceHeight[j],
-											v->HTotal[k]) / v->DISPCLK);
+							+ dml30_CalculateWriteBackDelay(v, j, v->HTotal[k]) / v->DISPCLK);
 				}
 			}
 		}
@@ -3602,32 +3578,6 @@ double dml314_CalculateWriteBackDISPCLK(
 	return dml_max3(DISPCLK_H, DISPCLK_V, DISPCLK_HB);
 }
 
-static double CalculateWriteBackDelay(
-		enum source_format_class WritebackPixelFormat,
-		double WritebackHRatio,
-		double WritebackVRatio,
-		unsigned int WritebackVTaps,
-		int WritebackDestinationWidth,
-		int WritebackDestinationHeight,
-		int WritebackSourceHeight,
-		unsigned int HTotal)
-{
-	double CalculateWriteBackDelay;
-	double Line_length;
-	double Output_lines_last_notclamped;
-	double WritebackVInit;
-
-	WritebackVInit = (WritebackVRatio + WritebackVTaps + 1) / 2;
-	Line_length = dml_max((double) WritebackDestinationWidth, dml_ceil(WritebackDestinationWidth / 6.0, 1) * WritebackVTaps);
-	Output_lines_last_notclamped = WritebackDestinationHeight - 1 - dml_ceil((WritebackSourceHeight - WritebackVInit) / WritebackVRatio, 1);
-	if (Output_lines_last_notclamped < 0) {
-		CalculateWriteBackDelay = 0;
-	} else {
-		CalculateWriteBackDelay = Output_lines_last_notclamped * Line_length + (HTotal - WritebackDestinationWidth) + 80;
-	}
-	return CalculateWriteBackDelay;
-}
-
 static void CalculateVupdateAndDynamicMetadataParameters(
 		int MaxInterDCNTileRepeaters,
 		double DPPCLK,
@@ -5092,15 +5042,7 @@ void dml314_ModeSupportAndSystemConfigurationFull(struct display_mode_lib *mode_
 				if (v->BlendingAndTiming[k] == k) {
 					if (v->WritebackEnable[k] == true) {
 						v->WritebackDelayTime[k] = v->WritebackLatency
-								+ CalculateWriteBackDelay(
-										v->WritebackPixelFormat[k],
-										v->WritebackHRatio[k],
-										v->WritebackVRatio[k],
-										v->WritebackVTaps[k],
-										v->WritebackDestinationWidth[k],
-										v->WritebackDestinationHeight[k],
-										v->WritebackSourceHeight[k],
-										v->HTotal[k]) / v->RequiredDISPCLK[i][j];
+							+ dml30_CalculateWriteBackDelay(v, k, v->HTotal[k]) / v->RequiredDISPCLK[i][j];
 					} else {
 						v->WritebackDelayTime[k] = 0.0;
 					}
@@ -5109,15 +5051,7 @@ void dml314_ModeSupportAndSystemConfigurationFull(struct display_mode_lib *mode_
 							v->WritebackDelayTime[k] = dml_max(
 									v->WritebackDelayTime[k],
 									v->WritebackLatency
-											+ CalculateWriteBackDelay(
-													v->WritebackPixelFormat[m],
-													v->WritebackHRatio[m],
-													v->WritebackVRatio[m],
-													v->WritebackVTaps[m],
-													v->WritebackDestinationWidth[m],
-													v->WritebackDestinationHeight[m],
-													v->WritebackSourceHeight[m],
-													v->HTotal[m]) / v->RequiredDISPCLK[i][j]);
+									+ dml30_CalculateWriteBackDelay(v, m, v->HTotal[m]) / v->RequiredDISPCLK[i][j]);
 						}
 					}
 				}
diff --git a/drivers/gpu/drm/amd/display/dc/dml/dcn32/display_mode_vba_32.c b/drivers/gpu/drm/amd/display/dc/dml/dcn32/display_mode_vba_32.c
index ad100658132f..9778effba7a4 100644
--- a/drivers/gpu/drm/amd/display/dc/dml/dcn32/display_mode_vba_32.c
+++ b/drivers/gpu/drm/amd/display/dc/dml/dcn32/display_mode_vba_32.c
@@ -597,15 +597,7 @@ static void DISPCLKDPPCLKDCFCLKDeepSleepPrefetchParametersWatermarksAndPerforman
 		if (mode_lib->vba.BlendingAndTiming[k] == k) {
 			if (mode_lib->vba.WritebackEnable[k] == true) {
 				v->WritebackDelay[mode_lib->vba.VoltageLevel][k] = mode_lib->vba.WritebackLatency
-						+ dml32_CalculateWriteBackDelay(
-								mode_lib->vba.WritebackPixelFormat[k],
-								mode_lib->vba.WritebackHRatio[k],
-								mode_lib->vba.WritebackVRatio[k],
-								mode_lib->vba.WritebackVTaps[k],
-								mode_lib->vba.WritebackDestinationWidth[k],
-								mode_lib->vba.WritebackDestinationHeight[k],
-								mode_lib->vba.WritebackSourceHeight[k],
-								mode_lib->vba.HTotal[k]) / mode_lib->vba.DISPCLK;
+					+ dml30_CalculateWriteBackDelay(v, k, v->HTotal[k]) / mode_lib->vba.DISPCLK;
 			} else
 				v->WritebackDelay[mode_lib->vba.VoltageLevel][k] = 0;
 			for (j = 0; j < mode_lib->vba.NumberOfActiveSurfaces; ++j) {
@@ -614,15 +606,7 @@ static void DISPCLKDPPCLKDCFCLKDeepSleepPrefetchParametersWatermarksAndPerforman
 					v->WritebackDelay[mode_lib->vba.VoltageLevel][k] =
 						dml_max(v->WritebackDelay[mode_lib->vba.VoltageLevel][k],
 						mode_lib->vba.WritebackLatency +
-						dml32_CalculateWriteBackDelay(
-								mode_lib->vba.WritebackPixelFormat[j],
-								mode_lib->vba.WritebackHRatio[j],
-								mode_lib->vba.WritebackVRatio[j],
-								mode_lib->vba.WritebackVTaps[j],
-								mode_lib->vba.WritebackDestinationWidth[j],
-								mode_lib->vba.WritebackDestinationHeight[j],
-								mode_lib->vba.WritebackSourceHeight[j],
-								mode_lib->vba.HTotal[k]) / mode_lib->vba.DISPCLK);
+							dml30_CalculateWriteBackDelay(v, j, v->HTotal[k]) / mode_lib->vba.DISPCLK);
 				}
 			}
 		}
@@ -2864,16 +2848,7 @@ void dml32_ModeSupportAndSystemConfigurationFull(struct display_mode_lib *mode_l
 					if (mode_lib->vba.WritebackEnable[k] == true) {
 						mode_lib->vba.WritebackDelayTime[k] =
 							mode_lib->vba.WritebackLatency
-						+ dml32_CalculateWriteBackDelay(
-							mode_lib->vba.WritebackPixelFormat[k],
-							mode_lib->vba.WritebackHRatio[k],
-							mode_lib->vba.WritebackVRatio[k],
-							mode_lib->vba.WritebackVTaps[k],
-							mode_lib->vba.WritebackDestinationWidth[k],
-							mode_lib->vba.WritebackDestinationHeight[k],
-							mode_lib->vba.WritebackSourceHeight[k],
-							mode_lib->vba.HTotal[k])
-							/ mode_lib->vba.RequiredDISPCLK[i][j];
+							+ dml30_CalculateWriteBackDelay(v, k, v->HTotal[k]) / mode_lib->vba.RequiredDISPCLK[i][j];
 					} else {
 						mode_lib->vba.WritebackDelayTime[k] = 0.0;
 					}
@@ -2883,16 +2858,7 @@ void dml32_ModeSupportAndSystemConfigurationFull(struct display_mode_lib *mode_l
 							mode_lib->vba.WritebackDelayTime[k] =
 								dml_max(mode_lib->vba.WritebackDelayTime[k],
 									mode_lib->vba.WritebackLatency
-								+ dml32_CalculateWriteBackDelay(
-									mode_lib->vba.WritebackPixelFormat[m],
-									mode_lib->vba.WritebackHRatio[m],
-									mode_lib->vba.WritebackVRatio[m],
-									mode_lib->vba.WritebackVTaps[m],
-									mode_lib->vba.WritebackDestinationWidth[m],
-									mode_lib->vba.WritebackDestinationHeight[m],
-									mode_lib->vba.WritebackSourceHeight[m],
-									mode_lib->vba.HTotal[m]) /
-									mode_lib->vba.RequiredDISPCLK[i][j]);
+									+ dml30_CalculateWriteBackDelay(v, m, v->HTotal[m]) / mode_lib->vba.RequiredDISPCLK[i][j]);
 						}
 					}
 				}
diff --git a/drivers/gpu/drm/amd/display/dc/dml/dcn32/display_mode_vba_util_32.c b/drivers/gpu/drm/amd/display/dc/dml/dcn32/display_mode_vba_util_32.c
index 5b5b94f1024d..a08de0dc080f 100644
--- a/drivers/gpu/drm/amd/display/dc/dml/dcn32/display_mode_vba_util_32.c
+++ b/drivers/gpu/drm/amd/display/dc/dml/dcn32/display_mode_vba_util_32.c
@@ -2856,36 +2856,6 @@ void dml32_CalculateDCFCLKDeepSleep(
 #endif
 } // CalculateDCFCLKDeepSleep
 
-double dml32_CalculateWriteBackDelay(
-		enum source_format_class WritebackPixelFormat,
-		double WritebackHRatio,
-		double WritebackVRatio,
-		unsigned int WritebackVTaps,
-		unsigned int         WritebackDestinationWidth,
-		unsigned int         WritebackDestinationHeight,
-		unsigned int         WritebackSourceHeight,
-		unsigned int HTotal)
-{
-	double CalculateWriteBackDelay;
-	double Line_length;
-	double Output_lines_last_notclamped;
-	double WritebackVInit;
-
-	WritebackVInit = (WritebackVRatio + WritebackVTaps + 1) / 2;
-	Line_length = dml_max((double) WritebackDestinationWidth,
-			dml_ceil((double)WritebackDestinationWidth / 6.0, 1.0) * WritebackVTaps);
-	Output_lines_last_notclamped = WritebackDestinationHeight - 1 -
-			dml_ceil(((double)WritebackSourceHeight -
-					(double) WritebackVInit) / (double)WritebackVRatio, 1.0);
-	if (Output_lines_last_notclamped < 0) {
-		CalculateWriteBackDelay = 0;
-	} else {
-		CalculateWriteBackDelay = Output_lines_last_notclamped * Line_length +
-				(HTotal - WritebackDestinationWidth) + 80;
-	}
-	return CalculateWriteBackDelay;
-}
-
 void dml32_UseMinimumDCFCLK(
 		enum dm_use_mall_for_pstate_change_mode UseMALLForPStateChange[],
 		bool DRRDisplay[],
diff --git a/drivers/gpu/drm/amd/display/dc/dml/dcn32/display_mode_vba_util_32.h b/drivers/gpu/drm/amd/display/dc/dml/dcn32/display_mode_vba_util_32.h
index 3dbc9cf46aad..017acfe5af2f 100644
--- a/drivers/gpu/drm/amd/display/dc/dml/dcn32/display_mode_vba_util_32.h
+++ b/drivers/gpu/drm/amd/display/dc/dml/dcn32/display_mode_vba_util_32.h
@@ -571,15 +571,7 @@ void dml32_CalculateDCFCLKDeepSleep(
 		/* Output */
 		double *DCFClkDeepSleep);
 
-double dml32_CalculateWriteBackDelay(
-		enum source_format_class WritebackPixelFormat,
-		double WritebackHRatio,
-		double WritebackVRatio,
-		unsigned int WritebackVTaps,
-		unsigned int         WritebackDestinationWidth,
-		unsigned int         WritebackDestinationHeight,
-		unsigned int         WritebackSourceHeight,
-		unsigned int HTotal);
+double dml30_CalculateWriteBackDelay(struct vba_vars_st *vba, unsigned int i, unsigned int HTotal);
 
 void dml32_UseMinimumDCFCLK(
 		enum dm_use_mall_for_pstate_change_mode UseMALLForPStateChange[],
-- 
2.27.0


^ permalink raw reply related	[relevance 32%]

* Re: [PATCH 1/2] drm/amd/display: Reduce number of arguments of dml314's CalculateWatermarksAndDRAMSpeedChangeSupport()
  @ 2022-09-16 22:04 99% ` Tom Rix
  0 siblings, 0 replies; 180+ results
From: Tom Rix @ 2022-09-16 22:04 UTC (permalink / raw)
  To: Nathan Chancellor, Harry Wentland, Leo Li, Rodrigo Siqueira,
	Alex Deucher, Christian König, Pan, Xinhui
  Cc: kernelci.org bot, llvm, Nick Desaulniers, patches, dri-devel, amd-gfx


On 9/16/22 2:06 PM, Nathan Chancellor wrote:
> Most of the arguments are identical between the two call sites and they
> can be accessed through the 'struct vba_vars_st' pointer. This reduces
> the total amount of stack space that
> dml314_ModeSupportAndSystemConfigurationFull() uses by 240 bytes with
> LLVM 16 (2216 -> 1976), helping clear up the following clang warning:
>
>    drivers/gpu/drm/amd/amdgpu/../display/dc/dml/dcn314/display_mode_vba_314.c:4020:6: error: stack frame size (2216) exceeds limit (2048) in 'dml314_ModeSupportAndSystemConfigurationFull' [-Werror,-Wframe-larger-than]
>    void dml314_ModeSupportAndSystemConfigurationFull(struct display_mode_lib *mode_lib)
>         ^
>    1 error generated.
>
> Link: https://github.com/ClangBuiltLinux/linux/issues/1710
> Reported-by: "kernelci.org bot" <bot@kernelci.org>
> Signed-off-by: Nathan Chancellor <nathan@kernel.org>

Nathan,

I like this change but I don't think it goes far enough.

There are many similar functions in this file and there other 
display_node_vba_*.c files that pass too many vba_vars_st elements.

I think most/all of the static functions should be refactored to pass 
vba_vars_st * or vba_vars_st **

fwiw, i found the calling function 
DISPCLKDPPCLKDCFCLKDeepSleepPrefetchParametersWatermarksAndPerformanceCalculation, 
hilariously long :)

I'll do the change if you want to pass this to me, I promise not to add 
to the above function name.

Tom

> ---
>
> This is just commit ab2ac59c32db ("drm/amd/display: Reduce number of
> arguments of dml31's CalculateWatermarksAndDRAMSpeedChangeSupport()")
> applied to dml314.
>
>   .../dc/dml/dcn314/display_mode_vba_314.c      | 248 ++++--------------
>   1 file changed, 52 insertions(+), 196 deletions(-)
>
> diff --git a/drivers/gpu/drm/amd/display/dc/dml/dcn314/display_mode_vba_314.c b/drivers/gpu/drm/amd/display/dc/dml/dcn314/display_mode_vba_314.c
> index 2829f179f982..32ceb72f7a14 100644
> --- a/drivers/gpu/drm/amd/display/dc/dml/dcn314/display_mode_vba_314.c
> +++ b/drivers/gpu/drm/amd/display/dc/dml/dcn314/display_mode_vba_314.c
> @@ -325,64 +325,28 @@ static void CalculateVupdateAndDynamicMetadataParameters(
>   static void CalculateWatermarksAndDRAMSpeedChangeSupport(
>   		struct display_mode_lib *mode_lib,
>   		unsigned int PrefetchMode,
> -		unsigned int NumberOfActivePlanes,
> -		unsigned int MaxLineBufferLines,
> -		unsigned int LineBufferSize,
> -		unsigned int WritebackInterfaceBufferSize,
>   		double DCFCLK,
>   		double ReturnBW,
> -		bool SynchronizedVBlank,
> -		unsigned int dpte_group_bytes[],
> -		unsigned int MetaChunkSize,
>   		double UrgentLatency,
>   		double ExtraLatency,
> -		double WritebackLatency,
> -		double WritebackChunkSize,
>   		double SOCCLK,
> -		double DRAMClockChangeLatency,
> -		double SRExitTime,
> -		double SREnterPlusExitTime,
> -		double SRExitZ8Time,
> -		double SREnterPlusExitZ8Time,
>   		double DCFCLKDeepSleep,
>   		unsigned int DETBufferSizeY[],
>   		unsigned int DETBufferSizeC[],
>   		unsigned int SwathHeightY[],
>   		unsigned int SwathHeightC[],
> -		unsigned int LBBitPerPixel[],
>   		double SwathWidthY[],
>   		double SwathWidthC[],
> -		double HRatio[],
> -		double HRatioChroma[],
> -		unsigned int vtaps[],
> -		unsigned int VTAPsChroma[],
> -		double VRatio[],
> -		double VRatioChroma[],
> -		unsigned int HTotal[],
> -		double PixelClock[],
> -		unsigned int BlendingAndTiming[],
>   		unsigned int DPPPerPlane[],
>   		double BytePerPixelDETY[],
>   		double BytePerPixelDETC[],
> -		double DSTXAfterScaler[],
> -		double DSTYAfterScaler[],
> -		bool WritebackEnable[],
> -		enum source_format_class WritebackPixelFormat[],
> -		double WritebackDestinationWidth[],
> -		double WritebackDestinationHeight[],
> -		double WritebackSourceHeight[],
>   		bool UnboundedRequestEnabled,
>   		unsigned int CompressedBufferSizeInkByte,
>   		enum clock_change_support *DRAMClockChangeSupport,
> -		double *UrgentWatermark,
> -		double *WritebackUrgentWatermark,
> -		double *DRAMClockChangeWatermark,
> -		double *WritebackDRAMClockChangeWatermark,
>   		double *StutterExitWatermark,
>   		double *StutterEnterPlusExitWatermark,
>   		double *Z8StutterExitWatermark,
> -		double *Z8StutterEnterPlusExitWatermark,
> -		double *MinActiveDRAMClockChangeLatencySupported);
> +		double *Z8StutterEnterPlusExitWatermark);
>   
>   static void CalculateDCFCLKDeepSleep(
>   		struct display_mode_lib *mode_lib,
> @@ -3041,64 +3005,28 @@ static void DISPCLKDPPCLKDCFCLKDeepSleepPrefetchParametersWatermarksAndPerforman
>   		CalculateWatermarksAndDRAMSpeedChangeSupport(
>   				mode_lib,
>   				PrefetchMode,
> -				v->NumberOfActivePlanes,
> -				v->MaxLineBufferLines,
> -				v->LineBufferSize,
> -				v->WritebackInterfaceBufferSize,
>   				v->DCFCLK,
>   				v->ReturnBW,
> -				v->SynchronizedVBlank,
> -				v->dpte_group_bytes,
> -				v->MetaChunkSize,
>   				v->UrgentLatency,
>   				v->UrgentExtraLatency,
> -				v->WritebackLatency,
> -				v->WritebackChunkSize,
>   				v->SOCCLK,
> -				v->DRAMClockChangeLatency,
> -				v->SRExitTime,
> -				v->SREnterPlusExitTime,
> -				v->SRExitZ8Time,
> -				v->SREnterPlusExitZ8Time,
>   				v->DCFCLKDeepSleep,
>   				v->DETBufferSizeY,
>   				v->DETBufferSizeC,
>   				v->SwathHeightY,
>   				v->SwathHeightC,
> -				v->LBBitPerPixel,
>   				v->SwathWidthY,
>   				v->SwathWidthC,
> -				v->HRatio,
> -				v->HRatioChroma,
> -				v->vtaps,
> -				v->VTAPsChroma,
> -				v->VRatio,
> -				v->VRatioChroma,
> -				v->HTotal,
> -				v->PixelClock,
> -				v->BlendingAndTiming,
>   				v->DPPPerPlane,
>   				v->BytePerPixelDETY,
>   				v->BytePerPixelDETC,
> -				v->DSTXAfterScaler,
> -				v->DSTYAfterScaler,
> -				v->WritebackEnable,
> -				v->WritebackPixelFormat,
> -				v->WritebackDestinationWidth,
> -				v->WritebackDestinationHeight,
> -				v->WritebackSourceHeight,
>   				v->UnboundedRequestEnabled,
>   				v->CompressedBufferSizeInkByte,
>   				&DRAMClockChangeSupport,
> -				&v->UrgentWatermark,
> -				&v->WritebackUrgentWatermark,
> -				&v->DRAMClockChangeWatermark,
> -				&v->WritebackDRAMClockChangeWatermark,
>   				&v->StutterExitWatermark,
>   				&v->StutterEnterPlusExitWatermark,
>   				&v->Z8StutterExitWatermark,
> -				&v->Z8StutterEnterPlusExitWatermark,
> -				&v->MinActiveDRAMClockChangeLatencySupported);
> +				&v->Z8StutterEnterPlusExitWatermark);
>   
>   		for (k = 0; k < v->NumberOfActivePlanes; ++k) {
>   			if (v->WritebackEnable[k] == true) {
> @@ -5496,64 +5424,28 @@ void dml314_ModeSupportAndSystemConfigurationFull(struct display_mode_lib *mode_
>   			CalculateWatermarksAndDRAMSpeedChangeSupport(
>   					mode_lib,
>   					v->PrefetchModePerState[i][j],
> -					v->NumberOfActivePlanes,
> -					v->MaxLineBufferLines,
> -					v->LineBufferSize,
> -					v->WritebackInterfaceBufferSize,
>   					v->DCFCLKState[i][j],
>   					v->ReturnBWPerState[i][j],
> -					v->SynchronizedVBlank,
> -					v->dpte_group_bytes,
> -					v->MetaChunkSize,
>   					v->UrgLatency[i],
>   					v->ExtraLatency,
> -					v->WritebackLatency,
> -					v->WritebackChunkSize,
>   					v->SOCCLKPerState[i],
> -					v->DRAMClockChangeLatency,
> -					v->SRExitTime,
> -					v->SREnterPlusExitTime,
> -					v->SRExitZ8Time,
> -					v->SREnterPlusExitZ8Time,
>   					v->ProjectedDCFCLKDeepSleep[i][j],
>   					v->DETBufferSizeYThisState,
>   					v->DETBufferSizeCThisState,
>   					v->SwathHeightYThisState,
>   					v->SwathHeightCThisState,
> -					v->LBBitPerPixel,
>   					v->SwathWidthYThisState,
>   					v->SwathWidthCThisState,
> -					v->HRatio,
> -					v->HRatioChroma,
> -					v->vtaps,
> -					v->VTAPsChroma,
> -					v->VRatio,
> -					v->VRatioChroma,
> -					v->HTotal,
> -					v->PixelClock,
> -					v->BlendingAndTiming,
>   					v->NoOfDPPThisState,
>   					v->BytePerPixelInDETY,
>   					v->BytePerPixelInDETC,
> -					v->DSTXAfterScaler,
> -					v->DSTYAfterScaler,
> -					v->WritebackEnable,
> -					v->WritebackPixelFormat,
> -					v->WritebackDestinationWidth,
> -					v->WritebackDestinationHeight,
> -					v->WritebackSourceHeight,
>   					UnboundedRequestEnabledThisState,
>   					CompressedBufferSizeInkByteThisState,
>   					&v->DRAMClockChangeSupport[i][j],
> -					&v->UrgentWatermark,
> -					&v->WritebackUrgentWatermark,
> -					&v->DRAMClockChangeWatermark,
> -					&v->WritebackDRAMClockChangeWatermark,
> -					&dummy,
>   					&dummy,
>   					&dummy,
>   					&dummy,
> -					&v->MinActiveDRAMClockChangeLatencySupported);
> +					&dummy);
>   		}
>   	}
>   
> @@ -5679,64 +5571,28 @@ void dml314_ModeSupportAndSystemConfigurationFull(struct display_mode_lib *mode_
>   static void CalculateWatermarksAndDRAMSpeedChangeSupport(
>   		struct display_mode_lib *mode_lib,
>   		unsigned int PrefetchMode,
> -		unsigned int NumberOfActivePlanes,
> -		unsigned int MaxLineBufferLines,
> -		unsigned int LineBufferSize,
> -		unsigned int WritebackInterfaceBufferSize,
>   		double DCFCLK,
>   		double ReturnBW,
> -		bool SynchronizedVBlank,
> -		unsigned int dpte_group_bytes[],
> -		unsigned int MetaChunkSize,
>   		double UrgentLatency,
>   		double ExtraLatency,
> -		double WritebackLatency,
> -		double WritebackChunkSize,
>   		double SOCCLK,
> -		double DRAMClockChangeLatency,
> -		double SRExitTime,
> -		double SREnterPlusExitTime,
> -		double SRExitZ8Time,
> -		double SREnterPlusExitZ8Time,
>   		double DCFCLKDeepSleep,
>   		unsigned int DETBufferSizeY[],
>   		unsigned int DETBufferSizeC[],
>   		unsigned int SwathHeightY[],
>   		unsigned int SwathHeightC[],
> -		unsigned int LBBitPerPixel[],
>   		double SwathWidthY[],
>   		double SwathWidthC[],
> -		double HRatio[],
> -		double HRatioChroma[],
> -		unsigned int vtaps[],
> -		unsigned int VTAPsChroma[],
> -		double VRatio[],
> -		double VRatioChroma[],
> -		unsigned int HTotal[],
> -		double PixelClock[],
> -		unsigned int BlendingAndTiming[],
>   		unsigned int DPPPerPlane[],
>   		double BytePerPixelDETY[],
>   		double BytePerPixelDETC[],
> -		double DSTXAfterScaler[],
> -		double DSTYAfterScaler[],
> -		bool WritebackEnable[],
> -		enum source_format_class WritebackPixelFormat[],
> -		double WritebackDestinationWidth[],
> -		double WritebackDestinationHeight[],
> -		double WritebackSourceHeight[],
>   		bool UnboundedRequestEnabled,
>   		unsigned int CompressedBufferSizeInkByte,
>   		enum clock_change_support *DRAMClockChangeSupport,
> -		double *UrgentWatermark,
> -		double *WritebackUrgentWatermark,
> -		double *DRAMClockChangeWatermark,
> -		double *WritebackDRAMClockChangeWatermark,
>   		double *StutterExitWatermark,
>   		double *StutterEnterPlusExitWatermark,
>   		double *Z8StutterExitWatermark,
> -		double *Z8StutterEnterPlusExitWatermark,
> -		double *MinActiveDRAMClockChangeLatencySupported)
> +		double *Z8StutterEnterPlusExitWatermark)
>   {
>   	struct vba_vars_st *v = &mode_lib->vba;
>   	double EffectiveLBLatencyHidingY;
> @@ -5756,103 +5612,103 @@ static void CalculateWatermarksAndDRAMSpeedChangeSupport(
>   	double TotalPixelBW = 0.0;
>   	int k, j;
>   
> -	*UrgentWatermark = UrgentLatency + ExtraLatency;
> +	v->UrgentWatermark = UrgentLatency + ExtraLatency;
>   
>   #ifdef __DML_VBA_DEBUG__
>   	dml_print("DML::%s: UrgentLatency = %f\n", __func__, UrgentLatency);
>   	dml_print("DML::%s: ExtraLatency = %f\n", __func__, ExtraLatency);
> -	dml_print("DML::%s: UrgentWatermark = %f\n", __func__, *UrgentWatermark);
> +	dml_print("DML::%s: UrgentWatermark = %f\n", __func__, v->UrgentWatermark);
>   #endif
>   
> -	*DRAMClockChangeWatermark = DRAMClockChangeLatency + *UrgentWatermark;
> +	v->DRAMClockChangeWatermark = v->DRAMClockChangeLatency + v->UrgentWatermark;
>   
>   #ifdef __DML_VBA_DEBUG__
> -	dml_print("DML::%s: DRAMClockChangeLatency = %f\n", __func__, DRAMClockChangeLatency);
> -	dml_print("DML::%s: DRAMClockChangeWatermark = %f\n", __func__, *DRAMClockChangeWatermark);
> +	dml_print("DML::%s: v->DRAMClockChangeLatency = %f\n", __func__, v->DRAMClockChangeLatency);
> +	dml_print("DML::%s: DRAMClockChangeWatermark = %f\n", __func__, v->DRAMClockChangeWatermark);
>   #endif
>   
>   	v->TotalActiveWriteback = 0;
> -	for (k = 0; k < NumberOfActivePlanes; ++k) {
> -		if (WritebackEnable[k] == true) {
> +	for (k = 0; k < v->NumberOfActivePlanes; ++k) {
> +		if (v->WritebackEnable[k] == true) {
>   			v->TotalActiveWriteback = v->TotalActiveWriteback + 1;
>   		}
>   	}
>   
>   	if (v->TotalActiveWriteback <= 1) {
> -		*WritebackUrgentWatermark = WritebackLatency;
> +		v->WritebackUrgentWatermark = v->WritebackLatency;
>   	} else {
> -		*WritebackUrgentWatermark = WritebackLatency + WritebackChunkSize * 1024.0 / 32.0 / SOCCLK;
> +		v->WritebackUrgentWatermark = v->WritebackLatency + v->WritebackChunkSize * 1024.0 / 32.0 / SOCCLK;
>   	}
>   
>   	if (v->TotalActiveWriteback <= 1) {
> -		*WritebackDRAMClockChangeWatermark = DRAMClockChangeLatency + WritebackLatency;
> +		v->WritebackDRAMClockChangeWatermark = v->DRAMClockChangeLatency + v->WritebackLatency;
>   	} else {
> -		*WritebackDRAMClockChangeWatermark = DRAMClockChangeLatency + WritebackLatency + WritebackChunkSize * 1024.0 / 32.0 / SOCCLK;
> +		v->WritebackDRAMClockChangeWatermark = v->DRAMClockChangeLatency + v->WritebackLatency + v->WritebackChunkSize * 1024.0 / 32.0 / SOCCLK;
>   	}
>   
> -	for (k = 0; k < NumberOfActivePlanes; ++k) {
> +	for (k = 0; k < v->NumberOfActivePlanes; ++k) {
>   		TotalPixelBW = TotalPixelBW
> -				+ DPPPerPlane[k] * (SwathWidthY[k] * BytePerPixelDETY[k] * VRatio[k] + SwathWidthC[k] * BytePerPixelDETC[k] * VRatioChroma[k])
> -						/ (HTotal[k] / PixelClock[k]);
> +				+ DPPPerPlane[k] * (SwathWidthY[k] * BytePerPixelDETY[k] * v->VRatio[k] + SwathWidthC[k] * BytePerPixelDETC[k] * v->VRatioChroma[k])
> +						/ (v->HTotal[k] / v->PixelClock[k]);
>   	}
>   
> -	for (k = 0; k < NumberOfActivePlanes; ++k) {
> +	for (k = 0; k < v->NumberOfActivePlanes; ++k) {
>   		double EffectiveDETBufferSizeY = DETBufferSizeY[k];
>   
>   		v->LBLatencyHidingSourceLinesY = dml_min(
> -				(double) MaxLineBufferLines,
> -				dml_floor(LineBufferSize / LBBitPerPixel[k] / (SwathWidthY[k] / dml_max(HRatio[k], 1.0)), 1)) - (vtaps[k] - 1);
> +				(double) v->MaxLineBufferLines,
> +				dml_floor(v->LineBufferSize / v->LBBitPerPixel[k] / (SwathWidthY[k] / dml_max(v->HRatio[k], 1.0)), 1)) - (v->vtaps[k] - 1);
>   
>   		v->LBLatencyHidingSourceLinesC = dml_min(
> -				(double) MaxLineBufferLines,
> -				dml_floor(LineBufferSize / LBBitPerPixel[k] / (SwathWidthC[k] / dml_max(HRatioChroma[k], 1.0)), 1)) - (VTAPsChroma[k] - 1);
> +				(double) v->MaxLineBufferLines,
> +				dml_floor(v->LineBufferSize / v->LBBitPerPixel[k] / (SwathWidthC[k] / dml_max(v->HRatioChroma[k], 1.0)), 1)) - (v->VTAPsChroma[k] - 1);
>   
> -		EffectiveLBLatencyHidingY = v->LBLatencyHidingSourceLinesY / VRatio[k] * (HTotal[k] / PixelClock[k]);
> +		EffectiveLBLatencyHidingY = v->LBLatencyHidingSourceLinesY / v->VRatio[k] * (v->HTotal[k] / v->PixelClock[k]);
>   
> -		EffectiveLBLatencyHidingC = v->LBLatencyHidingSourceLinesC / VRatioChroma[k] * (HTotal[k] / PixelClock[k]);
> +		EffectiveLBLatencyHidingC = v->LBLatencyHidingSourceLinesC / v->VRatioChroma[k] * (v->HTotal[k] / v->PixelClock[k]);
>   
>   		if (UnboundedRequestEnabled) {
>   			EffectiveDETBufferSizeY = EffectiveDETBufferSizeY
> -					+ CompressedBufferSizeInkByte * 1024 * SwathWidthY[k] * BytePerPixelDETY[k] * VRatio[k] / (HTotal[k] / PixelClock[k]) / TotalPixelBW;
> +					+ CompressedBufferSizeInkByte * 1024 * SwathWidthY[k] * BytePerPixelDETY[k] * v->VRatio[k] / (v->HTotal[k] / v->PixelClock[k]) / TotalPixelBW;
>   		}
>   
>   		LinesInDETY[k] = (double) EffectiveDETBufferSizeY / BytePerPixelDETY[k] / SwathWidthY[k];
>   		LinesInDETYRoundedDownToSwath[k] = dml_floor(LinesInDETY[k], SwathHeightY[k]);
> -		FullDETBufferingTimeY = LinesInDETYRoundedDownToSwath[k] * (HTotal[k] / PixelClock[k]) / VRatio[k];
> +		FullDETBufferingTimeY = LinesInDETYRoundedDownToSwath[k] * (v->HTotal[k] / v->PixelClock[k]) / v->VRatio[k];
>   		if (BytePerPixelDETC[k] > 0) {
>   			LinesInDETC = v->DETBufferSizeC[k] / BytePerPixelDETC[k] / SwathWidthC[k];
>   			LinesInDETCRoundedDownToSwath = dml_floor(LinesInDETC, SwathHeightC[k]);
> -			FullDETBufferingTimeC = LinesInDETCRoundedDownToSwath * (HTotal[k] / PixelClock[k]) / VRatioChroma[k];
> +			FullDETBufferingTimeC = LinesInDETCRoundedDownToSwath * (v->HTotal[k] / v->PixelClock[k]) / v->VRatioChroma[k];
>   		} else {
>   			LinesInDETC = 0;
>   			FullDETBufferingTimeC = 999999;
>   		}
>   
>   		ActiveDRAMClockChangeLatencyMarginY = EffectiveLBLatencyHidingY + FullDETBufferingTimeY
> -				- ((double) DSTXAfterScaler[k] / HTotal[k] + DSTYAfterScaler[k]) * HTotal[k] / PixelClock[k] - *UrgentWatermark - *DRAMClockChangeWatermark;
> +				- ((double) v->DSTXAfterScaler[k] / v->HTotal[k] + v->DSTYAfterScaler[k]) * v->HTotal[k] / v->PixelClock[k] - v->UrgentWatermark - v->DRAMClockChangeWatermark;
>   
> -		if (NumberOfActivePlanes > 1) {
> +		if (v->NumberOfActivePlanes > 1) {
>   			ActiveDRAMClockChangeLatencyMarginY = ActiveDRAMClockChangeLatencyMarginY
> -					- (1 - 1.0 / NumberOfActivePlanes) * SwathHeightY[k] * HTotal[k] / PixelClock[k] / VRatio[k];
> +					- (1 - 1.0 / v->NumberOfActivePlanes) * SwathHeightY[k] * v->HTotal[k] / v->PixelClock[k] / v->VRatio[k];
>   		}
>   
>   		if (BytePerPixelDETC[k] > 0) {
>   			ActiveDRAMClockChangeLatencyMarginC = EffectiveLBLatencyHidingC + FullDETBufferingTimeC
> -					- ((double) DSTXAfterScaler[k] / HTotal[k] + DSTYAfterScaler[k]) * HTotal[k] / PixelClock[k] - *UrgentWatermark - *DRAMClockChangeWatermark;
> +					- ((double) v->DSTXAfterScaler[k] / v->HTotal[k] + v->DSTYAfterScaler[k]) * v->HTotal[k] / v->PixelClock[k] - v->UrgentWatermark - v->DRAMClockChangeWatermark;
>   
> -			if (NumberOfActivePlanes > 1) {
> +			if (v->NumberOfActivePlanes > 1) {
>   				ActiveDRAMClockChangeLatencyMarginC = ActiveDRAMClockChangeLatencyMarginC
> -						- (1 - 1.0 / NumberOfActivePlanes) * SwathHeightC[k] * HTotal[k] / PixelClock[k] / VRatioChroma[k];
> +						- (1 - 1.0 / v->NumberOfActivePlanes) * SwathHeightC[k] * v->HTotal[k] / v->PixelClock[k] / v->VRatioChroma[k];
>   			}
>   			v->ActiveDRAMClockChangeLatencyMargin[k] = dml_min(ActiveDRAMClockChangeLatencyMarginY, ActiveDRAMClockChangeLatencyMarginC);
>   		} else {
>   			v->ActiveDRAMClockChangeLatencyMargin[k] = ActiveDRAMClockChangeLatencyMarginY;
>   		}
>   
> -		if (WritebackEnable[k] == true) {
> -			WritebackDRAMClockChangeLatencyHiding = WritebackInterfaceBufferSize * 1024
> -					/ (WritebackDestinationWidth[k] * WritebackDestinationHeight[k] / (WritebackSourceHeight[k] * HTotal[k] / PixelClock[k]) * 4);
> -			if (WritebackPixelFormat[k] == dm_444_64) {
> +		if (v->WritebackEnable[k] == true) {
> +			WritebackDRAMClockChangeLatencyHiding = v->WritebackInterfaceBufferSize * 1024
> +					/ (v->WritebackDestinationWidth[k] * v->WritebackDestinationHeight[k] / (v->WritebackSourceHeight[k] * v->HTotal[k] / v->PixelClock[k]) * 4);
> +			if (v->WritebackPixelFormat[k] == dm_444_64) {
>   				WritebackDRAMClockChangeLatencyHiding = WritebackDRAMClockChangeLatencyHiding / 2;
>   			}
>   			WritebackDRAMClockChangeLatencyMargin = WritebackDRAMClockChangeLatencyHiding - v->WritebackDRAMClockChangeWatermark;
> @@ -5862,14 +5718,14 @@ static void CalculateWatermarksAndDRAMSpeedChangeSupport(
>   
>   	v->MinActiveDRAMClockChangeMargin = 999999;
>   	PlaneWithMinActiveDRAMClockChangeMargin = 0;
> -	for (k = 0; k < NumberOfActivePlanes; ++k) {
> +	for (k = 0; k < v->NumberOfActivePlanes; ++k) {
>   		if (v->ActiveDRAMClockChangeLatencyMargin[k] < v->MinActiveDRAMClockChangeMargin) {
>   			v->MinActiveDRAMClockChangeMargin = v->ActiveDRAMClockChangeLatencyMargin[k];
> -			if (BlendingAndTiming[k] == k) {
> +			if (v->BlendingAndTiming[k] == k) {
>   				PlaneWithMinActiveDRAMClockChangeMargin = k;
>   			} else {
> -				for (j = 0; j < NumberOfActivePlanes; ++j) {
> -					if (BlendingAndTiming[k] == j) {
> +				for (j = 0; j < v->NumberOfActivePlanes; ++j) {
> +					if (v->BlendingAndTiming[k] == j) {
>   						PlaneWithMinActiveDRAMClockChangeMargin = j;
>   					}
>   				}
> @@ -5877,11 +5733,11 @@ static void CalculateWatermarksAndDRAMSpeedChangeSupport(
>   		}
>   	}
>   
> -	*MinActiveDRAMClockChangeLatencySupported = v->MinActiveDRAMClockChangeMargin + DRAMClockChangeLatency;
> +	v->MinActiveDRAMClockChangeLatencySupported = v->MinActiveDRAMClockChangeMargin + v->DRAMClockChangeLatency ;
>   
>   	SecondMinActiveDRAMClockChangeMarginOneDisplayInVBLank = 999999;
> -	for (k = 0; k < NumberOfActivePlanes; ++k) {
> -		if (!((k == PlaneWithMinActiveDRAMClockChangeMargin) && (BlendingAndTiming[k] == k)) && !(BlendingAndTiming[k] == PlaneWithMinActiveDRAMClockChangeMargin)
> +	for (k = 0; k < v->NumberOfActivePlanes; ++k) {
> +		if (!((k == PlaneWithMinActiveDRAMClockChangeMargin) && (v->BlendingAndTiming[k] == k)) && !(v->BlendingAndTiming[k] == PlaneWithMinActiveDRAMClockChangeMargin)
>   				&& v->ActiveDRAMClockChangeLatencyMargin[k] < SecondMinActiveDRAMClockChangeMarginOneDisplayInVBLank) {
>   			SecondMinActiveDRAMClockChangeMarginOneDisplayInVBLank = v->ActiveDRAMClockChangeLatencyMargin[k];
>   		}
> @@ -5889,25 +5745,25 @@ static void CalculateWatermarksAndDRAMSpeedChangeSupport(
>   
>   	v->TotalNumberOfActiveOTG = 0;
>   
> -	for (k = 0; k < NumberOfActivePlanes; ++k) {
> -		if (BlendingAndTiming[k] == k) {
> +	for (k = 0; k < v->NumberOfActivePlanes; ++k) {
> +		if (v->BlendingAndTiming[k] == k) {
>   			v->TotalNumberOfActiveOTG = v->TotalNumberOfActiveOTG + 1;
>   		}
>   	}
>   
>   	if (v->MinActiveDRAMClockChangeMargin > 0 && PrefetchMode == 0) {
>   		*DRAMClockChangeSupport = dm_dram_clock_change_vactive;
> -	} else if ((SynchronizedVBlank == true || v->TotalNumberOfActiveOTG == 1
> +	} else if ((v->SynchronizedVBlank == true || v->TotalNumberOfActiveOTG == 1
>   			|| SecondMinActiveDRAMClockChangeMarginOneDisplayInVBLank > 0) && PrefetchMode == 0) {
>   		*DRAMClockChangeSupport = dm_dram_clock_change_vblank;
>   	} else {
>   		*DRAMClockChangeSupport = dm_dram_clock_change_unsupported;
>   	}
>   
> -	*StutterExitWatermark = SRExitTime + ExtraLatency + 10 / DCFCLKDeepSleep;
> -	*StutterEnterPlusExitWatermark = (SREnterPlusExitTime + ExtraLatency + 10 / DCFCLKDeepSleep);
> -	*Z8StutterExitWatermark = SRExitZ8Time + ExtraLatency + 10 / DCFCLKDeepSleep;
> -	*Z8StutterEnterPlusExitWatermark = SREnterPlusExitZ8Time + ExtraLatency + 10 / DCFCLKDeepSleep;
> +	*StutterExitWatermark = v->SRExitTime + ExtraLatency + 10 / DCFCLKDeepSleep;
> +	*StutterEnterPlusExitWatermark = (v->SREnterPlusExitTime + ExtraLatency + 10 / DCFCLKDeepSleep);
> +	*Z8StutterExitWatermark = v->SRExitZ8Time + ExtraLatency + 10 / DCFCLKDeepSleep;
> +	*Z8StutterEnterPlusExitWatermark = v->SREnterPlusExitZ8Time + ExtraLatency + 10 / DCFCLKDeepSleep;
>   
>   #ifdef __DML_VBA_DEBUG__
>   	dml_print("DML::%s: StutterExitWatermark = %f\n", __func__, *StutterExitWatermark);
>
> base-commit: dacd2d2d9d800b7ab2ee2734578112532cba8105


^ permalink raw reply	[relevance 99%]

* [PATCH] drm/vmwgfx: cleanup comments
@ 2022-07-30 13:57 66% Tom Rix
  0 siblings, 0 replies; 180+ results
From: Tom Rix @ 2022-07-30 13:57 UTC (permalink / raw)
  To: zackr, linux-graphics-maintainer, airlied, daniel, cai.huoqing
  Cc: Tom Rix, linux-kernel, dri-devel

Remove second 'should'

Spelling replacements
aqcuire     -> acquire
applcations -> applications
assumings   -> assumes
begining    -> beginning
commited    -> committed
contol      -> control
inbetween   -> in between
resorces    -> resources
succesful   -> successful
successfule -> successful

Signed-off-by: Tom Rix <trix@redhat.com>
---
 drivers/gpu/drm/vmwgfx/device_include/vm_basic_types.h | 2 +-
 drivers/gpu/drm/vmwgfx/ttm_object.h                    | 4 ++--
 drivers/gpu/drm/vmwgfx/vmwgfx_bo.c                     | 2 +-
 drivers/gpu/drm/vmwgfx/vmwgfx_cmdbuf_res.c             | 8 ++++----
 drivers/gpu/drm/vmwgfx/vmwgfx_kms.h                    | 2 +-
 drivers/gpu/drm/vmwgfx/vmwgfx_resource.c               | 8 ++++----
 drivers/gpu/drm/vmwgfx/vmwgfx_simple_resource.c        | 2 +-
 7 files changed, 14 insertions(+), 14 deletions(-)

diff --git a/drivers/gpu/drm/vmwgfx/device_include/vm_basic_types.h b/drivers/gpu/drm/vmwgfx/device_include/vm_basic_types.h
index 1f6e3bbc6605..f84376718086 100644
--- a/drivers/gpu/drm/vmwgfx/device_include/vm_basic_types.h
+++ b/drivers/gpu/drm/vmwgfx/device_include/vm_basic_types.h
@@ -121,7 +121,7 @@ typedef __attribute__((aligned(32))) struct MKSGuestStatInfoEntry {
  *
  * Since the MKSGuestStatInfoEntry structures contain userlevel
  * pointers, the InstanceDescriptor also contains pointers to the
- * begining of these sections allowing the host side code to correctly
+ * beginning of these sections allowing the host side code to correctly
  * interpret the pointers.
  *
  * Because the host side code never acknowledges anything back to the
diff --git a/drivers/gpu/drm/vmwgfx/ttm_object.h b/drivers/gpu/drm/vmwgfx/ttm_object.h
index 4c8700027c6d..1a2fa0f83f5f 100644
--- a/drivers/gpu/drm/vmwgfx/ttm_object.h
+++ b/drivers/gpu/drm/vmwgfx/ttm_object.h
@@ -96,7 +96,7 @@ struct ttm_object_device;
  *
  * This struct is intended to be used as a base struct for objects that
  * are visible to user-space. It provides a global name, race-safe
- * access and refcounting, minimal access contol and hooks for unref actions.
+ * access and refcounting, minimal access control and hooks for unref actions.
  */
 
 struct ttm_base_object {
@@ -138,7 +138,7 @@ struct ttm_prime_object {
  *
  * @tfile: Pointer to a struct ttm_object_file.
  * @base: The struct ttm_base_object to initialize.
- * @shareable: This object is shareable with other applcations.
+ * @shareable: This object is shareable with other applications.
  * (different @tfile pointers.)
  * @type: The object type.
  * @refcount_release: See the struct ttm_base_object description.
diff --git a/drivers/gpu/drm/vmwgfx/vmwgfx_bo.c b/drivers/gpu/drm/vmwgfx/vmwgfx_bo.c
index 85a66014c2b6..58246471597c 100644
--- a/drivers/gpu/drm/vmwgfx/vmwgfx_bo.c
+++ b/drivers/gpu/drm/vmwgfx/vmwgfx_bo.c
@@ -729,7 +729,7 @@ int vmw_user_bo_lookup(struct drm_file *filp,
  * Any persistent usage of the object requires a refcount to be taken using
  * ttm_bo_reference_unless_doomed(). Iff this function returns successfully it
  * needs to be paired with vmw_user_bo_noref_release() and no sleeping-
- * or scheduling functions may be called inbetween these function calls.
+ * or scheduling functions may be called in between these function calls.
  *
  * Return: A struct vmw_buffer_object pointer if successful or negative
  * error pointer on failure.
diff --git a/drivers/gpu/drm/vmwgfx/vmwgfx_cmdbuf_res.c b/drivers/gpu/drm/vmwgfx/vmwgfx_cmdbuf_res.c
index 415774fde796..82ef58ccdd42 100644
--- a/drivers/gpu/drm/vmwgfx/vmwgfx_cmdbuf_res.c
+++ b/drivers/gpu/drm/vmwgfx/vmwgfx_cmdbuf_res.c
@@ -36,7 +36,7 @@
  * @res: Refcounted pointer to a struct vmw_resource.
  * @hash: Hash entry for the manager hash table.
  * @head: List head used either by the staging list or the manager list
- * of commited resources.
+ * of committed resources.
  * @state: Staging state of this resource entry.
  * @man: Pointer to a resource manager for this entry.
  */
@@ -51,9 +51,9 @@ struct vmw_cmdbuf_res {
 /**
  * struct vmw_cmdbuf_res_manager - Command buffer resource manager.
  *
- * @resources: Hash table containing staged and commited command buffer
+ * @resources: Hash table containing staged and committed command buffer
  * resources
- * @list: List of commited command buffer resources.
+ * @list: List of committed command buffer resources.
  * @dev_priv: Pointer to a device private structure.
  *
  * @resources and @list are protected by the cmdbuf mutex for now.
@@ -118,7 +118,7 @@ static void vmw_cmdbuf_res_free(struct vmw_cmdbuf_res_manager *man,
  * This function commits a list of command buffer resource
  * additions or removals.
  * It is typically called when the execbuf ioctl call triggering these
- * actions has commited the fifo contents to the device.
+ * actions has committed the fifo contents to the device.
  */
 void vmw_cmdbuf_res_commit(struct list_head *list)
 {
diff --git a/drivers/gpu/drm/vmwgfx/vmwgfx_kms.h b/drivers/gpu/drm/vmwgfx/vmwgfx_kms.h
index 7046dfd0d1c6..85f86faa3243 100644
--- a/drivers/gpu/drm/vmwgfx/vmwgfx_kms.h
+++ b/drivers/gpu/drm/vmwgfx/vmwgfx_kms.h
@@ -70,7 +70,7 @@ struct vmw_du_update_plane {
 	 *
 	 * Some surface resource or buffer object need some extra cmd submission
 	 * like update GB image for proxy surface and define a GMRFB for screen
-	 * object. That should should be done here as this callback will be
+	 * object. That should be done here as this callback will be
 	 * called after FIFO allocation with the address of command buufer.
 	 *
 	 * This callback is optional.
diff --git a/drivers/gpu/drm/vmwgfx/vmwgfx_resource.c b/drivers/gpu/drm/vmwgfx/vmwgfx_resource.c
index a7d62a4eb47b..f66caa540e14 100644
--- a/drivers/gpu/drm/vmwgfx/vmwgfx_resource.c
+++ b/drivers/gpu/drm/vmwgfx/vmwgfx_resource.c
@@ -525,7 +525,7 @@ void vmw_resource_unreserve(struct vmw_resource *res,
  *                             for a resource and in that case, allocate
  *                             one, reserve and validate it.
  *
- * @ticket:         The ww aqcquire context to use, or NULL if trylocking.
+ * @ticket:         The ww acquire context to use, or NULL if trylocking.
  * @res:            The resource for which to allocate a backup buffer.
  * @interruptible:  Whether any sleeps during allocation should be
  *                  performed while interruptible.
@@ -686,7 +686,7 @@ static int vmw_resource_do_evict(struct ww_acquire_ctx *ticket,
  * @intr: Perform waits interruptible if possible.
  * @dirtying: Pending GPU operation will dirty the resource
  *
- * On succesful return, any backup DMA buffer pointed to by @res->backup will
+ * On successful return, any backup DMA buffer pointed to by @res->backup will
  * be reserved and validated.
  * On hardware resource shortage, this function will repeatedly evict
  * resources of the same type until the validation succeeds.
@@ -804,7 +804,7 @@ void vmw_resource_unbind_list(struct vmw_buffer_object *vbo)
  * @dx_query_mob: Buffer containing the DX query MOB
  *
  * Read back cached states from the device if they exist.  This function
- * assumings binding_mutex is held.
+ * assumes binding_mutex is held.
  */
 int vmw_query_readback_all(struct vmw_buffer_object *dx_query_mob)
 {
@@ -1125,7 +1125,7 @@ int vmw_resources_clean(struct vmw_buffer_object *vbo, pgoff_t start,
 	}
 
 	/*
-	 * In order of increasing backup_offset, clean dirty resorces
+	 * In order of increasing backup_offset, clean dirty resources
 	 * intersecting the range.
 	 */
 	while (found) {
diff --git a/drivers/gpu/drm/vmwgfx/vmwgfx_simple_resource.c b/drivers/gpu/drm/vmwgfx/vmwgfx_simple_resource.c
index 483ad544ea54..0d51b4542269 100644
--- a/drivers/gpu/drm/vmwgfx/vmwgfx_simple_resource.c
+++ b/drivers/gpu/drm/vmwgfx/vmwgfx_simple_resource.c
@@ -196,7 +196,7 @@ vmw_simple_resource_create_ioctl(struct drm_device *dev, void *data,
  * type.
  *
  * Returns: Refcounted pointer to the embedded struct vmw_resource if
- * successfule. Error pointer otherwise.
+ * successful. Error pointer otherwise.
  */
 struct vmw_resource *
 vmw_simple_resource_lookup(struct ttm_object_file *tfile,
-- 
2.27.0


^ permalink raw reply related	[relevance 66%]

* Re: [PATCH] drm/nouveau/bios: set info only when the return is not 0
  @ 2022-07-15 20:24 99%     ` Tom Rix
  0 siblings, 0 replies; 180+ results
From: Tom Rix @ 2022-07-15 20:24 UTC (permalink / raw)
  To: Lyude Paul, bskeggs, kherbst, airlied, daniel, nathan, ndesaulniers
  Cc: nouveau, llvm, linux-kernel, dri-devel


On 7/15/22 12:09 PM, Lyude Paul wrote:
> On Mon, 2022-07-04 at 17:32 -0400, Lyude Paul wrote:
>> Reviewed-by: Lyude Paul <lyude@redhat.com>
>>
>> Currently on flakey internet in the back of a car, so I probably won't be
>> able
>> to push this until I get back tonight or early tomorrow
> Whoops! Slipped my mind when I got back, but I just remembered it now so I
> will go ahead and push :). apologies for the delay!

Thanks!

T

>
>> On Sat, 2022-07-02 at 11:39 -0400, Tom Rix wrote:
>>> clang static analysis reports
>>> drivers/gpu/drm/nouveau/nvkm/subdev/bios/pmu.c:68:17: warning: The right
>>> operand of '*' is a garbage value [core.UndefinedBinaryOperatorResult]
>>>          switch (!!data * *ver) {
>>>                         ^ ~~~~
>>> A switch statement with only a default should be reduced to an if.
>>>
>>> If nvbios_pmuEp() returns 0, via the data variable, the output info
>>> parameter
>>> is not used.  So set info only when data is not 0.
>>>
>>> The struct nvbios_pmuE only has the type and data elements.  Since both of
>>> these
>>> are explicitly set, memset is not needed.  So remove it.
>>>
>>> Signed-off-by: Tom Rix <trix@redhat.com>
>>> ---
>>>   drivers/gpu/drm/nouveau/nvkm/subdev/bios/pmu.c | 5 +----
>>>   1 file changed, 1 insertion(+), 4 deletions(-)
>>>
>>> diff --git a/drivers/gpu/drm/nouveau/nvkm/subdev/bios/pmu.c
>>> b/drivers/gpu/drm/nouveau/nvkm/subdev/bios/pmu.c
>>> index b4a308f3cf7b..49e2664a734c 100644
>>> --- a/drivers/gpu/drm/nouveau/nvkm/subdev/bios/pmu.c
>>> +++ b/drivers/gpu/drm/nouveau/nvkm/subdev/bios/pmu.c
>>> @@ -64,12 +64,9 @@ nvbios_pmuEp(struct nvkm_bios *bios, int idx, u8 *ver,
>>> u8
>>> *hdr,
>>>               struct nvbios_pmuE *info)
>>>   {
>>>          u32 data = nvbios_pmuEe(bios, idx, ver, hdr);
>>> -       memset(info, 0x00, sizeof(*info));
>>> -       switch (!!data * *ver) {
>>> -       default:
>>> +       if (data) {
>>>                  info->type = nvbios_rd08(bios, data + 0x00);
>>>                  info->data = nvbios_rd32(bios, data + 0x02);
>>> -               break;
>>>          }
>>>          return data;
>>>   }


^ permalink raw reply	[relevance 99%]

* [PATCH] drm/nouveau/bios: set info only when the return is not 0
@ 2022-07-02 15:39 97% Tom Rix
    0 siblings, 1 reply; 180+ results
From: Tom Rix @ 2022-07-02 15:39 UTC (permalink / raw)
  To: bskeggs, kherbst, lyude, airlied, daniel, nathan, ndesaulniers
  Cc: nouveau, llvm, linux-kernel, dri-devel, Tom Rix

clang static analysis reports
drivers/gpu/drm/nouveau/nvkm/subdev/bios/pmu.c:68:17: warning: The right operand of '*' is a garbage value [core.UndefinedBinaryOperatorResult]
        switch (!!data * *ver) {
                       ^ ~~~~
A switch statement with only a default should be reduced to an if.

If nvbios_pmuEp() returns 0, via the data variable, the output info parameter
is not used.  So set info only when data is not 0.

The struct nvbios_pmuE only has the type and data elements.  Since both of these
are explicitly set, memset is not needed.  So remove it.

Signed-off-by: Tom Rix <trix@redhat.com>
---
 drivers/gpu/drm/nouveau/nvkm/subdev/bios/pmu.c | 5 +----
 1 file changed, 1 insertion(+), 4 deletions(-)

diff --git a/drivers/gpu/drm/nouveau/nvkm/subdev/bios/pmu.c b/drivers/gpu/drm/nouveau/nvkm/subdev/bios/pmu.c
index b4a308f3cf7b..49e2664a734c 100644
--- a/drivers/gpu/drm/nouveau/nvkm/subdev/bios/pmu.c
+++ b/drivers/gpu/drm/nouveau/nvkm/subdev/bios/pmu.c
@@ -64,12 +64,9 @@ nvbios_pmuEp(struct nvkm_bios *bios, int idx, u8 *ver, u8 *hdr,
 	     struct nvbios_pmuE *info)
 {
 	u32 data = nvbios_pmuEe(bios, idx, ver, hdr);
-	memset(info, 0x00, sizeof(*info));
-	switch (!!data * *ver) {
-	default:
+	if (data) {
 		info->type = nvbios_rd08(bios, data + 0x00);
 		info->data = nvbios_rd32(bios, data + 0x02);
-		break;
 	}
 	return data;
 }
-- 
2.27.0


^ permalink raw reply related	[relevance 97%]

* [PATCH] drm/i915/display: clean up comments
@ 2022-07-01 20:32 94% Tom Rix
  0 siblings, 0 replies; 180+ results
From: Tom Rix @ 2022-07-01 20:32 UTC (permalink / raw)
  To: jani.nikula, joonas.lahtinen, rodrigo.vivi, tvrtko.ursulin,
	airlied, daniel, jose.souza, jouni.hogander, gwan-gyeong.mun,
	ville.syrjala, matthew.d.roper
  Cc: Tom Rix, intel-gfx, linux-kernel, dri-devel

spelling changes
resoluition -> resolution
dont        -> don't
commmit     -> commit
Invalidade  -> Invalidate

Signed-off-by: Tom Rix <trix@redhat.com>
---
 drivers/gpu/drm/i915/display/intel_psr.c | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/drivers/gpu/drm/i915/display/intel_psr.c b/drivers/gpu/drm/i915/display/intel_psr.c
index 7d61c55184e5..e6a870641cd2 100644
--- a/drivers/gpu/drm/i915/display/intel_psr.c
+++ b/drivers/gpu/drm/i915/display/intel_psr.c
@@ -555,7 +555,7 @@ static void hsw_activate_psr2(struct intel_dp *intel_dp)
 		/*
 		 * TODO: 7 lines of IO_BUFFER_WAKE and FAST_WAKE are default
 		 * values from BSpec. In order to setting an optimal power
-		 * consumption, lower than 4k resoluition mode needs to decrese
+		 * consumption, lower than 4k resolution mode needs to decrease
 		 * IO_BUFFER_WAKE and FAST_WAKE. And higher than 4K resolution
 		 * mode needs to increase IO_BUFFER_WAKE and FAST_WAKE.
 		 */
@@ -959,7 +959,7 @@ void intel_psr_compute_config(struct intel_dp *intel_dp,
 	int psr_setup_time;
 
 	/*
-	 * Current PSR panels dont work reliably with VRR enabled
+	 * Current PSR panels don't work reliably with VRR enabled
 	 * So if VRR is enabled, do not enable PSR.
 	 */
 	if (crtc_state->vrr.enable)
@@ -1664,7 +1664,7 @@ static void intel_psr2_sel_fetch_pipe_alignment(const struct intel_crtc_state *c
  *
  * Plane scaling and rotation is not supported by selective fetch and both
  * properties can change without a modeset, so need to be check at every
- * atomic commmit.
+ * atomic commit.
  */
 static bool psr2_sel_fetch_plane_state_supported(const struct intel_plane_state *plane_state)
 {
@@ -2203,7 +2203,7 @@ static void _psr_invalidate_handle(struct intel_dp *intel_dp)
 }
 
 /**
- * intel_psr_invalidate - Invalidade PSR
+ * intel_psr_invalidate - Invalidate PSR
  * @dev_priv: i915 device
  * @frontbuffer_bits: frontbuffer plane tracking bits
  * @origin: which operation caused the invalidate
-- 
2.27.0


^ permalink raw reply related	[relevance 94%]

* [PATCH] drm/vc4: change vc4_dma_range_matches from a global to static
@ 2022-06-29 20:01 99% Tom Rix
  0 siblings, 0 replies; 180+ results
From: Tom Rix @ 2022-06-29 20:01 UTC (permalink / raw)
  To: emma, mripard, airlied, daniel, dave.stevenson
  Cc: Tom Rix, linux-kernel, dri-devel

sparse reports
drivers/gpu/drm/vc4/vc4_drv.c:270:27: warning: symbol 'vc4_dma_range_matches' was not declared. Should it be static?

vc4_dma_range_matches is only used in vc4_drv.c, so it's storage class specifier
should be static.

Fixes: da8e393e23ef ("drm/vc4: drv: Adopt the dma configuration from the HVS or V3D component")
Signed-off-by: Tom Rix <trix@redhat.com>
---
 drivers/gpu/drm/vc4/vc4_drv.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/gpu/drm/vc4/vc4_drv.c b/drivers/gpu/drm/vc4/vc4_drv.c
index 2b014b6332a6..292d1b6a01b6 100644
--- a/drivers/gpu/drm/vc4/vc4_drv.c
+++ b/drivers/gpu/drm/vc4/vc4_drv.c
@@ -267,7 +267,7 @@ static void vc4_match_add_drivers(struct device *dev,
 	}
 }
 
-const struct of_device_id vc4_dma_range_matches[] = {
+static const struct of_device_id vc4_dma_range_matches[] = {
 	{ .compatible = "brcm,bcm2711-hvs" },
 	{ .compatible = "brcm,bcm2835-hvs" },
 	{ .compatible = "brcm,bcm2835-v3d" },
-- 
2.27.0


^ permalink raw reply related	[relevance 99%]

* [PATCH] drm/amd/display: change to_dal_irq_source_dnc32() storage class specifier to static
@ 2022-06-26 14:46 99% Tom Rix
  0 siblings, 0 replies; 180+ results
From: Tom Rix @ 2022-06-26 14:46 UTC (permalink / raw)
  To: harry.wentland, sunpeng.li, Rodrigo.Siqueira, alexander.deucher,
	christian.koenig, Xinhui.Pan, airlied, daniel, Qingqing.Zhuo,
	mario.limonciello, nicholas.kazlauskas, aurabindo.pillai,
	maira.canal
  Cc: Tom Rix, dri-devel, amd-gfx, linux-kernel

sparse reports
drivers/gpu/drm/amd/amdgpu/../display/dc/irq/dcn32/irq_service_dcn32.c:39:20: warning: symbol 'to_dal_irq_source_dcn32' was not declared. Should it be static?

to_dal_irq_source_dnc32() is only referenced in irq_service_dnc32.c, so change its
storage class specifier to static.

Fixes: 0efd4374f6b4 ("drm/amd/display: add dcn32 IRQ changes")
Signed-off-by: Tom Rix <trix@redhat.com>
---
 drivers/gpu/drm/amd/display/dc/irq/dcn32/irq_service_dcn32.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/gpu/drm/amd/display/dc/irq/dcn32/irq_service_dcn32.c b/drivers/gpu/drm/amd/display/dc/irq/dcn32/irq_service_dcn32.c
index 3a213ca2f077..b1012fa1977b 100644
--- a/drivers/gpu/drm/amd/display/dc/irq/dcn32/irq_service_dcn32.c
+++ b/drivers/gpu/drm/amd/display/dc/irq/dcn32/irq_service_dcn32.c
@@ -36,7 +36,7 @@
 
 #define DCN_BASE__INST0_SEG2                       0x000034C0
 
-enum dc_irq_source to_dal_irq_source_dcn32(
+static enum dc_irq_source to_dal_irq_source_dcn32(
 		struct irq_service *irq_service,
 		uint32_t src_id,
 		uint32_t ext_id)
-- 
2.27.0


^ permalink raw reply related	[relevance 99%]

* [PATCH] drm/amd/display: Remove unused globals FORCE_RATE and FORCE_LANE_COUNT
@ 2022-06-26 14:20 96% Tom Rix
  0 siblings, 0 replies; 180+ results
From: Tom Rix @ 2022-06-26 14:20 UTC (permalink / raw)
  To: harry.wentland, sunpeng.li, Rodrigo.Siqueira, alexander.deucher,
	christian.koenig, Xinhui.Pan, airlied, daniel, wenjing.liu,
	Jun.Lei, George.Shen, Jimmy.Kizito, Jerry.Zuo, michael.strauss,
	aurabindo.pillai
  Cc: Tom Rix, dri-devel, amd-gfx, linux-kernel

sparse reports
drivers/gpu/drm/amd/amdgpu/../display/dc/core/dc_link_dp.c:3885:6: warning: symbol 'FORCE_RATE' was not declared. Should it be static?
drivers/gpu/drm/amd/amdgpu/../display/dc/core/dc_link_dp.c:3886:10: warning: symbol 'FORCE_LANE_COUNT' was not declared. Should it be static?

Neither of thse variables is used in dc_link_dp.c.  Reviewing the commit listed in
the fixes tag shows neither was used in the original patch.  So remove them.

Fixes: 265280b99822 ("drm/amd/display: add CLKMGR changes for DCN32/321")
Signed-off-by: Tom Rix <trix@redhat.com>
---
 drivers/gpu/drm/amd/display/dc/core/dc_link_dp.c | 3 ---
 1 file changed, 3 deletions(-)

diff --git a/drivers/gpu/drm/amd/display/dc/core/dc_link_dp.c b/drivers/gpu/drm/amd/display/dc/core/dc_link_dp.c
index be1dcb0a2a06..f3421f2bd52e 100644
--- a/drivers/gpu/drm/amd/display/dc/core/dc_link_dp.c
+++ b/drivers/gpu/drm/amd/display/dc/core/dc_link_dp.c
@@ -3882,9 +3882,6 @@ static bool decide_mst_link_settings(const struct dc_link *link, struct dc_link_
 	return true;
 }
 
-bool FORCE_RATE = false;
-uint32_t FORCE_LANE_COUNT = 0;
-
 void decide_link_settings(struct dc_stream_state *stream,
 	struct dc_link_settings *link_setting)
 {
-- 
2.27.0


^ permalink raw reply related	[relevance 96%]

* [PATCH] drm/nouveau/fifo/gv100-: set gv100_fifo_runlist storage-class to static
@ 2022-05-28 14:18 99% Tom Rix
  0 siblings, 0 replies; 180+ results
From: Tom Rix @ 2022-05-28 14:18 UTC (permalink / raw)
  To: bskeggs, kherbst, lyude, airlied, daniel
  Cc: nouveau, linux-kernel, dri-devel, Tom Rix

sparse reports
drivers/gpu/drm/nouveau/nvkm/engine/fifo/gv100.c:56:1: warning: symbol 'gv100_fifo_runlist' was not declared. Should it be static?

gv100_fifo_runlist is only used in gv100.c, so change it to static.

Signed-off-by: Tom Rix <trix@redhat.com>
---
 drivers/gpu/drm/nouveau/nvkm/engine/fifo/gv100.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/gpu/drm/nouveau/nvkm/engine/fifo/gv100.c b/drivers/gpu/drm/nouveau/nvkm/engine/fifo/gv100.c
index 70e16a91ac12..faf0fe9f704c 100644
--- a/drivers/gpu/drm/nouveau/nvkm/engine/fifo/gv100.c
+++ b/drivers/gpu/drm/nouveau/nvkm/engine/fifo/gv100.c
@@ -52,7 +52,7 @@ gv100_fifo_runlist_cgrp(struct nvkm_fifo_cgrp *cgrp,
 	nvkm_wo32(memory, offset + 0xc, 0x00000000);
 }
 
-const struct gk104_fifo_runlist_func
+static const struct gk104_fifo_runlist_func
 gv100_fifo_runlist = {
 	.size = 16,
 	.cgrp = gv100_fifo_runlist_cgrp,
-- 
2.27.0


^ permalink raw reply related	[relevance 99%]

* [PATCH] xen: remove setting of 'transp' parameter
@ 2022-05-21 19:59 99% Tom Rix
  0 siblings, 0 replies; 180+ results
From: Tom Rix @ 2022-05-21 19:59 UTC (permalink / raw)
  To: deller, tzimmermann, javierm, boris.ostrovsky, jgross
  Cc: Tom Rix, linux-fbdev, linux-kernel, dri-devel

cppcheck reports
[drivers/video/fbdev/xen-fbfront.c:226]: (style) Assignment of function parameter has no effect outside the function.

The value parameter 'transp' is not used, so setting it can be removed.

Signed-off-by: Tom Rix <trix@redhat.com>
---
 drivers/video/fbdev/xen-fbfront.c | 1 -
 1 file changed, 1 deletion(-)

diff --git a/drivers/video/fbdev/xen-fbfront.c b/drivers/video/fbdev/xen-fbfront.c
index 3bed357a9870..4d2694d904aa 100644
--- a/drivers/video/fbdev/xen-fbfront.c
+++ b/drivers/video/fbdev/xen-fbfront.c
@@ -223,7 +223,6 @@ static int xenfb_setcolreg(unsigned regno, unsigned red, unsigned green,
 	red = CNVT_TOHW(red, info->var.red.length);
 	green = CNVT_TOHW(green, info->var.green.length);
 	blue = CNVT_TOHW(blue, info->var.blue.length);
-	transp = CNVT_TOHW(transp, info->var.transp.length);
 #undef CNVT_TOHW
 
 	v = (red << info->var.red.offset) |
-- 
2.27.0


^ permalink raw reply related	[relevance 99%]

* [PATCH] drm/rockchip: remove vop_writel
@ 2022-05-21 19:07 99% Tom Rix
  0 siblings, 0 replies; 180+ results
From: Tom Rix @ 2022-05-21 19:07 UTC (permalink / raw)
  To: hjc, heiko, airlied, daniel
  Cc: linux-rockchip, Tom Rix, linux-arm-kernel, dri-devel, linux-kernel

cppcheck reports
[drivers/gpu/drm/rockchip/rockchip_drm_vop.c:186]: (style) The function 'vop_writel' is never used.

vop_writel is static function that is not used, so remove it.

Signed-off-by: Tom Rix <trix@redhat.com>
---
 drivers/gpu/drm/rockchip/rockchip_drm_vop.c | 6 ------
 1 file changed, 6 deletions(-)

diff --git a/drivers/gpu/drm/rockchip/rockchip_drm_vop.c b/drivers/gpu/drm/rockchip/rockchip_drm_vop.c
index 74562d40f639..d1026e78feff 100644
--- a/drivers/gpu/drm/rockchip/rockchip_drm_vop.c
+++ b/drivers/gpu/drm/rockchip/rockchip_drm_vop.c
@@ -183,12 +183,6 @@ struct vop {
 	struct vop_win win[];
 };
 
-static inline void vop_writel(struct vop *vop, uint32_t offset, uint32_t v)
-{
-	writel(v, vop->regs + offset);
-	vop->regsbak[offset >> 2] = v;
-}
-
 static inline uint32_t vop_readl(struct vop *vop, uint32_t offset)
 {
 	return readl(vop->regs + offset);
-- 
2.27.0


^ permalink raw reply related	[relevance 99%]

* [PATCH] drm/nouveau/disp/gv100: make gv100_disp_wndw and gv100_disp_wndw_mthd static
@ 2022-04-25 13:13 99% Tom Rix
  0 siblings, 0 replies; 180+ results
From: Tom Rix @ 2022-04-25 13:13 UTC (permalink / raw)
  To: bskeggs, kherbst, lyude, airlied, daniel
  Cc: nouveau, linux-kernel, dri-devel, Tom Rix

Sparse reports these issues
wndwgv100.c:120:1: warning: symbol 'gv100_disp_wndw_mthd' was not declared. Should it be static?
wndwgv100.c:140:1: warning: symbol 'gv100_disp_wndw' was not declared. Should it be static?

These variable are only used in wndwgv100.c.  Single file variables should be static.
So use static as their storage-class specifiers.

Signed-off-by: Tom Rix <trix@redhat.com>
---
 drivers/gpu/drm/nouveau/nvkm/engine/disp/wndwgv100.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/gpu/drm/nouveau/nvkm/engine/disp/wndwgv100.c b/drivers/gpu/drm/nouveau/nvkm/engine/disp/wndwgv100.c
index 5d3b641dbb14..e635247d794f 100644
--- a/drivers/gpu/drm/nouveau/nvkm/engine/disp/wndwgv100.c
+++ b/drivers/gpu/drm/nouveau/nvkm/engine/disp/wndwgv100.c
@@ -116,7 +116,7 @@ gv100_disp_wndw_mthd_base = {
 	}
 };
 
-const struct nv50_disp_chan_mthd
+static const struct nv50_disp_chan_mthd
 gv100_disp_wndw_mthd = {
 	.name = "Window",
 	.addr = 0x001000,
@@ -136,7 +136,7 @@ gv100_disp_wndw_intr(struct nv50_disp_chan *chan, bool en)
 	nvkm_mask(device, 0x611da4, mask, data);
 }
 
-const struct nv50_disp_chan_func
+static const struct nv50_disp_chan_func
 gv100_disp_wndw = {
 	.init = gv100_disp_dmac_init,
 	.fini = gv100_disp_dmac_fini,
-- 
2.27.0


^ permalink raw reply related	[relevance 99%]

* [PATCH] drm/nouveau/disp/gv100: make gv100_disp_wimm static
@ 2022-04-25 13:00 99% Tom Rix
  0 siblings, 0 replies; 180+ results
From: Tom Rix @ 2022-04-25 13:00 UTC (permalink / raw)
  To: bskeggs, kherbst, lyude, airlied, daniel
  Cc: nouveau, linux-kernel, dri-devel, Tom Rix

Sparse reports this issue
wimmgv100.c:39:1: warning: symbol 'gv100_disp_wimm' was not declared. Should it be static?

This variable is only used in wimmgv100.c.  Single file variables should be static.
So use static as its storage-class specifier.

Signed-off-by: Tom Rix <trix@redhat.com>
---
 drivers/gpu/drm/nouveau/nvkm/engine/disp/wimmgv100.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/gpu/drm/nouveau/nvkm/engine/disp/wimmgv100.c b/drivers/gpu/drm/nouveau/nvkm/engine/disp/wimmgv100.c
index 89d783368b4f..bb4db6351ddf 100644
--- a/drivers/gpu/drm/nouveau/nvkm/engine/disp/wimmgv100.c
+++ b/drivers/gpu/drm/nouveau/nvkm/engine/disp/wimmgv100.c
@@ -35,7 +35,7 @@ gv100_disp_wimm_intr(struct nv50_disp_chan *chan, bool en)
 	nvkm_mask(device, 0x611da8, mask, data);
 }
 
-const struct nv50_disp_chan_func
+static const struct nv50_disp_chan_func
 gv100_disp_wimm = {
 	.init = gv100_disp_dmac_init,
 	.fini = gv100_disp_dmac_fini,
-- 
2.27.0


^ permalink raw reply related	[relevance 99%]

* [PATCH] drm/radeon: change cac_weights_* to static
@ 2022-04-23 20:01 99% Tom Rix
  0 siblings, 0 replies; 180+ results
From: Tom Rix @ 2022-04-23 20:01 UTC (permalink / raw)
  To: alexander.deucher, christian.koenig, Xinhui.Pan, airlied, daniel
  Cc: Tom Rix, dri-devel, amd-gfx, linux-kernel

Sparse reports these issues
si_dpm.c:332:26: warning: symbol 'cac_weights_pitcairn' was not declared. Should it be static?
si_dpm.c:1088:26: warning: symbol 'cac_weights_oland' was not declared. Should it be static?

Both of these variables are only used in si_dpm.c.  Single file variables
should be static, so change their storage-class specifiers to static.

Signed-off-by: Tom Rix <trix@redhat.com>
---
 drivers/gpu/drm/radeon/si_dpm.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/gpu/drm/radeon/si_dpm.c b/drivers/gpu/drm/radeon/si_dpm.c
index 3add39c1a689..fbf968e3f6d7 100644
--- a/drivers/gpu/drm/radeon/si_dpm.c
+++ b/drivers/gpu/drm/radeon/si_dpm.c
@@ -329,7 +329,7 @@ static const struct si_dte_data dte_data_malta =
 	true
 };
 
-struct si_cac_config_reg cac_weights_pitcairn[] =
+static struct si_cac_config_reg cac_weights_pitcairn[] =
 {
 	{ 0x0, 0x0000ffff, 0, 0x8a, SISLANDS_CACCONFIG_CGIND },
 	{ 0x0, 0xffff0000, 16, 0x0, SISLANDS_CACCONFIG_CGIND },
@@ -1085,7 +1085,7 @@ static const struct si_dte_data dte_data_venus_pro =
 	true
 };
 
-struct si_cac_config_reg cac_weights_oland[] =
+static struct si_cac_config_reg cac_weights_oland[] =
 {
 	{ 0x0, 0x0000ffff, 0, 0x82, SISLANDS_CACCONFIG_CGIND },
 	{ 0x0, 0xffff0000, 16, 0x4F, SISLANDS_CACCONFIG_CGIND },
-- 
2.27.0


^ permalink raw reply related	[relevance 99%]

* [PATCH] drm/kmb: remove layer_irqs variable
@ 2022-04-23 14:02 99% Tom Rix
  0 siblings, 0 replies; 180+ results
From: Tom Rix @ 2022-04-23 14:02 UTC (permalink / raw)
  To: anitha.chrisanthus, edmund.j.dea, airlied, daniel
  Cc: Tom Rix, linux-kernel, dri-devel

Sparse reports these issues
kmb_plane.c:21:11: warning: symbol 'layer_irqs' was not declared. Should it be static?

layer_irq in not used, so remove it.

Signed-off-by: Tom Rix <trix@redhat.com>
---
 drivers/gpu/drm/kmb/kmb_plane.c | 7 -------
 1 file changed, 7 deletions(-)

diff --git a/drivers/gpu/drm/kmb/kmb_plane.c b/drivers/gpu/drm/kmb/kmb_plane.c
index 2735b8eb3537..8fe93d149491 100644
--- a/drivers/gpu/drm/kmb/kmb_plane.c
+++ b/drivers/gpu/drm/kmb/kmb_plane.c
@@ -18,13 +18,6 @@
 #include "kmb_plane.h"
 #include "kmb_regs.h"
 
-const u32 layer_irqs[] = {
-	LCD_INT_VL0,
-	LCD_INT_VL1,
-	LCD_INT_GL0,
-	LCD_INT_GL1
-};
-
 /* Conversion (yuv->rgb) matrix from myriadx */
 static const u32 csc_coef_lcd[] = {
 	1024, 0, 1436,
-- 
2.27.0


^ permalink raw reply related	[relevance 99%]

* [PATCH] drm/radeon: change cik_default_state table from global to static
@ 2022-04-23 13:44 68% Tom Rix
  0 siblings, 0 replies; 180+ results
From: Tom Rix @ 2022-04-23 13:44 UTC (permalink / raw)
  To: alexander.deucher, christian.koenig, Xinhui.Pan, airlied, daniel
  Cc: Tom Rix, dri-devel, linux-kernel, amd-gfx

Sparse reports these issues
cik_blit_shaders.c:31:11: warning: symbol 'cik_default_state' was not declared. Should it be static?
cik_blit_shaders.c:246:11: warning: symbol 'cik_default_size' was not declared. Should it be static?

cik_default_state and cik_default_size are only used in cik.c. Single file symbols
should be static. So move their definitions to cik_blit_shaders.h and change their
storage-class-specifier to static.

Remove unneeded cik_blit_shader.c

Signed-off-by: Tom Rix <trix@redhat.com>
---
 drivers/gpu/drm/radeon/Makefile           |   2 +-
 drivers/gpu/drm/radeon/cik_blit_shaders.c | 246 ----------------------
 drivers/gpu/drm/radeon/cik_blit_shaders.h | 219 ++++++++++++++++++-
 3 files changed, 218 insertions(+), 249 deletions(-)
 delete mode 100644 drivers/gpu/drm/radeon/cik_blit_shaders.c

diff --git a/drivers/gpu/drm/radeon/Makefile b/drivers/gpu/drm/radeon/Makefile
index 1045d2c46a76..ea5380e24c3c 100644
--- a/drivers/gpu/drm/radeon/Makefile
+++ b/drivers/gpu/drm/radeon/Makefile
@@ -44,7 +44,7 @@ radeon-y += radeon_device.o radeon_asic.o radeon_kms.o \
 	evergreen.o evergreen_cs.o \
 	evergreen_hdmi.o radeon_trace_points.o ni.o \
 	atombios_encoders.o radeon_semaphore.o radeon_sa.o atombios_i2c.o si.o \
-	radeon_prime.o cik.o cik_blit_shaders.o \
+	radeon_prime.o cik.o \
 	r600_dpm.o rs780_dpm.o rv6xx_dpm.o rv770_dpm.o rv730_dpm.o rv740_dpm.o \
 	rv770_smc.o cypress_dpm.o btc_dpm.o sumo_dpm.o sumo_smc.o trinity_dpm.o \
 	trinity_smc.o ni_dpm.o si_smc.o si_dpm.o kv_smc.o kv_dpm.o ci_smc.o \
diff --git a/drivers/gpu/drm/radeon/cik_blit_shaders.c b/drivers/gpu/drm/radeon/cik_blit_shaders.c
deleted file mode 100644
index ff1311806e91..000000000000
--- a/drivers/gpu/drm/radeon/cik_blit_shaders.c
+++ /dev/null
@@ -1,246 +0,0 @@
-/*
- * Copyright 2012 Advanced Micro Devices, Inc.
- *
- * Permission is hereby granted, free of charge, to any person obtaining a
- * copy of this software and associated documentation files (the "Software"),
- * to deal in the Software without restriction, including without limitation
- * the rights to use, copy, modify, merge, publish, distribute, sublicense,
- * and/or sell copies of the Software, and to permit persons to whom the
- * Software is furnished to do so, subject to the following conditions:
- *
- * The above copyright notice and this permission notice (including the next
- * paragraph) shall be included in all copies or substantial portions of the
- * Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
- * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
- * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL
- * THE COPYRIGHT HOLDER(S) AND/OR ITS SUPPLIERS BE LIABLE FOR ANY CLAIM, DAMAGES OR
- * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
- * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
- * DEALINGS IN THE SOFTWARE.
- *
- * Authors:
- *     Alex Deucher <alexander.deucher@amd.com>
- */
-
-#include <linux/types.h>
-#include <linux/bug.h>
-#include <linux/kernel.h>
-
-const u32 cik_default_state[] =
-{
-	0xc0066900,
-	0x00000000,
-	0x00000060, /* DB_RENDER_CONTROL */
-	0x00000000, /* DB_COUNT_CONTROL */
-	0x00000000, /* DB_DEPTH_VIEW */
-	0x0000002a, /* DB_RENDER_OVERRIDE */
-	0x00000000, /* DB_RENDER_OVERRIDE2 */
-	0x00000000, /* DB_HTILE_DATA_BASE */
-
-	0xc0046900,
-	0x00000008,
-	0x00000000, /* DB_DEPTH_BOUNDS_MIN */
-	0x00000000, /* DB_DEPTH_BOUNDS_MAX */
-	0x00000000, /* DB_STENCIL_CLEAR */
-	0x00000000, /* DB_DEPTH_CLEAR */
-
-	0xc0036900,
-	0x0000000f,
-	0x00000000, /* DB_DEPTH_INFO */
-	0x00000000, /* DB_Z_INFO */
-	0x00000000, /* DB_STENCIL_INFO */
-
-	0xc0016900,
-	0x00000080,
-	0x00000000, /* PA_SC_WINDOW_OFFSET */
-
-	0xc00d6900,
-	0x00000083,
-	0x0000ffff, /* PA_SC_CLIPRECT_RULE */
-	0x00000000, /* PA_SC_CLIPRECT_0_TL */
-	0x20002000, /* PA_SC_CLIPRECT_0_BR */
-	0x00000000,
-	0x20002000,
-	0x00000000,
-	0x20002000,
-	0x00000000,
-	0x20002000,
-	0xaaaaaaaa, /* PA_SC_EDGERULE */
-	0x00000000, /* PA_SU_HARDWARE_SCREEN_OFFSET */
-	0x0000000f, /* CB_TARGET_MASK */
-	0x0000000f, /* CB_SHADER_MASK */
-
-	0xc0226900,
-	0x00000094,
-	0x80000000, /* PA_SC_VPORT_SCISSOR_0_TL */
-	0x20002000, /* PA_SC_VPORT_SCISSOR_0_BR */
-	0x80000000,
-	0x20002000,
-	0x80000000,
-	0x20002000,
-	0x80000000,
-	0x20002000,
-	0x80000000,
-	0x20002000,
-	0x80000000,
-	0x20002000,
-	0x80000000,
-	0x20002000,
-	0x80000000,
-	0x20002000,
-	0x80000000,
-	0x20002000,
-	0x80000000,
-	0x20002000,
-	0x80000000,
-	0x20002000,
-	0x80000000,
-	0x20002000,
-	0x80000000,
-	0x20002000,
-	0x80000000,
-	0x20002000,
-	0x80000000,
-	0x20002000,
-	0x80000000,
-	0x20002000,
-	0x00000000, /* PA_SC_VPORT_ZMIN_0 */
-	0x3f800000, /* PA_SC_VPORT_ZMAX_0 */
-
-	0xc0046900,
-	0x00000100,
-	0xffffffff, /* VGT_MAX_VTX_INDX */
-	0x00000000, /* VGT_MIN_VTX_INDX */
-	0x00000000, /* VGT_INDX_OFFSET */
-	0x00000000, /* VGT_MULTI_PRIM_IB_RESET_INDX */
-
-	0xc0046900,
-	0x00000105,
-	0x00000000, /* CB_BLEND_RED */
-	0x00000000, /* CB_BLEND_GREEN */
-	0x00000000, /* CB_BLEND_BLUE */
-	0x00000000, /* CB_BLEND_ALPHA */
-
-	0xc0016900,
-	0x000001e0,
-	0x00000000, /* CB_BLEND0_CONTROL */
-
-	0xc00c6900,
-	0x00000200,
-	0x00000000, /* DB_DEPTH_CONTROL */
-	0x00000000, /* DB_EQAA */
-	0x00cc0010, /* CB_COLOR_CONTROL */
-	0x00000210, /* DB_SHADER_CONTROL */
-	0x00010000, /* PA_CL_CLIP_CNTL */
-	0x00000004, /* PA_SU_SC_MODE_CNTL */
-	0x00000100, /* PA_CL_VTE_CNTL */
-	0x00000000, /* PA_CL_VS_OUT_CNTL */
-	0x00000000, /* PA_CL_NANINF_CNTL */
-	0x00000000, /* PA_SU_LINE_STIPPLE_CNTL */
-	0x00000000, /* PA_SU_LINE_STIPPLE_SCALE */
-	0x00000000, /* PA_SU_PRIM_FILTER_CNTL */
-
-	0xc0116900,
-	0x00000280,
-	0x00000000, /* PA_SU_POINT_SIZE */
-	0x00000000, /* PA_SU_POINT_MINMAX */
-	0x00000008, /* PA_SU_LINE_CNTL */
-	0x00000000, /* PA_SC_LINE_STIPPLE */
-	0x00000000, /* VGT_OUTPUT_PATH_CNTL */
-	0x00000000, /* VGT_HOS_CNTL */
-	0x00000000,
-	0x00000000,
-	0x00000000,
-	0x00000000,
-	0x00000000,
-	0x00000000,
-	0x00000000,
-	0x00000000,
-	0x00000000,
-	0x00000000,
-	0x00000000, /* VGT_GS_MODE */
-
-	0xc0026900,
-	0x00000292,
-	0x00000000, /* PA_SC_MODE_CNTL_0 */
-	0x00000000, /* PA_SC_MODE_CNTL_1 */
-
-	0xc0016900,
-	0x000002a1,
-	0x00000000, /* VGT_PRIMITIVEID_EN */
-
-	0xc0016900,
-	0x000002a5,
-	0x00000000, /* VGT_MULTI_PRIM_IB_RESET_EN */
-
-	0xc0026900,
-	0x000002a8,
-	0x00000000, /* VGT_INSTANCE_STEP_RATE_0 */
-	0x00000000,
-
-	0xc0026900,
-	0x000002ad,
-	0x00000000, /* VGT_REUSE_OFF */
-	0x00000000,
-
-	0xc0016900,
-	0x000002d5,
-	0x00000000, /* VGT_SHADER_STAGES_EN */
-
-	0xc0016900,
-	0x000002dc,
-	0x0000aa00, /* DB_ALPHA_TO_MASK */
-
-	0xc0066900,
-	0x000002de,
-	0x00000000, /* PA_SU_POLY_OFFSET_DB_FMT_CNTL */
-	0x00000000,
-	0x00000000,
-	0x00000000,
-	0x00000000,
-	0x00000000,
-
-	0xc0026900,
-	0x000002e5,
-	0x00000000, /* VGT_STRMOUT_CONFIG */
-	0x00000000,
-
-	0xc01b6900,
-	0x000002f5,
-	0x76543210, /* PA_SC_CENTROID_PRIORITY_0 */
-	0xfedcba98, /* PA_SC_CENTROID_PRIORITY_1 */
-	0x00000000, /* PA_SC_LINE_CNTL */
-	0x00000000, /* PA_SC_AA_CONFIG */
-	0x00000005, /* PA_SU_VTX_CNTL */
-	0x3f800000, /* PA_CL_GB_VERT_CLIP_ADJ */
-	0x3f800000, /* PA_CL_GB_VERT_DISC_ADJ */
-	0x3f800000, /* PA_CL_GB_HORZ_CLIP_ADJ */
-	0x3f800000, /* PA_CL_GB_HORZ_DISC_ADJ */
-	0x00000000, /* PA_SC_AA_SAMPLE_LOCS_PIXEL_X0Y0_0 */
-	0x00000000,
-	0x00000000,
-	0x00000000,
-	0x00000000,
-	0x00000000,
-	0x00000000,
-	0x00000000,
-	0x00000000,
-	0x00000000,
-	0x00000000,
-	0x00000000,
-	0x00000000,
-	0x00000000,
-	0x00000000,
-	0x00000000,
-	0xffffffff, /* PA_SC_AA_MASK_X0Y0_X1Y0 */
-	0xffffffff,
-
-	0xc0026900,
-	0x00000316,
-	0x0000000e, /* VGT_VERTEX_REUSE_BLOCK_CNTL */
-	0x00000010, /*  */
-};
-
-const u32 cik_default_size = ARRAY_SIZE(cik_default_state);
diff --git a/drivers/gpu/drm/radeon/cik_blit_shaders.h b/drivers/gpu/drm/radeon/cik_blit_shaders.h
index dfe7314f9ff4..d2a2e2316814 100644
--- a/drivers/gpu/drm/radeon/cik_blit_shaders.h
+++ b/drivers/gpu/drm/radeon/cik_blit_shaders.h
@@ -20,13 +20,228 @@
  * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
  * DEALINGS IN THE SOFTWARE.
  *
+ * Authors:
+ *     Alex Deucher <alexander.deucher@amd.com>
  */
 
 #ifndef CIK_BLIT_SHADERS_H
 #define CIK_BLIT_SHADERS_H
 
-extern const u32 cik_default_state[];
+static const u32 cik_default_state[] =
+{
+	0xc0066900,
+	0x00000000,
+	0x00000060, /* DB_RENDER_CONTROL */
+	0x00000000, /* DB_COUNT_CONTROL */
+	0x00000000, /* DB_DEPTH_VIEW */
+	0x0000002a, /* DB_RENDER_OVERRIDE */
+	0x00000000, /* DB_RENDER_OVERRIDE2 */
+	0x00000000, /* DB_HTILE_DATA_BASE */
 
-extern const u32 cik_default_size;
+	0xc0046900,
+	0x00000008,
+	0x00000000, /* DB_DEPTH_BOUNDS_MIN */
+	0x00000000, /* DB_DEPTH_BOUNDS_MAX */
+	0x00000000, /* DB_STENCIL_CLEAR */
+	0x00000000, /* DB_DEPTH_CLEAR */
+
+	0xc0036900,
+	0x0000000f,
+	0x00000000, /* DB_DEPTH_INFO */
+	0x00000000, /* DB_Z_INFO */
+	0x00000000, /* DB_STENCIL_INFO */
+
+	0xc0016900,
+	0x00000080,
+	0x00000000, /* PA_SC_WINDOW_OFFSET */
+
+	0xc00d6900,
+	0x00000083,
+	0x0000ffff, /* PA_SC_CLIPRECT_RULE */
+	0x00000000, /* PA_SC_CLIPRECT_0_TL */
+	0x20002000, /* PA_SC_CLIPRECT_0_BR */
+	0x00000000,
+	0x20002000,
+	0x00000000,
+	0x20002000,
+	0x00000000,
+	0x20002000,
+	0xaaaaaaaa, /* PA_SC_EDGERULE */
+	0x00000000, /* PA_SU_HARDWARE_SCREEN_OFFSET */
+	0x0000000f, /* CB_TARGET_MASK */
+	0x0000000f, /* CB_SHADER_MASK */
+
+	0xc0226900,
+	0x00000094,
+	0x80000000, /* PA_SC_VPORT_SCISSOR_0_TL */
+	0x20002000, /* PA_SC_VPORT_SCISSOR_0_BR */
+	0x80000000,
+	0x20002000,
+	0x80000000,
+	0x20002000,
+	0x80000000,
+	0x20002000,
+	0x80000000,
+	0x20002000,
+	0x80000000,
+	0x20002000,
+	0x80000000,
+	0x20002000,
+	0x80000000,
+	0x20002000,
+	0x80000000,
+	0x20002000,
+	0x80000000,
+	0x20002000,
+	0x80000000,
+	0x20002000,
+	0x80000000,
+	0x20002000,
+	0x80000000,
+	0x20002000,
+	0x80000000,
+	0x20002000,
+	0x80000000,
+	0x20002000,
+	0x80000000,
+	0x20002000,
+	0x00000000, /* PA_SC_VPORT_ZMIN_0 */
+	0x3f800000, /* PA_SC_VPORT_ZMAX_0 */
+
+	0xc0046900,
+	0x00000100,
+	0xffffffff, /* VGT_MAX_VTX_INDX */
+	0x00000000, /* VGT_MIN_VTX_INDX */
+	0x00000000, /* VGT_INDX_OFFSET */
+	0x00000000, /* VGT_MULTI_PRIM_IB_RESET_INDX */
+
+	0xc0046900,
+	0x00000105,
+	0x00000000, /* CB_BLEND_RED */
+	0x00000000, /* CB_BLEND_GREEN */
+	0x00000000, /* CB_BLEND_BLUE */
+	0x00000000, /* CB_BLEND_ALPHA */
+
+	0xc0016900,
+	0x000001e0,
+	0x00000000, /* CB_BLEND0_CONTROL */
+
+	0xc00c6900,
+	0x00000200,
+	0x00000000, /* DB_DEPTH_CONTROL */
+	0x00000000, /* DB_EQAA */
+	0x00cc0010, /* CB_COLOR_CONTROL */
+	0x00000210, /* DB_SHADER_CONTROL */
+	0x00010000, /* PA_CL_CLIP_CNTL */
+	0x00000004, /* PA_SU_SC_MODE_CNTL */
+	0x00000100, /* PA_CL_VTE_CNTL */
+	0x00000000, /* PA_CL_VS_OUT_CNTL */
+	0x00000000, /* PA_CL_NANINF_CNTL */
+	0x00000000, /* PA_SU_LINE_STIPPLE_CNTL */
+	0x00000000, /* PA_SU_LINE_STIPPLE_SCALE */
+	0x00000000, /* PA_SU_PRIM_FILTER_CNTL */
+
+	0xc0116900,
+	0x00000280,
+	0x00000000, /* PA_SU_POINT_SIZE */
+	0x00000000, /* PA_SU_POINT_MINMAX */
+	0x00000008, /* PA_SU_LINE_CNTL */
+	0x00000000, /* PA_SC_LINE_STIPPLE */
+	0x00000000, /* VGT_OUTPUT_PATH_CNTL */
+	0x00000000, /* VGT_HOS_CNTL */
+	0x00000000,
+	0x00000000,
+	0x00000000,
+	0x00000000,
+	0x00000000,
+	0x00000000,
+	0x00000000,
+	0x00000000,
+	0x00000000,
+	0x00000000,
+	0x00000000, /* VGT_GS_MODE */
+
+	0xc0026900,
+	0x00000292,
+	0x00000000, /* PA_SC_MODE_CNTL_0 */
+	0x00000000, /* PA_SC_MODE_CNTL_1 */
+
+	0xc0016900,
+	0x000002a1,
+	0x00000000, /* VGT_PRIMITIVEID_EN */
+
+	0xc0016900,
+	0x000002a5,
+	0x00000000, /* VGT_MULTI_PRIM_IB_RESET_EN */
+
+	0xc0026900,
+	0x000002a8,
+	0x00000000, /* VGT_INSTANCE_STEP_RATE_0 */
+	0x00000000,
+
+	0xc0026900,
+	0x000002ad,
+	0x00000000, /* VGT_REUSE_OFF */
+	0x00000000,
+
+	0xc0016900,
+	0x000002d5,
+	0x00000000, /* VGT_SHADER_STAGES_EN */
+
+	0xc0016900,
+	0x000002dc,
+	0x0000aa00, /* DB_ALPHA_TO_MASK */
+
+	0xc0066900,
+	0x000002de,
+	0x00000000, /* PA_SU_POLY_OFFSET_DB_FMT_CNTL */
+	0x00000000,
+	0x00000000,
+	0x00000000,
+	0x00000000,
+	0x00000000,
+
+	0xc0026900,
+	0x000002e5,
+	0x00000000, /* VGT_STRMOUT_CONFIG */
+	0x00000000,
+
+	0xc01b6900,
+	0x000002f5,
+	0x76543210, /* PA_SC_CENTROID_PRIORITY_0 */
+	0xfedcba98, /* PA_SC_CENTROID_PRIORITY_1 */
+	0x00000000, /* PA_SC_LINE_CNTL */
+	0x00000000, /* PA_SC_AA_CONFIG */
+	0x00000005, /* PA_SU_VTX_CNTL */
+	0x3f800000, /* PA_CL_GB_VERT_CLIP_ADJ */
+	0x3f800000, /* PA_CL_GB_VERT_DISC_ADJ */
+	0x3f800000, /* PA_CL_GB_HORZ_CLIP_ADJ */
+	0x3f800000, /* PA_CL_GB_HORZ_DISC_ADJ */
+	0x00000000, /* PA_SC_AA_SAMPLE_LOCS_PIXEL_X0Y0_0 */
+	0x00000000,
+	0x00000000,
+	0x00000000,
+	0x00000000,
+	0x00000000,
+	0x00000000,
+	0x00000000,
+	0x00000000,
+	0x00000000,
+	0x00000000,
+	0x00000000,
+	0x00000000,
+	0x00000000,
+	0x00000000,
+	0x00000000,
+	0xffffffff, /* PA_SC_AA_MASK_X0Y0_X1Y0 */
+	0xffffffff,
+
+	0xc0026900,
+	0x00000316,
+	0x0000000e, /* VGT_VERTEX_REUSE_BLOCK_CNTL */
+	0x00000010, /*  */
+};
+
+static const u32 cik_default_size = ARRAY_SIZE(cik_default_state);
 
 #endif
-- 
2.27.0


^ permalink raw reply related	[relevance 68%]

* [PATCH] fbcon: change fbcon_*registered_fb variables to static
@ 2022-04-23 12:56 99% Tom Rix
  0 siblings, 0 replies; 180+ results
From: Tom Rix @ 2022-04-23 12:56 UTC (permalink / raw)
  To: daniel, deller, sam, tzimmermann, javierm, cssk
  Cc: Tom Rix, linux-fbdev, linux-kernel, dri-devel

Sparse reports these issues
fbcon.c:106:16: warning: symbol 'fbcon_registered_fb' was not declared. Should it be static?
fbcon.c:107:5: warning: symbol 'fbcon_num_registered_fb' was not declared. Should it be static?

These variables are only used in fbcon.c. Single file use variables should
be static, so change their storage-class specifiers to static.

Signed-off-by: Tom Rix <trix@redhat.com>
---
 drivers/video/fbdev/core/fbcon.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/video/fbdev/core/fbcon.c b/drivers/video/fbdev/core/fbcon.c
index c4e91715ef00..225ac0fe0143 100644
--- a/drivers/video/fbdev/core/fbcon.c
+++ b/drivers/video/fbdev/core/fbcon.c
@@ -103,8 +103,8 @@ enum {
 
 static struct fbcon_display fb_display[MAX_NR_CONSOLES];
 
-struct fb_info *fbcon_registered_fb[FB_MAX];
-int fbcon_num_registered_fb;
+static struct fb_info *fbcon_registered_fb[FB_MAX];
+static int fbcon_num_registered_fb;
 
 #define fbcon_for_each_registered_fb(i)		\
 	for (i = 0; WARN_CONSOLE_UNLOCKED(), i < FB_MAX; i++)		\
-- 
2.27.0


^ permalink raw reply related	[relevance 99%]

* [PATCH] drm/nouveau/kms/gv100: use static for gv100_disp_core_mthd_[base|sor]
@ 2022-04-22 18:51 99% Tom Rix
  0 siblings, 0 replies; 180+ results
From: Tom Rix @ 2022-04-22 18:51 UTC (permalink / raw)
  To: bskeggs, kherbst, lyude, airlied, daniel
  Cc: nouveau, linux-kernel, dri-devel, Tom Rix

Sparse reports these issues
coregv100.c:27:1: warning: symbol 'gv100_disp_core_mthd_base' was not declared. Should it be static?
coregv100.c:43:1: warning: symbol 'gv100_disp_core_mthd_sor' was not declared. Should it be static?

These variables are only used in coregv100.c.  Single file use
variables should be static, so add static to their storage-class specifier.

Signed-off-by: Tom Rix <trix@redhat.com>
---
 drivers/gpu/drm/nouveau/nvkm/engine/disp/coregv100.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/gpu/drm/nouveau/nvkm/engine/disp/coregv100.c b/drivers/gpu/drm/nouveau/nvkm/engine/disp/coregv100.c
index 448a515057c7..1d333c484a49 100644
--- a/drivers/gpu/drm/nouveau/nvkm/engine/disp/coregv100.c
+++ b/drivers/gpu/drm/nouveau/nvkm/engine/disp/coregv100.c
@@ -23,7 +23,7 @@
 
 #include <subdev/timer.h>
 
-const struct nv50_disp_mthd_list
+static const struct nv50_disp_mthd_list
 gv100_disp_core_mthd_base = {
 	.mthd = 0x0000,
 	.addr = 0x000000,
@@ -39,7 +39,7 @@ gv100_disp_core_mthd_base = {
 	}
 };
 
-const struct nv50_disp_mthd_list
+static const struct nv50_disp_mthd_list
 gv100_disp_core_mthd_sor = {
 	.mthd = 0x0020,
 	.addr = 0x000020,
-- 
2.27.0


^ permalink raw reply related	[relevance 99%]

* [PATCH] drm/rockchip: cdn-dp: change rk3399_cdn_dp from global to static
@ 2022-04-21 14:43 99% Tom Rix
  0 siblings, 0 replies; 180+ results
From: Tom Rix @ 2022-04-21 14:43 UTC (permalink / raw)
  To: hjc, heiko, airlied, daniel
  Cc: linux-rockchip, Tom Rix, linux-arm-kernel, dri-devel, linux-kernel

Smatch reports this issue
cdn-dp-core.c:51:20: warning: symbol 'rk3399_cdn_dp' was not declared. Should it be static?

rk3399_cdn_dp is only used in cdn-dp-core.c so change
its storge-class specifier to static.

Signed-off-by: Tom Rix <trix@redhat.com>
---
 drivers/gpu/drm/rockchip/cdn-dp-core.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/gpu/drm/rockchip/cdn-dp-core.c b/drivers/gpu/drm/rockchip/cdn-dp-core.c
index d3e6c93739bf..ce67c9daa2b1 100644
--- a/drivers/gpu/drm/rockchip/cdn-dp-core.c
+++ b/drivers/gpu/drm/rockchip/cdn-dp-core.c
@@ -48,7 +48,7 @@ struct cdn_dp_data {
 	u8 max_phy;
 };
 
-struct cdn_dp_data rk3399_cdn_dp = {
+static struct cdn_dp_data rk3399_cdn_dp = {
 	.max_phy = 2,
 };
 
-- 
2.27.0


^ permalink raw reply related	[relevance 99%]

* [PATCH] drm/qxl: remove qxl_log_level global
@ 2022-04-21 14:20 99% Tom Rix
  0 siblings, 0 replies; 180+ results
From: Tom Rix @ 2022-04-21 14:20 UTC (permalink / raw)
  To: airlied, kraxel, airlied, daniel
  Cc: spice-devel, Tom Rix, linux-kernel, dri-devel, virtualization

Smatch reports this issue
qxl_kms.c:36:5: warning: symbol 'qxl_log_level' was not declared. Should it be static?

qxl_log_level is defined qxl_kms.c but unused, so remove.

Signed-off-by: Tom Rix <trix@redhat.com>
---
 drivers/gpu/drm/qxl/qxl_kms.c | 2 --
 1 file changed, 2 deletions(-)

diff --git a/drivers/gpu/drm/qxl/qxl_kms.c b/drivers/gpu/drm/qxl/qxl_kms.c
index a054e4a00fe8..9bf6d4cc98d4 100644
--- a/drivers/gpu/drm/qxl/qxl_kms.c
+++ b/drivers/gpu/drm/qxl/qxl_kms.c
@@ -33,8 +33,6 @@
 #include "qxl_drv.h"
 #include "qxl_object.h"
 
-int qxl_log_level;
-
 static bool qxl_check_device(struct qxl_device *qdev)
 {
 	struct qxl_rom *rom = qdev->rom;
-- 
2.27.0


^ permalink raw reply related	[relevance 99%]

* [PATCH] drm/nouveau/gsp: change gv100_gsp from global to static
@ 2022-04-21 13:30 99% Tom Rix
  0 siblings, 0 replies; 180+ results
From: Tom Rix @ 2022-04-21 13:30 UTC (permalink / raw)
  To: bskeggs, kherbst, lyude, airlied, daniel
  Cc: nouveau, linux-kernel, dri-devel, Tom Rix

Smatch reports this issue
gv100.c:46:1: warning: symbol 'gv100_gsp' was not declared. Should it be static?

gv100_gsp is only used in gv100.c so change its
storage-class specifier to static.

Signed-off-by: Tom Rix <trix@redhat.com>
---
 drivers/gpu/drm/nouveau/nvkm/subdev/gsp/gv100.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/gpu/drm/nouveau/nvkm/subdev/gsp/gv100.c b/drivers/gpu/drm/nouveau/nvkm/subdev/gsp/gv100.c
index 2ac7fc934c09..6c4ef62a746a 100644
--- a/drivers/gpu/drm/nouveau/nvkm/subdev/gsp/gv100.c
+++ b/drivers/gpu/drm/nouveau/nvkm/subdev/gsp/gv100.c
@@ -42,7 +42,7 @@ gv100_gsp_nofw(struct nvkm_gsp *gsp, int ver, const struct nvkm_gsp_fwif *fwif)
 	return 0;
 }
 
-struct nvkm_gsp_fwif
+static struct nvkm_gsp_fwif
 gv100_gsp[] = {
 	{ -1, gv100_gsp_nofw, &gv100_gsp_flcn },
 	{}
-- 
2.27.0


^ permalink raw reply related	[relevance 99%]

* [PATCH] drm/msm: change msm_sched_ops from global to static
@ 2022-04-21 13:15 99% Tom Rix
  0 siblings, 0 replies; 180+ results
From: Tom Rix @ 2022-04-21 13:15 UTC (permalink / raw)
  To: robdclark, sean, quic_abhinavk, airlied, daniel
  Cc: linux-arm-msm, freedreno, linux-kernel, dri-devel, Tom Rix

Smatch reports this issue
msm_ringbuffer.c:43:36: warning: symbol 'msm_sched_ops' was not declared. Should it be static?

msm_sched_ops is only used in msm_ringbuffer.c so change its
storage-class specifier to static.

Signed-off-by: Tom Rix <trix@redhat.com>
---
 drivers/gpu/drm/msm/msm_ringbuffer.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/gpu/drm/msm/msm_ringbuffer.c b/drivers/gpu/drm/msm/msm_ringbuffer.c
index 367a6aaa3a20..66f4ec09ef67 100644
--- a/drivers/gpu/drm/msm/msm_ringbuffer.c
+++ b/drivers/gpu/drm/msm/msm_ringbuffer.c
@@ -40,7 +40,7 @@ static void msm_job_free(struct drm_sched_job *job)
 	msm_gem_submit_put(submit);
 }
 
-const struct drm_sched_backend_ops msm_sched_ops = {
+static const struct drm_sched_backend_ops msm_sched_ops = {
 	.run_job = msm_job_run,
 	.free_job = msm_job_free
 };
-- 
2.27.0


^ permalink raw reply related	[relevance 99%]

* [PATCH] drm/amd/display: add virtual_setup_stream_attribute decl to header
@ 2022-04-18 19:48 99% Tom Rix
  0 siblings, 0 replies; 180+ results
From: Tom Rix @ 2022-04-18 19:48 UTC (permalink / raw)
  To: harry.wentland, sunpeng.li, Rodrigo.Siqueira, alexander.deucher,
	christian.koenig, Xinhui.Pan, airlied, daniel, stylon.wang,
	Jun.Lei, wenjing.liu
  Cc: Tom Rix, dri-devel, amd-gfx, linux-kernel

Smatch reports this issue
virtual_link_hwss.c:32:6: warning: symbol
  'virtual_setup_stream_attribute' was not declared.
  Should it be static?

virtual_setup_stream_attribute is only used in
virtual_link_hwss.c, but the other functions in the
file are declared in the header file and used elsewhere.
For consistency, add the virtual_setup_stream_attribute
decl to virtual_link_hwss.h.

Signed-off-by: Tom Rix <trix@redhat.com>
---
 drivers/gpu/drm/amd/display/dc/virtual/virtual_link_hwss.h | 1 +
 1 file changed, 1 insertion(+)

diff --git a/drivers/gpu/drm/amd/display/dc/virtual/virtual_link_hwss.h b/drivers/gpu/drm/amd/display/dc/virtual/virtual_link_hwss.h
index e6bcb4bb0f3a..fbcbc5afb47d 100644
--- a/drivers/gpu/drm/amd/display/dc/virtual/virtual_link_hwss.h
+++ b/drivers/gpu/drm/amd/display/dc/virtual/virtual_link_hwss.h
@@ -28,6 +28,7 @@
 #include "core_types.h"
 
 void virtual_setup_stream_encoder(struct pipe_ctx *pipe_ctx);
+void virtual_setup_stream_attribute(struct pipe_ctx *pipe_ctx);
 void virtual_reset_stream_encoder(struct pipe_ctx *pipe_ctx);
 const struct link_hwss *get_virtual_link_hwss(void);
 
-- 
2.27.0


^ permalink raw reply related	[relevance 99%]

* [PATCH] drm/nouveau/gr/gf100-: change gf108_gr_fwif from global to static
@ 2022-04-18 15:28 99% Tom Rix
  0 siblings, 0 replies; 180+ results
From: Tom Rix @ 2022-04-18 15:28 UTC (permalink / raw)
  To: bskeggs, kherbst, lyude, airlied, daniel
  Cc: nouveau, linux-kernel, dri-devel, Tom Rix

Smatch reports this issue
gf108.c:147:1: warning: symbol 'gf108_gr_fwif'
  was not declared. Should it be static?

gf108_gr_fwif is only used in gf108.c.  Single
file variables should not be global so change
gf108_gr_fwif's storage-class specifier to static.

Signed-off-by: Tom Rix <trix@redhat.com>
---
 drivers/gpu/drm/nouveau/nvkm/engine/gr/gf108.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/gpu/drm/nouveau/nvkm/engine/gr/gf108.c b/drivers/gpu/drm/nouveau/nvkm/engine/gr/gf108.c
index 030640bb3dca..ab3760e804b8 100644
--- a/drivers/gpu/drm/nouveau/nvkm/engine/gr/gf108.c
+++ b/drivers/gpu/drm/nouveau/nvkm/engine/gr/gf108.c
@@ -143,7 +143,7 @@ gf108_gr = {
 	}
 };
 
-const struct gf100_gr_fwif
+static const struct gf100_gr_fwif
 gf108_gr_fwif[] = {
 	{ -1, gf100_gr_load, &gf108_gr },
 	{ -1, gf100_gr_nofw, &gf108_gr },
-- 
2.27.0


^ permalink raw reply related	[relevance 99%]

* [PATCH] drm/nouveau: change base917c_format from global to static
@ 2022-04-18 14:18 99% Tom Rix
  0 siblings, 0 replies; 180+ results
From: Tom Rix @ 2022-04-18 14:18 UTC (permalink / raw)
  To: bskeggs, kherbst, lyude, airlied, daniel
  Cc: nouveau, linux-kernel, dri-devel, Tom Rix

Smatch reports this issue
base917c.c:26:1: warning: symbol 'base917c_format'
  was not declared. Should it be static?

base917c_format is only used in base917.c.  Single
file variables should not be global so change
base917c_format's storage-class specifier to static.

Signed-off-by: Tom Rix <trix@redhat.com>
---
 drivers/gpu/drm/nouveau/dispnv50/base917c.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/gpu/drm/nouveau/dispnv50/base917c.c b/drivers/gpu/drm/nouveau/dispnv50/base917c.c
index a1baed4fe0e9..ca260509a4f1 100644
--- a/drivers/gpu/drm/nouveau/dispnv50/base917c.c
+++ b/drivers/gpu/drm/nouveau/dispnv50/base917c.c
@@ -22,7 +22,7 @@
 #include "base.h"
 #include "atom.h"
 
-const u32
+static const u32
 base917c_format[] = {
 	DRM_FORMAT_C8,
 	DRM_FORMAT_XRGB8888,
-- 
2.27.0


^ permalink raw reply related	[relevance 99%]

* [PATCH v2] drm/i915: change node clearing from memset to initialization
@ 2022-04-16 22:34 97% Tom Rix
  0 siblings, 0 replies; 180+ results
From: Tom Rix @ 2022-04-16 22:34 UTC (permalink / raw)
  To: jani.nikula, joonas.lahtinen, rodrigo.vivi, tvrtko.ursulin,
	airlied, daniel
  Cc: Tom Rix, intel-gfx, linux-kernel, dri-devel

In insert_mappable_node(), the parameter node is
cleared late in node's use with memset.
insert_mappable_node() is a singleton, called only
from i915_gem_gtt_prepare() which itself is only
called by i915_gem_gtt_pread() and
i915_gem_gtt_pwrite_fast() where the definition of
node originates.

Instead of using memset, initialize node to 0 at its
definitions.

Signed-off-by: Tom Rix <trix@redhat.com>
---
v2: restore clearing of flags

 drivers/gpu/drm/i915/i915_gem.c | 5 ++---
 1 file changed, 2 insertions(+), 3 deletions(-)

diff --git a/drivers/gpu/drm/i915/i915_gem.c b/drivers/gpu/drm/i915/i915_gem.c
index 2e10187cd0a0..268b1f66b873 100644
--- a/drivers/gpu/drm/i915/i915_gem.c
+++ b/drivers/gpu/drm/i915/i915_gem.c
@@ -69,7 +69,6 @@ insert_mappable_node(struct i915_ggtt *ggtt, struct drm_mm_node *node, u32 size)
 	if (err)
 		return err;
 
-	memset(node, 0, sizeof(*node));
 	err = drm_mm_insert_node_in_range(&ggtt->vm.mm, node,
 					  size, 0, I915_COLOR_UNEVICTABLE,
 					  0, ggtt->mappable_end,
@@ -381,7 +380,7 @@ i915_gem_gtt_pread(struct drm_i915_gem_object *obj,
 	struct drm_i915_private *i915 = to_i915(obj->base.dev);
 	struct i915_ggtt *ggtt = to_gt(i915)->ggtt;
 	intel_wakeref_t wakeref;
-	struct drm_mm_node node;
+	struct drm_mm_node node = {};
 	void __user *user_data;
 	struct i915_vma *vma;
 	u64 remain, offset;
@@ -538,7 +537,7 @@ i915_gem_gtt_pwrite_fast(struct drm_i915_gem_object *obj,
 	struct i915_ggtt *ggtt = to_gt(i915)->ggtt;
 	struct intel_runtime_pm *rpm = &i915->runtime_pm;
 	intel_wakeref_t wakeref;
-	struct drm_mm_node node;
+	struct drm_mm_node node = {};
 	struct i915_vma *vma;
 	u64 remain, offset;
 	void __user *user_data;
-- 
2.27.0


^ permalink raw reply related	[relevance 97%]

* Re: [PATCH] drm/i915: change node clearing from memset to initialization
  @ 2022-04-16 22:25 99%       ` Tom Rix
  0 siblings, 0 replies; 180+ results
From: Tom Rix @ 2022-04-16 22:25 UTC (permalink / raw)
  To: Joe Perches, jani.nikula, joonas.lahtinen, rodrigo.vivi,
	tvrtko.ursulin, airlied, daniel
  Cc: intel-gfx, linux-kernel, dri-devel


On 4/16/22 2:04 PM, Joe Perches wrote:
> On Sat, 2022-04-16 at 13:48 -0700, Tom Rix wrote:
>> On 4/16/22 11:33 AM, Joe Perches wrote:
>>> On Sat, 2022-04-16 at 13:23 -0400, Tom Rix wrote:
>>>> In insert_mappable_node(), the parameter node is
>>>> cleared late in node's use with memset.
>>>> insert_mappable_node() is a singleton, called only
>>>> from i915_gem_gtt_prepare() which itself is only
>>>> called by i915_gem_gtt_pread() and
>>>> i915_gem_gtt_pwrite_fast() where the definition of
>>>> node originates.
>>>>
>>>> Instead of using memset, initialize node to 0 at it's
>>>> definitions.
>>> trivia: /it's/its/
>>>
>>> Only reason _not_ to do this is memset is guaranteed to
>>> zero any padding that might go to userspace.
>>>
>>> But it doesn't seem there is any padding anyway nor is
>>> the struct available to userspace.
>>>
>>> So this seems fine though it might increase overall code
>>> size a tiny bit.
>>>
>>> I do have a caveat: see below:
>>>
>>>> diff --git a/drivers/gpu/drm/i915/i915_gem.c b/drivers/gpu/drm/i915/i915_gem.c
>>> []
>>>> @@ -328,7 +327,6 @@ static struct i915_vma *i915_gem_gtt_prepare(struct drm_i915_gem_object *obj,
>>>>    		goto err_ww;
>>>>    	} else if (!IS_ERR(vma)) {
>>>>    		node->start = i915_ggtt_offset(vma);
>>>> -		node->flags = 0;
>>> Why is this unneeded?
>> node = {} initializes all of node's elements to 0, including this one.
> true, but could the call to insert_mappable_node combined with the
> retry goto in i915_gem_gtt_prepare set this to non-zero?

Yikes!

I'll add that back.

Thanks for pointing it out.

Tom

>
>


^ permalink raw reply	[relevance 99%]

* Re: [PATCH] drm/i915: change node clearing from memset to initialization
  @ 2022-04-16 20:48 99%   ` Tom Rix
    0 siblings, 1 reply; 180+ results
From: Tom Rix @ 2022-04-16 20:48 UTC (permalink / raw)
  To: Joe Perches, jani.nikula, joonas.lahtinen, rodrigo.vivi,
	tvrtko.ursulin, airlied, daniel
  Cc: intel-gfx, linux-kernel, dri-devel


On 4/16/22 11:33 AM, Joe Perches wrote:
> On Sat, 2022-04-16 at 13:23 -0400, Tom Rix wrote:
>> In insert_mappable_node(), the parameter node is
>> cleared late in node's use with memset.
>> insert_mappable_node() is a singleton, called only
>> from i915_gem_gtt_prepare() which itself is only
>> called by i915_gem_gtt_pread() and
>> i915_gem_gtt_pwrite_fast() where the definition of
>> node originates.
>>
>> Instead of using memset, initialize node to 0 at it's
>> definitions.
> trivia: /it's/its/
>
> Only reason _not_ to do this is memset is guaranteed to
> zero any padding that might go to userspace.
>
> But it doesn't seem there is any padding anyway nor is
> the struct available to userspace.
>
> So this seems fine though it might increase overall code
> size a tiny bit.
>
> I do have a caveat: see below:
>
>> diff --git a/drivers/gpu/drm/i915/i915_gem.c b/drivers/gpu/drm/i915/i915_gem.c
> []
>> @@ -328,7 +327,6 @@ static struct i915_vma *i915_gem_gtt_prepare(struct drm_i915_gem_object *obj,
>>   		goto err_ww;
>>   	} else if (!IS_ERR(vma)) {
>>   		node->start = i915_ggtt_offset(vma);
>> -		node->flags = 0;
> Why is this unneeded?

node = {} initializes all of node's elements to 0, including this one.

Tom

>
> from: drm_mm_insert_node_in_range which can set node->flags
>
> 		__set_bit(DRM_MM_NODE_ALLOCATED_BIT, &node->flags);
>
>


^ permalink raw reply	[relevance 99%]

* [PATCH] drm/radeon/kms: change evergreen_default_state table from global to static
@ 2022-04-16 18:47 63% Tom Rix
  0 siblings, 0 replies; 180+ results
From: Tom Rix @ 2022-04-16 18:47 UTC (permalink / raw)
  To: alexander.deucher, christian.koenig, Xinhui.Pan, airlied, daniel
  Cc: Tom Rix, dri-devel, linux-kernel, amd-gfx

evergreen_default_state and evergreen_default_size are only
used in evergreen.c.  Single file symbols should be static.
So move their definitions to evergreen_blit_shaders.h
and change their storage-class-specifier to static.

Remove unneeded evergreen_blit_shader.c

evergreen_ps/vs definitions were removed with
commit 4f8629675800 ("drm/radeon/kms: remove r6xx+ blit copy routines")
So their declarations in evergreen_blit_shader.h
are not needed, so remove them.

Signed-off-by: Tom Rix <trix@redhat.com>
---
 drivers/gpu/drm/radeon/Makefile               |   2 +-
 .../gpu/drm/radeon/evergreen_blit_shaders.c   | 303 ------------------
 .../gpu/drm/radeon/evergreen_blit_shaders.h   | 278 +++++++++++++++-
 3 files changed, 274 insertions(+), 309 deletions(-)
 delete mode 100644 drivers/gpu/drm/radeon/evergreen_blit_shaders.c

diff --git a/drivers/gpu/drm/radeon/Makefile b/drivers/gpu/drm/radeon/Makefile
index 4deedaacd655..1045d2c46a76 100644
--- a/drivers/gpu/drm/radeon/Makefile
+++ b/drivers/gpu/drm/radeon/Makefile
@@ -41,7 +41,7 @@ radeon-y += radeon_device.o radeon_asic.o radeon_kms.o \
 	rs400.o rs600.o rs690.o rv515.o r520.o r600.o rv770.o radeon_test.o \
 	r200.o radeon_legacy_tv.o r600_cs.o \
 	radeon_pm.o atombios_dp.o r600_hdmi.o dce3_1_afmt.o \
-	evergreen.o evergreen_cs.o evergreen_blit_shaders.o \
+	evergreen.o evergreen_cs.o \
 	evergreen_hdmi.o radeon_trace_points.o ni.o \
 	atombios_encoders.o radeon_semaphore.o radeon_sa.o atombios_i2c.o si.o \
 	radeon_prime.o cik.o cik_blit_shaders.o \
diff --git a/drivers/gpu/drm/radeon/evergreen_blit_shaders.c b/drivers/gpu/drm/radeon/evergreen_blit_shaders.c
deleted file mode 100644
index 1a96ddb3e5ed..000000000000
--- a/drivers/gpu/drm/radeon/evergreen_blit_shaders.c
+++ /dev/null
@@ -1,303 +0,0 @@
-/*
- * Copyright 2010 Advanced Micro Devices, Inc.
- *
- * Permission is hereby granted, free of charge, to any person obtaining a
- * copy of this software and associated documentation files (the "Software"),
- * to deal in the Software without restriction, including without limitation
- * the rights to use, copy, modify, merge, publish, distribute, sublicense,
- * and/or sell copies of the Software, and to permit persons to whom the
- * Software is furnished to do so, subject to the following conditions:
- *
- * The above copyright notice and this permission notice (including the next
- * paragraph) shall be included in all copies or substantial portions of the
- * Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
- * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
- * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL
- * THE COPYRIGHT HOLDER(S) AND/OR ITS SUPPLIERS BE LIABLE FOR ANY CLAIM, DAMAGES OR
- * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
- * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
- * DEALINGS IN THE SOFTWARE.
- *
- * Authors:
- *     Alex Deucher <alexander.deucher@amd.com>
- */
-
-#include <linux/bug.h>
-#include <linux/types.h>
-#include <linux/kernel.h>
-
-/*
- * evergreen cards need to use the 3D engine to blit data which requires
- * quite a bit of hw state setup.  Rather than pull the whole 3D driver
- * (which normally generates the 3D state) into the DRM, we opt to use
- * statically generated state tables.  The register state and shaders
- * were hand generated to support blitting functionality.  See the 3D
- * driver or documentation for descriptions of the registers and
- * shader instructions.
- */
-
-const u32 evergreen_default_state[] =
-{
-	0xc0016900,
-	0x0000023b,
-	0x00000000, /* SQ_LDS_ALLOC_PS */
-
-	0xc0066900,
-	0x00000240,
-	0x00000000, /* SQ_ESGS_RING_ITEMSIZE */
-	0x00000000,
-	0x00000000,
-	0x00000000,
-	0x00000000,
-	0x00000000,
-
-	0xc0046900,
-	0x00000247,
-	0x00000000, /* SQ_GS_VERT_ITEMSIZE */
-	0x00000000,
-	0x00000000,
-	0x00000000,
-
-	0xc0026900,
-	0x00000010,
-	0x00000000, /* DB_Z_INFO */
-	0x00000000, /* DB_STENCIL_INFO */
-
-	0xc0016900,
-	0x00000200,
-	0x00000000, /* DB_DEPTH_CONTROL */
-
-	0xc0066900,
-	0x00000000,
-	0x00000060, /* DB_RENDER_CONTROL */
-	0x00000000, /* DB_COUNT_CONTROL */
-	0x00000000, /* DB_DEPTH_VIEW */
-	0x0000002a, /* DB_RENDER_OVERRIDE */
-	0x00000000, /* DB_RENDER_OVERRIDE2 */
-	0x00000000, /* DB_HTILE_DATA_BASE */
-
-	0xc0026900,
-	0x0000000a,
-	0x00000000, /* DB_STENCIL_CLEAR */
-	0x00000000, /* DB_DEPTH_CLEAR */
-
-	0xc0016900,
-	0x000002dc,
-	0x0000aa00, /* DB_ALPHA_TO_MASK */
-
-	0xc0016900,
-	0x00000080,
-	0x00000000, /* PA_SC_WINDOW_OFFSET */
-
-	0xc00d6900,
-	0x00000083,
-	0x0000ffff, /* PA_SC_CLIPRECT_RULE */
-	0x00000000, /* PA_SC_CLIPRECT_0_TL */
-	0x20002000, /* PA_SC_CLIPRECT_0_BR */
-	0x00000000,
-	0x20002000,
-	0x00000000,
-	0x20002000,
-	0x00000000,
-	0x20002000,
-	0xaaaaaaaa, /* PA_SC_EDGERULE */
-	0x00000000, /* PA_SU_HARDWARE_SCREEN_OFFSET */
-	0x0000000f, /* CB_TARGET_MASK */
-	0x0000000f, /* CB_SHADER_MASK */
-
-	0xc0226900,
-	0x00000094,
-	0x80000000, /* PA_SC_VPORT_SCISSOR_0_TL */
-	0x20002000, /* PA_SC_VPORT_SCISSOR_0_BR */
-	0x80000000,
-	0x20002000,
-	0x80000000,
-	0x20002000,
-	0x80000000,
-	0x20002000,
-	0x80000000,
-	0x20002000,
-	0x80000000,
-	0x20002000,
-	0x80000000,
-	0x20002000,
-	0x80000000,
-	0x20002000,
-	0x80000000,
-	0x20002000,
-	0x80000000,
-	0x20002000,
-	0x80000000,
-	0x20002000,
-	0x80000000,
-	0x20002000,
-	0x80000000,
-	0x20002000,
-	0x80000000,
-	0x20002000,
-	0x80000000,
-	0x20002000,
-	0x80000000,
-	0x20002000,
-	0x00000000, /* PA_SC_VPORT_ZMIN_0 */
-	0x3f800000, /* PA_SC_VPORT_ZMAX_0 */
-
-	0xc0016900,
-	0x000000d4,
-	0x00000000, /* SX_MISC */
-
-	0xc0026900,
-	0x00000292,
-	0x00000000, /* PA_SC_MODE_CNTL_0 */
-	0x00000000, /* PA_SC_MODE_CNTL_1 */
-
-	0xc0106900,
-	0x00000300,
-	0x00000000, /* PA_SC_LINE_CNTL */
-	0x00000000, /* PA_SC_AA_CONFIG */
-	0x00000005, /* PA_SU_VTX_CNTL */
-	0x3f800000, /* PA_CL_GB_VERT_CLIP_ADJ */
-	0x3f800000, /* PA_CL_GB_VERT_DISC_ADJ */
-	0x3f800000, /* PA_CL_GB_HORZ_CLIP_ADJ */
-	0x3f800000, /* PA_CL_GB_HORZ_DISC_ADJ */
-	0x00000000, /* PA_SC_AA_SAMPLE_LOCS_0 */
-	0x00000000, /*  */
-	0x00000000, /*  */
-	0x00000000, /*  */
-	0x00000000, /*  */
-	0x00000000, /*  */
-	0x00000000, /*  */
-	0x00000000, /* PA_SC_AA_SAMPLE_LOCS_7 */
-	0xffffffff, /* PA_SC_AA_MASK */
-
-	0xc00d6900,
-	0x00000202,
-	0x00cc0010, /* CB_COLOR_CONTROL */
-	0x00000210, /* DB_SHADER_CONTROL */
-	0x00010000, /* PA_CL_CLIP_CNTL */
-	0x00000004, /* PA_SU_SC_MODE_CNTL */
-	0x00000100, /* PA_CL_VTE_CNTL */
-	0x00000000, /* PA_CL_VS_OUT_CNTL */
-	0x00000000, /* PA_CL_NANINF_CNTL */
-	0x00000000, /* PA_SU_LINE_STIPPLE_CNTL */
-	0x00000000, /* PA_SU_LINE_STIPPLE_SCALE */
-	0x00000000, /* PA_SU_PRIM_FILTER_CNTL */
-	0x00000000, /*  */
-	0x00000000, /*  */
-	0x00000000, /* SQ_DYN_GPR_RESOURCE_LIMIT_1 */
-
-	0xc0066900,
-	0x000002de,
-	0x00000000, /* PA_SU_POLY_OFFSET_DB_FMT_CNTL */
-	0x00000000, /*  */
-	0x00000000, /*  */
-	0x00000000, /*  */
-	0x00000000, /*  */
-	0x00000000, /*  */
-
-	0xc0016900,
-	0x00000229,
-	0x00000000, /* SQ_PGM_START_FS */
-
-	0xc0016900,
-	0x0000022a,
-	0x00000000, /* SQ_PGM_RESOURCES_FS */
-
-	0xc0096900,
-	0x00000100,
-	0x00ffffff, /* VGT_MAX_VTX_INDX */
-	0x00000000, /*  */
-	0x00000000, /*  */
-	0x00000000, /*  */
-	0x00000000, /* SX_ALPHA_TEST_CONTROL */
-	0x00000000, /* CB_BLEND_RED */
-	0x00000000, /* CB_BLEND_GREEN */
-	0x00000000, /* CB_BLEND_BLUE */
-	0x00000000, /* CB_BLEND_ALPHA */
-
-	0xc0026900,
-	0x000002a8,
-	0x00000000, /* VGT_INSTANCE_STEP_RATE_0 */
-	0x00000000, /*  */
-
-	0xc0026900,
-	0x000002ad,
-	0x00000000, /* VGT_REUSE_OFF */
-	0x00000000, /*  */
-
-	0xc0116900,
-	0x00000280,
-	0x00000000, /* PA_SU_POINT_SIZE */
-	0x00000000, /* PA_SU_POINT_MINMAX */
-	0x00000008, /* PA_SU_LINE_CNTL */
-	0x00000000, /* PA_SC_LINE_STIPPLE */
-	0x00000000, /* VGT_OUTPUT_PATH_CNTL */
-	0x00000000, /* VGT_HOS_CNTL */
-	0x00000000, /*  */
-	0x00000000, /*  */
-	0x00000000, /*  */
-	0x00000000, /*  */
-	0x00000000, /*  */
-	0x00000000, /*  */
-	0x00000000, /*  */
-	0x00000000, /*  */
-	0x00000000, /*  */
-	0x00000000, /*  */
-	0x00000000, /* VGT_GS_MODE */
-
-	0xc0016900,
-	0x000002a1,
-	0x00000000, /* VGT_PRIMITIVEID_EN */
-
-	0xc0016900,
-	0x000002a5,
-	0x00000000, /* VGT_MULTI_PRIM_IB_RESET_EN */
-
-	0xc0016900,
-	0x000002d5,
-	0x00000000, /* VGT_SHADER_STAGES_EN */
-
-	0xc0026900,
-	0x000002e5,
-	0x00000000, /* VGT_STRMOUT_CONFIG */
-	0x00000000, /*  */
-
-	0xc0016900,
-	0x000001e0,
-	0x00000000, /* CB_BLEND0_CONTROL */
-
-	0xc0016900,
-	0x000001b1,
-	0x00000000, /* SPI_VS_OUT_CONFIG */
-
-	0xc0016900,
-	0x00000187,
-	0x00000000, /* SPI_VS_OUT_ID_0 */
-
-	0xc0016900,
-	0x00000191,
-	0x00000100, /* SPI_PS_INPUT_CNTL_0 */
-
-	0xc00b6900,
-	0x000001b3,
-	0x20000001, /* SPI_PS_IN_CONTROL_0 */
-	0x00000000, /* SPI_PS_IN_CONTROL_1 */
-	0x00000000, /* SPI_INTERP_CONTROL_0 */
-	0x00000000, /* SPI_INPUT_Z */
-	0x00000000, /* SPI_FOG_CNTL */
-	0x00100000, /* SPI_BARYC_CNTL */
-	0x00000000, /* SPI_PS_IN_CONTROL_2 */
-	0x00000000, /*  */
-	0x00000000, /*  */
-	0x00000000, /*  */
-	0x00000000, /*  */
-
-	0xc0026900,
-	0x00000316,
-	0x0000000e, /* VGT_VERTEX_REUSE_BLOCK_CNTL */
-	0x00000010, /*  */
-};
-
-const u32 evergreen_default_size = ARRAY_SIZE(evergreen_default_state);
diff --git a/drivers/gpu/drm/radeon/evergreen_blit_shaders.h b/drivers/gpu/drm/radeon/evergreen_blit_shaders.h
index bb8d6c751595..4492524ee1df 100644
--- a/drivers/gpu/drm/radeon/evergreen_blit_shaders.h
+++ b/drivers/gpu/drm/radeon/evergreen_blit_shaders.h
@@ -20,16 +20,284 @@
  * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
  * DEALINGS IN THE SOFTWARE.
  *
+ * Authors:
+ *     Alex Deucher <alexander.deucher@amd.com>
  */
 
 #ifndef EVERGREEN_BLIT_SHADERS_H
 #define EVERGREEN_BLIT_SHADERS_H
 
-extern const u32 evergreen_ps[];
-extern const u32 evergreen_vs[];
-extern const u32 evergreen_default_state[];
+/*
+ * evergreen cards need to use the 3D engine to blit data which requires
+ * quite a bit of hw state setup.  Rather than pull the whole 3D driver
+ * (which normally generates the 3D state) into the DRM, we opt to use
+ * statically generated state tables.  The register state and shaders
+ * were hand generated to support blitting functionality.  See the 3D
+ * driver or documentation for descriptions of the registers and
+ * shader instructions.
+ */
+
+static const u32 evergreen_default_state[] = {
+	0xc0016900,
+	0x0000023b,
+	0x00000000, /* SQ_LDS_ALLOC_PS */
+
+	0xc0066900,
+	0x00000240,
+	0x00000000, /* SQ_ESGS_RING_ITEMSIZE */
+	0x00000000,
+	0x00000000,
+	0x00000000,
+	0x00000000,
+	0x00000000,
+
+	0xc0046900,
+	0x00000247,
+	0x00000000, /* SQ_GS_VERT_ITEMSIZE */
+	0x00000000,
+	0x00000000,
+	0x00000000,
+
+	0xc0026900,
+	0x00000010,
+	0x00000000, /* DB_Z_INFO */
+	0x00000000, /* DB_STENCIL_INFO */
+
+	0xc0016900,
+	0x00000200,
+	0x00000000, /* DB_DEPTH_CONTROL */
+
+	0xc0066900,
+	0x00000000,
+	0x00000060, /* DB_RENDER_CONTROL */
+	0x00000000, /* DB_COUNT_CONTROL */
+	0x00000000, /* DB_DEPTH_VIEW */
+	0x0000002a, /* DB_RENDER_OVERRIDE */
+	0x00000000, /* DB_RENDER_OVERRIDE2 */
+	0x00000000, /* DB_HTILE_DATA_BASE */
+
+	0xc0026900,
+	0x0000000a,
+	0x00000000, /* DB_STENCIL_CLEAR */
+	0x00000000, /* DB_DEPTH_CLEAR */
+
+	0xc0016900,
+	0x000002dc,
+	0x0000aa00, /* DB_ALPHA_TO_MASK */
+
+	0xc0016900,
+	0x00000080,
+	0x00000000, /* PA_SC_WINDOW_OFFSET */
+
+	0xc00d6900,
+	0x00000083,
+	0x0000ffff, /* PA_SC_CLIPRECT_RULE */
+	0x00000000, /* PA_SC_CLIPRECT_0_TL */
+	0x20002000, /* PA_SC_CLIPRECT_0_BR */
+	0x00000000,
+	0x20002000,
+	0x00000000,
+	0x20002000,
+	0x00000000,
+	0x20002000,
+	0xaaaaaaaa, /* PA_SC_EDGERULE */
+	0x00000000, /* PA_SU_HARDWARE_SCREEN_OFFSET */
+	0x0000000f, /* CB_TARGET_MASK */
+	0x0000000f, /* CB_SHADER_MASK */
+
+	0xc0226900,
+	0x00000094,
+	0x80000000, /* PA_SC_VPORT_SCISSOR_0_TL */
+	0x20002000, /* PA_SC_VPORT_SCISSOR_0_BR */
+	0x80000000,
+	0x20002000,
+	0x80000000,
+	0x20002000,
+	0x80000000,
+	0x20002000,
+	0x80000000,
+	0x20002000,
+	0x80000000,
+	0x20002000,
+	0x80000000,
+	0x20002000,
+	0x80000000,
+	0x20002000,
+	0x80000000,
+	0x20002000,
+	0x80000000,
+	0x20002000,
+	0x80000000,
+	0x20002000,
+	0x80000000,
+	0x20002000,
+	0x80000000,
+	0x20002000,
+	0x80000000,
+	0x20002000,
+	0x80000000,
+	0x20002000,
+	0x80000000,
+	0x20002000,
+	0x00000000, /* PA_SC_VPORT_ZMIN_0 */
+	0x3f800000, /* PA_SC_VPORT_ZMAX_0 */
+
+	0xc0016900,
+	0x000000d4,
+	0x00000000, /* SX_MISC */
+
+	0xc0026900,
+	0x00000292,
+	0x00000000, /* PA_SC_MODE_CNTL_0 */
+	0x00000000, /* PA_SC_MODE_CNTL_1 */
+
+	0xc0106900,
+	0x00000300,
+	0x00000000, /* PA_SC_LINE_CNTL */
+	0x00000000, /* PA_SC_AA_CONFIG */
+	0x00000005, /* PA_SU_VTX_CNTL */
+	0x3f800000, /* PA_CL_GB_VERT_CLIP_ADJ */
+	0x3f800000, /* PA_CL_GB_VERT_DISC_ADJ */
+	0x3f800000, /* PA_CL_GB_HORZ_CLIP_ADJ */
+	0x3f800000, /* PA_CL_GB_HORZ_DISC_ADJ */
+	0x00000000, /* PA_SC_AA_SAMPLE_LOCS_0 */
+	0x00000000, /*  */
+	0x00000000, /*  */
+	0x00000000, /*  */
+	0x00000000, /*  */
+	0x00000000, /*  */
+	0x00000000, /*  */
+	0x00000000, /* PA_SC_AA_SAMPLE_LOCS_7 */
+	0xffffffff, /* PA_SC_AA_MASK */
+
+	0xc00d6900,
+	0x00000202,
+	0x00cc0010, /* CB_COLOR_CONTROL */
+	0x00000210, /* DB_SHADER_CONTROL */
+	0x00010000, /* PA_CL_CLIP_CNTL */
+	0x00000004, /* PA_SU_SC_MODE_CNTL */
+	0x00000100, /* PA_CL_VTE_CNTL */
+	0x00000000, /* PA_CL_VS_OUT_CNTL */
+	0x00000000, /* PA_CL_NANINF_CNTL */
+	0x00000000, /* PA_SU_LINE_STIPPLE_CNTL */
+	0x00000000, /* PA_SU_LINE_STIPPLE_SCALE */
+	0x00000000, /* PA_SU_PRIM_FILTER_CNTL */
+	0x00000000, /*  */
+	0x00000000, /*  */
+	0x00000000, /* SQ_DYN_GPR_RESOURCE_LIMIT_1 */
+
+	0xc0066900,
+	0x000002de,
+	0x00000000, /* PA_SU_POLY_OFFSET_DB_FMT_CNTL */
+	0x00000000, /*  */
+	0x00000000, /*  */
+	0x00000000, /*  */
+	0x00000000, /*  */
+	0x00000000, /*  */
+
+	0xc0016900,
+	0x00000229,
+	0x00000000, /* SQ_PGM_START_FS */
+
+	0xc0016900,
+	0x0000022a,
+	0x00000000, /* SQ_PGM_RESOURCES_FS */
+
+	0xc0096900,
+	0x00000100,
+	0x00ffffff, /* VGT_MAX_VTX_INDX */
+	0x00000000, /*  */
+	0x00000000, /*  */
+	0x00000000, /*  */
+	0x00000000, /* SX_ALPHA_TEST_CONTROL */
+	0x00000000, /* CB_BLEND_RED */
+	0x00000000, /* CB_BLEND_GREEN */
+	0x00000000, /* CB_BLEND_BLUE */
+	0x00000000, /* CB_BLEND_ALPHA */
+
+	0xc0026900,
+	0x000002a8,
+	0x00000000, /* VGT_INSTANCE_STEP_RATE_0 */
+	0x00000000, /*  */
+
+	0xc0026900,
+	0x000002ad,
+	0x00000000, /* VGT_REUSE_OFF */
+	0x00000000, /*  */
+
+	0xc0116900,
+	0x00000280,
+	0x00000000, /* PA_SU_POINT_SIZE */
+	0x00000000, /* PA_SU_POINT_MINMAX */
+	0x00000008, /* PA_SU_LINE_CNTL */
+	0x00000000, /* PA_SC_LINE_STIPPLE */
+	0x00000000, /* VGT_OUTPUT_PATH_CNTL */
+	0x00000000, /* VGT_HOS_CNTL */
+	0x00000000, /*  */
+	0x00000000, /*  */
+	0x00000000, /*  */
+	0x00000000, /*  */
+	0x00000000, /*  */
+	0x00000000, /*  */
+	0x00000000, /*  */
+	0x00000000, /*  */
+	0x00000000, /*  */
+	0x00000000, /*  */
+	0x00000000, /* VGT_GS_MODE */
+
+	0xc0016900,
+	0x000002a1,
+	0x00000000, /* VGT_PRIMITIVEID_EN */
+
+	0xc0016900,
+	0x000002a5,
+	0x00000000, /* VGT_MULTI_PRIM_IB_RESET_EN */
+
+	0xc0016900,
+	0x000002d5,
+	0x00000000, /* VGT_SHADER_STAGES_EN */
+
+	0xc0026900,
+	0x000002e5,
+	0x00000000, /* VGT_STRMOUT_CONFIG */
+	0x00000000, /*  */
+
+	0xc0016900,
+	0x000001e0,
+	0x00000000, /* CB_BLEND0_CONTROL */
+
+	0xc0016900,
+	0x000001b1,
+	0x00000000, /* SPI_VS_OUT_CONFIG */
+
+	0xc0016900,
+	0x00000187,
+	0x00000000, /* SPI_VS_OUT_ID_0 */
+
+	0xc0016900,
+	0x00000191,
+	0x00000100, /* SPI_PS_INPUT_CNTL_0 */
+
+	0xc00b6900,
+	0x000001b3,
+	0x20000001, /* SPI_PS_IN_CONTROL_0 */
+	0x00000000, /* SPI_PS_IN_CONTROL_1 */
+	0x00000000, /* SPI_INTERP_CONTROL_0 */
+	0x00000000, /* SPI_INPUT_Z */
+	0x00000000, /* SPI_FOG_CNTL */
+	0x00100000, /* SPI_BARYC_CNTL */
+	0x00000000, /* SPI_PS_IN_CONTROL_2 */
+	0x00000000, /*  */
+	0x00000000, /*  */
+	0x00000000, /*  */
+	0x00000000, /*  */
+
+	0xc0026900,
+	0x00000316,
+	0x0000000e, /* VGT_VERTEX_REUSE_BLOCK_CNTL */
+	0x00000010, /*  */
+};
 
-extern const u32 evergreen_ps_size, evergreen_vs_size;
-extern const u32 evergreen_default_size;
+static const u32 evergreen_default_size = ARRAY_SIZE(evergreen_default_state);
 
 #endif
-- 
2.27.0


^ permalink raw reply related	[relevance 63%]

* [PATCH] drm/i915: change node clearing from memset to initialization
@ 2022-04-16 17:23 95% Tom Rix
    0 siblings, 1 reply; 180+ results
From: Tom Rix @ 2022-04-16 17:23 UTC (permalink / raw)
  To: jani.nikula, joonas.lahtinen, rodrigo.vivi, tvrtko.ursulin,
	airlied, daniel
  Cc: Tom Rix, intel-gfx, linux-kernel, dri-devel

In insert_mappable_node(), the parameter node is
cleared late in node's use with memset.
insert_mappable_node() is a singleton, called only
from i915_gem_gtt_prepare() which itself is only
called by i915_gem_gtt_pread() and
i915_gem_gtt_pwrite_fast() where the definition of
node originates.

Instead of using memset, initialize node to 0 at it's
definitions.  And remove unneeded clearing of the flags
element.

Signed-off-by: Tom Rix <trix@redhat.com>
---
 drivers/gpu/drm/i915/i915_gem.c | 6 ++----
 1 file changed, 2 insertions(+), 4 deletions(-)

diff --git a/drivers/gpu/drm/i915/i915_gem.c b/drivers/gpu/drm/i915/i915_gem.c
index 2e10187cd0a0..7dbd0b325c43 100644
--- a/drivers/gpu/drm/i915/i915_gem.c
+++ b/drivers/gpu/drm/i915/i915_gem.c
@@ -69,7 +69,6 @@ insert_mappable_node(struct i915_ggtt *ggtt, struct drm_mm_node *node, u32 size)
 	if (err)
 		return err;
 
-	memset(node, 0, sizeof(*node));
 	err = drm_mm_insert_node_in_range(&ggtt->vm.mm, node,
 					  size, 0, I915_COLOR_UNEVICTABLE,
 					  0, ggtt->mappable_end,
@@ -328,7 +327,6 @@ static struct i915_vma *i915_gem_gtt_prepare(struct drm_i915_gem_object *obj,
 		goto err_ww;
 	} else if (!IS_ERR(vma)) {
 		node->start = i915_ggtt_offset(vma);
-		node->flags = 0;
 	} else {
 		ret = insert_mappable_node(ggtt, node, PAGE_SIZE);
 		if (ret)
@@ -381,7 +379,7 @@ i915_gem_gtt_pread(struct drm_i915_gem_object *obj,
 	struct drm_i915_private *i915 = to_i915(obj->base.dev);
 	struct i915_ggtt *ggtt = to_gt(i915)->ggtt;
 	intel_wakeref_t wakeref;
-	struct drm_mm_node node;
+	struct drm_mm_node node = {};
 	void __user *user_data;
 	struct i915_vma *vma;
 	u64 remain, offset;
@@ -538,7 +536,7 @@ i915_gem_gtt_pwrite_fast(struct drm_i915_gem_object *obj,
 	struct i915_ggtt *ggtt = to_gt(i915)->ggtt;
 	struct intel_runtime_pm *rpm = &i915->runtime_pm;
 	intel_wakeref_t wakeref;
-	struct drm_mm_node node;
+	struct drm_mm_node node = {};
 	struct i915_vma *vma;
 	u64 remain, offset;
 	void __user *user_data;
-- 
2.27.0


^ permalink raw reply related	[relevance 95%]

* [PATCH] drm/radeon: remove r600_blit_shaders.[c|h]
@ 2022-04-09 17:11 58% Tom Rix
  0 siblings, 0 replies; 180+ results
From: Tom Rix @ 2022-04-09 17:11 UTC (permalink / raw)
  To: alexander.deucher, christian.koenig, Xinhui.Pan, airlied, daniel
  Cc: Tom Rix, dri-devel, linux-kernel, amd-gfx

The only use of the global variables in r600_blit_shaders.c
were in the old drivers/gpu/drm/radeon/r600_blit.c
This file was removed in
commit 8333f607a631 ("drm/radeon: remove UMS support")

So remove the r600_blit_shaders.[c|h] files

Signed-off-by: Tom Rix <trix@redhat.com>
---
 drivers/gpu/drm/radeon/Makefile            |   2 +-
 drivers/gpu/drm/radeon/r600_blit_shaders.c | 719 ---------------------
 drivers/gpu/drm/radeon/r600_blit_shaders.h |  38 --
 3 files changed, 1 insertion(+), 758 deletions(-)
 delete mode 100644 drivers/gpu/drm/radeon/r600_blit_shaders.c
 delete mode 100644 drivers/gpu/drm/radeon/r600_blit_shaders.h

diff --git a/drivers/gpu/drm/radeon/Makefile b/drivers/gpu/drm/radeon/Makefile
index 2425a3612d6c..4deedaacd655 100644
--- a/drivers/gpu/drm/radeon/Makefile
+++ b/drivers/gpu/drm/radeon/Makefile
@@ -39,7 +39,7 @@ radeon-y += radeon_device.o radeon_asic.o radeon_kms.o \
 	radeon_clocks.o radeon_fb.o radeon_gem.o radeon_ring.o radeon_irq_kms.o \
 	radeon_cs.o radeon_bios.o radeon_benchmark.o r100.o r300.o r420.o \
 	rs400.o rs600.o rs690.o rv515.o r520.o r600.o rv770.o radeon_test.o \
-	r200.o radeon_legacy_tv.o r600_cs.o r600_blit_shaders.o \
+	r200.o radeon_legacy_tv.o r600_cs.o \
 	radeon_pm.o atombios_dp.o r600_hdmi.o dce3_1_afmt.o \
 	evergreen.o evergreen_cs.o evergreen_blit_shaders.o \
 	evergreen_hdmi.o radeon_trace_points.o ni.o \
diff --git a/drivers/gpu/drm/radeon/r600_blit_shaders.c b/drivers/gpu/drm/radeon/r600_blit_shaders.c
deleted file mode 100644
index 443cbe59b274..000000000000
--- a/drivers/gpu/drm/radeon/r600_blit_shaders.c
+++ /dev/null
@@ -1,719 +0,0 @@
-/*
- * Copyright 2009 Advanced Micro Devices, Inc.
- *
- * Permission is hereby granted, free of charge, to any person obtaining a
- * copy of this software and associated documentation files (the "Software"),
- * to deal in the Software without restriction, including without limitation
- * the rights to use, copy, modify, merge, publish, distribute, sublicense,
- * and/or sell copies of the Software, and to permit persons to whom the
- * Software is furnished to do so, subject to the following conditions:
- *
- * The above copyright notice and this permission notice (including the next
- * paragraph) shall be included in all copies or substantial portions of the
- * Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
- * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
- * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL
- * THE COPYRIGHT HOLDER(S) AND/OR ITS SUPPLIERS BE LIABLE FOR ANY CLAIM, DAMAGES OR
- * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
- * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
- * DEALINGS IN THE SOFTWARE.
- *
- * Authors:
- *     Alex Deucher <alexander.deucher@amd.com>
- */
-
-#include <linux/bug.h>
-#include <linux/types.h>
-#include <linux/kernel.h>
-
-/*
- * R6xx+ cards need to use the 3D engine to blit data which requires
- * quite a bit of hw state setup.  Rather than pull the whole 3D driver
- * (which normally generates the 3D state) into the DRM, we opt to use
- * statically generated state tables.  The register state and shaders
- * were hand generated to support blitting functionality.  See the 3D
- * driver or documentation for descriptions of the registers and
- * shader instructions.
- */
-
-const u32 r6xx_default_state[] =
-{
-	0xc0002400, /* START_3D_CMDBUF */
-	0x00000000,
-
-	0xc0012800, /* CONTEXT_CONTROL */
-	0x80000000,
-	0x80000000,
-
-	0xc0016800,
-	0x00000010,
-	0x00008000, /* WAIT_UNTIL */
-
-	0xc0016800,
-	0x00000542,
-	0x07000003, /* TA_CNTL_AUX */
-
-	0xc0016800,
-	0x000005c5,
-	0x00000000, /* VC_ENHANCE */
-
-	0xc0016800,
-	0x00000363,
-	0x00000000, /* SQ_DYN_GPR_CNTL_PS_FLUSH_REQ */
-
-	0xc0016800,
-	0x0000060c,
-	0x82000000, /* DB_DEBUG */
-
-	0xc0016800,
-	0x0000060e,
-	0x01020204, /* DB_WATERMARKS */
-
-	0xc0026f00,
-	0x00000000,
-	0x00000000, /* SQ_VTX_BASE_VTX_LOC */
-	0x00000000, /* SQ_VTX_START_INST_LOC */
-
-	0xc0096900,
-	0x0000022a,
-	0x00000000, /* SQ_ESGS_RING_ITEMSIZE */
-	0x00000000,
-	0x00000000,
-	0x00000000,
-	0x00000000,
-	0x00000000,
-	0x00000000,
-	0x00000000,
-	0x00000000,
-
-	0xc0016900,
-	0x00000004,
-	0x00000000, /* DB_DEPTH_INFO */
-
-	0xc0026900,
-	0x0000000a,
-	0x00000000, /* DB_STENCIL_CLEAR */
-	0x00000000, /* DB_DEPTH_CLEAR */
-
-	0xc0016900,
-	0x00000200,
-	0x00000000, /* DB_DEPTH_CONTROL */
-
-	0xc0026900,
-	0x00000343,
-	0x00000060, /* DB_RENDER_CONTROL */
-	0x00000040, /* DB_RENDER_OVERRIDE */
-
-	0xc0016900,
-	0x00000351,
-	0x0000aa00, /* DB_ALPHA_TO_MASK */
-
-	0xc00f6900,
-	0x00000100,
-	0x00000800, /* VGT_MAX_VTX_INDX */
-	0x00000000, /* VGT_MIN_VTX_INDX */
-	0x00000000, /* VGT_INDX_OFFSET */
-	0x00000000, /* VGT_MULTI_PRIM_IB_RESET_INDX */
-	0x00000000, /* SX_ALPHA_TEST_CONTROL */
-	0x00000000, /* CB_BLEND_RED */
-	0x00000000,
-	0x00000000,
-	0x00000000,
-	0x00000000, /* CB_FOG_RED */
-	0x00000000,
-	0x00000000,
-	0x00000000, /* DB_STENCILREFMASK */
-	0x00000000, /* DB_STENCILREFMASK_BF */
-	0x00000000, /* SX_ALPHA_REF */
-
-	0xc0046900,
-	0x0000030c,
-	0x01000000, /* CB_CLRCMP_CNTL */
-	0x00000000,
-	0x00000000,
-	0x00000000,
-
-	0xc0046900,
-	0x00000048,
-	0x3f800000, /* CB_CLEAR_RED */
-	0x00000000,
-	0x3f800000,
-	0x3f800000,
-
-	0xc0016900,
-	0x00000080,
-	0x00000000, /* PA_SC_WINDOW_OFFSET */
-
-	0xc00a6900,
-	0x00000083,
-	0x0000ffff, /* PA_SC_CLIP_RECT_RULE */
-	0x00000000, /* PA_SC_CLIPRECT_0_TL */
-	0x20002000,
-	0x00000000,
-	0x20002000,
-	0x00000000,
-	0x20002000,
-	0x00000000,
-	0x20002000,
-	0x00000000, /* PA_SC_EDGERULE */
-
-	0xc0406900,
-	0x00000094,
-	0x80000000, /* PA_SC_VPORT_SCISSOR_0_TL */
-	0x20002000, /* PA_SC_VPORT_SCISSOR_0_BR */
-	0x80000000, /* PA_SC_VPORT_SCISSOR_1_TL */
-	0x20002000,
-	0x80000000,
-	0x20002000,
-	0x80000000,
-	0x20002000,
-	0x80000000,
-	0x20002000,
-	0x80000000,
-	0x20002000,
-	0x80000000,
-	0x20002000,
-	0x80000000,
-	0x20002000,
-	0x80000000,
-	0x20002000,
-	0x80000000,
-	0x20002000,
-	0x80000000,
-	0x20002000,
-	0x80000000,
-	0x20002000,
-	0x80000000,
-	0x20002000,
-	0x80000000,
-	0x20002000,
-	0x80000000,
-	0x20002000,
-	0x80000000,
-	0x20002000,
-	0x00000000, /* PA_SC_VPORT_ZMIN_0 */
-	0x3f800000,
-	0x00000000,
-	0x3f800000,
-	0x00000000,
-	0x3f800000,
-	0x00000000,
-	0x3f800000,
-	0x00000000,
-	0x3f800000,
-	0x00000000,
-	0x3f800000,
-	0x00000000,
-	0x3f800000,
-	0x00000000,
-	0x3f800000,
-	0x00000000,
-	0x3f800000,
-	0x00000000,
-	0x3f800000,
-	0x00000000,
-	0x3f800000,
-	0x00000000,
-	0x3f800000,
-	0x00000000,
-	0x3f800000,
-	0x00000000,
-	0x3f800000,
-	0x00000000,
-	0x3f800000,
-	0x00000000,
-	0x3f800000,
-
-	0xc0026900,
-	0x00000292,
-	0x00000000, /* PA_SC_MPASS_PS_CNTL */
-	0x00004010, /* PA_SC_MODE_CNTL */
-
-	0xc0096900,
-	0x00000300,
-	0x00000000, /* PA_SC_LINE_CNTL */
-	0x00000000, /* PA_SC_AA_CONFIG */
-	0x0000002d, /* PA_SU_VTX_CNTL */
-	0x3f800000, /* PA_CL_GB_VERT_CLIP_ADJ */
-	0x3f800000,
-	0x3f800000,
-	0x3f800000,
-	0x00000000, /* PA_SC_SAMPLE_LOCS_MCTX */
-	0x00000000,
-
-	0xc0016900,
-	0x00000312,
-	0xffffffff, /* PA_SC_AA_MASK */
-
-	0xc0066900,
-	0x0000037e,
-	0x00000000, /* PA_SU_POLY_OFFSET_DB_FMT_CNTL */
-	0x00000000, /* PA_SU_POLY_OFFSET_CLAMP */
-	0x00000000, /* PA_SU_POLY_OFFSET_FRONT_SCALE */
-	0x00000000, /* PA_SU_POLY_OFFSET_FRONT_OFFSET */
-	0x00000000, /* PA_SU_POLY_OFFSET_BACK_SCALE */
-	0x00000000, /* PA_SU_POLY_OFFSET_BACK_OFFSET */
-
-	0xc0046900,
-	0x000001b6,
-	0x00000000, /* SPI_INPUT_Z */
-	0x00000000, /* SPI_FOG_CNTL */
-	0x00000000, /* SPI_FOG_FUNC_SCALE */
-	0x00000000, /* SPI_FOG_FUNC_BIAS */
-
-	0xc0016900,
-	0x00000225,
-	0x00000000, /* SQ_PGM_START_FS */
-
-	0xc0016900,
-	0x00000229,
-	0x00000000, /* SQ_PGM_RESOURCES_FS */
-
-	0xc0016900,
-	0x00000237,
-	0x00000000, /* SQ_PGM_CF_OFFSET_FS */
-
-	0xc0026900,
-	0x000002a8,
-	0x00000000, /* VGT_INSTANCE_STEP_RATE_0 */
-	0x00000000, /* VGT_INSTANCE_STEP_RATE_1 */
-
-	0xc0116900,
-	0x00000280,
-	0x00000000, /* PA_SU_POINT_SIZE */
-	0x00000000, /* PA_SU_POINT_MINMAX */
-	0x00000008, /* PA_SU_LINE_CNTL */
-	0x00000000, /* PA_SC_LINE_STIPPLE */
-	0x00000000, /* VGT_OUTPUT_PATH_CNTL */
-	0x00000000, /* VGT_HOS_CNTL */
-	0x00000000, /* VGT_HOS_MAX_TESS_LEVEL */
-	0x00000000, /* VGT_HOS_MIN_TESS_LEVEL */
-	0x00000000, /* VGT_HOS_REUSE_DEPTH */
-	0x00000000, /* VGT_GROUP_PRIM_TYPE */
-	0x00000000, /* VGT_GROUP_FIRST_DECR */
-	0x00000000, /* VGT_GROUP_DECR */
-	0x00000000, /* VGT_GROUP_VECT_0_CNTL */
-	0x00000000, /* VGT_GROUP_VECT_1_CNTL */
-	0x00000000, /* VGT_GROUP_VECT_0_FMT_CNTL */
-	0x00000000, /* VGT_GROUP_VECT_1_FMT_CNTL */
-	0x00000000, /* VGT_GS_MODE */
-
-	0xc0016900,
-	0x000002a1,
-	0x00000000, /* VGT_PRIMITIVEID_EN */
-
-	0xc0016900,
-	0x000002a5,
-	0x00000000, /* VGT_MULTI_PRIM_ID_RESET_EN */
-
-	0xc0036900,
-	0x000002ac,
-	0x00000000, /* VGT_STRMOUT_EN */
-	0x00000000, /* VGT_REUSE_OFF */
-	0x00000000, /* VGT_VTX_CNT_EN */
-
-	0xc0016900,
-	0x000000d4,
-	0x00000000, /* SX_MISC */
-
-	0xc0016900,
-	0x000002c8,
-	0x00000000, /* VGT_STRMOUT_BUFFER_EN */
-
-	0xc0076900,
-	0x00000202,
-	0x00cc0000, /* CB_COLOR_CONTROL */
-	0x00000210, /* DB_SHADER_CNTL */
-	0x00010000, /* PA_CL_CLIP_CNTL */
-	0x00000244, /* PA_SU_SC_MODE_CNTL */
-	0x00000100, /* PA_CL_VTE_CNTL */
-	0x00000000, /* PA_CL_VS_OUT_CNTL */
-	0x00000000, /* PA_CL_NANINF_CNTL */
-
-	0xc0026900,
-	0x0000008e,
-	0x0000000f, /* CB_TARGET_MASK */
-	0x0000000f, /* CB_SHADER_MASK */
-
-	0xc0016900,
-	0x000001e8,
-	0x00000001, /* CB_SHADER_CONTROL */
-
-	0xc0016900,
-	0x00000185,
-	0x00000000, /* SPI_VS_OUT_ID_0 */
-
-	0xc0016900,
-	0x00000191,
-	0x00000b00, /* SPI_PS_INPUT_CNTL_0 */
-
-	0xc0056900,
-	0x000001b1,
-	0x00000000, /* SPI_VS_OUT_CONFIG */
-	0x00000000, /* SPI_THREAD_GROUPING */
-	0x00000001, /* SPI_PS_IN_CONTROL_0 */
-	0x00000000, /* SPI_PS_IN_CONTROL_1 */
-	0x00000000, /* SPI_INTERP_CONTROL_0 */
-
-	0xc0036e00, /* SET_SAMPLER */
-	0x00000000,
-	0x00000012,
-	0x00000000,
-	0x00000000,
-};
-
-const u32 r7xx_default_state[] =
-{
-	0xc0012800, /* CONTEXT_CONTROL */
-	0x80000000,
-	0x80000000,
-
-	0xc0016800,
-	0x00000010,
-	0x00008000, /* WAIT_UNTIL */
-
-	0xc0016800,
-	0x00000542,
-	0x07000002, /* TA_CNTL_AUX */
-
-	0xc0016800,
-	0x000005c5,
-	0x00000000, /* VC_ENHANCE */
-
-	0xc0016800,
-	0x00000363,
-	0x00004000, /* SQ_DYN_GPR_CNTL_PS_FLUSH_REQ */
-
-	0xc0016800,
-	0x0000060c,
-	0x00000000, /* DB_DEBUG */
-
-	0xc0016800,
-	0x0000060e,
-	0x00420204, /* DB_WATERMARKS */
-
-	0xc0026f00,
-	0x00000000,
-	0x00000000, /* SQ_VTX_BASE_VTX_LOC */
-	0x00000000, /* SQ_VTX_START_INST_LOC */
-
-	0xc0096900,
-	0x0000022a,
-	0x00000000, /* SQ_ESGS_RING_ITEMSIZE */
-	0x00000000,
-	0x00000000,
-	0x00000000,
-	0x00000000,
-	0x00000000,
-	0x00000000,
-	0x00000000,
-	0x00000000,
-
-	0xc0016900,
-	0x00000004,
-	0x00000000, /* DB_DEPTH_INFO */
-
-	0xc0026900,
-	0x0000000a,
-	0x00000000, /* DB_STENCIL_CLEAR */
-	0x00000000, /* DB_DEPTH_CLEAR */
-
-	0xc0016900,
-	0x00000200,
-	0x00000000, /* DB_DEPTH_CONTROL */
-
-	0xc0026900,
-	0x00000343,
-	0x00000060, /* DB_RENDER_CONTROL */
-	0x00000000, /* DB_RENDER_OVERRIDE */
-
-	0xc0016900,
-	0x00000351,
-	0x0000aa00, /* DB_ALPHA_TO_MASK */
-
-	0xc0096900,
-	0x00000100,
-	0x00000800, /* VGT_MAX_VTX_INDX */
-	0x00000000, /* VGT_MIN_VTX_INDX */
-	0x00000000, /* VGT_INDX_OFFSET */
-	0x00000000, /* VGT_MULTI_PRIM_IB_RESET_INDX */
-	0x00000000, /* SX_ALPHA_TEST_CONTROL */
-	0x00000000, /* CB_BLEND_RED */
-	0x00000000,
-	0x00000000,
-	0x00000000,
-
-	0xc0036900,
-	0x0000010c,
-	0x00000000, /* DB_STENCILREFMASK */
-	0x00000000, /* DB_STENCILREFMASK_BF */
-	0x00000000, /* SX_ALPHA_REF */
-
-	0xc0046900,
-	0x0000030c, /* CB_CLRCMP_CNTL */
-	0x01000000,
-	0x00000000,
-	0x00000000,
-	0x00000000,
-
-	0xc0016900,
-	0x00000080,
-	0x00000000, /* PA_SC_WINDOW_OFFSET */
-
-	0xc00a6900,
-	0x00000083,
-	0x0000ffff, /* PA_SC_CLIP_RECT_RULE */
-	0x00000000, /* PA_SC_CLIPRECT_0_TL */
-	0x20002000,
-	0x00000000,
-	0x20002000,
-	0x00000000,
-	0x20002000,
-	0x00000000,
-	0x20002000,
-	0xaaaaaaaa, /* PA_SC_EDGERULE */
-
-	0xc0406900,
-	0x00000094,
-	0x80000000, /* PA_SC_VPORT_SCISSOR_0_TL */
-	0x20002000, /* PA_SC_VPORT_SCISSOR_0_BR */
-	0x80000000, /* PA_SC_VPORT_SCISSOR_1_TL */
-	0x20002000,
-	0x80000000,
-	0x20002000,
-	0x80000000,
-	0x20002000,
-	0x80000000,
-	0x20002000,
-	0x80000000,
-	0x20002000,
-	0x80000000,
-	0x20002000,
-	0x80000000,
-	0x20002000,
-	0x80000000,
-	0x20002000,
-	0x80000000,
-	0x20002000,
-	0x80000000,
-	0x20002000,
-	0x80000000,
-	0x20002000,
-	0x80000000,
-	0x20002000,
-	0x80000000,
-	0x20002000,
-	0x80000000,
-	0x20002000,
-	0x80000000,
-	0x20002000,
-	0x00000000, /* PA_SC_VPORT_ZMIN_0 */
-	0x3f800000,
-	0x00000000,
-	0x3f800000,
-	0x00000000,
-	0x3f800000,
-	0x00000000,
-	0x3f800000,
-	0x00000000,
-	0x3f800000,
-	0x00000000,
-	0x3f800000,
-	0x00000000,
-	0x3f800000,
-	0x00000000,
-	0x3f800000,
-	0x00000000,
-	0x3f800000,
-	0x00000000,
-	0x3f800000,
-	0x00000000,
-	0x3f800000,
-	0x00000000,
-	0x3f800000,
-	0x00000000,
-	0x3f800000,
-	0x00000000,
-	0x3f800000,
-	0x00000000,
-	0x3f800000,
-	0x00000000,
-	0x3f800000,
-
-	0xc0026900,
-	0x00000292,
-	0x00000000, /* PA_SC_MPASS_PS_CNTL */
-	0x00514000, /* PA_SC_MODE_CNTL */
-
-	0xc0096900,
-	0x00000300,
-	0x00000000, /* PA_SC_LINE_CNTL */
-	0x00000000, /* PA_SC_AA_CONFIG */
-	0x0000002d, /* PA_SU_VTX_CNTL */
-	0x3f800000, /* PA_CL_GB_VERT_CLIP_ADJ */
-	0x3f800000,
-	0x3f800000,
-	0x3f800000,
-	0x00000000, /* PA_SC_SAMPLE_LOCS_MCTX */
-	0x00000000,
-
-	0xc0016900,
-	0x00000312,
-	0xffffffff, /* PA_SC_AA_MASK */
-
-	0xc0066900,
-	0x0000037e,
-	0x00000000, /* PA_SU_POLY_OFFSET_DB_FMT_CNTL */
-	0x00000000, /* PA_SU_POLY_OFFSET_CLAMP */
-	0x00000000, /* PA_SU_POLY_OFFSET_FRONT_SCALE */
-	0x00000000, /* PA_SU_POLY_OFFSET_FRONT_OFFSET */
-	0x00000000, /* PA_SU_POLY_OFFSET_BACK_SCALE */
-	0x00000000, /* PA_SU_POLY_OFFSET_BACK_OFFSET */
-
-	0xc0046900,
-	0x000001b6,
-	0x00000000, /* SPI_INPUT_Z */
-	0x00000000, /* SPI_FOG_CNTL */
-	0x00000000, /* SPI_FOG_FUNC_SCALE */
-	0x00000000, /* SPI_FOG_FUNC_BIAS */
-
-	0xc0016900,
-	0x00000225,
-	0x00000000, /* SQ_PGM_START_FS */
-
-	0xc0016900,
-	0x00000229,
-	0x00000000, /* SQ_PGM_RESOURCES_FS */
-
-	0xc0016900,
-	0x00000237,
-	0x00000000, /* SQ_PGM_CF_OFFSET_FS */
-
-	0xc0026900,
-	0x000002a8,
-	0x00000000, /* VGT_INSTANCE_STEP_RATE_0 */
-	0x00000000, /* VGT_INSTANCE_STEP_RATE_1 */
-
-	0xc0116900,
-	0x00000280,
-	0x00000000, /* PA_SU_POINT_SIZE */
-	0x00000000, /* PA_SU_POINT_MINMAX */
-	0x00000008, /* PA_SU_LINE_CNTL */
-	0x00000000, /* PA_SC_LINE_STIPPLE */
-	0x00000000, /* VGT_OUTPUT_PATH_CNTL */
-	0x00000000, /* VGT_HOS_CNTL */
-	0x00000000, /* VGT_HOS_MAX_TESS_LEVEL */
-	0x00000000, /* VGT_HOS_MIN_TESS_LEVEL */
-	0x00000000, /* VGT_HOS_REUSE_DEPTH */
-	0x00000000, /* VGT_GROUP_PRIM_TYPE */
-	0x00000000, /* VGT_GROUP_FIRST_DECR */
-	0x00000000, /* VGT_GROUP_DECR */
-	0x00000000, /* VGT_GROUP_VECT_0_CNTL */
-	0x00000000, /* VGT_GROUP_VECT_1_CNTL */
-	0x00000000, /* VGT_GROUP_VECT_0_FMT_CNTL */
-	0x00000000, /* VGT_GROUP_VECT_1_FMT_CNTL */
-	0x00000000, /* VGT_GS_MODE */
-
-	0xc0016900,
-	0x000002a1,
-	0x00000000, /* VGT_PRIMITIVEID_EN */
-
-	0xc0016900,
-	0x000002a5,
-	0x00000000, /* VGT_MULTI_PRIM_ID_RESET_EN */
-
-	0xc0036900,
-	0x000002ac,
-	0x00000000, /* VGT_STRMOUT_EN */
-	0x00000000, /* VGT_REUSE_OFF */
-	0x00000000, /* VGT_VTX_CNT_EN */
-
-	0xc0016900,
-	0x000000d4,
-	0x00000000, /* SX_MISC */
-
-	0xc0016900,
-	0x000002c8,
-	0x00000000, /* VGT_STRMOUT_BUFFER_EN */
-
-	0xc0076900,
-	0x00000202,
-	0x00cc0000, /* CB_COLOR_CONTROL */
-	0x00000210, /* DB_SHADER_CNTL */
-	0x00010000, /* PA_CL_CLIP_CNTL */
-	0x00000244, /* PA_SU_SC_MODE_CNTL */
-	0x00000100, /* PA_CL_VTE_CNTL */
-	0x00000000, /* PA_CL_VS_OUT_CNTL */
-	0x00000000, /* PA_CL_NANINF_CNTL */
-
-	0xc0026900,
-	0x0000008e,
-	0x0000000f, /* CB_TARGET_MASK */
-	0x0000000f, /* CB_SHADER_MASK */
-
-	0xc0016900,
-	0x000001e8,
-	0x00000001, /* CB_SHADER_CONTROL */
-
-	0xc0016900,
-	0x00000185,
-	0x00000000, /* SPI_VS_OUT_ID_0 */
-
-	0xc0016900,
-	0x00000191,
-	0x00000b00, /* SPI_PS_INPUT_CNTL_0 */
-
-	0xc0056900,
-	0x000001b1,
-	0x00000000, /* SPI_VS_OUT_CONFIG */
-	0x00000001, /* SPI_THREAD_GROUPING */
-	0x00000001, /* SPI_PS_IN_CONTROL_0 */
-	0x00000000, /* SPI_PS_IN_CONTROL_1 */
-	0x00000000, /* SPI_INTERP_CONTROL_0 */
-
-	0xc0036e00, /* SET_SAMPLER */
-	0x00000000,
-	0x00000012,
-	0x00000000,
-	0x00000000,
-};
-
-/* same for r6xx/r7xx */
-const u32 r6xx_vs[] =
-{
-	0x00000004,
-	0x81000000,
-	0x0000203c,
-	0x94000b08,
-	0x00004000,
-	0x14200b1a,
-	0x00000000,
-	0x00000000,
-	0x3c000000,
-	0x68cd1000,
-#ifdef __BIG_ENDIAN
-	0x000a0000,
-#else
-	0x00080000,
-#endif
-	0x00000000,
-};
-
-const u32 r6xx_ps[] =
-{
-	0x00000002,
-	0x80800000,
-	0x00000000,
-	0x94200688,
-	0x00000010,
-	0x000d1000,
-	0xb0800000,
-	0x00000000,
-};
-
-const u32 r6xx_ps_size = ARRAY_SIZE(r6xx_ps);
-const u32 r6xx_vs_size = ARRAY_SIZE(r6xx_vs);
-const u32 r6xx_default_size = ARRAY_SIZE(r6xx_default_state);
-const u32 r7xx_default_size = ARRAY_SIZE(r7xx_default_state);
diff --git a/drivers/gpu/drm/radeon/r600_blit_shaders.h b/drivers/gpu/drm/radeon/r600_blit_shaders.h
deleted file mode 100644
index f437d36dd98c..000000000000
--- a/drivers/gpu/drm/radeon/r600_blit_shaders.h
+++ /dev/null
@@ -1,38 +0,0 @@
-/*
- * Copyright 2009 Advanced Micro Devices, Inc.
- * Copyright 2009 Red Hat Inc.
- *
- * Permission is hereby granted, free of charge, to any person obtaining a
- * copy of this software and associated documentation files (the "Software"),
- * to deal in the Software without restriction, including without limitation
- * the rights to use, copy, modify, merge, publish, distribute, sublicense,
- * and/or sell copies of the Software, and to permit persons to whom the
- * Software is furnished to do so, subject to the following conditions:
- *
- * The above copyright notice and this permission notice (including the next
- * paragraph) shall be included in all copies or substantial portions of the
- * Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
- * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
- * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL
- * THE COPYRIGHT HOLDER(S) AND/OR ITS SUPPLIERS BE LIABLE FOR ANY CLAIM, DAMAGES OR
- * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
- * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
- * DEALINGS IN THE SOFTWARE.
- *
- */
-
-#ifndef R600_BLIT_SHADERS_H
-#define R600_BLIT_SHADERS_H
-
-extern const u32 r6xx_ps[];
-extern const u32 r6xx_vs[];
-extern const u32 r7xx_default_state[];
-extern const u32 r6xx_default_state[];
-
-
-extern const u32 r6xx_ps_size, r6xx_vs_size;
-extern const u32 r6xx_default_size, r7xx_default_size;
-
-#endif
-- 
2.27.0


^ permalink raw reply related	[relevance 58%]

* [PATCH] drm/radeon: change cayman_default_state table from global to static
@ 2022-04-07 21:46 62% Tom Rix
  0 siblings, 0 replies; 180+ results
From: Tom Rix @ 2022-04-07 21:46 UTC (permalink / raw)
  To: alexander.deucher, christian.koenig, Xinhui.Pan, airlied, daniel
  Cc: Tom Rix, dri-devel, linux-kernel, amd-gfx

cayman_default_state and cayman_default_size are only
used in ni.c.  Single file symbols should be static.
So move their definitions to cayman_blit_shaders.h
and change their storage-class-specifier to static.

Remove unneeded cayman_blit_shader.c

cayman_ps/vs definitions were removed with
commit 4f8629675800 ("drm/radeon/kms: remove r6xx+ blit copy routines")
So their declarations in cayman_blit_shader.h
are not needed, so remove them.

Signed-off-by: Tom Rix <trix@redhat.com>
---
 drivers/gpu/drm/radeon/Makefile              |   2 +-
 drivers/gpu/drm/radeon/cayman_blit_shaders.c | 320 -------------------
 drivers/gpu/drm/radeon/cayman_blit_shaders.h | 294 ++++++++++++++++-
 3 files changed, 290 insertions(+), 326 deletions(-)
 delete mode 100644 drivers/gpu/drm/radeon/cayman_blit_shaders.c

diff --git a/drivers/gpu/drm/radeon/Makefile b/drivers/gpu/drm/radeon/Makefile
index 664381f4eb07..2425a3612d6c 100644
--- a/drivers/gpu/drm/radeon/Makefile
+++ b/drivers/gpu/drm/radeon/Makefile
@@ -42,7 +42,7 @@ radeon-y += radeon_device.o radeon_asic.o radeon_kms.o \
 	r200.o radeon_legacy_tv.o r600_cs.o r600_blit_shaders.o \
 	radeon_pm.o atombios_dp.o r600_hdmi.o dce3_1_afmt.o \
 	evergreen.o evergreen_cs.o evergreen_blit_shaders.o \
-	evergreen_hdmi.o radeon_trace_points.o ni.o cayman_blit_shaders.o \
+	evergreen_hdmi.o radeon_trace_points.o ni.o \
 	atombios_encoders.o radeon_semaphore.o radeon_sa.o atombios_i2c.o si.o \
 	radeon_prime.o cik.o cik_blit_shaders.o \
 	r600_dpm.o rs780_dpm.o rv6xx_dpm.o rv770_dpm.o rv730_dpm.o rv740_dpm.o \
diff --git a/drivers/gpu/drm/radeon/cayman_blit_shaders.c b/drivers/gpu/drm/radeon/cayman_blit_shaders.c
deleted file mode 100644
index 9fec4d09f383..000000000000
--- a/drivers/gpu/drm/radeon/cayman_blit_shaders.c
+++ /dev/null
@@ -1,320 +0,0 @@
-/*
- * Copyright 2010 Advanced Micro Devices, Inc.
- *
- * Permission is hereby granted, free of charge, to any person obtaining a
- * copy of this software and associated documentation files (the "Software"),
- * to deal in the Software without restriction, including without limitation
- * the rights to use, copy, modify, merge, publish, distribute, sublicense,
- * and/or sell copies of the Software, and to permit persons to whom the
- * Software is furnished to do so, subject to the following conditions:
- *
- * The above copyright notice and this permission notice (including the next
- * paragraph) shall be included in all copies or substantial portions of the
- * Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
- * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
- * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL
- * THE COPYRIGHT HOLDER(S) AND/OR ITS SUPPLIERS BE LIABLE FOR ANY CLAIM, DAMAGES OR
- * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
- * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
- * DEALINGS IN THE SOFTWARE.
- *
- * Authors:
- *     Alex Deucher <alexander.deucher@amd.com>
- */
-
-#include <linux/bug.h>
-#include <linux/types.h>
-#include <linux/kernel.h>
-
-/*
- * evergreen cards need to use the 3D engine to blit data which requires
- * quite a bit of hw state setup.  Rather than pull the whole 3D driver
- * (which normally generates the 3D state) into the DRM, we opt to use
- * statically generated state tables.  The register state and shaders
- * were hand generated to support blitting functionality.  See the 3D
- * driver or documentation for descriptions of the registers and
- * shader instructions.
- */
-
-const u32 cayman_default_state[] =
-{
-	0xc0066900,
-	0x00000000,
-	0x00000060, /* DB_RENDER_CONTROL */
-	0x00000000, /* DB_COUNT_CONTROL */
-	0x00000000, /* DB_DEPTH_VIEW */
-	0x0000002a, /* DB_RENDER_OVERRIDE */
-	0x00000000, /* DB_RENDER_OVERRIDE2 */
-	0x00000000, /* DB_HTILE_DATA_BASE */
-
-	0xc0026900,
-	0x0000000a,
-	0x00000000, /* DB_STENCIL_CLEAR */
-	0x00000000, /* DB_DEPTH_CLEAR */
-
-	0xc0036900,
-	0x0000000f,
-	0x00000000, /* DB_DEPTH_INFO */
-	0x00000000, /* DB_Z_INFO */
-	0x00000000, /* DB_STENCIL_INFO */
-
-	0xc0016900,
-	0x00000080,
-	0x00000000, /* PA_SC_WINDOW_OFFSET */
-
-	0xc00d6900,
-	0x00000083,
-	0x0000ffff, /* PA_SC_CLIPRECT_RULE */
-	0x00000000, /* PA_SC_CLIPRECT_0_TL */
-	0x20002000, /* PA_SC_CLIPRECT_0_BR */
-	0x00000000,
-	0x20002000,
-	0x00000000,
-	0x20002000,
-	0x00000000,
-	0x20002000,
-	0xaaaaaaaa, /* PA_SC_EDGERULE */
-	0x00000000, /* PA_SU_HARDWARE_SCREEN_OFFSET */
-	0x0000000f, /* CB_TARGET_MASK */
-	0x0000000f, /* CB_SHADER_MASK */
-
-	0xc0226900,
-	0x00000094,
-	0x80000000, /* PA_SC_VPORT_SCISSOR_0_TL */
-	0x20002000, /* PA_SC_VPORT_SCISSOR_0_BR */
-	0x80000000,
-	0x20002000,
-	0x80000000,
-	0x20002000,
-	0x80000000,
-	0x20002000,
-	0x80000000,
-	0x20002000,
-	0x80000000,
-	0x20002000,
-	0x80000000,
-	0x20002000,
-	0x80000000,
-	0x20002000,
-	0x80000000,
-	0x20002000,
-	0x80000000,
-	0x20002000,
-	0x80000000,
-	0x20002000,
-	0x80000000,
-	0x20002000,
-	0x80000000,
-	0x20002000,
-	0x80000000,
-	0x20002000,
-	0x80000000,
-	0x20002000,
-	0x80000000,
-	0x20002000,
-	0x00000000, /* PA_SC_VPORT_ZMIN_0 */
-	0x3f800000, /* PA_SC_VPORT_ZMAX_0 */
-
-	0xc0016900,
-	0x000000d4,
-	0x00000000, /* SX_MISC */
-
-	0xc0026900,
-	0x000000d9,
-	0x00000000, /* CP_RINGID */
-	0x00000000, /* CP_VMID */
-
-	0xc0096900,
-	0x00000100,
-	0x00ffffff, /* VGT_MAX_VTX_INDX */
-	0x00000000, /* VGT_MIN_VTX_INDX */
-	0x00000000, /* VGT_INDX_OFFSET */
-	0x00000000, /* VGT_MULTI_PRIM_IB_RESET_INDX */
-	0x00000000, /* SX_ALPHA_TEST_CONTROL */
-	0x00000000, /* CB_BLEND_RED */
-	0x00000000, /* CB_BLEND_GREEN */
-	0x00000000, /* CB_BLEND_BLUE */
-	0x00000000, /* CB_BLEND_ALPHA */
-
-	0xc0016900,
-	0x00000187,
-	0x00000100, /* SPI_VS_OUT_ID_0 */
-
-	0xc0026900,
-	0x00000191,
-	0x00000100, /* SPI_PS_INPUT_CNTL_0 */
-	0x00000101, /* SPI_PS_INPUT_CNTL_1 */
-
-	0xc0016900,
-	0x000001b1,
-	0x00000000, /* SPI_VS_OUT_CONFIG */
-
-	0xc0106900,
-	0x000001b3,
-	0x20000001, /* SPI_PS_IN_CONTROL_0 */
-	0x00000000, /* SPI_PS_IN_CONTROL_1 */
-	0x00000000, /* SPI_INTERP_CONTROL_0 */
-	0x00000000, /* SPI_INPUT_Z */
-	0x00000000, /* SPI_FOG_CNTL */
-	0x00100000, /* SPI_BARYC_CNTL */
-	0x00000000, /* SPI_PS_IN_CONTROL_2 */
-	0x00000000, /* SPI_COMPUTE_INPUT_CNTL */
-	0x00000000, /* SPI_COMPUTE_NUM_THREAD_X */
-	0x00000000, /* SPI_COMPUTE_NUM_THREAD_Y */
-	0x00000000, /* SPI_COMPUTE_NUM_THREAD_Z */
-	0x00000000, /* SPI_GPR_MGMT */
-	0x00000000, /* SPI_LDS_MGMT */
-	0x00000000, /* SPI_STACK_MGMT */
-	0x00000000, /* SPI_WAVE_MGMT_1 */
-	0x00000000, /* SPI_WAVE_MGMT_2 */
-
-	0xc0016900,
-	0x000001e0,
-	0x00000000, /* CB_BLEND0_CONTROL */
-
-	0xc00e6900,
-	0x00000200,
-	0x00000000, /* DB_DEPTH_CONTROL */
-	0x00000000, /* DB_EQAA */
-	0x00cc0010, /* CB_COLOR_CONTROL */
-	0x00000210, /* DB_SHADER_CONTROL */
-	0x00010000, /* PA_CL_CLIP_CNTL */
-	0x00000004, /* PA_SU_SC_MODE_CNTL */
-	0x00000100, /* PA_CL_VTE_CNTL */
-	0x00000000, /* PA_CL_VS_OUT_CNTL */
-	0x00000000, /* PA_CL_NANINF_CNTL */
-	0x00000000, /* PA_SU_LINE_STIPPLE_CNTL */
-	0x00000000, /* PA_SU_LINE_STIPPLE_SCALE */
-	0x00000000, /* PA_SU_PRIM_FILTER_CNTL */
-	0x00000000, /*  */
-	0x00000000, /*  */
-
-	0xc0026900,
-	0x00000229,
-	0x00000000, /* SQ_PGM_START_FS */
-	0x00000000,
-
-	0xc0016900,
-	0x0000023b,
-	0x00000000, /* SQ_LDS_ALLOC_PS */
-
-	0xc0066900,
-	0x00000240,
-	0x00000000, /* SQ_ESGS_RING_ITEMSIZE */
-	0x00000000,
-	0x00000000,
-	0x00000000,
-	0x00000000,
-	0x00000000,
-
-	0xc0046900,
-	0x00000247,
-	0x00000000, /* SQ_GS_VERT_ITEMSIZE */
-	0x00000000,
-	0x00000000,
-	0x00000000,
-
-	0xc0116900,
-	0x00000280,
-	0x00000000, /* PA_SU_POINT_SIZE */
-	0x00000000, /* PA_SU_POINT_MINMAX */
-	0x00000008, /* PA_SU_LINE_CNTL */
-	0x00000000, /* PA_SC_LINE_STIPPLE */
-	0x00000000, /* VGT_OUTPUT_PATH_CNTL */
-	0x00000000, /* VGT_HOS_CNTL */
-	0x00000000,
-	0x00000000,
-	0x00000000,
-	0x00000000,
-	0x00000000,
-	0x00000000,
-	0x00000000,
-	0x00000000,
-	0x00000000,
-	0x00000000,
-	0x00000000, /* VGT_GS_MODE */
-
-	0xc0026900,
-	0x00000292,
-	0x00000000, /* PA_SC_MODE_CNTL_0 */
-	0x00000000, /* PA_SC_MODE_CNTL_1 */
-
-	0xc0016900,
-	0x000002a1,
-	0x00000000, /* VGT_PRIMITIVEID_EN */
-
-	0xc0016900,
-	0x000002a5,
-	0x00000000, /* VGT_MULTI_PRIM_IB_RESET_EN */
-
-	0xc0026900,
-	0x000002a8,
-	0x00000000, /* VGT_INSTANCE_STEP_RATE_0 */
-	0x00000000,
-
-	0xc0026900,
-	0x000002ad,
-	0x00000000, /* VGT_REUSE_OFF */
-	0x00000000,
-
-	0xc0016900,
-	0x000002d5,
-	0x00000000, /* VGT_SHADER_STAGES_EN */
-
-	0xc0016900,
-	0x000002dc,
-	0x0000aa00, /* DB_ALPHA_TO_MASK */
-
-	0xc0066900,
-	0x000002de,
-	0x00000000, /* PA_SU_POLY_OFFSET_DB_FMT_CNTL */
-	0x00000000,
-	0x00000000,
-	0x00000000,
-	0x00000000,
-	0x00000000,
-
-	0xc0026900,
-	0x000002e5,
-	0x00000000, /* VGT_STRMOUT_CONFIG */
-	0x00000000,
-
-	0xc01b6900,
-	0x000002f5,
-	0x76543210, /* PA_SC_CENTROID_PRIORITY_0 */
-	0xfedcba98, /* PA_SC_CENTROID_PRIORITY_1 */
-	0x00000000, /* PA_SC_LINE_CNTL */
-	0x00000000, /* PA_SC_AA_CONFIG */
-	0x00000005, /* PA_SU_VTX_CNTL */
-	0x3f800000, /* PA_CL_GB_VERT_CLIP_ADJ */
-	0x3f800000, /* PA_CL_GB_VERT_DISC_ADJ */
-	0x3f800000, /* PA_CL_GB_HORZ_CLIP_ADJ */
-	0x3f800000, /* PA_CL_GB_HORZ_DISC_ADJ */
-	0x00000000, /* PA_SC_AA_SAMPLE_LOCS_PIXEL_X0Y0_0 */
-	0x00000000,
-	0x00000000,
-	0x00000000,
-	0x00000000,
-	0x00000000,
-	0x00000000,
-	0x00000000,
-	0x00000000,
-	0x00000000,
-	0x00000000,
-	0x00000000,
-	0x00000000,
-	0x00000000,
-	0x00000000,
-	0x00000000,
-	0xffffffff, /* PA_SC_AA_MASK_X0Y0_X1Y0 */
-	0xffffffff,
-
-	0xc0026900,
-	0x00000316,
-	0x0000000e, /* VGT_VERTEX_REUSE_BLOCK_CNTL */
-	0x00000010, /*  */
-};
-
-const u32 cayman_default_size = ARRAY_SIZE(cayman_default_state);
diff --git a/drivers/gpu/drm/radeon/cayman_blit_shaders.h b/drivers/gpu/drm/radeon/cayman_blit_shaders.h
index f5d0e9a60267..1dca73d9e005 100644
--- a/drivers/gpu/drm/radeon/cayman_blit_shaders.h
+++ b/drivers/gpu/drm/radeon/cayman_blit_shaders.h
@@ -20,16 +20,300 @@
  * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
  * DEALINGS IN THE SOFTWARE.
  *
+ * Authors:
+ *     Alex Deucher <alexander.deucher@amd.com>
  */
 
 #ifndef CAYMAN_BLIT_SHADERS_H
 #define CAYMAN_BLIT_SHADERS_H
 
-extern const u32 cayman_ps[];
-extern const u32 cayman_vs[];
-extern const u32 cayman_default_state[];
+/*
+ * evergreen cards need to use the 3D engine to blit data which requires
+ * quite a bit of hw state setup.  Rather than pull the whole 3D driver
+ * (which normally generates the 3D state) into the DRM, we opt to use
+ * statically generated state tables.  The register state and shaders
+ * were hand generated to support blitting functionality.  See the 3D
+ * driver or documentation for descriptions of the registers and
+ * shader instructions.
+ */
+static const u32 cayman_default_state[] = {
+	0xc0066900,
+	0x00000000,
+	0x00000060, /* DB_RENDER_CONTROL */
+	0x00000000, /* DB_COUNT_CONTROL */
+	0x00000000, /* DB_DEPTH_VIEW */
+	0x0000002a, /* DB_RENDER_OVERRIDE */
+	0x00000000, /* DB_RENDER_OVERRIDE2 */
+	0x00000000, /* DB_HTILE_DATA_BASE */
+
+	0xc0026900,
+	0x0000000a,
+	0x00000000, /* DB_STENCIL_CLEAR */
+	0x00000000, /* DB_DEPTH_CLEAR */
+
+	0xc0036900,
+	0x0000000f,
+	0x00000000, /* DB_DEPTH_INFO */
+	0x00000000, /* DB_Z_INFO */
+	0x00000000, /* DB_STENCIL_INFO */
+
+	0xc0016900,
+	0x00000080,
+	0x00000000, /* PA_SC_WINDOW_OFFSET */
+
+	0xc00d6900,
+	0x00000083,
+	0x0000ffff, /* PA_SC_CLIPRECT_RULE */
+	0x00000000, /* PA_SC_CLIPRECT_0_TL */
+	0x20002000, /* PA_SC_CLIPRECT_0_BR */
+	0x00000000,
+	0x20002000,
+	0x00000000,
+	0x20002000,
+	0x00000000,
+	0x20002000,
+	0xaaaaaaaa, /* PA_SC_EDGERULE */
+	0x00000000, /* PA_SU_HARDWARE_SCREEN_OFFSET */
+	0x0000000f, /* CB_TARGET_MASK */
+	0x0000000f, /* CB_SHADER_MASK */
+
+	0xc0226900,
+	0x00000094,
+	0x80000000, /* PA_SC_VPORT_SCISSOR_0_TL */
+	0x20002000, /* PA_SC_VPORT_SCISSOR_0_BR */
+	0x80000000,
+	0x20002000,
+	0x80000000,
+	0x20002000,
+	0x80000000,
+	0x20002000,
+	0x80000000,
+	0x20002000,
+	0x80000000,
+	0x20002000,
+	0x80000000,
+	0x20002000,
+	0x80000000,
+	0x20002000,
+	0x80000000,
+	0x20002000,
+	0x80000000,
+	0x20002000,
+	0x80000000,
+	0x20002000,
+	0x80000000,
+	0x20002000,
+	0x80000000,
+	0x20002000,
+	0x80000000,
+	0x20002000,
+	0x80000000,
+	0x20002000,
+	0x80000000,
+	0x20002000,
+	0x00000000, /* PA_SC_VPORT_ZMIN_0 */
+	0x3f800000, /* PA_SC_VPORT_ZMAX_0 */
+
+	0xc0016900,
+	0x000000d4,
+	0x00000000, /* SX_MISC */
+
+	0xc0026900,
+	0x000000d9,
+	0x00000000, /* CP_RINGID */
+	0x00000000, /* CP_VMID */
+
+	0xc0096900,
+	0x00000100,
+	0x00ffffff, /* VGT_MAX_VTX_INDX */
+	0x00000000, /* VGT_MIN_VTX_INDX */
+	0x00000000, /* VGT_INDX_OFFSET */
+	0x00000000, /* VGT_MULTI_PRIM_IB_RESET_INDX */
+	0x00000000, /* SX_ALPHA_TEST_CONTROL */
+	0x00000000, /* CB_BLEND_RED */
+	0x00000000, /* CB_BLEND_GREEN */
+	0x00000000, /* CB_BLEND_BLUE */
+	0x00000000, /* CB_BLEND_ALPHA */
+
+	0xc0016900,
+	0x00000187,
+	0x00000100, /* SPI_VS_OUT_ID_0 */
+
+	0xc0026900,
+	0x00000191,
+	0x00000100, /* SPI_PS_INPUT_CNTL_0 */
+	0x00000101, /* SPI_PS_INPUT_CNTL_1 */
+
+	0xc0016900,
+	0x000001b1,
+	0x00000000, /* SPI_VS_OUT_CONFIG */
+
+	0xc0106900,
+	0x000001b3,
+	0x20000001, /* SPI_PS_IN_CONTROL_0 */
+	0x00000000, /* SPI_PS_IN_CONTROL_1 */
+	0x00000000, /* SPI_INTERP_CONTROL_0 */
+	0x00000000, /* SPI_INPUT_Z */
+	0x00000000, /* SPI_FOG_CNTL */
+	0x00100000, /* SPI_BARYC_CNTL */
+	0x00000000, /* SPI_PS_IN_CONTROL_2 */
+	0x00000000, /* SPI_COMPUTE_INPUT_CNTL */
+	0x00000000, /* SPI_COMPUTE_NUM_THREAD_X */
+	0x00000000, /* SPI_COMPUTE_NUM_THREAD_Y */
+	0x00000000, /* SPI_COMPUTE_NUM_THREAD_Z */
+	0x00000000, /* SPI_GPR_MGMT */
+	0x00000000, /* SPI_LDS_MGMT */
+	0x00000000, /* SPI_STACK_MGMT */
+	0x00000000, /* SPI_WAVE_MGMT_1 */
+	0x00000000, /* SPI_WAVE_MGMT_2 */
+
+	0xc0016900,
+	0x000001e0,
+	0x00000000, /* CB_BLEND0_CONTROL */
+
+	0xc00e6900,
+	0x00000200,
+	0x00000000, /* DB_DEPTH_CONTROL */
+	0x00000000, /* DB_EQAA */
+	0x00cc0010, /* CB_COLOR_CONTROL */
+	0x00000210, /* DB_SHADER_CONTROL */
+	0x00010000, /* PA_CL_CLIP_CNTL */
+	0x00000004, /* PA_SU_SC_MODE_CNTL */
+	0x00000100, /* PA_CL_VTE_CNTL */
+	0x00000000, /* PA_CL_VS_OUT_CNTL */
+	0x00000000, /* PA_CL_NANINF_CNTL */
+	0x00000000, /* PA_SU_LINE_STIPPLE_CNTL */
+	0x00000000, /* PA_SU_LINE_STIPPLE_SCALE */
+	0x00000000, /* PA_SU_PRIM_FILTER_CNTL */
+	0x00000000, /*  */
+	0x00000000, /*  */
+
+	0xc0026900,
+	0x00000229,
+	0x00000000, /* SQ_PGM_START_FS */
+	0x00000000,
+
+	0xc0016900,
+	0x0000023b,
+	0x00000000, /* SQ_LDS_ALLOC_PS */
+
+	0xc0066900,
+	0x00000240,
+	0x00000000, /* SQ_ESGS_RING_ITEMSIZE */
+	0x00000000,
+	0x00000000,
+	0x00000000,
+	0x00000000,
+	0x00000000,
+
+	0xc0046900,
+	0x00000247,
+	0x00000000, /* SQ_GS_VERT_ITEMSIZE */
+	0x00000000,
+	0x00000000,
+	0x00000000,
+
+	0xc0116900,
+	0x00000280,
+	0x00000000, /* PA_SU_POINT_SIZE */
+	0x00000000, /* PA_SU_POINT_MINMAX */
+	0x00000008, /* PA_SU_LINE_CNTL */
+	0x00000000, /* PA_SC_LINE_STIPPLE */
+	0x00000000, /* VGT_OUTPUT_PATH_CNTL */
+	0x00000000, /* VGT_HOS_CNTL */
+	0x00000000,
+	0x00000000,
+	0x00000000,
+	0x00000000,
+	0x00000000,
+	0x00000000,
+	0x00000000,
+	0x00000000,
+	0x00000000,
+	0x00000000,
+	0x00000000, /* VGT_GS_MODE */
+
+	0xc0026900,
+	0x00000292,
+	0x00000000, /* PA_SC_MODE_CNTL_0 */
+	0x00000000, /* PA_SC_MODE_CNTL_1 */
+
+	0xc0016900,
+	0x000002a1,
+	0x00000000, /* VGT_PRIMITIVEID_EN */
+
+	0xc0016900,
+	0x000002a5,
+	0x00000000, /* VGT_MULTI_PRIM_IB_RESET_EN */
+
+	0xc0026900,
+	0x000002a8,
+	0x00000000, /* VGT_INSTANCE_STEP_RATE_0 */
+	0x00000000,
+
+	0xc0026900,
+	0x000002ad,
+	0x00000000, /* VGT_REUSE_OFF */
+	0x00000000,
+
+	0xc0016900,
+	0x000002d5,
+	0x00000000, /* VGT_SHADER_STAGES_EN */
+
+	0xc0016900,
+	0x000002dc,
+	0x0000aa00, /* DB_ALPHA_TO_MASK */
+
+	0xc0066900,
+	0x000002de,
+	0x00000000, /* PA_SU_POLY_OFFSET_DB_FMT_CNTL */
+	0x00000000,
+	0x00000000,
+	0x00000000,
+	0x00000000,
+	0x00000000,
+
+	0xc0026900,
+	0x000002e5,
+	0x00000000, /* VGT_STRMOUT_CONFIG */
+	0x00000000,
+
+	0xc01b6900,
+	0x000002f5,
+	0x76543210, /* PA_SC_CENTROID_PRIORITY_0 */
+	0xfedcba98, /* PA_SC_CENTROID_PRIORITY_1 */
+	0x00000000, /* PA_SC_LINE_CNTL */
+	0x00000000, /* PA_SC_AA_CONFIG */
+	0x00000005, /* PA_SU_VTX_CNTL */
+	0x3f800000, /* PA_CL_GB_VERT_CLIP_ADJ */
+	0x3f800000, /* PA_CL_GB_VERT_DISC_ADJ */
+	0x3f800000, /* PA_CL_GB_HORZ_CLIP_ADJ */
+	0x3f800000, /* PA_CL_GB_HORZ_DISC_ADJ */
+	0x00000000, /* PA_SC_AA_SAMPLE_LOCS_PIXEL_X0Y0_0 */
+	0x00000000,
+	0x00000000,
+	0x00000000,
+	0x00000000,
+	0x00000000,
+	0x00000000,
+	0x00000000,
+	0x00000000,
+	0x00000000,
+	0x00000000,
+	0x00000000,
+	0x00000000,
+	0x00000000,
+	0x00000000,
+	0x00000000,
+	0xffffffff, /* PA_SC_AA_MASK_X0Y0_X1Y0 */
+	0xffffffff,
+
+	0xc0026900,
+	0x00000316,
+	0x0000000e, /* VGT_VERTEX_REUSE_BLOCK_CNTL */
+	0x00000010, /*  */
+};
 
-extern const u32 cayman_ps_size, cayman_vs_size;
-extern const u32 cayman_default_size;
+static const u32 cayman_default_size = ARRAY_SIZE(cayman_default_state);
 
 #endif
-- 
2.27.0


^ permalink raw reply related	[relevance 62%]

* [PATCH v2] drm/radeon: change si_default_state table from global to static
@ 2022-04-04 22:57 68% Tom Rix
  0 siblings, 0 replies; 180+ results
From: Tom Rix @ 2022-04-04 22:57 UTC (permalink / raw)
  To: alexander.deucher, christian.koenig, Xinhui.Pan, airlied, daniel
  Cc: Tom Rix, dri-devel, linux-kernel, amd-gfx

Smatch reports these issues
si_blit_shaders.c:31:11: warning: symbol 'si_default_state'
  was not declared. Should it be static?
si_blit_shaders.c:253:11: warning: symbol 'si_default_size'
  was not declared. Should it be static?

Both symbols are only used in si.c.  Single file symbols
should be static.  So move the definition of
si_default_state and si_default_size to si_blit_shader.h
and change their storage-class-specifier to static.

Remove unneeded si_blit_shader.c

Signed-off-by: Tom Rix <trix@redhat.com>
---
v2: move definitions to header

 drivers/gpu/drm/radeon/Makefile          |   2 +-
 drivers/gpu/drm/radeon/si_blit_shaders.c | 253 -----------------------
 drivers/gpu/drm/radeon/si_blit_shaders.h | 223 +++++++++++++++++++-
 3 files changed, 222 insertions(+), 256 deletions(-)
 delete mode 100644 drivers/gpu/drm/radeon/si_blit_shaders.c

diff --git a/drivers/gpu/drm/radeon/Makefile b/drivers/gpu/drm/radeon/Makefile
index 11c97edde54d..664381f4eb07 100644
--- a/drivers/gpu/drm/radeon/Makefile
+++ b/drivers/gpu/drm/radeon/Makefile
@@ -44,7 +44,7 @@ radeon-y += radeon_device.o radeon_asic.o radeon_kms.o \
 	evergreen.o evergreen_cs.o evergreen_blit_shaders.o \
 	evergreen_hdmi.o radeon_trace_points.o ni.o cayman_blit_shaders.o \
 	atombios_encoders.o radeon_semaphore.o radeon_sa.o atombios_i2c.o si.o \
-	si_blit_shaders.o radeon_prime.o cik.o cik_blit_shaders.o \
+	radeon_prime.o cik.o cik_blit_shaders.o \
 	r600_dpm.o rs780_dpm.o rv6xx_dpm.o rv770_dpm.o rv730_dpm.o rv740_dpm.o \
 	rv770_smc.o cypress_dpm.o btc_dpm.o sumo_dpm.o sumo_smc.o trinity_dpm.o \
 	trinity_smc.o ni_dpm.o si_smc.o si_dpm.o kv_smc.o kv_dpm.o ci_smc.o \
diff --git a/drivers/gpu/drm/radeon/si_blit_shaders.c b/drivers/gpu/drm/radeon/si_blit_shaders.c
deleted file mode 100644
index ec415e7dfa4b..000000000000
--- a/drivers/gpu/drm/radeon/si_blit_shaders.c
+++ /dev/null
@@ -1,253 +0,0 @@
-/*
- * Copyright 2011 Advanced Micro Devices, Inc.
- *
- * Permission is hereby granted, free of charge, to any person obtaining a
- * copy of this software and associated documentation files (the "Software"),
- * to deal in the Software without restriction, including without limitation
- * the rights to use, copy, modify, merge, publish, distribute, sublicense,
- * and/or sell copies of the Software, and to permit persons to whom the
- * Software is furnished to do so, subject to the following conditions:
- *
- * The above copyright notice and this permission notice (including the next
- * paragraph) shall be included in all copies or substantial portions of the
- * Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
- * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
- * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL
- * THE COPYRIGHT HOLDER(S) AND/OR ITS SUPPLIERS BE LIABLE FOR ANY CLAIM, DAMAGES OR
- * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
- * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
- * DEALINGS IN THE SOFTWARE.
- *
- * Authors:
- *     Alex Deucher <alexander.deucher@amd.com>
- */
-
-#include <linux/types.h>
-#include <linux/bug.h>
-#include <linux/kernel.h>
-
-const u32 si_default_state[] =
-{
-	0xc0066900,
-	0x00000000,
-	0x00000060, /* DB_RENDER_CONTROL */
-	0x00000000, /* DB_COUNT_CONTROL */
-	0x00000000, /* DB_DEPTH_VIEW */
-	0x0000002a, /* DB_RENDER_OVERRIDE */
-	0x00000000, /* DB_RENDER_OVERRIDE2 */
-	0x00000000, /* DB_HTILE_DATA_BASE */
-
-	0xc0046900,
-	0x00000008,
-	0x00000000, /* DB_DEPTH_BOUNDS_MIN */
-	0x00000000, /* DB_DEPTH_BOUNDS_MAX */
-	0x00000000, /* DB_STENCIL_CLEAR */
-	0x00000000, /* DB_DEPTH_CLEAR */
-
-	0xc0036900,
-	0x0000000f,
-	0x00000000, /* DB_DEPTH_INFO */
-	0x00000000, /* DB_Z_INFO */
-	0x00000000, /* DB_STENCIL_INFO */
-
-	0xc0016900,
-	0x00000080,
-	0x00000000, /* PA_SC_WINDOW_OFFSET */
-
-	0xc00d6900,
-	0x00000083,
-	0x0000ffff, /* PA_SC_CLIPRECT_RULE */
-	0x00000000, /* PA_SC_CLIPRECT_0_TL */
-	0x20002000, /* PA_SC_CLIPRECT_0_BR */
-	0x00000000,
-	0x20002000,
-	0x00000000,
-	0x20002000,
-	0x00000000,
-	0x20002000,
-	0xaaaaaaaa, /* PA_SC_EDGERULE */
-	0x00000000, /* PA_SU_HARDWARE_SCREEN_OFFSET */
-	0x0000000f, /* CB_TARGET_MASK */
-	0x0000000f, /* CB_SHADER_MASK */
-
-	0xc0226900,
-	0x00000094,
-	0x80000000, /* PA_SC_VPORT_SCISSOR_0_TL */
-	0x20002000, /* PA_SC_VPORT_SCISSOR_0_BR */
-	0x80000000,
-	0x20002000,
-	0x80000000,
-	0x20002000,
-	0x80000000,
-	0x20002000,
-	0x80000000,
-	0x20002000,
-	0x80000000,
-	0x20002000,
-	0x80000000,
-	0x20002000,
-	0x80000000,
-	0x20002000,
-	0x80000000,
-	0x20002000,
-	0x80000000,
-	0x20002000,
-	0x80000000,
-	0x20002000,
-	0x80000000,
-	0x20002000,
-	0x80000000,
-	0x20002000,
-	0x80000000,
-	0x20002000,
-	0x80000000,
-	0x20002000,
-	0x80000000,
-	0x20002000,
-	0x00000000, /* PA_SC_VPORT_ZMIN_0 */
-	0x3f800000, /* PA_SC_VPORT_ZMAX_0 */
-
-	0xc0026900,
-	0x000000d9,
-	0x00000000, /* CP_RINGID */
-	0x00000000, /* CP_VMID */
-
-	0xc0046900,
-	0x00000100,
-	0xffffffff, /* VGT_MAX_VTX_INDX */
-	0x00000000, /* VGT_MIN_VTX_INDX */
-	0x00000000, /* VGT_INDX_OFFSET */
-	0x00000000, /* VGT_MULTI_PRIM_IB_RESET_INDX */
-
-	0xc0046900,
-	0x00000105,
-	0x00000000, /* CB_BLEND_RED */
-	0x00000000, /* CB_BLEND_GREEN */
-	0x00000000, /* CB_BLEND_BLUE */
-	0x00000000, /* CB_BLEND_ALPHA */
-
-	0xc0016900,
-	0x000001e0,
-	0x00000000, /* CB_BLEND0_CONTROL */
-
-	0xc00e6900,
-	0x00000200,
-	0x00000000, /* DB_DEPTH_CONTROL */
-	0x00000000, /* DB_EQAA */
-	0x00cc0010, /* CB_COLOR_CONTROL */
-	0x00000210, /* DB_SHADER_CONTROL */
-	0x00010000, /* PA_CL_CLIP_CNTL */
-	0x00000004, /* PA_SU_SC_MODE_CNTL */
-	0x00000100, /* PA_CL_VTE_CNTL */
-	0x00000000, /* PA_CL_VS_OUT_CNTL */
-	0x00000000, /* PA_CL_NANINF_CNTL */
-	0x00000000, /* PA_SU_LINE_STIPPLE_CNTL */
-	0x00000000, /* PA_SU_LINE_STIPPLE_SCALE */
-	0x00000000, /* PA_SU_PRIM_FILTER_CNTL */
-	0x00000000, /*  */
-	0x00000000, /*  */
-
-	0xc0116900,
-	0x00000280,
-	0x00000000, /* PA_SU_POINT_SIZE */
-	0x00000000, /* PA_SU_POINT_MINMAX */
-	0x00000008, /* PA_SU_LINE_CNTL */
-	0x00000000, /* PA_SC_LINE_STIPPLE */
-	0x00000000, /* VGT_OUTPUT_PATH_CNTL */
-	0x00000000, /* VGT_HOS_CNTL */
-	0x00000000,
-	0x00000000,
-	0x00000000,
-	0x00000000,
-	0x00000000,
-	0x00000000,
-	0x00000000,
-	0x00000000,
-	0x00000000,
-	0x00000000,
-	0x00000000, /* VGT_GS_MODE */
-
-	0xc0026900,
-	0x00000292,
-	0x00000000, /* PA_SC_MODE_CNTL_0 */
-	0x00000000, /* PA_SC_MODE_CNTL_1 */
-
-	0xc0016900,
-	0x000002a1,
-	0x00000000, /* VGT_PRIMITIVEID_EN */
-
-	0xc0016900,
-	0x000002a5,
-	0x00000000, /* VGT_MULTI_PRIM_IB_RESET_EN */
-
-	0xc0026900,
-	0x000002a8,
-	0x00000000, /* VGT_INSTANCE_STEP_RATE_0 */
-	0x00000000,
-
-	0xc0026900,
-	0x000002ad,
-	0x00000000, /* VGT_REUSE_OFF */
-	0x00000000,
-
-	0xc0016900,
-	0x000002d5,
-	0x00000000, /* VGT_SHADER_STAGES_EN */
-
-	0xc0016900,
-	0x000002dc,
-	0x0000aa00, /* DB_ALPHA_TO_MASK */
-
-	0xc0066900,
-	0x000002de,
-	0x00000000, /* PA_SU_POLY_OFFSET_DB_FMT_CNTL */
-	0x00000000,
-	0x00000000,
-	0x00000000,
-	0x00000000,
-	0x00000000,
-
-	0xc0026900,
-	0x000002e5,
-	0x00000000, /* VGT_STRMOUT_CONFIG */
-	0x00000000,
-
-	0xc01b6900,
-	0x000002f5,
-	0x76543210, /* PA_SC_CENTROID_PRIORITY_0 */
-	0xfedcba98, /* PA_SC_CENTROID_PRIORITY_1 */
-	0x00000000, /* PA_SC_LINE_CNTL */
-	0x00000000, /* PA_SC_AA_CONFIG */
-	0x00000005, /* PA_SU_VTX_CNTL */
-	0x3f800000, /* PA_CL_GB_VERT_CLIP_ADJ */
-	0x3f800000, /* PA_CL_GB_VERT_DISC_ADJ */
-	0x3f800000, /* PA_CL_GB_HORZ_CLIP_ADJ */
-	0x3f800000, /* PA_CL_GB_HORZ_DISC_ADJ */
-	0x00000000, /* PA_SC_AA_SAMPLE_LOCS_PIXEL_X0Y0_0 */
-	0x00000000,
-	0x00000000,
-	0x00000000,
-	0x00000000,
-	0x00000000,
-	0x00000000,
-	0x00000000,
-	0x00000000,
-	0x00000000,
-	0x00000000,
-	0x00000000,
-	0x00000000,
-	0x00000000,
-	0x00000000,
-	0x00000000,
-	0xffffffff, /* PA_SC_AA_MASK_X0Y0_X1Y0 */
-	0xffffffff,
-
-	0xc0026900,
-	0x00000316,
-	0x0000000e, /* VGT_VERTEX_REUSE_BLOCK_CNTL */
-	0x00000010, /*  */
-};
-
-const u32 si_default_size = ARRAY_SIZE(si_default_state);
diff --git a/drivers/gpu/drm/radeon/si_blit_shaders.h b/drivers/gpu/drm/radeon/si_blit_shaders.h
index c739e51e3961..829a2b6228b7 100644
--- a/drivers/gpu/drm/radeon/si_blit_shaders.h
+++ b/drivers/gpu/drm/radeon/si_blit_shaders.h
@@ -25,8 +25,227 @@
 #ifndef SI_BLIT_SHADERS_H
 #define SI_BLIT_SHADERS_H
 
-extern const u32 si_default_state[];
+static const u32 si_default_state[] = {
+	0xc0066900,
+	0x00000000,
+	0x00000060, /* DB_RENDER_CONTROL */
+	0x00000000, /* DB_COUNT_CONTROL */
+	0x00000000, /* DB_DEPTH_VIEW */
+	0x0000002a, /* DB_RENDER_OVERRIDE */
+	0x00000000, /* DB_RENDER_OVERRIDE2 */
+	0x00000000, /* DB_HTILE_DATA_BASE */
 
-extern const u32 si_default_size;
+	0xc0046900,
+	0x00000008,
+	0x00000000, /* DB_DEPTH_BOUNDS_MIN */
+	0x00000000, /* DB_DEPTH_BOUNDS_MAX */
+	0x00000000, /* DB_STENCIL_CLEAR */
+	0x00000000, /* DB_DEPTH_CLEAR */
+
+	0xc0036900,
+	0x0000000f,
+	0x00000000, /* DB_DEPTH_INFO */
+	0x00000000, /* DB_Z_INFO */
+	0x00000000, /* DB_STENCIL_INFO */
+
+	0xc0016900,
+	0x00000080,
+	0x00000000, /* PA_SC_WINDOW_OFFSET */
+
+	0xc00d6900,
+	0x00000083,
+	0x0000ffff, /* PA_SC_CLIPRECT_RULE */
+	0x00000000, /* PA_SC_CLIPRECT_0_TL */
+	0x20002000, /* PA_SC_CLIPRECT_0_BR */
+	0x00000000,
+	0x20002000,
+	0x00000000,
+	0x20002000,
+	0x00000000,
+	0x20002000,
+	0xaaaaaaaa, /* PA_SC_EDGERULE */
+	0x00000000, /* PA_SU_HARDWARE_SCREEN_OFFSET */
+	0x0000000f, /* CB_TARGET_MASK */
+	0x0000000f, /* CB_SHADER_MASK */
+
+	0xc0226900,
+	0x00000094,
+	0x80000000, /* PA_SC_VPORT_SCISSOR_0_TL */
+	0x20002000, /* PA_SC_VPORT_SCISSOR_0_BR */
+	0x80000000,
+	0x20002000,
+	0x80000000,
+	0x20002000,
+	0x80000000,
+	0x20002000,
+	0x80000000,
+	0x20002000,
+	0x80000000,
+	0x20002000,
+	0x80000000,
+	0x20002000,
+	0x80000000,
+	0x20002000,
+	0x80000000,
+	0x20002000,
+	0x80000000,
+	0x20002000,
+	0x80000000,
+	0x20002000,
+	0x80000000,
+	0x20002000,
+	0x80000000,
+	0x20002000,
+	0x80000000,
+	0x20002000,
+	0x80000000,
+	0x20002000,
+	0x80000000,
+	0x20002000,
+	0x00000000, /* PA_SC_VPORT_ZMIN_0 */
+	0x3f800000, /* PA_SC_VPORT_ZMAX_0 */
+
+	0xc0026900,
+	0x000000d9,
+	0x00000000, /* CP_RINGID */
+	0x00000000, /* CP_VMID */
+
+	0xc0046900,
+	0x00000100,
+	0xffffffff, /* VGT_MAX_VTX_INDX */
+	0x00000000, /* VGT_MIN_VTX_INDX */
+	0x00000000, /* VGT_INDX_OFFSET */
+	0x00000000, /* VGT_MULTI_PRIM_IB_RESET_INDX */
+
+	0xc0046900,
+	0x00000105,
+	0x00000000, /* CB_BLEND_RED */
+	0x00000000, /* CB_BLEND_GREEN */
+	0x00000000, /* CB_BLEND_BLUE */
+	0x00000000, /* CB_BLEND_ALPHA */
+
+	0xc0016900,
+	0x000001e0,
+	0x00000000, /* CB_BLEND0_CONTROL */
+
+	0xc00e6900,
+	0x00000200,
+	0x00000000, /* DB_DEPTH_CONTROL */
+	0x00000000, /* DB_EQAA */
+	0x00cc0010, /* CB_COLOR_CONTROL */
+	0x00000210, /* DB_SHADER_CONTROL */
+	0x00010000, /* PA_CL_CLIP_CNTL */
+	0x00000004, /* PA_SU_SC_MODE_CNTL */
+	0x00000100, /* PA_CL_VTE_CNTL */
+	0x00000000, /* PA_CL_VS_OUT_CNTL */
+	0x00000000, /* PA_CL_NANINF_CNTL */
+	0x00000000, /* PA_SU_LINE_STIPPLE_CNTL */
+	0x00000000, /* PA_SU_LINE_STIPPLE_SCALE */
+	0x00000000, /* PA_SU_PRIM_FILTER_CNTL */
+	0x00000000, /*  */
+	0x00000000, /*  */
+
+	0xc0116900,
+	0x00000280,
+	0x00000000, /* PA_SU_POINT_SIZE */
+	0x00000000, /* PA_SU_POINT_MINMAX */
+	0x00000008, /* PA_SU_LINE_CNTL */
+	0x00000000, /* PA_SC_LINE_STIPPLE */
+	0x00000000, /* VGT_OUTPUT_PATH_CNTL */
+	0x00000000, /* VGT_HOS_CNTL */
+	0x00000000,
+	0x00000000,
+	0x00000000,
+	0x00000000,
+	0x00000000,
+	0x00000000,
+	0x00000000,
+	0x00000000,
+	0x00000000,
+	0x00000000,
+	0x00000000, /* VGT_GS_MODE */
+
+	0xc0026900,
+	0x00000292,
+	0x00000000, /* PA_SC_MODE_CNTL_0 */
+	0x00000000, /* PA_SC_MODE_CNTL_1 */
+
+	0xc0016900,
+	0x000002a1,
+	0x00000000, /* VGT_PRIMITIVEID_EN */
+
+	0xc0016900,
+	0x000002a5,
+	0x00000000, /* VGT_MULTI_PRIM_IB_RESET_EN */
+
+	0xc0026900,
+	0x000002a8,
+	0x00000000, /* VGT_INSTANCE_STEP_RATE_0 */
+	0x00000000,
+
+	0xc0026900,
+	0x000002ad,
+	0x00000000, /* VGT_REUSE_OFF */
+	0x00000000,
+
+	0xc0016900,
+	0x000002d5,
+	0x00000000, /* VGT_SHADER_STAGES_EN */
+
+	0xc0016900,
+	0x000002dc,
+	0x0000aa00, /* DB_ALPHA_TO_MASK */
+
+	0xc0066900,
+	0x000002de,
+	0x00000000, /* PA_SU_POLY_OFFSET_DB_FMT_CNTL */
+	0x00000000,
+	0x00000000,
+	0x00000000,
+	0x00000000,
+	0x00000000,
+
+	0xc0026900,
+	0x000002e5,
+	0x00000000, /* VGT_STRMOUT_CONFIG */
+	0x00000000,
+
+	0xc01b6900,
+	0x000002f5,
+	0x76543210, /* PA_SC_CENTROID_PRIORITY_0 */
+	0xfedcba98, /* PA_SC_CENTROID_PRIORITY_1 */
+	0x00000000, /* PA_SC_LINE_CNTL */
+	0x00000000, /* PA_SC_AA_CONFIG */
+	0x00000005, /* PA_SU_VTX_CNTL */
+	0x3f800000, /* PA_CL_GB_VERT_CLIP_ADJ */
+	0x3f800000, /* PA_CL_GB_VERT_DISC_ADJ */
+	0x3f800000, /* PA_CL_GB_HORZ_CLIP_ADJ */
+	0x3f800000, /* PA_CL_GB_HORZ_DISC_ADJ */
+	0x00000000, /* PA_SC_AA_SAMPLE_LOCS_PIXEL_X0Y0_0 */
+	0x00000000,
+	0x00000000,
+	0x00000000,
+	0x00000000,
+	0x00000000,
+	0x00000000,
+	0x00000000,
+	0x00000000,
+	0x00000000,
+	0x00000000,
+	0x00000000,
+	0x00000000,
+	0x00000000,
+	0x00000000,
+	0x00000000,
+	0xffffffff, /* PA_SC_AA_MASK_X0Y0_X1Y0 */
+	0xffffffff,
+
+	0xc0026900,
+	0x00000316,
+	0x0000000e, /* VGT_VERTEX_REUSE_BLOCK_CNTL */
+	0x00000010, /*  */
+};
+
+static const u32 si_default_size = ARRAY_SIZE(si_default_state);
 
 #endif
-- 
2.27.0


^ permalink raw reply related	[relevance 68%]

* Re: [PATCH] drm/amd/display: cleanup extern usage in function definition
  @ 2022-04-04 15:43 99%   ` Tom Rix
  0 siblings, 0 replies; 180+ results
From: Tom Rix @ 2022-04-04 15:43 UTC (permalink / raw)
  To: Harry Wentland, sunpeng.li, Rodrigo.Siqueira, alexander.deucher,
	christian.koenig, Xinhui.Pan, airlied, daniel, wenjing.liu,
	waynelin, Anson.Jacob, Yu-ting.Shen, keescook,
	nicholas.kazlauskas
  Cc: dri-devel, amd-gfx, linux-kernel


On 4/4/22 8:22 AM, Harry Wentland wrote:
>
> On 2022-04-03 10:21, Tom Rix wrote:
>> Smatch reports this issue
>> hdcp1_execution.c:500:29: warning: function
>>    'mod_hdcp_hdcp1_dp_execution' with external linkage
>>    has definition
>>
> Which branch are you using?

linux-next from 4/1

Tom

>
> I don't see the 'extern' on
> https://gitlab.freedesktop.org/agd5f/linux/-/blob/amd-staging-drm-next/drivers/gpu/drm/amd/display/modules/hdcp/hdcp1_execution.c
>
> Harry
>
>
>> The storage-class-specifier extern is not needed in a
>> definition, so remove it.
>>
>> Signed-off-by: Tom Rix <trix@redhat.com>
>> ---
>>   drivers/gpu/drm/amd/display/modules/hdcp/hdcp1_execution.c | 6 +++---
>>   1 file changed, 3 insertions(+), 3 deletions(-)
>>
>> diff --git a/drivers/gpu/drm/amd/display/modules/hdcp/hdcp1_execution.c b/drivers/gpu/drm/amd/display/modules/hdcp/hdcp1_execution.c
>> index 6ec918af3bff..1ddb4f5eac8e 100644
>> --- a/drivers/gpu/drm/amd/display/modules/hdcp/hdcp1_execution.c
>> +++ b/drivers/gpu/drm/amd/display/modules/hdcp/hdcp1_execution.c
>> @@ -497,9 +497,9 @@ enum mod_hdcp_status mod_hdcp_hdcp1_execution(struct mod_hdcp *hdcp,
>>   	return status;
>>   }
>>   
>> -extern enum mod_hdcp_status mod_hdcp_hdcp1_dp_execution(struct mod_hdcp *hdcp,
>> -		struct mod_hdcp_event_context *event_ctx,
>> -		struct mod_hdcp_transition_input_hdcp1 *input)
>> +enum mod_hdcp_status mod_hdcp_hdcp1_dp_execution(struct mod_hdcp *hdcp,
>> +						 struct mod_hdcp_event_context *event_ctx,
>> +						 struct mod_hdcp_transition_input_hdcp1 *input)
>>   {
>>   	enum mod_hdcp_status status = MOD_HDCP_STATUS_SUCCESS;
>>   


^ permalink raw reply	[relevance 99%]

* Re: [PATCH] drm/radeon: change si_default_state table from global to static
  @ 2022-04-04 14:22 99%           ` Tom Rix
  0 siblings, 0 replies; 180+ results
From: Tom Rix @ 2022-04-04 14:22 UTC (permalink / raw)
  To: Christian König, alexander.deucher, Xinhui.Pan, airlied, daniel
  Cc: dri-devel, linux-kernel, amd-gfx


On 4/4/22 6:32 AM, Christian König wrote:
> Am 04.04.22 um 15:01 schrieb Tom Rix:
>> On 4/4/22 5:34 AM, Christian König wrote:
>>> Am 04.04.22 um 14:32 schrieb Tom Rix:
>>>> On 4/3/22 8:23 AM, Christian König wrote:
>>>>> Am 02.04.22 um 18:27 schrieb Tom Rix:
>>>>>> Smatch reports these issues
>>>>>> si_blit_shaders.c:31:11: warning: symbol 'si_default_state'
>>>>>>    was not declared. Should it be static?
>>>>>> si_blit_shaders.c:253:11: warning: symbol 'si_default_size'
>>>>>>    was not declared. Should it be static?
>>>>>>
>>>>>> Both symbols are only used in si.c.  Single file symbols
>>>>>> should be static.  So move the si_default_state and
>>>>>> si_default_size to si.c and change their
>>>>>> storage-class-specifier to static.
>>>>>>
>>>>>> Remove unneeded si_blit_shaders.[c|h]
>>>>>
>>>>> Uff, well NAK.
>>>>>
>>>>> IIRC this was intentionally moved into a separate file because it 
>>>>> is rather large and not related to anything in si.c.
>>>>>
>>>>> It's unlikely that we are ever going to update it, but I would 
>>>>> still rather want to keep it separated.
>>>>>
>>>>> You should rather just include si_blit_shaders.h in 
>>>>> si_blit_shaders.c.
>>>>
>>>> Do you mean #include "si_blit_shaders.c" in si.c or similar ?
>>>
>>> No, as far as I can see you are getting this warning because of a 
>>> missing previous prototype for the exported array.
>>>
>>> This can be avoided if you add si_blit_shaders.h as an include to 
>>> si_blit_shaders.c.
>>
>> The warning is a symptom.
>>
>> There are about 5-6 similar big, global tables in radeon/ with 
>> similar one file uses.
>>
>> These global tables should become static.
>>
>> Moving the table to si_blit_shader.h would keep it separated, adding 
>> the 'static' would remove it from the globals.
>>
>> *.c removed, Makefile updated.
>
> Sound like that would work for me as well. Main concern is to keep 
> that in a separate file.
>
> But why do you want to drop it from globals in the first place?

Generally the least needed access should be used.

For security

https://cwe.mitre.org/data/definitions/1108.html

A big global table can hide introduced code.

For the compiler

global variables (can not/harder to) be optimized.

Tom

>
> Christian.
>
>>
>> Tom
>>
>>>
>>> Regards,
>>> Christian.
>>>
>>>>
>>>> This could have the same effect of while keeping these separate failes
>>>>
>>>> Tom
>>>>
>>>>>
>>>>> Regards,
>>>>> Christian.
>>>>>
>>>>>>
>>>>>> Signed-off-by: Tom Rix <trix@redhat.com>
>>>>>> ---
>>>>>>   drivers/gpu/drm/radeon/Makefile          |   2 +-
>>>>>>   drivers/gpu/drm/radeon/si.c              | 224 
>>>>>> +++++++++++++++++++-
>>>>>>   drivers/gpu/drm/radeon/si_blit_shaders.c | 253 
>>>>>> -----------------------
>>>>>>   drivers/gpu/drm/radeon/si_blit_shaders.h |  32 ---
>>>>>>   4 files changed, 224 insertions(+), 287 deletions(-)
>>>>>>   delete mode 100644 drivers/gpu/drm/radeon/si_blit_shaders.c
>>>>>>   delete mode 100644 drivers/gpu/drm/radeon/si_blit_shaders.h
>>>>>>
>>>>>> diff --git a/drivers/gpu/drm/radeon/Makefile 
>>>>>> b/drivers/gpu/drm/radeon/Makefile
>>>>>> index 11c97edde54d..664381f4eb07 100644
>>>>>> --- a/drivers/gpu/drm/radeon/Makefile
>>>>>> +++ b/drivers/gpu/drm/radeon/Makefile
>>>>>> @@ -44,7 +44,7 @@ radeon-y += radeon_device.o radeon_asic.o 
>>>>>> radeon_kms.o \
>>>>>>       evergreen.o evergreen_cs.o evergreen_blit_shaders.o \
>>>>>>       evergreen_hdmi.o radeon_trace_points.o ni.o 
>>>>>> cayman_blit_shaders.o \
>>>>>>       atombios_encoders.o radeon_semaphore.o radeon_sa.o 
>>>>>> atombios_i2c.o si.o \
>>>>>> -    si_blit_shaders.o radeon_prime.o cik.o cik_blit_shaders.o \
>>>>>> +    radeon_prime.o cik.o cik_blit_shaders.o \
>>>>>>       r600_dpm.o rs780_dpm.o rv6xx_dpm.o rv770_dpm.o rv730_dpm.o 
>>>>>> rv740_dpm.o \
>>>>>>       rv770_smc.o cypress_dpm.o btc_dpm.o sumo_dpm.o sumo_smc.o 
>>>>>> trinity_dpm.o \
>>>>>>       trinity_smc.o ni_dpm.o si_smc.o si_dpm.o kv_smc.o kv_dpm.o 
>>>>>> ci_smc.o \
>>>>>> diff --git a/drivers/gpu/drm/radeon/si.c 
>>>>>> b/drivers/gpu/drm/radeon/si.c
>>>>>> index 8d5e4b25609d..a4032702e302 100644
>>>>>> --- a/drivers/gpu/drm/radeon/si.c
>>>>>> +++ b/drivers/gpu/drm/radeon/si.c
>>>>>> @@ -38,7 +38,6 @@
>>>>>>   #include "radeon_asic.h"
>>>>>>   #include "radeon_audio.h"
>>>>>>   #include "radeon_ucode.h"
>>>>>> -#include "si_blit_shaders.h"
>>>>>>   #include "si.h"
>>>>>>   #include "sid.h"
>>>>>>   @@ -3553,6 +3552,229 @@ static int si_cp_load_microcode(struct 
>>>>>> radeon_device *rdev)
>>>>>>       return 0;
>>>>>>   }
>>>>>>   +static const u32 si_default_state[] = {
>>>>>> +    0xc0066900,
>>>>>> +    0x00000000,
>>>>>> +    0x00000060, /* DB_RENDER_CONTROL */
>>>>>> +    0x00000000, /* DB_COUNT_CONTROL */
>>>>>> +    0x00000000, /* DB_DEPTH_VIEW */
>>>>>> +    0x0000002a, /* DB_RENDER_OVERRIDE */
>>>>>> +    0x00000000, /* DB_RENDER_OVERRIDE2 */
>>>>>> +    0x00000000, /* DB_HTILE_DATA_BASE */
>>>>>> +
>>>>>> +    0xc0046900,
>>>>>> +    0x00000008,
>>>>>> +    0x00000000, /* DB_DEPTH_BOUNDS_MIN */
>>>>>> +    0x00000000, /* DB_DEPTH_BOUNDS_MAX */
>>>>>> +    0x00000000, /* DB_STENCIL_CLEAR */
>>>>>> +    0x00000000, /* DB_DEPTH_CLEAR */
>>>>>> +
>>>>>> +    0xc0036900,
>>>>>> +    0x0000000f,
>>>>>> +    0x00000000, /* DB_DEPTH_INFO */
>>>>>> +    0x00000000, /* DB_Z_INFO */
>>>>>> +    0x00000000, /* DB_STENCIL_INFO */
>>>>>> +
>>>>>> +    0xc0016900,
>>>>>> +    0x00000080,
>>>>>> +    0x00000000, /* PA_SC_WINDOW_OFFSET */
>>>>>> +
>>>>>> +    0xc00d6900,
>>>>>> +    0x00000083,
>>>>>> +    0x0000ffff, /* PA_SC_CLIPRECT_RULE */
>>>>>> +    0x00000000, /* PA_SC_CLIPRECT_0_TL */
>>>>>> +    0x20002000, /* PA_SC_CLIPRECT_0_BR */
>>>>>> +    0x00000000,
>>>>>> +    0x20002000,
>>>>>> +    0x00000000,
>>>>>> +    0x20002000,
>>>>>> +    0x00000000,
>>>>>> +    0x20002000,
>>>>>> +    0xaaaaaaaa, /* PA_SC_EDGERULE */
>>>>>> +    0x00000000, /* PA_SU_HARDWARE_SCREEN_OFFSET */
>>>>>> +    0x0000000f, /* CB_TARGET_MASK */
>>>>>> +    0x0000000f, /* CB_SHADER_MASK */
>>>>>> +
>>>>>> +    0xc0226900,
>>>>>> +    0x00000094,
>>>>>> +    0x80000000, /* PA_SC_VPORT_SCISSOR_0_TL */
>>>>>> +    0x20002000, /* PA_SC_VPORT_SCISSOR_0_BR */
>>>>>> +    0x80000000,
>>>>>> +    0x20002000,
>>>>>> +    0x80000000,
>>>>>> +    0x20002000,
>>>>>> +    0x80000000,
>>>>>> +    0x20002000,
>>>>>> +    0x80000000,
>>>>>> +    0x20002000,
>>>>>> +    0x80000000,
>>>>>> +    0x20002000,
>>>>>> +    0x80000000,
>>>>>> +    0x20002000,
>>>>>> +    0x80000000,
>>>>>> +    0x20002000,
>>>>>> +    0x80000000,
>>>>>> +    0x20002000,
>>>>>> +    0x80000000,
>>>>>> +    0x20002000,
>>>>>> +    0x80000000,
>>>>>> +    0x20002000,
>>>>>> +    0x80000000,
>>>>>> +    0x20002000,
>>>>>> +    0x80000000,
>>>>>> +    0x20002000,
>>>>>> +    0x80000000,
>>>>>> +    0x20002000,
>>>>>> +    0x80000000,
>>>>>> +    0x20002000,
>>>>>> +    0x80000000,
>>>>>> +    0x20002000,
>>>>>> +    0x00000000, /* PA_SC_VPORT_ZMIN_0 */
>>>>>> +    0x3f800000, /* PA_SC_VPORT_ZMAX_0 */
>>>>>> +
>>>>>> +    0xc0026900,
>>>>>> +    0x000000d9,
>>>>>> +    0x00000000, /* CP_RINGID */
>>>>>> +    0x00000000, /* CP_VMID */
>>>>>> +
>>>>>> +    0xc0046900,
>>>>>> +    0x00000100,
>>>>>> +    0xffffffff, /* VGT_MAX_VTX_INDX */
>>>>>> +    0x00000000, /* VGT_MIN_VTX_INDX */
>>>>>> +    0x00000000, /* VGT_INDX_OFFSET */
>>>>>> +    0x00000000, /* VGT_MULTI_PRIM_IB_RESET_INDX */
>>>>>> +
>>>>>> +    0xc0046900,
>>>>>> +    0x00000105,
>>>>>> +    0x00000000, /* CB_BLEND_RED */
>>>>>> +    0x00000000, /* CB_BLEND_GREEN */
>>>>>> +    0x00000000, /* CB_BLEND_BLUE */
>>>>>> +    0x00000000, /* CB_BLEND_ALPHA */
>>>>>> +
>>>>>> +    0xc0016900,
>>>>>> +    0x000001e0,
>>>>>> +    0x00000000, /* CB_BLEND0_CONTROL */
>>>>>> +
>>>>>> +    0xc00e6900,
>>>>>> +    0x00000200,
>>>>>> +    0x00000000, /* DB_DEPTH_CONTROL */
>>>>>> +    0x00000000, /* DB_EQAA */
>>>>>> +    0x00cc0010, /* CB_COLOR_CONTROL */
>>>>>> +    0x00000210, /* DB_SHADER_CONTROL */
>>>>>> +    0x00010000, /* PA_CL_CLIP_CNTL */
>>>>>> +    0x00000004, /* PA_SU_SC_MODE_CNTL */
>>>>>> +    0x00000100, /* PA_CL_VTE_CNTL */
>>>>>> +    0x00000000, /* PA_CL_VS_OUT_CNTL */
>>>>>> +    0x00000000, /* PA_CL_NANINF_CNTL */
>>>>>> +    0x00000000, /* PA_SU_LINE_STIPPLE_CNTL */
>>>>>> +    0x00000000, /* PA_SU_LINE_STIPPLE_SCALE */
>>>>>> +    0x00000000, /* PA_SU_PRIM_FILTER_CNTL */
>>>>>> +    0x00000000, /*  */
>>>>>> +    0x00000000, /*  */
>>>>>> +
>>>>>> +    0xc0116900,
>>>>>> +    0x00000280,
>>>>>> +    0x00000000, /* PA_SU_POINT_SIZE */
>>>>>> +    0x00000000, /* PA_SU_POINT_MINMAX */
>>>>>> +    0x00000008, /* PA_SU_LINE_CNTL */
>>>>>> +    0x00000000, /* PA_SC_LINE_STIPPLE */
>>>>>> +    0x00000000, /* VGT_OUTPUT_PATH_CNTL */
>>>>>> +    0x00000000, /* VGT_HOS_CNTL */
>>>>>> +    0x00000000,
>>>>>> +    0x00000000,
>>>>>> +    0x00000000,
>>>>>> +    0x00000000,
>>>>>> +    0x00000000,
>>>>>> +    0x00000000,
>>>>>> +    0x00000000,
>>>>>> +    0x00000000,
>>>>>> +    0x00000000,
>>>>>> +    0x00000000,
>>>>>> +    0x00000000, /* VGT_GS_MODE */
>>>>>> +
>>>>>> +    0xc0026900,
>>>>>> +    0x00000292,
>>>>>> +    0x00000000, /* PA_SC_MODE_CNTL_0 */
>>>>>> +    0x00000000, /* PA_SC_MODE_CNTL_1 */
>>>>>> +
>>>>>> +    0xc0016900,
>>>>>> +    0x000002a1,
>>>>>> +    0x00000000, /* VGT_PRIMITIVEID_EN */
>>>>>> +
>>>>>> +    0xc0016900,
>>>>>> +    0x000002a5,
>>>>>> +    0x00000000, /* VGT_MULTI_PRIM_IB_RESET_EN */
>>>>>> +
>>>>>> +    0xc0026900,
>>>>>> +    0x000002a8,
>>>>>> +    0x00000000, /* VGT_INSTANCE_STEP_RATE_0 */
>>>>>> +    0x00000000,
>>>>>> +
>>>>>> +    0xc0026900,
>>>>>> +    0x000002ad,
>>>>>> +    0x00000000, /* VGT_REUSE_OFF */
>>>>>> +    0x00000000,
>>>>>> +
>>>>>> +    0xc0016900,
>>>>>> +    0x000002d5,
>>>>>> +    0x00000000, /* VGT_SHADER_STAGES_EN */
>>>>>> +
>>>>>> +    0xc0016900,
>>>>>> +    0x000002dc,
>>>>>> +    0x0000aa00, /* DB_ALPHA_TO_MASK */
>>>>>> +
>>>>>> +    0xc0066900,
>>>>>> +    0x000002de,
>>>>>> +    0x00000000, /* PA_SU_POLY_OFFSET_DB_FMT_CNTL */
>>>>>> +    0x00000000,
>>>>>> +    0x00000000,
>>>>>> +    0x00000000,
>>>>>> +    0x00000000,
>>>>>> +    0x00000000,
>>>>>> +
>>>>>> +    0xc0026900,
>>>>>> +    0x000002e5,
>>>>>> +    0x00000000, /* VGT_STRMOUT_CONFIG */
>>>>>> +    0x00000000,
>>>>>> +
>>>>>> +    0xc01b6900,
>>>>>> +    0x000002f5,
>>>>>> +    0x76543210, /* PA_SC_CENTROID_PRIORITY_0 */
>>>>>> +    0xfedcba98, /* PA_SC_CENTROID_PRIORITY_1 */
>>>>>> +    0x00000000, /* PA_SC_LINE_CNTL */
>>>>>> +    0x00000000, /* PA_SC_AA_CONFIG */
>>>>>> +    0x00000005, /* PA_SU_VTX_CNTL */
>>>>>> +    0x3f800000, /* PA_CL_GB_VERT_CLIP_ADJ */
>>>>>> +    0x3f800000, /* PA_CL_GB_VERT_DISC_ADJ */
>>>>>> +    0x3f800000, /* PA_CL_GB_HORZ_CLIP_ADJ */
>>>>>> +    0x3f800000, /* PA_CL_GB_HORZ_DISC_ADJ */
>>>>>> +    0x00000000, /* PA_SC_AA_SAMPLE_LOCS_PIXEL_X0Y0_0 */
>>>>>> +    0x00000000,
>>>>>> +    0x00000000,
>>>>>> +    0x00000000,
>>>>>> +    0x00000000,
>>>>>> +    0x00000000,
>>>>>> +    0x00000000,
>>>>>> +    0x00000000,
>>>>>> +    0x00000000,
>>>>>> +    0x00000000,
>>>>>> +    0x00000000,
>>>>>> +    0x00000000,
>>>>>> +    0x00000000,
>>>>>> +    0x00000000,
>>>>>> +    0x00000000,
>>>>>> +    0x00000000,
>>>>>> +    0xffffffff, /* PA_SC_AA_MASK_X0Y0_X1Y0 */
>>>>>> +    0xffffffff,
>>>>>> +
>>>>>> +    0xc0026900,
>>>>>> +    0x00000316,
>>>>>> +    0x0000000e, /* VGT_VERTEX_REUSE_BLOCK_CNTL */
>>>>>> +    0x00000010, /*  */
>>>>>> +};
>>>>>> +
>>>>>> +static const u32 si_default_size = ARRAY_SIZE(si_default_state);
>>>>>> +
>>>>>>   static int si_cp_start(struct radeon_device *rdev)
>>>>>>   {
>>>>>>       struct radeon_ring *ring = 
>>>>>> &rdev->ring[RADEON_RING_TYPE_GFX_INDEX];
>>>>>> diff --git a/drivers/gpu/drm/radeon/si_blit_shaders.c 
>>>>>> b/drivers/gpu/drm/radeon/si_blit_shaders.c
>>>>>> deleted file mode 100644
>>>>>> index ec415e7dfa4b..000000000000
>>>>>> --- a/drivers/gpu/drm/radeon/si_blit_shaders.c
>>>>>> +++ /dev/null
>>>>>> @@ -1,253 +0,0 @@
>>>>>> -/*
>>>>>> - * Copyright 2011 Advanced Micro Devices, Inc.
>>>>>> - *
>>>>>> - * Permission is hereby granted, free of charge, to any person 
>>>>>> obtaining a
>>>>>> - * copy of this software and associated documentation files (the 
>>>>>> "Software"),
>>>>>> - * to deal in the Software without restriction, including 
>>>>>> without limitation
>>>>>> - * the rights to use, copy, modify, merge, publish, distribute, 
>>>>>> sublicense,
>>>>>> - * and/or sell copies of the Software, and to permit persons to 
>>>>>> whom the
>>>>>> - * Software is furnished to do so, subject to the following 
>>>>>> conditions:
>>>>>> - *
>>>>>> - * The above copyright notice and this permission notice 
>>>>>> (including the next
>>>>>> - * paragraph) shall be included in all copies or substantial 
>>>>>> portions of the
>>>>>> - * Software.
>>>>>> - *
>>>>>> - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY 
>>>>>> KIND, EXPRESS OR
>>>>>> - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF 
>>>>>> MERCHANTABILITY,
>>>>>> - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO 
>>>>>> EVENT SHALL
>>>>>> - * THE COPYRIGHT HOLDER(S) AND/OR ITS SUPPLIERS BE LIABLE FOR 
>>>>>> ANY CLAIM, DAMAGES OR
>>>>>> - * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR 
>>>>>> OTHERWISE,
>>>>>> - * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR 
>>>>>> THE USE OR OTHER
>>>>>> - * DEALINGS IN THE SOFTWARE.
>>>>>> - *
>>>>>> - * Authors:
>>>>>> - *     Alex Deucher <alexander.deucher@amd.com>
>>>>>> - */
>>>>>> -
>>>>>> -#include <linux/types.h>
>>>>>> -#include <linux/bug.h>
>>>>>> -#include <linux/kernel.h>
>>>>>> -
>>>>>> -const u32 si_default_state[] =
>>>>>> -{
>>>>>> -    0xc0066900,
>>>>>> -    0x00000000,
>>>>>> -    0x00000060, /* DB_RENDER_CONTROL */
>>>>>> -    0x00000000, /* DB_COUNT_CONTROL */
>>>>>> -    0x00000000, /* DB_DEPTH_VIEW */
>>>>>> -    0x0000002a, /* DB_RENDER_OVERRIDE */
>>>>>> -    0x00000000, /* DB_RENDER_OVERRIDE2 */
>>>>>> -    0x00000000, /* DB_HTILE_DATA_BASE */
>>>>>> -
>>>>>> -    0xc0046900,
>>>>>> -    0x00000008,
>>>>>> -    0x00000000, /* DB_DEPTH_BOUNDS_MIN */
>>>>>> -    0x00000000, /* DB_DEPTH_BOUNDS_MAX */
>>>>>> -    0x00000000, /* DB_STENCIL_CLEAR */
>>>>>> -    0x00000000, /* DB_DEPTH_CLEAR */
>>>>>> -
>>>>>> -    0xc0036900,
>>>>>> -    0x0000000f,
>>>>>> -    0x00000000, /* DB_DEPTH_INFO */
>>>>>> -    0x00000000, /* DB_Z_INFO */
>>>>>> -    0x00000000, /* DB_STENCIL_INFO */
>>>>>> -
>>>>>> -    0xc0016900,
>>>>>> -    0x00000080,
>>>>>> -    0x00000000, /* PA_SC_WINDOW_OFFSET */
>>>>>> -
>>>>>> -    0xc00d6900,
>>>>>> -    0x00000083,
>>>>>> -    0x0000ffff, /* PA_SC_CLIPRECT_RULE */
>>>>>> -    0x00000000, /* PA_SC_CLIPRECT_0_TL */
>>>>>> -    0x20002000, /* PA_SC_CLIPRECT_0_BR */
>>>>>> -    0x00000000,
>>>>>> -    0x20002000,
>>>>>> -    0x00000000,
>>>>>> -    0x20002000,
>>>>>> -    0x00000000,
>>>>>> -    0x20002000,
>>>>>> -    0xaaaaaaaa, /* PA_SC_EDGERULE */
>>>>>> -    0x00000000, /* PA_SU_HARDWARE_SCREEN_OFFSET */
>>>>>> -    0x0000000f, /* CB_TARGET_MASK */
>>>>>> -    0x0000000f, /* CB_SHADER_MASK */
>>>>>> -
>>>>>> -    0xc0226900,
>>>>>> -    0x00000094,
>>>>>> -    0x80000000, /* PA_SC_VPORT_SCISSOR_0_TL */
>>>>>> -    0x20002000, /* PA_SC_VPORT_SCISSOR_0_BR */
>>>>>> -    0x80000000,
>>>>>> -    0x20002000,
>>>>>> -    0x80000000,
>>>>>> -    0x20002000,
>>>>>> -    0x80000000,
>>>>>> -    0x20002000,
>>>>>> -    0x80000000,
>>>>>> -    0x20002000,
>>>>>> -    0x80000000,
>>>>>> -    0x20002000,
>>>>>> -    0x80000000,
>>>>>> -    0x20002000,
>>>>>> -    0x80000000,
>>>>>> -    0x20002000,
>>>>>> -    0x80000000,
>>>>>> -    0x20002000,
>>>>>> -    0x80000000,
>>>>>> -    0x20002000,
>>>>>> -    0x80000000,
>>>>>> -    0x20002000,
>>>>>> -    0x80000000,
>>>>>> -    0x20002000,
>>>>>> -    0x80000000,
>>>>>> -    0x20002000,
>>>>>> -    0x80000000,
>>>>>> -    0x20002000,
>>>>>> -    0x80000000,
>>>>>> -    0x20002000,
>>>>>> -    0x80000000,
>>>>>> -    0x20002000,
>>>>>> -    0x00000000, /* PA_SC_VPORT_ZMIN_0 */
>>>>>> -    0x3f800000, /* PA_SC_VPORT_ZMAX_0 */
>>>>>> -
>>>>>> -    0xc0026900,
>>>>>> -    0x000000d9,
>>>>>> -    0x00000000, /* CP_RINGID */
>>>>>> -    0x00000000, /* CP_VMID */
>>>>>> -
>>>>>> -    0xc0046900,
>>>>>> -    0x00000100,
>>>>>> -    0xffffffff, /* VGT_MAX_VTX_INDX */
>>>>>> -    0x00000000, /* VGT_MIN_VTX_INDX */
>>>>>> -    0x00000000, /* VGT_INDX_OFFSET */
>>>>>> -    0x00000000, /* VGT_MULTI_PRIM_IB_RESET_INDX */
>>>>>> -
>>>>>> -    0xc0046900,
>>>>>> -    0x00000105,
>>>>>> -    0x00000000, /* CB_BLEND_RED */
>>>>>> -    0x00000000, /* CB_BLEND_GREEN */
>>>>>> -    0x00000000, /* CB_BLEND_BLUE */
>>>>>> -    0x00000000, /* CB_BLEND_ALPHA */
>>>>>> -
>>>>>> -    0xc0016900,
>>>>>> -    0x000001e0,
>>>>>> -    0x00000000, /* CB_BLEND0_CONTROL */
>>>>>> -
>>>>>> -    0xc00e6900,
>>>>>> -    0x00000200,
>>>>>> -    0x00000000, /* DB_DEPTH_CONTROL */
>>>>>> -    0x00000000, /* DB_EQAA */
>>>>>> -    0x00cc0010, /* CB_COLOR_CONTROL */
>>>>>> -    0x00000210, /* DB_SHADER_CONTROL */
>>>>>> -    0x00010000, /* PA_CL_CLIP_CNTL */
>>>>>> -    0x00000004, /* PA_SU_SC_MODE_CNTL */
>>>>>> -    0x00000100, /* PA_CL_VTE_CNTL */
>>>>>> -    0x00000000, /* PA_CL_VS_OUT_CNTL */
>>>>>> -    0x00000000, /* PA_CL_NANINF_CNTL */
>>>>>> -    0x00000000, /* PA_SU_LINE_STIPPLE_CNTL */
>>>>>> -    0x00000000, /* PA_SU_LINE_STIPPLE_SCALE */
>>>>>> -    0x00000000, /* PA_SU_PRIM_FILTER_CNTL */
>>>>>> -    0x00000000, /*  */
>>>>>> -    0x00000000, /*  */
>>>>>> -
>>>>>> -    0xc0116900,
>>>>>> -    0x00000280,
>>>>>> -    0x00000000, /* PA_SU_POINT_SIZE */
>>>>>> -    0x00000000, /* PA_SU_POINT_MINMAX */
>>>>>> -    0x00000008, /* PA_SU_LINE_CNTL */
>>>>>> -    0x00000000, /* PA_SC_LINE_STIPPLE */
>>>>>> -    0x00000000, /* VGT_OUTPUT_PATH_CNTL */
>>>>>> -    0x00000000, /* VGT_HOS_CNTL */
>>>>>> -    0x00000000,
>>>>>> -    0x00000000,
>>>>>> -    0x00000000,
>>>>>> -    0x00000000,
>>>>>> -    0x00000000,
>>>>>> -    0x00000000,
>>>>>> -    0x00000000,
>>>>>> -    0x00000000,
>>>>>> -    0x00000000,
>>>>>> -    0x00000000,
>>>>>> -    0x00000000, /* VGT_GS_MODE */
>>>>>> -
>>>>>> -    0xc0026900,
>>>>>> -    0x00000292,
>>>>>> -    0x00000000, /* PA_SC_MODE_CNTL_0 */
>>>>>> -    0x00000000, /* PA_SC_MODE_CNTL_1 */
>>>>>> -
>>>>>> -    0xc0016900,
>>>>>> -    0x000002a1,
>>>>>> -    0x00000000, /* VGT_PRIMITIVEID_EN */
>>>>>> -
>>>>>> -    0xc0016900,
>>>>>> -    0x000002a5,
>>>>>> -    0x00000000, /* VGT_MULTI_PRIM_IB_RESET_EN */
>>>>>> -
>>>>>> -    0xc0026900,
>>>>>> -    0x000002a8,
>>>>>> -    0x00000000, /* VGT_INSTANCE_STEP_RATE_0 */
>>>>>> -    0x00000000,
>>>>>> -
>>>>>> -    0xc0026900,
>>>>>> -    0x000002ad,
>>>>>> -    0x00000000, /* VGT_REUSE_OFF */
>>>>>> -    0x00000000,
>>>>>> -
>>>>>> -    0xc0016900,
>>>>>> -    0x000002d5,
>>>>>> -    0x00000000, /* VGT_SHADER_STAGES_EN */
>>>>>> -
>>>>>> -    0xc0016900,
>>>>>> -    0x000002dc,
>>>>>> -    0x0000aa00, /* DB_ALPHA_TO_MASK */
>>>>>> -
>>>>>> -    0xc0066900,
>>>>>> -    0x000002de,
>>>>>> -    0x00000000, /* PA_SU_POLY_OFFSET_DB_FMT_CNTL */
>>>>>> -    0x00000000,
>>>>>> -    0x00000000,
>>>>>> -    0x00000000,
>>>>>> -    0x00000000,
>>>>>> -    0x00000000,
>>>>>> -
>>>>>> -    0xc0026900,
>>>>>> -    0x000002e5,
>>>>>> -    0x00000000, /* VGT_STRMOUT_CONFIG */
>>>>>> -    0x00000000,
>>>>>> -
>>>>>> -    0xc01b6900,
>>>>>> -    0x000002f5,
>>>>>> -    0x76543210, /* PA_SC_CENTROID_PRIORITY_0 */
>>>>>> -    0xfedcba98, /* PA_SC_CENTROID_PRIORITY_1 */
>>>>>> -    0x00000000, /* PA_SC_LINE_CNTL */
>>>>>> -    0x00000000, /* PA_SC_AA_CONFIG */
>>>>>> -    0x00000005, /* PA_SU_VTX_CNTL */
>>>>>> -    0x3f800000, /* PA_CL_GB_VERT_CLIP_ADJ */
>>>>>> -    0x3f800000, /* PA_CL_GB_VERT_DISC_ADJ */
>>>>>> -    0x3f800000, /* PA_CL_GB_HORZ_CLIP_ADJ */
>>>>>> -    0x3f800000, /* PA_CL_GB_HORZ_DISC_ADJ */
>>>>>> -    0x00000000, /* PA_SC_AA_SAMPLE_LOCS_PIXEL_X0Y0_0 */
>>>>>> -    0x00000000,
>>>>>> -    0x00000000,
>>>>>> -    0x00000000,
>>>>>> -    0x00000000,
>>>>>> -    0x00000000,
>>>>>> -    0x00000000,
>>>>>> -    0x00000000,
>>>>>> -    0x00000000,
>>>>>> -    0x00000000,
>>>>>> -    0x00000000,
>>>>>> -    0x00000000,
>>>>>> -    0x00000000,
>>>>>> -    0x00000000,
>>>>>> -    0x00000000,
>>>>>> -    0x00000000,
>>>>>> -    0xffffffff, /* PA_SC_AA_MASK_X0Y0_X1Y0 */
>>>>>> -    0xffffffff,
>>>>>> -
>>>>>> -    0xc0026900,
>>>>>> -    0x00000316,
>>>>>> -    0x0000000e, /* VGT_VERTEX_REUSE_BLOCK_CNTL */
>>>>>> -    0x00000010, /*  */
>>>>>> -};
>>>>>> -
>>>>>> -const u32 si_default_size = ARRAY_SIZE(si_default_state);
>>>>>> diff --git a/drivers/gpu/drm/radeon/si_blit_shaders.h 
>>>>>> b/drivers/gpu/drm/radeon/si_blit_shaders.h
>>>>>> deleted file mode 100644
>>>>>> index c739e51e3961..000000000000
>>>>>> --- a/drivers/gpu/drm/radeon/si_blit_shaders.h
>>>>>> +++ /dev/null
>>>>>> @@ -1,32 +0,0 @@
>>>>>> -/*
>>>>>> - * Copyright 2011 Advanced Micro Devices, Inc.
>>>>>> - *
>>>>>> - * Permission is hereby granted, free of charge, to any person 
>>>>>> obtaining a
>>>>>> - * copy of this software and associated documentation files (the 
>>>>>> "Software"),
>>>>>> - * to deal in the Software without restriction, including 
>>>>>> without limitation
>>>>>> - * the rights to use, copy, modify, merge, publish, distribute, 
>>>>>> sublicense,
>>>>>> - * and/or sell copies of the Software, and to permit persons to 
>>>>>> whom the
>>>>>> - * Software is furnished to do so, subject to the following 
>>>>>> conditions:
>>>>>> - *
>>>>>> - * The above copyright notice and this permission notice 
>>>>>> (including the next
>>>>>> - * paragraph) shall be included in all copies or substantial 
>>>>>> portions of the
>>>>>> - * Software.
>>>>>> - *
>>>>>> - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY 
>>>>>> KIND, EXPRESS OR
>>>>>> - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF 
>>>>>> MERCHANTABILITY,
>>>>>> - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO 
>>>>>> EVENT SHALL
>>>>>> - * THE COPYRIGHT HOLDER(S) AND/OR ITS SUPPLIERS BE LIABLE FOR 
>>>>>> ANY CLAIM, DAMAGES OR
>>>>>> - * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR 
>>>>>> OTHERWISE,
>>>>>> - * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR 
>>>>>> THE USE OR OTHER
>>>>>> - * DEALINGS IN THE SOFTWARE.
>>>>>> - *
>>>>>> - */
>>>>>> -
>>>>>> -#ifndef SI_BLIT_SHADERS_H
>>>>>> -#define SI_BLIT_SHADERS_H
>>>>>> -
>>>>>> -extern const u32 si_default_state[];
>>>>>> -
>>>>>> -extern const u32 si_default_size;
>>>>>> -
>>>>>> -#endif
>>>>>
>>>>
>>>
>>
>


^ permalink raw reply	[relevance 99%]

* Re: [PATCH] drm/radeon: change si_default_state table from global to static
  @ 2022-04-04 13:01 99%       ` Tom Rix
    0 siblings, 1 reply; 180+ results
From: Tom Rix @ 2022-04-04 13:01 UTC (permalink / raw)
  To: Christian König, alexander.deucher, Xinhui.Pan, airlied, daniel
  Cc: dri-devel, linux-kernel, amd-gfx


On 4/4/22 5:34 AM, Christian König wrote:
> Am 04.04.22 um 14:32 schrieb Tom Rix:
>>
>> On 4/3/22 8:23 AM, Christian König wrote:
>>> Am 02.04.22 um 18:27 schrieb Tom Rix:
>>>> Smatch reports these issues
>>>> si_blit_shaders.c:31:11: warning: symbol 'si_default_state'
>>>>    was not declared. Should it be static?
>>>> si_blit_shaders.c:253:11: warning: symbol 'si_default_size'
>>>>    was not declared. Should it be static?
>>>>
>>>> Both symbols are only used in si.c.  Single file symbols
>>>> should be static.  So move the si_default_state and
>>>> si_default_size to si.c and change their
>>>> storage-class-specifier to static.
>>>>
>>>> Remove unneeded si_blit_shaders.[c|h]
>>>
>>> Uff, well NAK.
>>>
>>> IIRC this was intentionally moved into a separate file because it is 
>>> rather large and not related to anything in si.c.
>>>
>>> It's unlikely that we are ever going to update it, but I would still 
>>> rather want to keep it separated.
>>>
>>> You should rather just include si_blit_shaders.h in si_blit_shaders.c.
>>
>> Do you mean #include "si_blit_shaders.c" in si.c or similar ?
>
> No, as far as I can see you are getting this warning because of a 
> missing previous prototype for the exported array.
>
> This can be avoided if you add si_blit_shaders.h as an include to 
> si_blit_shaders.c.

The warning is a symptom.

There are about 5-6 similar big, global tables in radeon/ with similar 
one file uses.

These global tables should become static.

Moving the table to si_blit_shader.h would keep it separated, adding the 
'static' would remove it from the globals.

*.c removed, Makefile updated.

Tom

>
> Regards,
> Christian.
>
>>
>> This could have the same effect of while keeping these separate failes
>>
>> Tom
>>
>>>
>>> Regards,
>>> Christian.
>>>
>>>>
>>>> Signed-off-by: Tom Rix <trix@redhat.com>
>>>> ---
>>>>   drivers/gpu/drm/radeon/Makefile          |   2 +-
>>>>   drivers/gpu/drm/radeon/si.c              | 224 +++++++++++++++++++-
>>>>   drivers/gpu/drm/radeon/si_blit_shaders.c | 253 
>>>> -----------------------
>>>>   drivers/gpu/drm/radeon/si_blit_shaders.h |  32 ---
>>>>   4 files changed, 224 insertions(+), 287 deletions(-)
>>>>   delete mode 100644 drivers/gpu/drm/radeon/si_blit_shaders.c
>>>>   delete mode 100644 drivers/gpu/drm/radeon/si_blit_shaders.h
>>>>
>>>> diff --git a/drivers/gpu/drm/radeon/Makefile 
>>>> b/drivers/gpu/drm/radeon/Makefile
>>>> index 11c97edde54d..664381f4eb07 100644
>>>> --- a/drivers/gpu/drm/radeon/Makefile
>>>> +++ b/drivers/gpu/drm/radeon/Makefile
>>>> @@ -44,7 +44,7 @@ radeon-y += radeon_device.o radeon_asic.o 
>>>> radeon_kms.o \
>>>>       evergreen.o evergreen_cs.o evergreen_blit_shaders.o \
>>>>       evergreen_hdmi.o radeon_trace_points.o ni.o 
>>>> cayman_blit_shaders.o \
>>>>       atombios_encoders.o radeon_semaphore.o radeon_sa.o 
>>>> atombios_i2c.o si.o \
>>>> -    si_blit_shaders.o radeon_prime.o cik.o cik_blit_shaders.o \
>>>> +    radeon_prime.o cik.o cik_blit_shaders.o \
>>>>       r600_dpm.o rs780_dpm.o rv6xx_dpm.o rv770_dpm.o rv730_dpm.o 
>>>> rv740_dpm.o \
>>>>       rv770_smc.o cypress_dpm.o btc_dpm.o sumo_dpm.o sumo_smc.o 
>>>> trinity_dpm.o \
>>>>       trinity_smc.o ni_dpm.o si_smc.o si_dpm.o kv_smc.o kv_dpm.o 
>>>> ci_smc.o \
>>>> diff --git a/drivers/gpu/drm/radeon/si.c b/drivers/gpu/drm/radeon/si.c
>>>> index 8d5e4b25609d..a4032702e302 100644
>>>> --- a/drivers/gpu/drm/radeon/si.c
>>>> +++ b/drivers/gpu/drm/radeon/si.c
>>>> @@ -38,7 +38,6 @@
>>>>   #include "radeon_asic.h"
>>>>   #include "radeon_audio.h"
>>>>   #include "radeon_ucode.h"
>>>> -#include "si_blit_shaders.h"
>>>>   #include "si.h"
>>>>   #include "sid.h"
>>>>   @@ -3553,6 +3552,229 @@ static int si_cp_load_microcode(struct 
>>>> radeon_device *rdev)
>>>>       return 0;
>>>>   }
>>>>   +static const u32 si_default_state[] = {
>>>> +    0xc0066900,
>>>> +    0x00000000,
>>>> +    0x00000060, /* DB_RENDER_CONTROL */
>>>> +    0x00000000, /* DB_COUNT_CONTROL */
>>>> +    0x00000000, /* DB_DEPTH_VIEW */
>>>> +    0x0000002a, /* DB_RENDER_OVERRIDE */
>>>> +    0x00000000, /* DB_RENDER_OVERRIDE2 */
>>>> +    0x00000000, /* DB_HTILE_DATA_BASE */
>>>> +
>>>> +    0xc0046900,
>>>> +    0x00000008,
>>>> +    0x00000000, /* DB_DEPTH_BOUNDS_MIN */
>>>> +    0x00000000, /* DB_DEPTH_BOUNDS_MAX */
>>>> +    0x00000000, /* DB_STENCIL_CLEAR */
>>>> +    0x00000000, /* DB_DEPTH_CLEAR */
>>>> +
>>>> +    0xc0036900,
>>>> +    0x0000000f,
>>>> +    0x00000000, /* DB_DEPTH_INFO */
>>>> +    0x00000000, /* DB_Z_INFO */
>>>> +    0x00000000, /* DB_STENCIL_INFO */
>>>> +
>>>> +    0xc0016900,
>>>> +    0x00000080,
>>>> +    0x00000000, /* PA_SC_WINDOW_OFFSET */
>>>> +
>>>> +    0xc00d6900,
>>>> +    0x00000083,
>>>> +    0x0000ffff, /* PA_SC_CLIPRECT_RULE */
>>>> +    0x00000000, /* PA_SC_CLIPRECT_0_TL */
>>>> +    0x20002000, /* PA_SC_CLIPRECT_0_BR */
>>>> +    0x00000000,
>>>> +    0x20002000,
>>>> +    0x00000000,
>>>> +    0x20002000,
>>>> +    0x00000000,
>>>> +    0x20002000,
>>>> +    0xaaaaaaaa, /* PA_SC_EDGERULE */
>>>> +    0x00000000, /* PA_SU_HARDWARE_SCREEN_OFFSET */
>>>> +    0x0000000f, /* CB_TARGET_MASK */
>>>> +    0x0000000f, /* CB_SHADER_MASK */
>>>> +
>>>> +    0xc0226900,
>>>> +    0x00000094,
>>>> +    0x80000000, /* PA_SC_VPORT_SCISSOR_0_TL */
>>>> +    0x20002000, /* PA_SC_VPORT_SCISSOR_0_BR */
>>>> +    0x80000000,
>>>> +    0x20002000,
>>>> +    0x80000000,
>>>> +    0x20002000,
>>>> +    0x80000000,
>>>> +    0x20002000,
>>>> +    0x80000000,
>>>> +    0x20002000,
>>>> +    0x80000000,
>>>> +    0x20002000,
>>>> +    0x80000000,
>>>> +    0x20002000,
>>>> +    0x80000000,
>>>> +    0x20002000,
>>>> +    0x80000000,
>>>> +    0x20002000,
>>>> +    0x80000000,
>>>> +    0x20002000,
>>>> +    0x80000000,
>>>> +    0x20002000,
>>>> +    0x80000000,
>>>> +    0x20002000,
>>>> +    0x80000000,
>>>> +    0x20002000,
>>>> +    0x80000000,
>>>> +    0x20002000,
>>>> +    0x80000000,
>>>> +    0x20002000,
>>>> +    0x80000000,
>>>> +    0x20002000,
>>>> +    0x00000000, /* PA_SC_VPORT_ZMIN_0 */
>>>> +    0x3f800000, /* PA_SC_VPORT_ZMAX_0 */
>>>> +
>>>> +    0xc0026900,
>>>> +    0x000000d9,
>>>> +    0x00000000, /* CP_RINGID */
>>>> +    0x00000000, /* CP_VMID */
>>>> +
>>>> +    0xc0046900,
>>>> +    0x00000100,
>>>> +    0xffffffff, /* VGT_MAX_VTX_INDX */
>>>> +    0x00000000, /* VGT_MIN_VTX_INDX */
>>>> +    0x00000000, /* VGT_INDX_OFFSET */
>>>> +    0x00000000, /* VGT_MULTI_PRIM_IB_RESET_INDX */
>>>> +
>>>> +    0xc0046900,
>>>> +    0x00000105,
>>>> +    0x00000000, /* CB_BLEND_RED */
>>>> +    0x00000000, /* CB_BLEND_GREEN */
>>>> +    0x00000000, /* CB_BLEND_BLUE */
>>>> +    0x00000000, /* CB_BLEND_ALPHA */
>>>> +
>>>> +    0xc0016900,
>>>> +    0x000001e0,
>>>> +    0x00000000, /* CB_BLEND0_CONTROL */
>>>> +
>>>> +    0xc00e6900,
>>>> +    0x00000200,
>>>> +    0x00000000, /* DB_DEPTH_CONTROL */
>>>> +    0x00000000, /* DB_EQAA */
>>>> +    0x00cc0010, /* CB_COLOR_CONTROL */
>>>> +    0x00000210, /* DB_SHADER_CONTROL */
>>>> +    0x00010000, /* PA_CL_CLIP_CNTL */
>>>> +    0x00000004, /* PA_SU_SC_MODE_CNTL */
>>>> +    0x00000100, /* PA_CL_VTE_CNTL */
>>>> +    0x00000000, /* PA_CL_VS_OUT_CNTL */
>>>> +    0x00000000, /* PA_CL_NANINF_CNTL */
>>>> +    0x00000000, /* PA_SU_LINE_STIPPLE_CNTL */
>>>> +    0x00000000, /* PA_SU_LINE_STIPPLE_SCALE */
>>>> +    0x00000000, /* PA_SU_PRIM_FILTER_CNTL */
>>>> +    0x00000000, /*  */
>>>> +    0x00000000, /*  */
>>>> +
>>>> +    0xc0116900,
>>>> +    0x00000280,
>>>> +    0x00000000, /* PA_SU_POINT_SIZE */
>>>> +    0x00000000, /* PA_SU_POINT_MINMAX */
>>>> +    0x00000008, /* PA_SU_LINE_CNTL */
>>>> +    0x00000000, /* PA_SC_LINE_STIPPLE */
>>>> +    0x00000000, /* VGT_OUTPUT_PATH_CNTL */
>>>> +    0x00000000, /* VGT_HOS_CNTL */
>>>> +    0x00000000,
>>>> +    0x00000000,
>>>> +    0x00000000,
>>>> +    0x00000000,
>>>> +    0x00000000,
>>>> +    0x00000000,
>>>> +    0x00000000,
>>>> +    0x00000000,
>>>> +    0x00000000,
>>>> +    0x00000000,
>>>> +    0x00000000, /* VGT_GS_MODE */
>>>> +
>>>> +    0xc0026900,
>>>> +    0x00000292,
>>>> +    0x00000000, /* PA_SC_MODE_CNTL_0 */
>>>> +    0x00000000, /* PA_SC_MODE_CNTL_1 */
>>>> +
>>>> +    0xc0016900,
>>>> +    0x000002a1,
>>>> +    0x00000000, /* VGT_PRIMITIVEID_EN */
>>>> +
>>>> +    0xc0016900,
>>>> +    0x000002a5,
>>>> +    0x00000000, /* VGT_MULTI_PRIM_IB_RESET_EN */
>>>> +
>>>> +    0xc0026900,
>>>> +    0x000002a8,
>>>> +    0x00000000, /* VGT_INSTANCE_STEP_RATE_0 */
>>>> +    0x00000000,
>>>> +
>>>> +    0xc0026900,
>>>> +    0x000002ad,
>>>> +    0x00000000, /* VGT_REUSE_OFF */
>>>> +    0x00000000,
>>>> +
>>>> +    0xc0016900,
>>>> +    0x000002d5,
>>>> +    0x00000000, /* VGT_SHADER_STAGES_EN */
>>>> +
>>>> +    0xc0016900,
>>>> +    0x000002dc,
>>>> +    0x0000aa00, /* DB_ALPHA_TO_MASK */
>>>> +
>>>> +    0xc0066900,
>>>> +    0x000002de,
>>>> +    0x00000000, /* PA_SU_POLY_OFFSET_DB_FMT_CNTL */
>>>> +    0x00000000,
>>>> +    0x00000000,
>>>> +    0x00000000,
>>>> +    0x00000000,
>>>> +    0x00000000,
>>>> +
>>>> +    0xc0026900,
>>>> +    0x000002e5,
>>>> +    0x00000000, /* VGT_STRMOUT_CONFIG */
>>>> +    0x00000000,
>>>> +
>>>> +    0xc01b6900,
>>>> +    0x000002f5,
>>>> +    0x76543210, /* PA_SC_CENTROID_PRIORITY_0 */
>>>> +    0xfedcba98, /* PA_SC_CENTROID_PRIORITY_1 */
>>>> +    0x00000000, /* PA_SC_LINE_CNTL */
>>>> +    0x00000000, /* PA_SC_AA_CONFIG */
>>>> +    0x00000005, /* PA_SU_VTX_CNTL */
>>>> +    0x3f800000, /* PA_CL_GB_VERT_CLIP_ADJ */
>>>> +    0x3f800000, /* PA_CL_GB_VERT_DISC_ADJ */
>>>> +    0x3f800000, /* PA_CL_GB_HORZ_CLIP_ADJ */
>>>> +    0x3f800000, /* PA_CL_GB_HORZ_DISC_ADJ */
>>>> +    0x00000000, /* PA_SC_AA_SAMPLE_LOCS_PIXEL_X0Y0_0 */
>>>> +    0x00000000,
>>>> +    0x00000000,
>>>> +    0x00000000,
>>>> +    0x00000000,
>>>> +    0x00000000,
>>>> +    0x00000000,
>>>> +    0x00000000,
>>>> +    0x00000000,
>>>> +    0x00000000,
>>>> +    0x00000000,
>>>> +    0x00000000,
>>>> +    0x00000000,
>>>> +    0x00000000,
>>>> +    0x00000000,
>>>> +    0x00000000,
>>>> +    0xffffffff, /* PA_SC_AA_MASK_X0Y0_X1Y0 */
>>>> +    0xffffffff,
>>>> +
>>>> +    0xc0026900,
>>>> +    0x00000316,
>>>> +    0x0000000e, /* VGT_VERTEX_REUSE_BLOCK_CNTL */
>>>> +    0x00000010, /*  */
>>>> +};
>>>> +
>>>> +static const u32 si_default_size = ARRAY_SIZE(si_default_state);
>>>> +
>>>>   static int si_cp_start(struct radeon_device *rdev)
>>>>   {
>>>>       struct radeon_ring *ring = 
>>>> &rdev->ring[RADEON_RING_TYPE_GFX_INDEX];
>>>> diff --git a/drivers/gpu/drm/radeon/si_blit_shaders.c 
>>>> b/drivers/gpu/drm/radeon/si_blit_shaders.c
>>>> deleted file mode 100644
>>>> index ec415e7dfa4b..000000000000
>>>> --- a/drivers/gpu/drm/radeon/si_blit_shaders.c
>>>> +++ /dev/null
>>>> @@ -1,253 +0,0 @@
>>>> -/*
>>>> - * Copyright 2011 Advanced Micro Devices, Inc.
>>>> - *
>>>> - * Permission is hereby granted, free of charge, to any person 
>>>> obtaining a
>>>> - * copy of this software and associated documentation files (the 
>>>> "Software"),
>>>> - * to deal in the Software without restriction, including without 
>>>> limitation
>>>> - * the rights to use, copy, modify, merge, publish, distribute, 
>>>> sublicense,
>>>> - * and/or sell copies of the Software, and to permit persons to 
>>>> whom the
>>>> - * Software is furnished to do so, subject to the following 
>>>> conditions:
>>>> - *
>>>> - * The above copyright notice and this permission notice 
>>>> (including the next
>>>> - * paragraph) shall be included in all copies or substantial 
>>>> portions of the
>>>> - * Software.
>>>> - *
>>>> - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 
>>>> EXPRESS OR
>>>> - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF 
>>>> MERCHANTABILITY,
>>>> - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO 
>>>> EVENT SHALL
>>>> - * THE COPYRIGHT HOLDER(S) AND/OR ITS SUPPLIERS BE LIABLE FOR ANY 
>>>> CLAIM, DAMAGES OR
>>>> - * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR 
>>>> OTHERWISE,
>>>> - * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE 
>>>> USE OR OTHER
>>>> - * DEALINGS IN THE SOFTWARE.
>>>> - *
>>>> - * Authors:
>>>> - *     Alex Deucher <alexander.deucher@amd.com>
>>>> - */
>>>> -
>>>> -#include <linux/types.h>
>>>> -#include <linux/bug.h>
>>>> -#include <linux/kernel.h>
>>>> -
>>>> -const u32 si_default_state[] =
>>>> -{
>>>> -    0xc0066900,
>>>> -    0x00000000,
>>>> -    0x00000060, /* DB_RENDER_CONTROL */
>>>> -    0x00000000, /* DB_COUNT_CONTROL */
>>>> -    0x00000000, /* DB_DEPTH_VIEW */
>>>> -    0x0000002a, /* DB_RENDER_OVERRIDE */
>>>> -    0x00000000, /* DB_RENDER_OVERRIDE2 */
>>>> -    0x00000000, /* DB_HTILE_DATA_BASE */
>>>> -
>>>> -    0xc0046900,
>>>> -    0x00000008,
>>>> -    0x00000000, /* DB_DEPTH_BOUNDS_MIN */
>>>> -    0x00000000, /* DB_DEPTH_BOUNDS_MAX */
>>>> -    0x00000000, /* DB_STENCIL_CLEAR */
>>>> -    0x00000000, /* DB_DEPTH_CLEAR */
>>>> -
>>>> -    0xc0036900,
>>>> -    0x0000000f,
>>>> -    0x00000000, /* DB_DEPTH_INFO */
>>>> -    0x00000000, /* DB_Z_INFO */
>>>> -    0x00000000, /* DB_STENCIL_INFO */
>>>> -
>>>> -    0xc0016900,
>>>> -    0x00000080,
>>>> -    0x00000000, /* PA_SC_WINDOW_OFFSET */
>>>> -
>>>> -    0xc00d6900,
>>>> -    0x00000083,
>>>> -    0x0000ffff, /* PA_SC_CLIPRECT_RULE */
>>>> -    0x00000000, /* PA_SC_CLIPRECT_0_TL */
>>>> -    0x20002000, /* PA_SC_CLIPRECT_0_BR */
>>>> -    0x00000000,
>>>> -    0x20002000,
>>>> -    0x00000000,
>>>> -    0x20002000,
>>>> -    0x00000000,
>>>> -    0x20002000,
>>>> -    0xaaaaaaaa, /* PA_SC_EDGERULE */
>>>> -    0x00000000, /* PA_SU_HARDWARE_SCREEN_OFFSET */
>>>> -    0x0000000f, /* CB_TARGET_MASK */
>>>> -    0x0000000f, /* CB_SHADER_MASK */
>>>> -
>>>> -    0xc0226900,
>>>> -    0x00000094,
>>>> -    0x80000000, /* PA_SC_VPORT_SCISSOR_0_TL */
>>>> -    0x20002000, /* PA_SC_VPORT_SCISSOR_0_BR */
>>>> -    0x80000000,
>>>> -    0x20002000,
>>>> -    0x80000000,
>>>> -    0x20002000,
>>>> -    0x80000000,
>>>> -    0x20002000,
>>>> -    0x80000000,
>>>> -    0x20002000,
>>>> -    0x80000000,
>>>> -    0x20002000,
>>>> -    0x80000000,
>>>> -    0x20002000,
>>>> -    0x80000000,
>>>> -    0x20002000,
>>>> -    0x80000000,
>>>> -    0x20002000,
>>>> -    0x80000000,
>>>> -    0x20002000,
>>>> -    0x80000000,
>>>> -    0x20002000,
>>>> -    0x80000000,
>>>> -    0x20002000,
>>>> -    0x80000000,
>>>> -    0x20002000,
>>>> -    0x80000000,
>>>> -    0x20002000,
>>>> -    0x80000000,
>>>> -    0x20002000,
>>>> -    0x80000000,
>>>> -    0x20002000,
>>>> -    0x00000000, /* PA_SC_VPORT_ZMIN_0 */
>>>> -    0x3f800000, /* PA_SC_VPORT_ZMAX_0 */
>>>> -
>>>> -    0xc0026900,
>>>> -    0x000000d9,
>>>> -    0x00000000, /* CP_RINGID */
>>>> -    0x00000000, /* CP_VMID */
>>>> -
>>>> -    0xc0046900,
>>>> -    0x00000100,
>>>> -    0xffffffff, /* VGT_MAX_VTX_INDX */
>>>> -    0x00000000, /* VGT_MIN_VTX_INDX */
>>>> -    0x00000000, /* VGT_INDX_OFFSET */
>>>> -    0x00000000, /* VGT_MULTI_PRIM_IB_RESET_INDX */
>>>> -
>>>> -    0xc0046900,
>>>> -    0x00000105,
>>>> -    0x00000000, /* CB_BLEND_RED */
>>>> -    0x00000000, /* CB_BLEND_GREEN */
>>>> -    0x00000000, /* CB_BLEND_BLUE */
>>>> -    0x00000000, /* CB_BLEND_ALPHA */
>>>> -
>>>> -    0xc0016900,
>>>> -    0x000001e0,
>>>> -    0x00000000, /* CB_BLEND0_CONTROL */
>>>> -
>>>> -    0xc00e6900,
>>>> -    0x00000200,
>>>> -    0x00000000, /* DB_DEPTH_CONTROL */
>>>> -    0x00000000, /* DB_EQAA */
>>>> -    0x00cc0010, /* CB_COLOR_CONTROL */
>>>> -    0x00000210, /* DB_SHADER_CONTROL */
>>>> -    0x00010000, /* PA_CL_CLIP_CNTL */
>>>> -    0x00000004, /* PA_SU_SC_MODE_CNTL */
>>>> -    0x00000100, /* PA_CL_VTE_CNTL */
>>>> -    0x00000000, /* PA_CL_VS_OUT_CNTL */
>>>> -    0x00000000, /* PA_CL_NANINF_CNTL */
>>>> -    0x00000000, /* PA_SU_LINE_STIPPLE_CNTL */
>>>> -    0x00000000, /* PA_SU_LINE_STIPPLE_SCALE */
>>>> -    0x00000000, /* PA_SU_PRIM_FILTER_CNTL */
>>>> -    0x00000000, /*  */
>>>> -    0x00000000, /*  */
>>>> -
>>>> -    0xc0116900,
>>>> -    0x00000280,
>>>> -    0x00000000, /* PA_SU_POINT_SIZE */
>>>> -    0x00000000, /* PA_SU_POINT_MINMAX */
>>>> -    0x00000008, /* PA_SU_LINE_CNTL */
>>>> -    0x00000000, /* PA_SC_LINE_STIPPLE */
>>>> -    0x00000000, /* VGT_OUTPUT_PATH_CNTL */
>>>> -    0x00000000, /* VGT_HOS_CNTL */
>>>> -    0x00000000,
>>>> -    0x00000000,
>>>> -    0x00000000,
>>>> -    0x00000000,
>>>> -    0x00000000,
>>>> -    0x00000000,
>>>> -    0x00000000,
>>>> -    0x00000000,
>>>> -    0x00000000,
>>>> -    0x00000000,
>>>> -    0x00000000, /* VGT_GS_MODE */
>>>> -
>>>> -    0xc0026900,
>>>> -    0x00000292,
>>>> -    0x00000000, /* PA_SC_MODE_CNTL_0 */
>>>> -    0x00000000, /* PA_SC_MODE_CNTL_1 */
>>>> -
>>>> -    0xc0016900,
>>>> -    0x000002a1,
>>>> -    0x00000000, /* VGT_PRIMITIVEID_EN */
>>>> -
>>>> -    0xc0016900,
>>>> -    0x000002a5,
>>>> -    0x00000000, /* VGT_MULTI_PRIM_IB_RESET_EN */
>>>> -
>>>> -    0xc0026900,
>>>> -    0x000002a8,
>>>> -    0x00000000, /* VGT_INSTANCE_STEP_RATE_0 */
>>>> -    0x00000000,
>>>> -
>>>> -    0xc0026900,
>>>> -    0x000002ad,
>>>> -    0x00000000, /* VGT_REUSE_OFF */
>>>> -    0x00000000,
>>>> -
>>>> -    0xc0016900,
>>>> -    0x000002d5,
>>>> -    0x00000000, /* VGT_SHADER_STAGES_EN */
>>>> -
>>>> -    0xc0016900,
>>>> -    0x000002dc,
>>>> -    0x0000aa00, /* DB_ALPHA_TO_MASK */
>>>> -
>>>> -    0xc0066900,
>>>> -    0x000002de,
>>>> -    0x00000000, /* PA_SU_POLY_OFFSET_DB_FMT_CNTL */
>>>> -    0x00000000,
>>>> -    0x00000000,
>>>> -    0x00000000,
>>>> -    0x00000000,
>>>> -    0x00000000,
>>>> -
>>>> -    0xc0026900,
>>>> -    0x000002e5,
>>>> -    0x00000000, /* VGT_STRMOUT_CONFIG */
>>>> -    0x00000000,
>>>> -
>>>> -    0xc01b6900,
>>>> -    0x000002f5,
>>>> -    0x76543210, /* PA_SC_CENTROID_PRIORITY_0 */
>>>> -    0xfedcba98, /* PA_SC_CENTROID_PRIORITY_1 */
>>>> -    0x00000000, /* PA_SC_LINE_CNTL */
>>>> -    0x00000000, /* PA_SC_AA_CONFIG */
>>>> -    0x00000005, /* PA_SU_VTX_CNTL */
>>>> -    0x3f800000, /* PA_CL_GB_VERT_CLIP_ADJ */
>>>> -    0x3f800000, /* PA_CL_GB_VERT_DISC_ADJ */
>>>> -    0x3f800000, /* PA_CL_GB_HORZ_CLIP_ADJ */
>>>> -    0x3f800000, /* PA_CL_GB_HORZ_DISC_ADJ */
>>>> -    0x00000000, /* PA_SC_AA_SAMPLE_LOCS_PIXEL_X0Y0_0 */
>>>> -    0x00000000,
>>>> -    0x00000000,
>>>> -    0x00000000,
>>>> -    0x00000000,
>>>> -    0x00000000,
>>>> -    0x00000000,
>>>> -    0x00000000,
>>>> -    0x00000000,
>>>> -    0x00000000,
>>>> -    0x00000000,
>>>> -    0x00000000,
>>>> -    0x00000000,
>>>> -    0x00000000,
>>>> -    0x00000000,
>>>> -    0x00000000,
>>>> -    0xffffffff, /* PA_SC_AA_MASK_X0Y0_X1Y0 */
>>>> -    0xffffffff,
>>>> -
>>>> -    0xc0026900,
>>>> -    0x00000316,
>>>> -    0x0000000e, /* VGT_VERTEX_REUSE_BLOCK_CNTL */
>>>> -    0x00000010, /*  */
>>>> -};
>>>> -
>>>> -const u32 si_default_size = ARRAY_SIZE(si_default_state);
>>>> diff --git a/drivers/gpu/drm/radeon/si_blit_shaders.h 
>>>> b/drivers/gpu/drm/radeon/si_blit_shaders.h
>>>> deleted file mode 100644
>>>> index c739e51e3961..000000000000
>>>> --- a/drivers/gpu/drm/radeon/si_blit_shaders.h
>>>> +++ /dev/null
>>>> @@ -1,32 +0,0 @@
>>>> -/*
>>>> - * Copyright 2011 Advanced Micro Devices, Inc.
>>>> - *
>>>> - * Permission is hereby granted, free of charge, to any person 
>>>> obtaining a
>>>> - * copy of this software and associated documentation files (the 
>>>> "Software"),
>>>> - * to deal in the Software without restriction, including without 
>>>> limitation
>>>> - * the rights to use, copy, modify, merge, publish, distribute, 
>>>> sublicense,
>>>> - * and/or sell copies of the Software, and to permit persons to 
>>>> whom the
>>>> - * Software is furnished to do so, subject to the following 
>>>> conditions:
>>>> - *
>>>> - * The above copyright notice and this permission notice 
>>>> (including the next
>>>> - * paragraph) shall be included in all copies or substantial 
>>>> portions of the
>>>> - * Software.
>>>> - *
>>>> - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 
>>>> EXPRESS OR
>>>> - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF 
>>>> MERCHANTABILITY,
>>>> - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO 
>>>> EVENT SHALL
>>>> - * THE COPYRIGHT HOLDER(S) AND/OR ITS SUPPLIERS BE LIABLE FOR ANY 
>>>> CLAIM, DAMAGES OR
>>>> - * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR 
>>>> OTHERWISE,
>>>> - * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE 
>>>> USE OR OTHER
>>>> - * DEALINGS IN THE SOFTWARE.
>>>> - *
>>>> - */
>>>> -
>>>> -#ifndef SI_BLIT_SHADERS_H
>>>> -#define SI_BLIT_SHADERS_H
>>>> -
>>>> -extern const u32 si_default_state[];
>>>> -
>>>> -extern const u32 si_default_size;
>>>> -
>>>> -#endif
>>>
>>
>


^ permalink raw reply	[relevance 99%]

* Re: [PATCH] drm/radeon: change si_default_state table from global to static
  @ 2022-04-04 12:32 99%   ` Tom Rix
    0 siblings, 1 reply; 180+ results
From: Tom Rix @ 2022-04-04 12:32 UTC (permalink / raw)
  To: Christian König, alexander.deucher, Xinhui.Pan, airlied, daniel
  Cc: dri-devel, linux-kernel, amd-gfx


On 4/3/22 8:23 AM, Christian König wrote:
> Am 02.04.22 um 18:27 schrieb Tom Rix:
>> Smatch reports these issues
>> si_blit_shaders.c:31:11: warning: symbol 'si_default_state'
>>    was not declared. Should it be static?
>> si_blit_shaders.c:253:11: warning: symbol 'si_default_size'
>>    was not declared. Should it be static?
>>
>> Both symbols are only used in si.c.  Single file symbols
>> should be static.  So move the si_default_state and
>> si_default_size to si.c and change their
>> storage-class-specifier to static.
>>
>> Remove unneeded si_blit_shaders.[c|h]
>
> Uff, well NAK.
>
> IIRC this was intentionally moved into a separate file because it is 
> rather large and not related to anything in si.c.
>
> It's unlikely that we are ever going to update it, but I would still 
> rather want to keep it separated.
>
> You should rather just include si_blit_shaders.h in si_blit_shaders.c.

Do you mean #include "si_blit_shaders.c" in si.c or similar ?

This could have the same effect of while keeping these separate failes

Tom

>
> Regards,
> Christian.
>
>>
>> Signed-off-by: Tom Rix <trix@redhat.com>
>> ---
>>   drivers/gpu/drm/radeon/Makefile          |   2 +-
>>   drivers/gpu/drm/radeon/si.c              | 224 +++++++++++++++++++-
>>   drivers/gpu/drm/radeon/si_blit_shaders.c | 253 -----------------------
>>   drivers/gpu/drm/radeon/si_blit_shaders.h |  32 ---
>>   4 files changed, 224 insertions(+), 287 deletions(-)
>>   delete mode 100644 drivers/gpu/drm/radeon/si_blit_shaders.c
>>   delete mode 100644 drivers/gpu/drm/radeon/si_blit_shaders.h
>>
>> diff --git a/drivers/gpu/drm/radeon/Makefile 
>> b/drivers/gpu/drm/radeon/Makefile
>> index 11c97edde54d..664381f4eb07 100644
>> --- a/drivers/gpu/drm/radeon/Makefile
>> +++ b/drivers/gpu/drm/radeon/Makefile
>> @@ -44,7 +44,7 @@ radeon-y += radeon_device.o radeon_asic.o 
>> radeon_kms.o \
>>       evergreen.o evergreen_cs.o evergreen_blit_shaders.o \
>>       evergreen_hdmi.o radeon_trace_points.o ni.o 
>> cayman_blit_shaders.o \
>>       atombios_encoders.o radeon_semaphore.o radeon_sa.o 
>> atombios_i2c.o si.o \
>> -    si_blit_shaders.o radeon_prime.o cik.o cik_blit_shaders.o \
>> +    radeon_prime.o cik.o cik_blit_shaders.o \
>>       r600_dpm.o rs780_dpm.o rv6xx_dpm.o rv770_dpm.o rv730_dpm.o 
>> rv740_dpm.o \
>>       rv770_smc.o cypress_dpm.o btc_dpm.o sumo_dpm.o sumo_smc.o 
>> trinity_dpm.o \
>>       trinity_smc.o ni_dpm.o si_smc.o si_dpm.o kv_smc.o kv_dpm.o 
>> ci_smc.o \
>> diff --git a/drivers/gpu/drm/radeon/si.c b/drivers/gpu/drm/radeon/si.c
>> index 8d5e4b25609d..a4032702e302 100644
>> --- a/drivers/gpu/drm/radeon/si.c
>> +++ b/drivers/gpu/drm/radeon/si.c
>> @@ -38,7 +38,6 @@
>>   #include "radeon_asic.h"
>>   #include "radeon_audio.h"
>>   #include "radeon_ucode.h"
>> -#include "si_blit_shaders.h"
>>   #include "si.h"
>>   #include "sid.h"
>>   @@ -3553,6 +3552,229 @@ static int si_cp_load_microcode(struct 
>> radeon_device *rdev)
>>       return 0;
>>   }
>>   +static const u32 si_default_state[] = {
>> +    0xc0066900,
>> +    0x00000000,
>> +    0x00000060, /* DB_RENDER_CONTROL */
>> +    0x00000000, /* DB_COUNT_CONTROL */
>> +    0x00000000, /* DB_DEPTH_VIEW */
>> +    0x0000002a, /* DB_RENDER_OVERRIDE */
>> +    0x00000000, /* DB_RENDER_OVERRIDE2 */
>> +    0x00000000, /* DB_HTILE_DATA_BASE */
>> +
>> +    0xc0046900,
>> +    0x00000008,
>> +    0x00000000, /* DB_DEPTH_BOUNDS_MIN */
>> +    0x00000000, /* DB_DEPTH_BOUNDS_MAX */
>> +    0x00000000, /* DB_STENCIL_CLEAR */
>> +    0x00000000, /* DB_DEPTH_CLEAR */
>> +
>> +    0xc0036900,
>> +    0x0000000f,
>> +    0x00000000, /* DB_DEPTH_INFO */
>> +    0x00000000, /* DB_Z_INFO */
>> +    0x00000000, /* DB_STENCIL_INFO */
>> +
>> +    0xc0016900,
>> +    0x00000080,
>> +    0x00000000, /* PA_SC_WINDOW_OFFSET */
>> +
>> +    0xc00d6900,
>> +    0x00000083,
>> +    0x0000ffff, /* PA_SC_CLIPRECT_RULE */
>> +    0x00000000, /* PA_SC_CLIPRECT_0_TL */
>> +    0x20002000, /* PA_SC_CLIPRECT_0_BR */
>> +    0x00000000,
>> +    0x20002000,
>> +    0x00000000,
>> +    0x20002000,
>> +    0x00000000,
>> +    0x20002000,
>> +    0xaaaaaaaa, /* PA_SC_EDGERULE */
>> +    0x00000000, /* PA_SU_HARDWARE_SCREEN_OFFSET */
>> +    0x0000000f, /* CB_TARGET_MASK */
>> +    0x0000000f, /* CB_SHADER_MASK */
>> +
>> +    0xc0226900,
>> +    0x00000094,
>> +    0x80000000, /* PA_SC_VPORT_SCISSOR_0_TL */
>> +    0x20002000, /* PA_SC_VPORT_SCISSOR_0_BR */
>> +    0x80000000,
>> +    0x20002000,
>> +    0x80000000,
>> +    0x20002000,
>> +    0x80000000,
>> +    0x20002000,
>> +    0x80000000,
>> +    0x20002000,
>> +    0x80000000,
>> +    0x20002000,
>> +    0x80000000,
>> +    0x20002000,
>> +    0x80000000,
>> +    0x20002000,
>> +    0x80000000,
>> +    0x20002000,
>> +    0x80000000,
>> +    0x20002000,
>> +    0x80000000,
>> +    0x20002000,
>> +    0x80000000,
>> +    0x20002000,
>> +    0x80000000,
>> +    0x20002000,
>> +    0x80000000,
>> +    0x20002000,
>> +    0x80000000,
>> +    0x20002000,
>> +    0x80000000,
>> +    0x20002000,
>> +    0x00000000, /* PA_SC_VPORT_ZMIN_0 */
>> +    0x3f800000, /* PA_SC_VPORT_ZMAX_0 */
>> +
>> +    0xc0026900,
>> +    0x000000d9,
>> +    0x00000000, /* CP_RINGID */
>> +    0x00000000, /* CP_VMID */
>> +
>> +    0xc0046900,
>> +    0x00000100,
>> +    0xffffffff, /* VGT_MAX_VTX_INDX */
>> +    0x00000000, /* VGT_MIN_VTX_INDX */
>> +    0x00000000, /* VGT_INDX_OFFSET */
>> +    0x00000000, /* VGT_MULTI_PRIM_IB_RESET_INDX */
>> +
>> +    0xc0046900,
>> +    0x00000105,
>> +    0x00000000, /* CB_BLEND_RED */
>> +    0x00000000, /* CB_BLEND_GREEN */
>> +    0x00000000, /* CB_BLEND_BLUE */
>> +    0x00000000, /* CB_BLEND_ALPHA */
>> +
>> +    0xc0016900,
>> +    0x000001e0,
>> +    0x00000000, /* CB_BLEND0_CONTROL */
>> +
>> +    0xc00e6900,
>> +    0x00000200,
>> +    0x00000000, /* DB_DEPTH_CONTROL */
>> +    0x00000000, /* DB_EQAA */
>> +    0x00cc0010, /* CB_COLOR_CONTROL */
>> +    0x00000210, /* DB_SHADER_CONTROL */
>> +    0x00010000, /* PA_CL_CLIP_CNTL */
>> +    0x00000004, /* PA_SU_SC_MODE_CNTL */
>> +    0x00000100, /* PA_CL_VTE_CNTL */
>> +    0x00000000, /* PA_CL_VS_OUT_CNTL */
>> +    0x00000000, /* PA_CL_NANINF_CNTL */
>> +    0x00000000, /* PA_SU_LINE_STIPPLE_CNTL */
>> +    0x00000000, /* PA_SU_LINE_STIPPLE_SCALE */
>> +    0x00000000, /* PA_SU_PRIM_FILTER_CNTL */
>> +    0x00000000, /*  */
>> +    0x00000000, /*  */
>> +
>> +    0xc0116900,
>> +    0x00000280,
>> +    0x00000000, /* PA_SU_POINT_SIZE */
>> +    0x00000000, /* PA_SU_POINT_MINMAX */
>> +    0x00000008, /* PA_SU_LINE_CNTL */
>> +    0x00000000, /* PA_SC_LINE_STIPPLE */
>> +    0x00000000, /* VGT_OUTPUT_PATH_CNTL */
>> +    0x00000000, /* VGT_HOS_CNTL */
>> +    0x00000000,
>> +    0x00000000,
>> +    0x00000000,
>> +    0x00000000,
>> +    0x00000000,
>> +    0x00000000,
>> +    0x00000000,
>> +    0x00000000,
>> +    0x00000000,
>> +    0x00000000,
>> +    0x00000000, /* VGT_GS_MODE */
>> +
>> +    0xc0026900,
>> +    0x00000292,
>> +    0x00000000, /* PA_SC_MODE_CNTL_0 */
>> +    0x00000000, /* PA_SC_MODE_CNTL_1 */
>> +
>> +    0xc0016900,
>> +    0x000002a1,
>> +    0x00000000, /* VGT_PRIMITIVEID_EN */
>> +
>> +    0xc0016900,
>> +    0x000002a5,
>> +    0x00000000, /* VGT_MULTI_PRIM_IB_RESET_EN */
>> +
>> +    0xc0026900,
>> +    0x000002a8,
>> +    0x00000000, /* VGT_INSTANCE_STEP_RATE_0 */
>> +    0x00000000,
>> +
>> +    0xc0026900,
>> +    0x000002ad,
>> +    0x00000000, /* VGT_REUSE_OFF */
>> +    0x00000000,
>> +
>> +    0xc0016900,
>> +    0x000002d5,
>> +    0x00000000, /* VGT_SHADER_STAGES_EN */
>> +
>> +    0xc0016900,
>> +    0x000002dc,
>> +    0x0000aa00, /* DB_ALPHA_TO_MASK */
>> +
>> +    0xc0066900,
>> +    0x000002de,
>> +    0x00000000, /* PA_SU_POLY_OFFSET_DB_FMT_CNTL */
>> +    0x00000000,
>> +    0x00000000,
>> +    0x00000000,
>> +    0x00000000,
>> +    0x00000000,
>> +
>> +    0xc0026900,
>> +    0x000002e5,
>> +    0x00000000, /* VGT_STRMOUT_CONFIG */
>> +    0x00000000,
>> +
>> +    0xc01b6900,
>> +    0x000002f5,
>> +    0x76543210, /* PA_SC_CENTROID_PRIORITY_0 */
>> +    0xfedcba98, /* PA_SC_CENTROID_PRIORITY_1 */
>> +    0x00000000, /* PA_SC_LINE_CNTL */
>> +    0x00000000, /* PA_SC_AA_CONFIG */
>> +    0x00000005, /* PA_SU_VTX_CNTL */
>> +    0x3f800000, /* PA_CL_GB_VERT_CLIP_ADJ */
>> +    0x3f800000, /* PA_CL_GB_VERT_DISC_ADJ */
>> +    0x3f800000, /* PA_CL_GB_HORZ_CLIP_ADJ */
>> +    0x3f800000, /* PA_CL_GB_HORZ_DISC_ADJ */
>> +    0x00000000, /* PA_SC_AA_SAMPLE_LOCS_PIXEL_X0Y0_0 */
>> +    0x00000000,
>> +    0x00000000,
>> +    0x00000000,
>> +    0x00000000,
>> +    0x00000000,
>> +    0x00000000,
>> +    0x00000000,
>> +    0x00000000,
>> +    0x00000000,
>> +    0x00000000,
>> +    0x00000000,
>> +    0x00000000,
>> +    0x00000000,
>> +    0x00000000,
>> +    0x00000000,
>> +    0xffffffff, /* PA_SC_AA_MASK_X0Y0_X1Y0 */
>> +    0xffffffff,
>> +
>> +    0xc0026900,
>> +    0x00000316,
>> +    0x0000000e, /* VGT_VERTEX_REUSE_BLOCK_CNTL */
>> +    0x00000010, /*  */
>> +};
>> +
>> +static const u32 si_default_size = ARRAY_SIZE(si_default_state);
>> +
>>   static int si_cp_start(struct radeon_device *rdev)
>>   {
>>       struct radeon_ring *ring = 
>> &rdev->ring[RADEON_RING_TYPE_GFX_INDEX];
>> diff --git a/drivers/gpu/drm/radeon/si_blit_shaders.c 
>> b/drivers/gpu/drm/radeon/si_blit_shaders.c
>> deleted file mode 100644
>> index ec415e7dfa4b..000000000000
>> --- a/drivers/gpu/drm/radeon/si_blit_shaders.c
>> +++ /dev/null
>> @@ -1,253 +0,0 @@
>> -/*
>> - * Copyright 2011 Advanced Micro Devices, Inc.
>> - *
>> - * Permission is hereby granted, free of charge, to any person 
>> obtaining a
>> - * copy of this software and associated documentation files (the 
>> "Software"),
>> - * to deal in the Software without restriction, including without 
>> limitation
>> - * the rights to use, copy, modify, merge, publish, distribute, 
>> sublicense,
>> - * and/or sell copies of the Software, and to permit persons to whom 
>> the
>> - * Software is furnished to do so, subject to the following conditions:
>> - *
>> - * The above copyright notice and this permission notice (including 
>> the next
>> - * paragraph) shall be included in all copies or substantial 
>> portions of the
>> - * Software.
>> - *
>> - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 
>> EXPRESS OR
>> - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF 
>> MERCHANTABILITY,
>> - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO 
>> EVENT SHALL
>> - * THE COPYRIGHT HOLDER(S) AND/OR ITS SUPPLIERS BE LIABLE FOR ANY 
>> CLAIM, DAMAGES OR
>> - * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR 
>> OTHERWISE,
>> - * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE 
>> USE OR OTHER
>> - * DEALINGS IN THE SOFTWARE.
>> - *
>> - * Authors:
>> - *     Alex Deucher <alexander.deucher@amd.com>
>> - */
>> -
>> -#include <linux/types.h>
>> -#include <linux/bug.h>
>> -#include <linux/kernel.h>
>> -
>> -const u32 si_default_state[] =
>> -{
>> -    0xc0066900,
>> -    0x00000000,
>> -    0x00000060, /* DB_RENDER_CONTROL */
>> -    0x00000000, /* DB_COUNT_CONTROL */
>> -    0x00000000, /* DB_DEPTH_VIEW */
>> -    0x0000002a, /* DB_RENDER_OVERRIDE */
>> -    0x00000000, /* DB_RENDER_OVERRIDE2 */
>> -    0x00000000, /* DB_HTILE_DATA_BASE */
>> -
>> -    0xc0046900,
>> -    0x00000008,
>> -    0x00000000, /* DB_DEPTH_BOUNDS_MIN */
>> -    0x00000000, /* DB_DEPTH_BOUNDS_MAX */
>> -    0x00000000, /* DB_STENCIL_CLEAR */
>> -    0x00000000, /* DB_DEPTH_CLEAR */
>> -
>> -    0xc0036900,
>> -    0x0000000f,
>> -    0x00000000, /* DB_DEPTH_INFO */
>> -    0x00000000, /* DB_Z_INFO */
>> -    0x00000000, /* DB_STENCIL_INFO */
>> -
>> -    0xc0016900,
>> -    0x00000080,
>> -    0x00000000, /* PA_SC_WINDOW_OFFSET */
>> -
>> -    0xc00d6900,
>> -    0x00000083,
>> -    0x0000ffff, /* PA_SC_CLIPRECT_RULE */
>> -    0x00000000, /* PA_SC_CLIPRECT_0_TL */
>> -    0x20002000, /* PA_SC_CLIPRECT_0_BR */
>> -    0x00000000,
>> -    0x20002000,
>> -    0x00000000,
>> -    0x20002000,
>> -    0x00000000,
>> -    0x20002000,
>> -    0xaaaaaaaa, /* PA_SC_EDGERULE */
>> -    0x00000000, /* PA_SU_HARDWARE_SCREEN_OFFSET */
>> -    0x0000000f, /* CB_TARGET_MASK */
>> -    0x0000000f, /* CB_SHADER_MASK */
>> -
>> -    0xc0226900,
>> -    0x00000094,
>> -    0x80000000, /* PA_SC_VPORT_SCISSOR_0_TL */
>> -    0x20002000, /* PA_SC_VPORT_SCISSOR_0_BR */
>> -    0x80000000,
>> -    0x20002000,
>> -    0x80000000,
>> -    0x20002000,
>> -    0x80000000,
>> -    0x20002000,
>> -    0x80000000,
>> -    0x20002000,
>> -    0x80000000,
>> -    0x20002000,
>> -    0x80000000,
>> -    0x20002000,
>> -    0x80000000,
>> -    0x20002000,
>> -    0x80000000,
>> -    0x20002000,
>> -    0x80000000,
>> -    0x20002000,
>> -    0x80000000,
>> -    0x20002000,
>> -    0x80000000,
>> -    0x20002000,
>> -    0x80000000,
>> -    0x20002000,
>> -    0x80000000,
>> -    0x20002000,
>> -    0x80000000,
>> -    0x20002000,
>> -    0x80000000,
>> -    0x20002000,
>> -    0x00000000, /* PA_SC_VPORT_ZMIN_0 */
>> -    0x3f800000, /* PA_SC_VPORT_ZMAX_0 */
>> -
>> -    0xc0026900,
>> -    0x000000d9,
>> -    0x00000000, /* CP_RINGID */
>> -    0x00000000, /* CP_VMID */
>> -
>> -    0xc0046900,
>> -    0x00000100,
>> -    0xffffffff, /* VGT_MAX_VTX_INDX */
>> -    0x00000000, /* VGT_MIN_VTX_INDX */
>> -    0x00000000, /* VGT_INDX_OFFSET */
>> -    0x00000000, /* VGT_MULTI_PRIM_IB_RESET_INDX */
>> -
>> -    0xc0046900,
>> -    0x00000105,
>> -    0x00000000, /* CB_BLEND_RED */
>> -    0x00000000, /* CB_BLEND_GREEN */
>> -    0x00000000, /* CB_BLEND_BLUE */
>> -    0x00000000, /* CB_BLEND_ALPHA */
>> -
>> -    0xc0016900,
>> -    0x000001e0,
>> -    0x00000000, /* CB_BLEND0_CONTROL */
>> -
>> -    0xc00e6900,
>> -    0x00000200,
>> -    0x00000000, /* DB_DEPTH_CONTROL */
>> -    0x00000000, /* DB_EQAA */
>> -    0x00cc0010, /* CB_COLOR_CONTROL */
>> -    0x00000210, /* DB_SHADER_CONTROL */
>> -    0x00010000, /* PA_CL_CLIP_CNTL */
>> -    0x00000004, /* PA_SU_SC_MODE_CNTL */
>> -    0x00000100, /* PA_CL_VTE_CNTL */
>> -    0x00000000, /* PA_CL_VS_OUT_CNTL */
>> -    0x00000000, /* PA_CL_NANINF_CNTL */
>> -    0x00000000, /* PA_SU_LINE_STIPPLE_CNTL */
>> -    0x00000000, /* PA_SU_LINE_STIPPLE_SCALE */
>> -    0x00000000, /* PA_SU_PRIM_FILTER_CNTL */
>> -    0x00000000, /*  */
>> -    0x00000000, /*  */
>> -
>> -    0xc0116900,
>> -    0x00000280,
>> -    0x00000000, /* PA_SU_POINT_SIZE */
>> -    0x00000000, /* PA_SU_POINT_MINMAX */
>> -    0x00000008, /* PA_SU_LINE_CNTL */
>> -    0x00000000, /* PA_SC_LINE_STIPPLE */
>> -    0x00000000, /* VGT_OUTPUT_PATH_CNTL */
>> -    0x00000000, /* VGT_HOS_CNTL */
>> -    0x00000000,
>> -    0x00000000,
>> -    0x00000000,
>> -    0x00000000,
>> -    0x00000000,
>> -    0x00000000,
>> -    0x00000000,
>> -    0x00000000,
>> -    0x00000000,
>> -    0x00000000,
>> -    0x00000000, /* VGT_GS_MODE */
>> -
>> -    0xc0026900,
>> -    0x00000292,
>> -    0x00000000, /* PA_SC_MODE_CNTL_0 */
>> -    0x00000000, /* PA_SC_MODE_CNTL_1 */
>> -
>> -    0xc0016900,
>> -    0x000002a1,
>> -    0x00000000, /* VGT_PRIMITIVEID_EN */
>> -
>> -    0xc0016900,
>> -    0x000002a5,
>> -    0x00000000, /* VGT_MULTI_PRIM_IB_RESET_EN */
>> -
>> -    0xc0026900,
>> -    0x000002a8,
>> -    0x00000000, /* VGT_INSTANCE_STEP_RATE_0 */
>> -    0x00000000,
>> -
>> -    0xc0026900,
>> -    0x000002ad,
>> -    0x00000000, /* VGT_REUSE_OFF */
>> -    0x00000000,
>> -
>> -    0xc0016900,
>> -    0x000002d5,
>> -    0x00000000, /* VGT_SHADER_STAGES_EN */
>> -
>> -    0xc0016900,
>> -    0x000002dc,
>> -    0x0000aa00, /* DB_ALPHA_TO_MASK */
>> -
>> -    0xc0066900,
>> -    0x000002de,
>> -    0x00000000, /* PA_SU_POLY_OFFSET_DB_FMT_CNTL */
>> -    0x00000000,
>> -    0x00000000,
>> -    0x00000000,
>> -    0x00000000,
>> -    0x00000000,
>> -
>> -    0xc0026900,
>> -    0x000002e5,
>> -    0x00000000, /* VGT_STRMOUT_CONFIG */
>> -    0x00000000,
>> -
>> -    0xc01b6900,
>> -    0x000002f5,
>> -    0x76543210, /* PA_SC_CENTROID_PRIORITY_0 */
>> -    0xfedcba98, /* PA_SC_CENTROID_PRIORITY_1 */
>> -    0x00000000, /* PA_SC_LINE_CNTL */
>> -    0x00000000, /* PA_SC_AA_CONFIG */
>> -    0x00000005, /* PA_SU_VTX_CNTL */
>> -    0x3f800000, /* PA_CL_GB_VERT_CLIP_ADJ */
>> -    0x3f800000, /* PA_CL_GB_VERT_DISC_ADJ */
>> -    0x3f800000, /* PA_CL_GB_HORZ_CLIP_ADJ */
>> -    0x3f800000, /* PA_CL_GB_HORZ_DISC_ADJ */
>> -    0x00000000, /* PA_SC_AA_SAMPLE_LOCS_PIXEL_X0Y0_0 */
>> -    0x00000000,
>> -    0x00000000,
>> -    0x00000000,
>> -    0x00000000,
>> -    0x00000000,
>> -    0x00000000,
>> -    0x00000000,
>> -    0x00000000,
>> -    0x00000000,
>> -    0x00000000,
>> -    0x00000000,
>> -    0x00000000,
>> -    0x00000000,
>> -    0x00000000,
>> -    0x00000000,
>> -    0xffffffff, /* PA_SC_AA_MASK_X0Y0_X1Y0 */
>> -    0xffffffff,
>> -
>> -    0xc0026900,
>> -    0x00000316,
>> -    0x0000000e, /* VGT_VERTEX_REUSE_BLOCK_CNTL */
>> -    0x00000010, /*  */
>> -};
>> -
>> -const u32 si_default_size = ARRAY_SIZE(si_default_state);
>> diff --git a/drivers/gpu/drm/radeon/si_blit_shaders.h 
>> b/drivers/gpu/drm/radeon/si_blit_shaders.h
>> deleted file mode 100644
>> index c739e51e3961..000000000000
>> --- a/drivers/gpu/drm/radeon/si_blit_shaders.h
>> +++ /dev/null
>> @@ -1,32 +0,0 @@
>> -/*
>> - * Copyright 2011 Advanced Micro Devices, Inc.
>> - *
>> - * Permission is hereby granted, free of charge, to any person 
>> obtaining a
>> - * copy of this software and associated documentation files (the 
>> "Software"),
>> - * to deal in the Software without restriction, including without 
>> limitation
>> - * the rights to use, copy, modify, merge, publish, distribute, 
>> sublicense,
>> - * and/or sell copies of the Software, and to permit persons to whom 
>> the
>> - * Software is furnished to do so, subject to the following conditions:
>> - *
>> - * The above copyright notice and this permission notice (including 
>> the next
>> - * paragraph) shall be included in all copies or substantial 
>> portions of the
>> - * Software.
>> - *
>> - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 
>> EXPRESS OR
>> - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF 
>> MERCHANTABILITY,
>> - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO 
>> EVENT SHALL
>> - * THE COPYRIGHT HOLDER(S) AND/OR ITS SUPPLIERS BE LIABLE FOR ANY 
>> CLAIM, DAMAGES OR
>> - * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR 
>> OTHERWISE,
>> - * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE 
>> USE OR OTHER
>> - * DEALINGS IN THE SOFTWARE.
>> - *
>> - */
>> -
>> -#ifndef SI_BLIT_SHADERS_H
>> -#define SI_BLIT_SHADERS_H
>> -
>> -extern const u32 si_default_state[];
>> -
>> -extern const u32 si_default_size;
>> -
>> -#endif
>


^ permalink raw reply	[relevance 99%]

* [PATCH] drm/amd/display: cleanup extern usage in function definition
@ 2022-04-03 14:21 99% Tom Rix
    0 siblings, 1 reply; 180+ results
From: Tom Rix @ 2022-04-03 14:21 UTC (permalink / raw)
  To: harry.wentland, sunpeng.li, Rodrigo.Siqueira, alexander.deucher,
	christian.koenig, Xinhui.Pan, airlied, daniel, wenjing.liu,
	waynelin, Anson.Jacob, Yu-ting.Shen, keescook,
	nicholas.kazlauskas
  Cc: Tom Rix, dri-devel, amd-gfx, linux-kernel

Smatch reports this issue
hdcp1_execution.c:500:29: warning: function
  'mod_hdcp_hdcp1_dp_execution' with external linkage
  has definition

The storage-class-specifier extern is not needed in a
definition, so remove it.

Signed-off-by: Tom Rix <trix@redhat.com>
---
 drivers/gpu/drm/amd/display/modules/hdcp/hdcp1_execution.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/drivers/gpu/drm/amd/display/modules/hdcp/hdcp1_execution.c b/drivers/gpu/drm/amd/display/modules/hdcp/hdcp1_execution.c
index 6ec918af3bff..1ddb4f5eac8e 100644
--- a/drivers/gpu/drm/amd/display/modules/hdcp/hdcp1_execution.c
+++ b/drivers/gpu/drm/amd/display/modules/hdcp/hdcp1_execution.c
@@ -497,9 +497,9 @@ enum mod_hdcp_status mod_hdcp_hdcp1_execution(struct mod_hdcp *hdcp,
 	return status;
 }
 
-extern enum mod_hdcp_status mod_hdcp_hdcp1_dp_execution(struct mod_hdcp *hdcp,
-		struct mod_hdcp_event_context *event_ctx,
-		struct mod_hdcp_transition_input_hdcp1 *input)
+enum mod_hdcp_status mod_hdcp_hdcp1_dp_execution(struct mod_hdcp *hdcp,
+						 struct mod_hdcp_event_context *event_ctx,
+						 struct mod_hdcp_transition_input_hdcp1 *input)
 {
 	enum mod_hdcp_status status = MOD_HDCP_STATUS_SUCCESS;
 
-- 
2.27.0


^ permalink raw reply related	[relevance 99%]

* [PATCH] drm/radeon: change si_default_state table from global to static
@ 2022-04-02 16:27 61% Tom Rix
    0 siblings, 1 reply; 180+ results
From: Tom Rix @ 2022-04-02 16:27 UTC (permalink / raw)
  To: alexander.deucher, christian.koenig, Xinhui.Pan, airlied, daniel
  Cc: Tom Rix, dri-devel, linux-kernel, amd-gfx

Smatch reports these issues
si_blit_shaders.c:31:11: warning: symbol 'si_default_state'
  was not declared. Should it be static?
si_blit_shaders.c:253:11: warning: symbol 'si_default_size'
  was not declared. Should it be static?

Both symbols are only used in si.c.  Single file symbols
should be static.  So move the si_default_state and
si_default_size to si.c and change their
storage-class-specifier to static.

Remove unneeded si_blit_shaders.[c|h]

Signed-off-by: Tom Rix <trix@redhat.com>
---
 drivers/gpu/drm/radeon/Makefile          |   2 +-
 drivers/gpu/drm/radeon/si.c              | 224 +++++++++++++++++++-
 drivers/gpu/drm/radeon/si_blit_shaders.c | 253 -----------------------
 drivers/gpu/drm/radeon/si_blit_shaders.h |  32 ---
 4 files changed, 224 insertions(+), 287 deletions(-)
 delete mode 100644 drivers/gpu/drm/radeon/si_blit_shaders.c
 delete mode 100644 drivers/gpu/drm/radeon/si_blit_shaders.h

diff --git a/drivers/gpu/drm/radeon/Makefile b/drivers/gpu/drm/radeon/Makefile
index 11c97edde54d..664381f4eb07 100644
--- a/drivers/gpu/drm/radeon/Makefile
+++ b/drivers/gpu/drm/radeon/Makefile
@@ -44,7 +44,7 @@ radeon-y += radeon_device.o radeon_asic.o radeon_kms.o \
 	evergreen.o evergreen_cs.o evergreen_blit_shaders.o \
 	evergreen_hdmi.o radeon_trace_points.o ni.o cayman_blit_shaders.o \
 	atombios_encoders.o radeon_semaphore.o radeon_sa.o atombios_i2c.o si.o \
-	si_blit_shaders.o radeon_prime.o cik.o cik_blit_shaders.o \
+	radeon_prime.o cik.o cik_blit_shaders.o \
 	r600_dpm.o rs780_dpm.o rv6xx_dpm.o rv770_dpm.o rv730_dpm.o rv740_dpm.o \
 	rv770_smc.o cypress_dpm.o btc_dpm.o sumo_dpm.o sumo_smc.o trinity_dpm.o \
 	trinity_smc.o ni_dpm.o si_smc.o si_dpm.o kv_smc.o kv_dpm.o ci_smc.o \
diff --git a/drivers/gpu/drm/radeon/si.c b/drivers/gpu/drm/radeon/si.c
index 8d5e4b25609d..a4032702e302 100644
--- a/drivers/gpu/drm/radeon/si.c
+++ b/drivers/gpu/drm/radeon/si.c
@@ -38,7 +38,6 @@
 #include "radeon_asic.h"
 #include "radeon_audio.h"
 #include "radeon_ucode.h"
-#include "si_blit_shaders.h"
 #include "si.h"
 #include "sid.h"
 
@@ -3553,6 +3552,229 @@ static int si_cp_load_microcode(struct radeon_device *rdev)
 	return 0;
 }
 
+static const u32 si_default_state[] = {
+	0xc0066900,
+	0x00000000,
+	0x00000060, /* DB_RENDER_CONTROL */
+	0x00000000, /* DB_COUNT_CONTROL */
+	0x00000000, /* DB_DEPTH_VIEW */
+	0x0000002a, /* DB_RENDER_OVERRIDE */
+	0x00000000, /* DB_RENDER_OVERRIDE2 */
+	0x00000000, /* DB_HTILE_DATA_BASE */
+
+	0xc0046900,
+	0x00000008,
+	0x00000000, /* DB_DEPTH_BOUNDS_MIN */
+	0x00000000, /* DB_DEPTH_BOUNDS_MAX */
+	0x00000000, /* DB_STENCIL_CLEAR */
+	0x00000000, /* DB_DEPTH_CLEAR */
+
+	0xc0036900,
+	0x0000000f,
+	0x00000000, /* DB_DEPTH_INFO */
+	0x00000000, /* DB_Z_INFO */
+	0x00000000, /* DB_STENCIL_INFO */
+
+	0xc0016900,
+	0x00000080,
+	0x00000000, /* PA_SC_WINDOW_OFFSET */
+
+	0xc00d6900,
+	0x00000083,
+	0x0000ffff, /* PA_SC_CLIPRECT_RULE */
+	0x00000000, /* PA_SC_CLIPRECT_0_TL */
+	0x20002000, /* PA_SC_CLIPRECT_0_BR */
+	0x00000000,
+	0x20002000,
+	0x00000000,
+	0x20002000,
+	0x00000000,
+	0x20002000,
+	0xaaaaaaaa, /* PA_SC_EDGERULE */
+	0x00000000, /* PA_SU_HARDWARE_SCREEN_OFFSET */
+	0x0000000f, /* CB_TARGET_MASK */
+	0x0000000f, /* CB_SHADER_MASK */
+
+	0xc0226900,
+	0x00000094,
+	0x80000000, /* PA_SC_VPORT_SCISSOR_0_TL */
+	0x20002000, /* PA_SC_VPORT_SCISSOR_0_BR */
+	0x80000000,
+	0x20002000,
+	0x80000000,
+	0x20002000,
+	0x80000000,
+	0x20002000,
+	0x80000000,
+	0x20002000,
+	0x80000000,
+	0x20002000,
+	0x80000000,
+	0x20002000,
+	0x80000000,
+	0x20002000,
+	0x80000000,
+	0x20002000,
+	0x80000000,
+	0x20002000,
+	0x80000000,
+	0x20002000,
+	0x80000000,
+	0x20002000,
+	0x80000000,
+	0x20002000,
+	0x80000000,
+	0x20002000,
+	0x80000000,
+	0x20002000,
+	0x80000000,
+	0x20002000,
+	0x00000000, /* PA_SC_VPORT_ZMIN_0 */
+	0x3f800000, /* PA_SC_VPORT_ZMAX_0 */
+
+	0xc0026900,
+	0x000000d9,
+	0x00000000, /* CP_RINGID */
+	0x00000000, /* CP_VMID */
+
+	0xc0046900,
+	0x00000100,
+	0xffffffff, /* VGT_MAX_VTX_INDX */
+	0x00000000, /* VGT_MIN_VTX_INDX */
+	0x00000000, /* VGT_INDX_OFFSET */
+	0x00000000, /* VGT_MULTI_PRIM_IB_RESET_INDX */
+
+	0xc0046900,
+	0x00000105,
+	0x00000000, /* CB_BLEND_RED */
+	0x00000000, /* CB_BLEND_GREEN */
+	0x00000000, /* CB_BLEND_BLUE */
+	0x00000000, /* CB_BLEND_ALPHA */
+
+	0xc0016900,
+	0x000001e0,
+	0x00000000, /* CB_BLEND0_CONTROL */
+
+	0xc00e6900,
+	0x00000200,
+	0x00000000, /* DB_DEPTH_CONTROL */
+	0x00000000, /* DB_EQAA */
+	0x00cc0010, /* CB_COLOR_CONTROL */
+	0x00000210, /* DB_SHADER_CONTROL */
+	0x00010000, /* PA_CL_CLIP_CNTL */
+	0x00000004, /* PA_SU_SC_MODE_CNTL */
+	0x00000100, /* PA_CL_VTE_CNTL */
+	0x00000000, /* PA_CL_VS_OUT_CNTL */
+	0x00000000, /* PA_CL_NANINF_CNTL */
+	0x00000000, /* PA_SU_LINE_STIPPLE_CNTL */
+	0x00000000, /* PA_SU_LINE_STIPPLE_SCALE */
+	0x00000000, /* PA_SU_PRIM_FILTER_CNTL */
+	0x00000000, /*  */
+	0x00000000, /*  */
+
+	0xc0116900,
+	0x00000280,
+	0x00000000, /* PA_SU_POINT_SIZE */
+	0x00000000, /* PA_SU_POINT_MINMAX */
+	0x00000008, /* PA_SU_LINE_CNTL */
+	0x00000000, /* PA_SC_LINE_STIPPLE */
+	0x00000000, /* VGT_OUTPUT_PATH_CNTL */
+	0x00000000, /* VGT_HOS_CNTL */
+	0x00000000,
+	0x00000000,
+	0x00000000,
+	0x00000000,
+	0x00000000,
+	0x00000000,
+	0x00000000,
+	0x00000000,
+	0x00000000,
+	0x00000000,
+	0x00000000, /* VGT_GS_MODE */
+
+	0xc0026900,
+	0x00000292,
+	0x00000000, /* PA_SC_MODE_CNTL_0 */
+	0x00000000, /* PA_SC_MODE_CNTL_1 */
+
+	0xc0016900,
+	0x000002a1,
+	0x00000000, /* VGT_PRIMITIVEID_EN */
+
+	0xc0016900,
+	0x000002a5,
+	0x00000000, /* VGT_MULTI_PRIM_IB_RESET_EN */
+
+	0xc0026900,
+	0x000002a8,
+	0x00000000, /* VGT_INSTANCE_STEP_RATE_0 */
+	0x00000000,
+
+	0xc0026900,
+	0x000002ad,
+	0x00000000, /* VGT_REUSE_OFF */
+	0x00000000,
+
+	0xc0016900,
+	0x000002d5,
+	0x00000000, /* VGT_SHADER_STAGES_EN */
+
+	0xc0016900,
+	0x000002dc,
+	0x0000aa00, /* DB_ALPHA_TO_MASK */
+
+	0xc0066900,
+	0x000002de,
+	0x00000000, /* PA_SU_POLY_OFFSET_DB_FMT_CNTL */
+	0x00000000,
+	0x00000000,
+	0x00000000,
+	0x00000000,
+	0x00000000,
+
+	0xc0026900,
+	0x000002e5,
+	0x00000000, /* VGT_STRMOUT_CONFIG */
+	0x00000000,
+
+	0xc01b6900,
+	0x000002f5,
+	0x76543210, /* PA_SC_CENTROID_PRIORITY_0 */
+	0xfedcba98, /* PA_SC_CENTROID_PRIORITY_1 */
+	0x00000000, /* PA_SC_LINE_CNTL */
+	0x00000000, /* PA_SC_AA_CONFIG */
+	0x00000005, /* PA_SU_VTX_CNTL */
+	0x3f800000, /* PA_CL_GB_VERT_CLIP_ADJ */
+	0x3f800000, /* PA_CL_GB_VERT_DISC_ADJ */
+	0x3f800000, /* PA_CL_GB_HORZ_CLIP_ADJ */
+	0x3f800000, /* PA_CL_GB_HORZ_DISC_ADJ */
+	0x00000000, /* PA_SC_AA_SAMPLE_LOCS_PIXEL_X0Y0_0 */
+	0x00000000,
+	0x00000000,
+	0x00000000,
+	0x00000000,
+	0x00000000,
+	0x00000000,
+	0x00000000,
+	0x00000000,
+	0x00000000,
+	0x00000000,
+	0x00000000,
+	0x00000000,
+	0x00000000,
+	0x00000000,
+	0x00000000,
+	0xffffffff, /* PA_SC_AA_MASK_X0Y0_X1Y0 */
+	0xffffffff,
+
+	0xc0026900,
+	0x00000316,
+	0x0000000e, /* VGT_VERTEX_REUSE_BLOCK_CNTL */
+	0x00000010, /*  */
+};
+
+static const u32 si_default_size = ARRAY_SIZE(si_default_state);
+
 static int si_cp_start(struct radeon_device *rdev)
 {
 	struct radeon_ring *ring = &rdev->ring[RADEON_RING_TYPE_GFX_INDEX];
diff --git a/drivers/gpu/drm/radeon/si_blit_shaders.c b/drivers/gpu/drm/radeon/si_blit_shaders.c
deleted file mode 100644
index ec415e7dfa4b..000000000000
--- a/drivers/gpu/drm/radeon/si_blit_shaders.c
+++ /dev/null
@@ -1,253 +0,0 @@
-/*
- * Copyright 2011 Advanced Micro Devices, Inc.
- *
- * Permission is hereby granted, free of charge, to any person obtaining a
- * copy of this software and associated documentation files (the "Software"),
- * to deal in the Software without restriction, including without limitation
- * the rights to use, copy, modify, merge, publish, distribute, sublicense,
- * and/or sell copies of the Software, and to permit persons to whom the
- * Software is furnished to do so, subject to the following conditions:
- *
- * The above copyright notice and this permission notice (including the next
- * paragraph) shall be included in all copies or substantial portions of the
- * Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
- * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
- * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL
- * THE COPYRIGHT HOLDER(S) AND/OR ITS SUPPLIERS BE LIABLE FOR ANY CLAIM, DAMAGES OR
- * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
- * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
- * DEALINGS IN THE SOFTWARE.
- *
- * Authors:
- *     Alex Deucher <alexander.deucher@amd.com>
- */
-
-#include <linux/types.h>
-#include <linux/bug.h>
-#include <linux/kernel.h>
-
-const u32 si_default_state[] =
-{
-	0xc0066900,
-	0x00000000,
-	0x00000060, /* DB_RENDER_CONTROL */
-	0x00000000, /* DB_COUNT_CONTROL */
-	0x00000000, /* DB_DEPTH_VIEW */
-	0x0000002a, /* DB_RENDER_OVERRIDE */
-	0x00000000, /* DB_RENDER_OVERRIDE2 */
-	0x00000000, /* DB_HTILE_DATA_BASE */
-
-	0xc0046900,
-	0x00000008,
-	0x00000000, /* DB_DEPTH_BOUNDS_MIN */
-	0x00000000, /* DB_DEPTH_BOUNDS_MAX */
-	0x00000000, /* DB_STENCIL_CLEAR */
-	0x00000000, /* DB_DEPTH_CLEAR */
-
-	0xc0036900,
-	0x0000000f,
-	0x00000000, /* DB_DEPTH_INFO */
-	0x00000000, /* DB_Z_INFO */
-	0x00000000, /* DB_STENCIL_INFO */
-
-	0xc0016900,
-	0x00000080,
-	0x00000000, /* PA_SC_WINDOW_OFFSET */
-
-	0xc00d6900,
-	0x00000083,
-	0x0000ffff, /* PA_SC_CLIPRECT_RULE */
-	0x00000000, /* PA_SC_CLIPRECT_0_TL */
-	0x20002000, /* PA_SC_CLIPRECT_0_BR */
-	0x00000000,
-	0x20002000,
-	0x00000000,
-	0x20002000,
-	0x00000000,
-	0x20002000,
-	0xaaaaaaaa, /* PA_SC_EDGERULE */
-	0x00000000, /* PA_SU_HARDWARE_SCREEN_OFFSET */
-	0x0000000f, /* CB_TARGET_MASK */
-	0x0000000f, /* CB_SHADER_MASK */
-
-	0xc0226900,
-	0x00000094,
-	0x80000000, /* PA_SC_VPORT_SCISSOR_0_TL */
-	0x20002000, /* PA_SC_VPORT_SCISSOR_0_BR */
-	0x80000000,
-	0x20002000,
-	0x80000000,
-	0x20002000,
-	0x80000000,
-	0x20002000,
-	0x80000000,
-	0x20002000,
-	0x80000000,
-	0x20002000,
-	0x80000000,
-	0x20002000,
-	0x80000000,
-	0x20002000,
-	0x80000000,
-	0x20002000,
-	0x80000000,
-	0x20002000,
-	0x80000000,
-	0x20002000,
-	0x80000000,
-	0x20002000,
-	0x80000000,
-	0x20002000,
-	0x80000000,
-	0x20002000,
-	0x80000000,
-	0x20002000,
-	0x80000000,
-	0x20002000,
-	0x00000000, /* PA_SC_VPORT_ZMIN_0 */
-	0x3f800000, /* PA_SC_VPORT_ZMAX_0 */
-
-	0xc0026900,
-	0x000000d9,
-	0x00000000, /* CP_RINGID */
-	0x00000000, /* CP_VMID */
-
-	0xc0046900,
-	0x00000100,
-	0xffffffff, /* VGT_MAX_VTX_INDX */
-	0x00000000, /* VGT_MIN_VTX_INDX */
-	0x00000000, /* VGT_INDX_OFFSET */
-	0x00000000, /* VGT_MULTI_PRIM_IB_RESET_INDX */
-
-	0xc0046900,
-	0x00000105,
-	0x00000000, /* CB_BLEND_RED */
-	0x00000000, /* CB_BLEND_GREEN */
-	0x00000000, /* CB_BLEND_BLUE */
-	0x00000000, /* CB_BLEND_ALPHA */
-
-	0xc0016900,
-	0x000001e0,
-	0x00000000, /* CB_BLEND0_CONTROL */
-
-	0xc00e6900,
-	0x00000200,
-	0x00000000, /* DB_DEPTH_CONTROL */
-	0x00000000, /* DB_EQAA */
-	0x00cc0010, /* CB_COLOR_CONTROL */
-	0x00000210, /* DB_SHADER_CONTROL */
-	0x00010000, /* PA_CL_CLIP_CNTL */
-	0x00000004, /* PA_SU_SC_MODE_CNTL */
-	0x00000100, /* PA_CL_VTE_CNTL */
-	0x00000000, /* PA_CL_VS_OUT_CNTL */
-	0x00000000, /* PA_CL_NANINF_CNTL */
-	0x00000000, /* PA_SU_LINE_STIPPLE_CNTL */
-	0x00000000, /* PA_SU_LINE_STIPPLE_SCALE */
-	0x00000000, /* PA_SU_PRIM_FILTER_CNTL */
-	0x00000000, /*  */
-	0x00000000, /*  */
-
-	0xc0116900,
-	0x00000280,
-	0x00000000, /* PA_SU_POINT_SIZE */
-	0x00000000, /* PA_SU_POINT_MINMAX */
-	0x00000008, /* PA_SU_LINE_CNTL */
-	0x00000000, /* PA_SC_LINE_STIPPLE */
-	0x00000000, /* VGT_OUTPUT_PATH_CNTL */
-	0x00000000, /* VGT_HOS_CNTL */
-	0x00000000,
-	0x00000000,
-	0x00000000,
-	0x00000000,
-	0x00000000,
-	0x00000000,
-	0x00000000,
-	0x00000000,
-	0x00000000,
-	0x00000000,
-	0x00000000, /* VGT_GS_MODE */
-
-	0xc0026900,
-	0x00000292,
-	0x00000000, /* PA_SC_MODE_CNTL_0 */
-	0x00000000, /* PA_SC_MODE_CNTL_1 */
-
-	0xc0016900,
-	0x000002a1,
-	0x00000000, /* VGT_PRIMITIVEID_EN */
-
-	0xc0016900,
-	0x000002a5,
-	0x00000000, /* VGT_MULTI_PRIM_IB_RESET_EN */
-
-	0xc0026900,
-	0x000002a8,
-	0x00000000, /* VGT_INSTANCE_STEP_RATE_0 */
-	0x00000000,
-
-	0xc0026900,
-	0x000002ad,
-	0x00000000, /* VGT_REUSE_OFF */
-	0x00000000,
-
-	0xc0016900,
-	0x000002d5,
-	0x00000000, /* VGT_SHADER_STAGES_EN */
-
-	0xc0016900,
-	0x000002dc,
-	0x0000aa00, /* DB_ALPHA_TO_MASK */
-
-	0xc0066900,
-	0x000002de,
-	0x00000000, /* PA_SU_POLY_OFFSET_DB_FMT_CNTL */
-	0x00000000,
-	0x00000000,
-	0x00000000,
-	0x00000000,
-	0x00000000,
-
-	0xc0026900,
-	0x000002e5,
-	0x00000000, /* VGT_STRMOUT_CONFIG */
-	0x00000000,
-
-	0xc01b6900,
-	0x000002f5,
-	0x76543210, /* PA_SC_CENTROID_PRIORITY_0 */
-	0xfedcba98, /* PA_SC_CENTROID_PRIORITY_1 */
-	0x00000000, /* PA_SC_LINE_CNTL */
-	0x00000000, /* PA_SC_AA_CONFIG */
-	0x00000005, /* PA_SU_VTX_CNTL */
-	0x3f800000, /* PA_CL_GB_VERT_CLIP_ADJ */
-	0x3f800000, /* PA_CL_GB_VERT_DISC_ADJ */
-	0x3f800000, /* PA_CL_GB_HORZ_CLIP_ADJ */
-	0x3f800000, /* PA_CL_GB_HORZ_DISC_ADJ */
-	0x00000000, /* PA_SC_AA_SAMPLE_LOCS_PIXEL_X0Y0_0 */
-	0x00000000,
-	0x00000000,
-	0x00000000,
-	0x00000000,
-	0x00000000,
-	0x00000000,
-	0x00000000,
-	0x00000000,
-	0x00000000,
-	0x00000000,
-	0x00000000,
-	0x00000000,
-	0x00000000,
-	0x00000000,
-	0x00000000,
-	0xffffffff, /* PA_SC_AA_MASK_X0Y0_X1Y0 */
-	0xffffffff,
-
-	0xc0026900,
-	0x00000316,
-	0x0000000e, /* VGT_VERTEX_REUSE_BLOCK_CNTL */
-	0x00000010, /*  */
-};
-
-const u32 si_default_size = ARRAY_SIZE(si_default_state);
diff --git a/drivers/gpu/drm/radeon/si_blit_shaders.h b/drivers/gpu/drm/radeon/si_blit_shaders.h
deleted file mode 100644
index c739e51e3961..000000000000
--- a/drivers/gpu/drm/radeon/si_blit_shaders.h
+++ /dev/null
@@ -1,32 +0,0 @@
-/*
- * Copyright 2011 Advanced Micro Devices, Inc.
- *
- * Permission is hereby granted, free of charge, to any person obtaining a
- * copy of this software and associated documentation files (the "Software"),
- * to deal in the Software without restriction, including without limitation
- * the rights to use, copy, modify, merge, publish, distribute, sublicense,
- * and/or sell copies of the Software, and to permit persons to whom the
- * Software is furnished to do so, subject to the following conditions:
- *
- * The above copyright notice and this permission notice (including the next
- * paragraph) shall be included in all copies or substantial portions of the
- * Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
- * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
- * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL
- * THE COPYRIGHT HOLDER(S) AND/OR ITS SUPPLIERS BE LIABLE FOR ANY CLAIM, DAMAGES OR
- * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
- * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
- * DEALINGS IN THE SOFTWARE.
- *
- */
-
-#ifndef SI_BLIT_SHADERS_H
-#define SI_BLIT_SHADERS_H
-
-extern const u32 si_default_state[];
-
-extern const u32 si_default_size;
-
-#endif
-- 
2.27.0


^ permalink raw reply related	[relevance 61%]

* Re: [PATCH] drm/repaper: combine allocs in repaper_spi_transfer()
  @ 2022-03-13 16:07 99%   ` Tom Rix
  0 siblings, 0 replies; 180+ results
From: Tom Rix @ 2022-03-13 16:07 UTC (permalink / raw)
  To: Noralf Trønnes, airlied, daniel; +Cc: linux-kernel, dri-devel


On 3/13/22 8:41 AM, Noralf Trønnes wrote:
>
> Den 13.03.2022 15.10, skrev trix@redhat.com:
>> From: Tom Rix <trix@redhat.com>
>>
>> repaper_spi_transfer() allocates a single byte
>> for the spi header and then another buffer for
>> the payload.  Combine the allocs into a single
>> buffer with offsets.  To simplify the offsets
>> put the header after the payload.
>>
>> Signed-off-by: Tom Rix <trix@redhat.com>
>> ---
>>   drivers/gpu/drm/tiny/repaper.c | 40 ++++++++++------------------------
>>   1 file changed, 12 insertions(+), 28 deletions(-)
>>
>> diff --git a/drivers/gpu/drm/tiny/repaper.c b/drivers/gpu/drm/tiny/repaper.c
>> index 37b6bb90e46e1..22a6732f35a01 100644
>> --- a/drivers/gpu/drm/tiny/repaper.c
>> +++ b/drivers/gpu/drm/tiny/repaper.c
>> @@ -100,50 +100,34 @@ static inline struct repaper_epd *drm_to_epd(struct drm_device *drm)
>>   static int repaper_spi_transfer(struct spi_device *spi, u8 header,
>>   				const void *tx, void *rx, size_t len)
>>   {
>> -	void *txbuf = NULL, *rxbuf = NULL;
>>   	struct spi_transfer tr[2] = {};
>> -	u8 *headerbuf;
>> +	u8 *buf;
>>   	int ret;
>>   
>> -	headerbuf = kmalloc(1, GFP_KERNEL);
>> -	if (!headerbuf)
>> +	buf = kmalloc(1 + len, GFP_KERNEL);
>> +	if (!buf)
>>   		return -ENOMEM;
>>   
>> -	headerbuf[0] = header;
>> -	tr[0].tx_buf = headerbuf;
>> +	buf[len] = header;
>> +	tr[0].tx_buf = &buf[len];
> I don't think this will work since the buffer is used directly for DMA
> on some platforms[1] so the buffers need to be at the correct alignment
> for that to work. For this reason I think it's better to leave this
> as-is since we know the kmalloc buffers will always be useable for DMA
> and the code is also easy to read and understand instead of calculating
> offsets.
>
> [1] tinydrm/mipi-dbi: Use dma-safe buffers for all SPI transfers
> (a89bfc5d9a07)
>
> Noralf.
>
>>   	tr[0].len = 1;
>>   
>> -	/* Stack allocated tx? */
>> -	if (tx && len <= 32) {

How about a change to remove this ?

It seems like you are getting lucky.

reduce the to single txrx_buf

Tom

>> -		txbuf = kmemdup(tx, len, GFP_KERNEL);
>> -		if (!txbuf) {
>> -			ret = -ENOMEM;
>> -			goto out_free;
>> -		}
>> +	if (tx) {
>> +		memcpy(buf, tx, len);
>> +		tr[1].tx_buf = buf;
>>   	}
>>   
>> -	if (rx) {
>> -		rxbuf = kmalloc(len, GFP_KERNEL);
>> -		if (!rxbuf) {
>> -			ret = -ENOMEM;
>> -			goto out_free;
>> -		}
>> -	}
>> +	if (rx)
>> +		tr[1].rx_buf = buf;
>>   
>> -	tr[1].tx_buf = txbuf ? txbuf : tx;
>> -	tr[1].rx_buf = rxbuf;
>>   	tr[1].len = len;
>>   
>>   	ndelay(80);
>>   	ret = spi_sync_transfer(spi, tr, 2);
>>   	if (rx && !ret)
>> -		memcpy(rx, rxbuf, len);
>> -
>> -out_free:
>> -	kfree(headerbuf);
>> -	kfree(txbuf);
>> -	kfree(rxbuf);
>> +		memcpy(rx, buf, len);
>>   
>> +	kfree(buf);
>>   	return ret;
>>   }
>>   


^ permalink raw reply	[relevance 99%]

* [PATCH] drm/repaper: combine allocs in repaper_spi_transfer()
@ 2022-03-13 14:10 95% trix
    0 siblings, 1 reply; 180+ results
From: trix @ 2022-03-13 14:10 UTC (permalink / raw)
  To: noralf, airlied, daniel; +Cc: Tom Rix, linux-kernel, dri-devel

From: Tom Rix <trix@redhat.com>

repaper_spi_transfer() allocates a single byte
for the spi header and then another buffer for
the payload.  Combine the allocs into a single
buffer with offsets.  To simplify the offsets
put the header after the payload.

Signed-off-by: Tom Rix <trix@redhat.com>
---
 drivers/gpu/drm/tiny/repaper.c | 40 ++++++++++------------------------
 1 file changed, 12 insertions(+), 28 deletions(-)

diff --git a/drivers/gpu/drm/tiny/repaper.c b/drivers/gpu/drm/tiny/repaper.c
index 37b6bb90e46e1..22a6732f35a01 100644
--- a/drivers/gpu/drm/tiny/repaper.c
+++ b/drivers/gpu/drm/tiny/repaper.c
@@ -100,50 +100,34 @@ static inline struct repaper_epd *drm_to_epd(struct drm_device *drm)
 static int repaper_spi_transfer(struct spi_device *spi, u8 header,
 				const void *tx, void *rx, size_t len)
 {
-	void *txbuf = NULL, *rxbuf = NULL;
 	struct spi_transfer tr[2] = {};
-	u8 *headerbuf;
+	u8 *buf;
 	int ret;
 
-	headerbuf = kmalloc(1, GFP_KERNEL);
-	if (!headerbuf)
+	buf = kmalloc(1 + len, GFP_KERNEL);
+	if (!buf)
 		return -ENOMEM;
 
-	headerbuf[0] = header;
-	tr[0].tx_buf = headerbuf;
+	buf[len] = header;
+	tr[0].tx_buf = &buf[len];
 	tr[0].len = 1;
 
-	/* Stack allocated tx? */
-	if (tx && len <= 32) {
-		txbuf = kmemdup(tx, len, GFP_KERNEL);
-		if (!txbuf) {
-			ret = -ENOMEM;
-			goto out_free;
-		}
+	if (tx) {
+		memcpy(buf, tx, len);
+		tr[1].tx_buf = buf;
 	}
 
-	if (rx) {
-		rxbuf = kmalloc(len, GFP_KERNEL);
-		if (!rxbuf) {
-			ret = -ENOMEM;
-			goto out_free;
-		}
-	}
+	if (rx)
+		tr[1].rx_buf = buf;
 
-	tr[1].tx_buf = txbuf ? txbuf : tx;
-	tr[1].rx_buf = rxbuf;
 	tr[1].len = len;
 
 	ndelay(80);
 	ret = spi_sync_transfer(spi, tr, 2);
 	if (rx && !ret)
-		memcpy(rx, rxbuf, len);
-
-out_free:
-	kfree(headerbuf);
-	kfree(txbuf);
-	kfree(rxbuf);
+		memcpy(rx, buf, len);
 
+	kfree(buf);
 	return ret;
 }
 
-- 
2.26.3


^ permalink raw reply related	[relevance 95%]

* Re: [PATCH] drm/bridge: anx7625: check the return on anx7625_aux_trans
  @ 2022-03-09  1:45 99%   ` Tom Rix
  0 siblings, 0 replies; 180+ results
From: Tom Rix @ 2022-03-09  1:45 UTC (permalink / raw)
  To: Nick Desaulniers
  Cc: llvm, jonas, airlied, robert.foss, dri-devel, narmstrong,
	linux-kernel, jernej.skrabec, nathan, tzungbi, pihsun,
	laurent.pinchart, andrzej.hajda, hsinyi, sam, xji, maxime


On 3/8/22 2:57 PM, Nick Desaulniers wrote:
> On Thu, Mar 3, 2022 at 12:19 PM <trix@redhat.com> wrote:
>> From: Tom Rix <trix@redhat.com>
>>
>> Clang static analysis reports this issue
>> anx7625.c:876:13: warning: The left operand of '&' is
>>    a garbage value
>>    if (!(bcap & 0xOA01)) {
>>          ~~~~ ^
>>
>> bcap is only set by a successful call to
>> anx7625_aux_trans().  So check.
>>
>> Fixes: cd1637c7e480 ("drm/bridge: anx7625: add HDCP support")
> Is this the correct Fixes tag?
yes
> I think it should be
>
> Fixes: adca62ec370c ("drm/bridge: anx7625: Support reading edid
> through aux channel")

This one changes the name of the function

-       anx7625_aux_dpcd_trans(ctx, DP_AUX_NATIVE_READ, 0x68028, 1, &bcap);
+       anx7625_aux_trans(ctx, DP_AUX_NATIVE_READ, 0x68028, 1, &bcap);

A return check from the earlier commit, when this block of code came 
into existence, is when it was first needed.

Tom

>
> instead.
>
>> Signed-off-by: Tom Rix <trix@redhat.com>
>> ---
>>   drivers/gpu/drm/bridge/analogix/anx7625.c | 5 ++++-
>>   1 file changed, 4 insertions(+), 1 deletion(-)
>>
>> diff --git a/drivers/gpu/drm/bridge/analogix/anx7625.c b/drivers/gpu/drm/bridge/analogix/anx7625.c
>> index 633618bafd75d..f02ac079ed2ec 100644
>> --- a/drivers/gpu/drm/bridge/analogix/anx7625.c
>> +++ b/drivers/gpu/drm/bridge/analogix/anx7625.c
>> @@ -872,7 +872,10 @@ static int anx7625_hdcp_enable(struct anx7625_data *ctx)
>>          }
>>
>>          /* Read downstream capability */
>> -       anx7625_aux_trans(ctx, DP_AUX_NATIVE_READ, 0x68028, 1, &bcap);
>> +       ret = anx7625_aux_trans(ctx, DP_AUX_NATIVE_READ, 0x68028, 1, &bcap);
>> +       if (ret < 0)
>> +               return ret;
>> +
>>          if (!(bcap & 0x01)) {
>>                  pr_warn("downstream not support HDCP 1.4, cap(%x).\n", bcap);
>>                  return 0;
>> --
>> 2.26.3
>>
>


^ permalink raw reply	[relevance 99%]

* [PATCH] drm/i915: rework the error handling in *_dpll_params
@ 2022-03-04 21:03 85% trix
  0 siblings, 0 replies; 180+ results
From: trix @ 2022-03-04 21:03 UTC (permalink / raw)
  To: jani.nikula, joonas.lahtinen, rodrigo.vivi, tvrtko.ursulin,
	airlied, daniel, nathan, ndesaulniers, ville.syrjala,
	matthew.d.roper, lucas.demarchi, airlied, imre.deak
  Cc: Tom Rix, intel-gfx, llvm, linux-kernel, dri-devel

From: Tom Rix <trix@redhat.com>

Clang static analysis reports this issue
intel_dpll.c:472:31: warning: The left operand of '-'
  is a garbage value [core.UndefinedBinaryOperatorResult]
  this_err = abs(clock.dot - target);
                 ~~~~~~~~~ ^

In a loop clock.dot is set on successful call to
i9xx_calc_dpll_params().  If the call fails, the later
*is_valid() will use the previous loop's clock.dot.

The *_dpll_params functions return an arithmetic statement
with the clock.dot as the variable.  Change the error handler
to set clock.dot to 0 and jump to the return statement.

Fixes: dccbea3b0704 ("drm/i915: calculate the port clock rate along with other PLL params")
Signed-off-by: Tom Rix <trix@redhat.com>
---
 drivers/gpu/drm/i915/display/intel_dpll.c | 32 ++++++++++++++---------
 1 file changed, 20 insertions(+), 12 deletions(-)

diff --git a/drivers/gpu/drm/i915/display/intel_dpll.c b/drivers/gpu/drm/i915/display/intel_dpll.c
index 0ae37fdbf2a5b..ba7cada704288 100644
--- a/drivers/gpu/drm/i915/display/intel_dpll.c
+++ b/drivers/gpu/drm/i915/display/intel_dpll.c
@@ -309,11 +309,13 @@ int pnv_calc_dpll_params(int refclk, struct dpll *clock)
 {
 	clock->m = clock->m2 + 2;
 	clock->p = clock->p1 * clock->p2;
-	if (WARN_ON(clock->n == 0 || clock->p == 0))
-		return 0;
+	if (WARN_ON(clock->n == 0 || clock->p == 0)) {
+		clock->dot = 0;
+		goto end;
+	}
 	clock->vco = DIV_ROUND_CLOSEST(refclk * clock->m, clock->n);
 	clock->dot = DIV_ROUND_CLOSEST(clock->vco, clock->p);
-
+end:
 	return clock->dot;
 }
 
@@ -326,11 +328,13 @@ int i9xx_calc_dpll_params(int refclk, struct dpll *clock)
 {
 	clock->m = i9xx_dpll_compute_m(clock);
 	clock->p = clock->p1 * clock->p2;
-	if (WARN_ON(clock->n + 2 == 0 || clock->p == 0))
-		return 0;
+	if (WARN_ON(clock->n + 2 == 0 || clock->p == 0)) {
+		clock->dot = 0;
+		goto end;
+	}
 	clock->vco = DIV_ROUND_CLOSEST(refclk * clock->m, clock->n + 2);
 	clock->dot = DIV_ROUND_CLOSEST(clock->vco, clock->p);
-
+end:
 	return clock->dot;
 }
 
@@ -338,11 +342,13 @@ int vlv_calc_dpll_params(int refclk, struct dpll *clock)
 {
 	clock->m = clock->m1 * clock->m2;
 	clock->p = clock->p1 * clock->p2;
-	if (WARN_ON(clock->n == 0 || clock->p == 0))
-		return 0;
+	if (WARN_ON(clock->n == 0 || clock->p == 0)) {
+		clock->dot = 0;
+		goto end;
+	}
 	clock->vco = DIV_ROUND_CLOSEST(refclk * clock->m, clock->n);
 	clock->dot = DIV_ROUND_CLOSEST(clock->vco, clock->p);
-
+end:
 	return clock->dot / 5;
 }
 
@@ -350,12 +356,14 @@ int chv_calc_dpll_params(int refclk, struct dpll *clock)
 {
 	clock->m = clock->m1 * clock->m2;
 	clock->p = clock->p1 * clock->p2;
-	if (WARN_ON(clock->n == 0 || clock->p == 0))
-		return 0;
+	if (WARN_ON(clock->n == 0 || clock->p == 0)) {
+		clock->dot = 0;
+		goto end;
+	}
 	clock->vco = DIV_ROUND_CLOSEST_ULL(mul_u32_u32(refclk, clock->m),
 					   clock->n << 22);
 	clock->dot = DIV_ROUND_CLOSEST(clock->vco, clock->p);
-
+end:
 	return clock->dot / 5;
 }
 
-- 
2.26.3


^ permalink raw reply related	[relevance 85%]

* [PATCH] drm/bridge: anx7625: check the return on anx7625_aux_trans
@ 2022-03-03 20:19 99% trix
    0 siblings, 1 reply; 180+ results
From: trix @ 2022-03-03 20:19 UTC (permalink / raw)
  To: andrzej.hajda, narmstrong, robert.foss, Laurent.pinchart, jonas,
	jernej.skrabec, airlied, daniel, nathan, ndesaulniers, xji,
	hsinyi, sam, tzungbi, pihsun, maxime
  Cc: Tom Rix, llvm, linux-kernel, dri-devel

From: Tom Rix <trix@redhat.com>

Clang static analysis reports this issue
anx7625.c:876:13: warning: The left operand of '&' is
  a garbage value
  if (!(bcap & 0xOA01)) {
        ~~~~ ^

bcap is only set by a successful call to
anx7625_aux_trans().  So check.

Fixes: cd1637c7e480 ("drm/bridge: anx7625: add HDCP support")
Signed-off-by: Tom Rix <trix@redhat.com>
---
 drivers/gpu/drm/bridge/analogix/anx7625.c | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/drivers/gpu/drm/bridge/analogix/anx7625.c b/drivers/gpu/drm/bridge/analogix/anx7625.c
index 633618bafd75d..f02ac079ed2ec 100644
--- a/drivers/gpu/drm/bridge/analogix/anx7625.c
+++ b/drivers/gpu/drm/bridge/analogix/anx7625.c
@@ -872,7 +872,10 @@ static int anx7625_hdcp_enable(struct anx7625_data *ctx)
 	}
 
 	/* Read downstream capability */
-	anx7625_aux_trans(ctx, DP_AUX_NATIVE_READ, 0x68028, 1, &bcap);
+	ret = anx7625_aux_trans(ctx, DP_AUX_NATIVE_READ, 0x68028, 1, &bcap);
+	if (ret < 0)
+		return ret;
+
 	if (!(bcap & 0x01)) {
 		pr_warn("downstream not support HDCP 1.4, cap(%x).\n", bcap);
 		return 0;
-- 
2.26.3


^ permalink raw reply related	[relevance 99%]

* [PATCH v2] drm/panfrost: cleanup comments
@ 2022-03-02 12:45 85% trix
  0 siblings, 0 replies; 180+ results
From: trix @ 2022-03-02 12:45 UTC (permalink / raw)
  To: robh, tomeu.vizoso, steven.price, alyssa.rosenzweig, airlied, daniel
  Cc: Tom Rix, linux-kernel, dri-devel

From: Tom Rix <trix@redhat.com>

For spdx
change tab to space delimiter
Use // for *.c

Replacements
commited to committed
regsiters to registers
initialze to initialize

Signed-off-by: Tom Rix <trix@redhat.com>
---
v2: remove multiline comment change

 drivers/gpu/drm/panfrost/panfrost_drv.c          | 2 +-
 drivers/gpu/drm/panfrost/panfrost_gem_shrinker.c | 2 +-
 drivers/gpu/drm/panfrost/panfrost_issues.h       | 2 +-
 drivers/gpu/drm/panfrost/panfrost_mmu.c          | 2 +-
 drivers/gpu/drm/panfrost/panfrost_regs.h         | 2 +-
 5 files changed, 5 insertions(+), 5 deletions(-)

diff --git a/drivers/gpu/drm/panfrost/panfrost_drv.c b/drivers/gpu/drm/panfrost/panfrost_drv.c
index 96bb5a4656278..94b6f0a19c83a 100644
--- a/drivers/gpu/drm/panfrost/panfrost_drv.c
+++ b/drivers/gpu/drm/panfrost/panfrost_drv.c
@@ -562,7 +562,7 @@ static int panfrost_probe(struct platform_device *pdev)
 
 	pfdev->coherent = device_get_dma_attr(&pdev->dev) == DEV_DMA_COHERENT;
 
-	/* Allocate and initialze the DRM device. */
+	/* Allocate and initialize the DRM device. */
 	ddev = drm_dev_alloc(&panfrost_drm_driver, &pdev->dev);
 	if (IS_ERR(ddev))
 		return PTR_ERR(ddev);
diff --git a/drivers/gpu/drm/panfrost/panfrost_gem_shrinker.c b/drivers/gpu/drm/panfrost/panfrost_gem_shrinker.c
index b0142341e2235..77e7cb6d1ae3b 100644
--- a/drivers/gpu/drm/panfrost/panfrost_gem_shrinker.c
+++ b/drivers/gpu/drm/panfrost/panfrost_gem_shrinker.c
@@ -1,4 +1,4 @@
-/* SPDX-License-Identifier: GPL-2.0 */
+// SPDX-License-Identifier: GPL-2.0
 /* Copyright (C) 2019 Arm Ltd.
  *
  * Based on msm_gem_freedreno.c:
diff --git a/drivers/gpu/drm/panfrost/panfrost_issues.h b/drivers/gpu/drm/panfrost/panfrost_issues.h
index 8e59d765bf19f..501a76c5e95ff 100644
--- a/drivers/gpu/drm/panfrost/panfrost_issues.h
+++ b/drivers/gpu/drm/panfrost/panfrost_issues.h
@@ -14,7 +14,7 @@
  */
 enum panfrost_hw_issue {
 	/* Need way to guarantee that all previously-translated memory accesses
-	 * are commited */
+	 * are committed */
 	HW_ISSUE_6367,
 
 	/* On job complete with non-done the cache is not flushed */
diff --git a/drivers/gpu/drm/panfrost/panfrost_mmu.c b/drivers/gpu/drm/panfrost/panfrost_mmu.c
index 39562f2d11a47..d3f82b26a631d 100644
--- a/drivers/gpu/drm/panfrost/panfrost_mmu.c
+++ b/drivers/gpu/drm/panfrost/panfrost_mmu.c
@@ -1,4 +1,4 @@
-// SPDX-License-Identifier:	GPL-2.0
+// SPDX-License-Identifier: GPL-2.0
 /* Copyright 2019 Linaro, Ltd, Rob Herring <robh@kernel.org> */
 
 #include <drm/panfrost_drm.h>
diff --git a/drivers/gpu/drm/panfrost/panfrost_regs.h b/drivers/gpu/drm/panfrost/panfrost_regs.h
index 6c5a11ef1ee87..efe4b75149d35 100644
--- a/drivers/gpu/drm/panfrost/panfrost_regs.h
+++ b/drivers/gpu/drm/panfrost/panfrost_regs.h
@@ -292,7 +292,7 @@
 #define AS_FAULTADDRESS_LO(as)		(MMU_AS(as) + 0x20) /* (RO) Fault Address for address space n, low word */
 #define AS_FAULTADDRESS_HI(as)		(MMU_AS(as) + 0x24) /* (RO) Fault Address for address space n, high word */
 #define AS_STATUS(as)			(MMU_AS(as) + 0x28) /* (RO) Status flags for address space n */
-/* Additional Bifrost AS regsiters */
+/* Additional Bifrost AS registers */
 #define AS_TRANSCFG_LO(as)		(MMU_AS(as) + 0x30) /* (RW) Translation table configuration for address space n, low word */
 #define AS_TRANSCFG_HI(as)		(MMU_AS(as) + 0x34) /* (RW) Translation table configuration for address space n, high word */
 #define AS_FAULTEXTRA_LO(as)		(MMU_AS(as) + 0x38) /* (RO) Secondary fault address for address space n, low word */
-- 
2.26.3


^ permalink raw reply related	[relevance 85%]

* Re: [PATCH] drm/panfrost: cleanup comments
  @ 2022-03-02 12:18 99%   ` Tom Rix
  0 siblings, 0 replies; 180+ results
From: Tom Rix @ 2022-03-02 12:18 UTC (permalink / raw)
  To: Steven Price, robh, tomeu.vizoso, alyssa.rosenzweig, airlied, daniel
  Cc: linux-kernel, dri-devel


On 3/2/22 1:09 AM, Steven Price wrote:
> On 01/03/2022 12:43, trix@redhat.com wrote:
>> From: Tom Rix <trix@redhat.com>
>>
>> For spdx
>> change tab to space delimiter
>> Use // for *.c
>>
>> Replacements
>> commited to committed, use multiline comment style
>> regsiters to registers
>> initialze to initialize
>>
>> Signed-off-by: Tom Rix <trix@redhat.com>
> Thanks, most of the changes look reasonable (although I've never
> understood the reason for using // for SPDX comments), but there's one
> below that I think needs rethinking.
>
>> ---
>>   drivers/gpu/drm/panfrost/panfrost_drv.c          | 2 +-
>>   drivers/gpu/drm/panfrost/panfrost_gem_shrinker.c | 2 +-
>>   drivers/gpu/drm/panfrost/panfrost_issues.h       | 6 ++++--
>>   drivers/gpu/drm/panfrost/panfrost_mmu.c          | 2 +-
>>   drivers/gpu/drm/panfrost/panfrost_regs.h         | 2 +-
>>   5 files changed, 8 insertions(+), 6 deletions(-)
>>
>> diff --git a/drivers/gpu/drm/panfrost/panfrost_drv.c b/drivers/gpu/drm/panfrost/panfrost_drv.c
>> index 96bb5a4656278..94b6f0a19c83a 100644
>> --- a/drivers/gpu/drm/panfrost/panfrost_drv.c
>> +++ b/drivers/gpu/drm/panfrost/panfrost_drv.c
>> @@ -562,7 +562,7 @@ static int panfrost_probe(struct platform_device *pdev)
>>   
>>   	pfdev->coherent = device_get_dma_attr(&pdev->dev) == DEV_DMA_COHERENT;
>>   
>> -	/* Allocate and initialze the DRM device. */
>> +	/* Allocate and initialize the DRM device. */
>>   	ddev = drm_dev_alloc(&panfrost_drm_driver, &pdev->dev);
>>   	if (IS_ERR(ddev))
>>   		return PTR_ERR(ddev);
>> diff --git a/drivers/gpu/drm/panfrost/panfrost_gem_shrinker.c b/drivers/gpu/drm/panfrost/panfrost_gem_shrinker.c
>> index b0142341e2235..77e7cb6d1ae3b 100644
>> --- a/drivers/gpu/drm/panfrost/panfrost_gem_shrinker.c
>> +++ b/drivers/gpu/drm/panfrost/panfrost_gem_shrinker.c
>> @@ -1,4 +1,4 @@
>> -/* SPDX-License-Identifier: GPL-2.0 */
>> +// SPDX-License-Identifier: GPL-2.0
>>   /* Copyright (C) 2019 Arm Ltd.
>>    *
>>    * Based on msm_gem_freedreno.c:
>> diff --git a/drivers/gpu/drm/panfrost/panfrost_issues.h b/drivers/gpu/drm/panfrost/panfrost_issues.h
>> index 8e59d765bf19f..4e7cf979ee67a 100644
>> --- a/drivers/gpu/drm/panfrost/panfrost_issues.h
>> +++ b/drivers/gpu/drm/panfrost/panfrost_issues.h
>> @@ -13,8 +13,10 @@
>>    * to care about.
>>    */
>>   enum panfrost_hw_issue {
>> -	/* Need way to guarantee that all previously-translated memory accesses
>> -	 * are commited */
>> +	/*
>> +	 * Need way to guarantee that all previously-translated memory accesses
>> +	 * are committed
>> +	 */
> This file has a whole load of multiline comments that don't technically
> follow the coding style. Fixing just one comment makes the file
> inconsistent. Note we recently had a discussion about this[1] and
> decided to leave the comment style as is. And I have to admit in this
> instance avoiding the extra mostly-blank lines makes the list easier to
> read. The typo fix is obviously welcomed though!

I'll switch this back in a respin.

Thanks

Tom


>
> [1] https://lore.kernel.org/r/c7331489-ad04-0f35-224e-164f144fb819%40arm.com
>
>>   	HW_ISSUE_6367,
>>   
>>   	/* On job complete with non-done the cache is not flushed */
>> diff --git a/drivers/gpu/drm/panfrost/panfrost_mmu.c b/drivers/gpu/drm/panfrost/panfrost_mmu.c
>> index 39562f2d11a47..d3f82b26a631d 100644
>> --- a/drivers/gpu/drm/panfrost/panfrost_mmu.c
>> +++ b/drivers/gpu/drm/panfrost/panfrost_mmu.c
>> @@ -1,4 +1,4 @@
>> -// SPDX-License-Identifier:	GPL-2.0
>> +// SPDX-License-Identifier: GPL-2.0
>>   /* Copyright 2019 Linaro, Ltd, Rob Herring <robh@kernel.org> */
>>   
>>   #include <drm/panfrost_drm.h>
>> diff --git a/drivers/gpu/drm/panfrost/panfrost_regs.h b/drivers/gpu/drm/panfrost/panfrost_regs.h
>> index 6c5a11ef1ee87..efe4b75149d35 100644
>> --- a/drivers/gpu/drm/panfrost/panfrost_regs.h
>> +++ b/drivers/gpu/drm/panfrost/panfrost_regs.h
>> @@ -292,7 +292,7 @@
>>   #define AS_FAULTADDRESS_LO(as)		(MMU_AS(as) + 0x20) /* (RO) Fault Address for address space n, low word */
>>   #define AS_FAULTADDRESS_HI(as)		(MMU_AS(as) + 0x24) /* (RO) Fault Address for address space n, high word */
>>   #define AS_STATUS(as)			(MMU_AS(as) + 0x28) /* (RO) Status flags for address space n */
>> -/* Additional Bifrost AS regsiters */
>> +/* Additional Bifrost AS registers */
>>   #define AS_TRANSCFG_LO(as)		(MMU_AS(as) + 0x30) /* (RW) Translation table configuration for address space n, low word */
>>   #define AS_TRANSCFG_HI(as)		(MMU_AS(as) + 0x34) /* (RW) Translation table configuration for address space n, high word */
>>   #define AS_FAULTEXTRA_LO(as)		(MMU_AS(as) + 0x38) /* (RO) Secondary fault address for address space n, low word */


^ permalink raw reply	[relevance 99%]

* [PATCH] vgaarbiter: fix vgaarbiter doc build break
@ 2022-03-01 19:29 99% trix
  0 siblings, 0 replies; 180+ results
From: trix @ 2022-03-01 19:29 UTC (permalink / raw)
  To: maarten.lankhorst, mripard, tzimmermann, airlied, daniel, corbet,
	bhelgaas
  Cc: Tom Rix, linux-kernel, dri-devel, linux-doc

From: Tom Rix <trix@redhat.com>

make htmldocs fails with
Error: Cannot open file ./drivers/gpu/vga/vgaarb.c

The location of the file changed
drivers/gpu/vga/vgaarb.c -> drivers/pci/vgaarb.c
So update the docs with the new location.

Fixes: d6e1898bfa5b ("PCI/VGA: Move vgaarb to drivers/pci")
Signed-off-by: Tom Rix <trix@redhat.com>
---
 Documentation/gpu/vgaarbiter.rst | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/Documentation/gpu/vgaarbiter.rst b/Documentation/gpu/vgaarbiter.rst
index 339ed5fecd2e4..bde3c0afb0590 100644
--- a/Documentation/gpu/vgaarbiter.rst
+++ b/Documentation/gpu/vgaarbiter.rst
@@ -100,7 +100,7 @@ In-kernel interface
 .. kernel-doc:: include/linux/vgaarb.h
    :internal:
 
-.. kernel-doc:: drivers/gpu/vga/vgaarb.c
+.. kernel-doc:: drivers/pci/vgaarb.c
    :export:
 
 libpciaccess
-- 
2.26.3


^ permalink raw reply related	[relevance 99%]

* [PATCH] drm/panfrost: cleanup comments
@ 2022-03-01 12:43 85% trix
    0 siblings, 1 reply; 180+ results
From: trix @ 2022-03-01 12:43 UTC (permalink / raw)
  To: robh, tomeu.vizoso, steven.price, alyssa.rosenzweig, airlied, daniel
  Cc: Tom Rix, linux-kernel, dri-devel

From: Tom Rix <trix@redhat.com>

For spdx
change tab to space delimiter
Use // for *.c

Replacements
commited to committed, use multiline comment style
regsiters to registers
initialze to initialize

Signed-off-by: Tom Rix <trix@redhat.com>
---
 drivers/gpu/drm/panfrost/panfrost_drv.c          | 2 +-
 drivers/gpu/drm/panfrost/panfrost_gem_shrinker.c | 2 +-
 drivers/gpu/drm/panfrost/panfrost_issues.h       | 6 ++++--
 drivers/gpu/drm/panfrost/panfrost_mmu.c          | 2 +-
 drivers/gpu/drm/panfrost/panfrost_regs.h         | 2 +-
 5 files changed, 8 insertions(+), 6 deletions(-)

diff --git a/drivers/gpu/drm/panfrost/panfrost_drv.c b/drivers/gpu/drm/panfrost/panfrost_drv.c
index 96bb5a4656278..94b6f0a19c83a 100644
--- a/drivers/gpu/drm/panfrost/panfrost_drv.c
+++ b/drivers/gpu/drm/panfrost/panfrost_drv.c
@@ -562,7 +562,7 @@ static int panfrost_probe(struct platform_device *pdev)
 
 	pfdev->coherent = device_get_dma_attr(&pdev->dev) == DEV_DMA_COHERENT;
 
-	/* Allocate and initialze the DRM device. */
+	/* Allocate and initialize the DRM device. */
 	ddev = drm_dev_alloc(&panfrost_drm_driver, &pdev->dev);
 	if (IS_ERR(ddev))
 		return PTR_ERR(ddev);
diff --git a/drivers/gpu/drm/panfrost/panfrost_gem_shrinker.c b/drivers/gpu/drm/panfrost/panfrost_gem_shrinker.c
index b0142341e2235..77e7cb6d1ae3b 100644
--- a/drivers/gpu/drm/panfrost/panfrost_gem_shrinker.c
+++ b/drivers/gpu/drm/panfrost/panfrost_gem_shrinker.c
@@ -1,4 +1,4 @@
-/* SPDX-License-Identifier: GPL-2.0 */
+// SPDX-License-Identifier: GPL-2.0
 /* Copyright (C) 2019 Arm Ltd.
  *
  * Based on msm_gem_freedreno.c:
diff --git a/drivers/gpu/drm/panfrost/panfrost_issues.h b/drivers/gpu/drm/panfrost/panfrost_issues.h
index 8e59d765bf19f..4e7cf979ee67a 100644
--- a/drivers/gpu/drm/panfrost/panfrost_issues.h
+++ b/drivers/gpu/drm/panfrost/panfrost_issues.h
@@ -13,8 +13,10 @@
  * to care about.
  */
 enum panfrost_hw_issue {
-	/* Need way to guarantee that all previously-translated memory accesses
-	 * are commited */
+	/*
+	 * Need way to guarantee that all previously-translated memory accesses
+	 * are committed
+	 */
 	HW_ISSUE_6367,
 
 	/* On job complete with non-done the cache is not flushed */
diff --git a/drivers/gpu/drm/panfrost/panfrost_mmu.c b/drivers/gpu/drm/panfrost/panfrost_mmu.c
index 39562f2d11a47..d3f82b26a631d 100644
--- a/drivers/gpu/drm/panfrost/panfrost_mmu.c
+++ b/drivers/gpu/drm/panfrost/panfrost_mmu.c
@@ -1,4 +1,4 @@
-// SPDX-License-Identifier:	GPL-2.0
+// SPDX-License-Identifier: GPL-2.0
 /* Copyright 2019 Linaro, Ltd, Rob Herring <robh@kernel.org> */
 
 #include <drm/panfrost_drm.h>
diff --git a/drivers/gpu/drm/panfrost/panfrost_regs.h b/drivers/gpu/drm/panfrost/panfrost_regs.h
index 6c5a11ef1ee87..efe4b75149d35 100644
--- a/drivers/gpu/drm/panfrost/panfrost_regs.h
+++ b/drivers/gpu/drm/panfrost/panfrost_regs.h
@@ -292,7 +292,7 @@
 #define AS_FAULTADDRESS_LO(as)		(MMU_AS(as) + 0x20) /* (RO) Fault Address for address space n, low word */
 #define AS_FAULTADDRESS_HI(as)		(MMU_AS(as) + 0x24) /* (RO) Fault Address for address space n, high word */
 #define AS_STATUS(as)			(MMU_AS(as) + 0x28) /* (RO) Status flags for address space n */
-/* Additional Bifrost AS regsiters */
+/* Additional Bifrost AS registers */
 #define AS_TRANSCFG_LO(as)		(MMU_AS(as) + 0x30) /* (RW) Translation table configuration for address space n, low word */
 #define AS_TRANSCFG_HI(as)		(MMU_AS(as) + 0x34) /* (RW) Translation table configuration for address space n, high word */
 #define AS_FAULTEXTRA_LO(as)		(MMU_AS(as) + 0x38) /* (RO) Secondary fault address for address space n, low word */
-- 
2.26.3


^ permalink raw reply related	[relevance 85%]

* [PATCH v2] drm/amdgpu: Fix realloc of ptr
@ 2022-02-27 15:33 95% trix
  0 siblings, 0 replies; 180+ results
From: trix @ 2022-02-27 15:33 UTC (permalink / raw)
  To: alexander.deucher, christian.koenig, Xinhui.Pan, airlied, daniel,
	nathan, ndesaulniers, lijo.lazar, nirmoy.das, kevin1.wang,
	tom.stdenis, evan.quan, Amaranath.Somalapuram
  Cc: Tom Rix, llvm, dri-devel, amd-gfx, linux-kernel

From: Tom Rix <trix@redhat.com>

Clang static analysis reports this error
amdgpu_debugfs.c:1690:9: warning: 1st function call
  argument is an uninitialized value
  tmp = krealloc_array(tmp, i + 1,
        ^~~~~~~~~~~~~~~~~~~~~~~~~~~

realloc uses tmp, so tmp can not be garbage.
And the return needs to be checked.

Fixes: 5ce5a584cb82 ("drm/amdgpu: add debugfs for reset registers list")
Signed-off-by: Tom Rix <trix@redhat.com>
---
v2:
  use 'new' to hold/check the ralloc return
  fix commit log mistake on ralloc freeing to using input ptr
  
 drivers/gpu/drm/amd/amdgpu/amdgpu_debugfs.c | 9 +++++++--
 1 file changed, 7 insertions(+), 2 deletions(-)

diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_debugfs.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_debugfs.c
index 9eb9b440bd438..2f4f8c5618d81 100644
--- a/drivers/gpu/drm/amd/amdgpu/amdgpu_debugfs.c
+++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_debugfs.c
@@ -1676,7 +1676,7 @@ static ssize_t amdgpu_reset_dump_register_list_write(struct file *f,
 {
 	struct amdgpu_device *adev = (struct amdgpu_device *)file_inode(f)->i_private;
 	char reg_offset[11];
-	uint32_t *tmp;
+	uint32_t *new, *tmp = NULL;
 	int ret, i = 0, len = 0;
 
 	do {
@@ -1687,7 +1687,12 @@ static ssize_t amdgpu_reset_dump_register_list_write(struct file *f,
 			goto error_free;
 		}
 
-		tmp = krealloc_array(tmp, i + 1, sizeof(uint32_t), GFP_KERNEL);
+		new = krealloc_array(tmp, i + 1, sizeof(uint32_t), GFP_KERNEL);
+		if (!new) {
+			ret = -ENOMEM;
+			goto error_free;
+		}
+		tmp = new;
 		if (sscanf(reg_offset, "%X %n", &tmp[i], &ret) != 1) {
 			ret = -EINVAL;
 			goto error_free;
-- 
2.26.3


^ permalink raw reply related	[relevance 95%]

* Re: [PATCH] drm/amdgpu: Fix realloc of ptr
  @ 2022-02-27 14:36 99%   ` Tom Rix
  0 siblings, 0 replies; 180+ results
From: Tom Rix @ 2022-02-27 14:36 UTC (permalink / raw)
  To: David Laight, alexander.deucher, christian.koenig, Xinhui.Pan,
	airlied, daniel, nathan, ndesaulniers, nirmoy.das, lijo.lazar,
	tom.stdenis, evan.quan, kevin1.wang, Amaranath.Somalapuram
  Cc: llvm, dri-devel, amd-gfx, linux-kernel


On 2/26/22 2:21 PM, David Laight wrote:
> From: trix@redhat.com
>> Sent: 26 February 2022 15:59
>>
>> From: Tom Rix <trix@redhat.com>
>>
>> Clang static analysis reports this error
>> amdgpu_debugfs.c:1690:9: warning: 1st function call
>>    argument is an uninitialized value
>>    tmp = krealloc_array(tmp, i + 1,
>>          ^~~~~~~~~~~~~~~~~~~~~~~~~~~
>>
>> realloc will free tmp, so tmp can not be garbage.
>> And the return needs to be checked.
> Are you sure?
> A quick check seems to show that krealloc() behaves the same
> way as libc realloc() and the pointer isn't freed on failure.

I suck, I'll respin the patch

Thanks

Tom

>
> 	David
>
>> Fixes: 5ce5a584cb82 ("drm/amdgpu: add debugfs for reset registers list")
>> Signed-off-by: Tom Rix <trix@redhat.com>
>> ---
>>   drivers/gpu/drm/amd/amdgpu/amdgpu_debugfs.c | 6 +++++-
>>   1 file changed, 5 insertions(+), 1 deletion(-)
>>
>> diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_debugfs.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_debugfs.c
>> index 9eb9b440bd438..159b97c0b4ebc 100644
>> --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_debugfs.c
>> +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_debugfs.c
>> @@ -1676,7 +1676,7 @@ static ssize_t amdgpu_reset_dump_register_list_write(struct file *f,
>>   {
>>   	struct amdgpu_device *adev = (struct amdgpu_device *)file_inode(f)->i_private;
>>   	char reg_offset[11];
>> -	uint32_t *tmp;
>> +	uint32_t *tmp = NULL;
>>   	int ret, i = 0, len = 0;
>>
>>   	do {
>> @@ -1688,6 +1688,10 @@ static ssize_t amdgpu_reset_dump_register_list_write(struct file *f,
>>   		}
>>
>>   		tmp = krealloc_array(tmp, i + 1, sizeof(uint32_t), GFP_KERNEL);
>> +		if (!tmp) {
>> +			ret = -ENOMEM;
>> +			goto error_free;
>> +		}
>>   		if (sscanf(reg_offset, "%X %n", &tmp[i], &ret) != 1) {
>>   			ret = -EINVAL;
>>   			goto error_free;
>> --
>> 2.26.3
> -
> Registered Address Lakeside, Bramley Road, Mount Farm, Milton Keynes, MK1 1PT, UK
> Registration No: 1397386 (Wales)
>


^ permalink raw reply	[relevance 99%]

* [PATCH] drm/amdgpu: Fix realloc of ptr
@ 2022-02-26 15:58 97% trix
    0 siblings, 1 reply; 180+ results
From: trix @ 2022-02-26 15:58 UTC (permalink / raw)
  To: alexander.deucher, christian.koenig, Xinhui.Pan, airlied, daniel,
	nathan, ndesaulniers, nirmoy.das, lijo.lazar, tom.stdenis,
	evan.quan, kevin1.wang, Amaranath.Somalapuram
  Cc: Tom Rix, llvm, dri-devel, amd-gfx, linux-kernel

From: Tom Rix <trix@redhat.com>

Clang static analysis reports this error
amdgpu_debugfs.c:1690:9: warning: 1st function call
  argument is an uninitialized value
  tmp = krealloc_array(tmp, i + 1,
        ^~~~~~~~~~~~~~~~~~~~~~~~~~~

realloc will free tmp, so tmp can not be garbage.
And the return needs to be checked.

Fixes: 5ce5a584cb82 ("drm/amdgpu: add debugfs for reset registers list")
Signed-off-by: Tom Rix <trix@redhat.com>
---
 drivers/gpu/drm/amd/amdgpu/amdgpu_debugfs.c | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)

diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_debugfs.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_debugfs.c
index 9eb9b440bd438..159b97c0b4ebc 100644
--- a/drivers/gpu/drm/amd/amdgpu/amdgpu_debugfs.c
+++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_debugfs.c
@@ -1676,7 +1676,7 @@ static ssize_t amdgpu_reset_dump_register_list_write(struct file *f,
 {
 	struct amdgpu_device *adev = (struct amdgpu_device *)file_inode(f)->i_private;
 	char reg_offset[11];
-	uint32_t *tmp;
+	uint32_t *tmp = NULL;
 	int ret, i = 0, len = 0;
 
 	do {
@@ -1688,6 +1688,10 @@ static ssize_t amdgpu_reset_dump_register_list_write(struct file *f,
 		}
 
 		tmp = krealloc_array(tmp, i + 1, sizeof(uint32_t), GFP_KERNEL);
+		if (!tmp) {
+			ret = -ENOMEM;
+			goto error_free;
+		}
 		if (sscanf(reg_offset, "%X %n", &tmp[i], &ret) != 1) {
 			ret = -EINVAL;
 			goto error_free;
-- 
2.26.3


^ permalink raw reply related	[relevance 97%]

* Re: [PATCH] drm/amdgpu: fix printk format for size_t variable
  @ 2022-02-21 21:02 99%       ` Tom Rix
  0 siblings, 0 replies; 180+ results
From: Tom Rix @ 2022-02-21 21:02 UTC (permalink / raw)
  To: Luben Tuikov, alexander.deucher, christian.koenig, Xinhui.Pan,
	airlied, daniel, guchun.chen, Prike.Liang, Hawking.Zhang
  Cc: Nick Desaulniers, amd-gfx, dri-devel, linux-kernel


On 2/21/22 12:53 PM, Luben Tuikov wrote:
> On 2022-02-21 15:36, Tom Rix wrote:
>> On 2/21/22 11:57 AM, Luben Tuikov wrote:
>>> Hi Tom,
>>>
>>> This was already fixed with this patch, and LKML was CC-ed. See the CC tags in the patch below,
>>>
>>> commit 4f7d7cda90cbd7
>>> Author: Luben Tuikov <luben.tuikov@amd.com>
>>> Date:   Wed Feb 16 16:47:32 2022 -0500
>>>
>>>       drm/amdgpu: Fix ARM compilation warning
>>>       
>>>       Fix this ARM warning:
>> I glad it wasn't just mips ;)
>>
>> There have been a couple of build breaks with amdgpu recently.
>>
>> Nick asked about adding clang to your ci.
>>
>> Could at least one non x86_64 gcc also be added, maybe aarch64 ?
> Yeah, that's a great idea. I tried the make.cross (for ARM) as per
> the initial breakage report, but when I tried it, it got into a loop of
> "make ARCH=arm mrproper" --> "make prepare" --> "make ARCH=arm mrproper" --> "make prepare" --> ...
> and I couldn't figure out why.
Maybe need to set CROSS_COMPILE ?
> I don't mind adding ARM cross compilation into my local setup.

For crosses, I generate a 'make' script like

#!/bin/sh

export PATH=<path-to-cross-tools>/bin:$PATH

make ARCH=arm64 CROSS_COMPILE=aarch64-elf- $@

so workflow looks like normal, replacing make with ./make

Tom

>
> Regards,
> Luben
>
>
>> Tom
>>
>>>       
>>>       drivers/gpu/drm/amd/amdgpu/amdgpu_discovery.c:664:35: warning: format '%ld'
>>>       expects argument of type 'long int', but argument 4 has type 'size_t' {aka
>>>       'unsigned int'} [-Wformat=]
>>>       
>>>       Cc: Alex Deucher <Alexander.Deucher@amd.com>
>>>       Cc: kbuild-all@lists.01.org
>>>       Cc: linux-kernel@vger.kernel.org
>>>       Reported-by: kernel test robot <lkp@intel.com>
>>>       Fixes: 7e60fbfbdc10a0 ("drm/amdgpu: Show IP discovery in sysfs")
>>>       Signed-off-by: Luben Tuikov <luben.tuikov@amd.com>
>>>       Acked-by: Alex Deucher <Alexander.Deucher@amd.com>
>>>
>>> diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_discovery.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_discovery.c
>>> index 2506bcf36c870c..6c7ec058125e1d 100644
>>> --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_discovery.c
>>> +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_discovery.c
>>> @@ -668,7 +668,7 @@ static int amdgpu_discovery_sysfs_ips(struct amdgpu_device *adev,
>>>                               le16_to_cpu(ip->hw_id) != ii)
>>>                                   goto next_ip;
>>>    
>>> -                       DRM_DEBUG("match:%d @ ip_offset:%ld", ii, ip_offset);
>>> +                       DRM_DEBUG("match:%d @ ip_offset:%zu", ii, ip_offset);
>>>    
>>>                           /* We have a hw_id match; register the hw
>>>                            * block if not yet registered.
>>>
>>> Regards,
>>> Luben
>>>
>>> On 2022-02-21 12:37, trix@redhat.com wrote:
>>>> From: Tom Rix <trix@redhat.com>
>>>>
>>>> On mips64 allyesconfig, there is this build break
>>>> amdgpu_discovery.c:671:35: error: format '%ld' expects
>>>>     argument of type 'long int', but argument 4 has
>>>>     type 'size_t' {aka 'unsigned int'}
>>>>     DRM_DEBUG("match:%d @ ip_offset:%ld", ii, ip_offset);
>>>>
>>>> For size_t, use %zu.
>>>>
>>>> Fixes: a6c40b178092 ("drm/amdgpu: Show IP discovery in sysfs")
>>>> Signed-off-by: Tom Rix <trix@redhat.com>
>>>> ---
>>>>    drivers/gpu/drm/amd/amdgpu/amdgpu_discovery.c | 2 +-
>>>>    1 file changed, 1 insertion(+), 1 deletion(-)
>>>>
>>>> diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_discovery.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_discovery.c
>>>> index 7c7e28fd912e..58238f67b1d3 100644
>>>> --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_discovery.c
>>>> +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_discovery.c
>>>> @@ -668,7 +668,7 @@ static int amdgpu_discovery_sysfs_ips(struct amdgpu_device *adev,
>>>>    			    le16_to_cpu(ip->hw_id) != ii)
>>>>    				goto next_ip;
>>>>    
>>>> -			DRM_DEBUG("match:%d @ ip_offset:%ld", ii, ip_offset);
>>>> +			DRM_DEBUG("match:%d @ ip_offset:%zu", ii, ip_offset);
>>>>    
>>>>    			/* We have a hw_id match; register the hw
>>>>    			 * block if not yet registered.
>>> Regards,
> Regards,


^ permalink raw reply	[relevance 99%]

* Re: [PATCH] drm/amdgpu: fix printk format for size_t variable
  @ 2022-02-21 20:36 99%   ` Tom Rix
    0 siblings, 1 reply; 180+ results
From: Tom Rix @ 2022-02-21 20:36 UTC (permalink / raw)
  To: Luben Tuikov, alexander.deucher, christian.koenig, Xinhui.Pan,
	airlied, daniel, guchun.chen, Prike.Liang, Hawking.Zhang
  Cc: Nick Desaulniers, amd-gfx, dri-devel, linux-kernel


On 2/21/22 11:57 AM, Luben Tuikov wrote:
> Hi Tom,
>
> This was already fixed with this patch, and LKML was CC-ed. See the CC tags in the patch below,
>
> commit 4f7d7cda90cbd7
> Author: Luben Tuikov <luben.tuikov@amd.com>
> Date:   Wed Feb 16 16:47:32 2022 -0500
>
>      drm/amdgpu: Fix ARM compilation warning
>      
>      Fix this ARM warning:

I glad it wasn't just mips ;)

There have been a couple of build breaks with amdgpu recently.

Nick asked about adding clang to your ci.

Could at least one non x86_64 gcc also be added, maybe aarch64 ?

Tom

>      
>      drivers/gpu/drm/amd/amdgpu/amdgpu_discovery.c:664:35: warning: format '%ld'
>      expects argument of type 'long int', but argument 4 has type 'size_t' {aka
>      'unsigned int'} [-Wformat=]
>      
>      Cc: Alex Deucher <Alexander.Deucher@amd.com>
>      Cc: kbuild-all@lists.01.org
>      Cc: linux-kernel@vger.kernel.org
>      Reported-by: kernel test robot <lkp@intel.com>
>      Fixes: 7e60fbfbdc10a0 ("drm/amdgpu: Show IP discovery in sysfs")
>      Signed-off-by: Luben Tuikov <luben.tuikov@amd.com>
>      Acked-by: Alex Deucher <Alexander.Deucher@amd.com>
>
> diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_discovery.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_discovery.c
> index 2506bcf36c870c..6c7ec058125e1d 100644
> --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_discovery.c
> +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_discovery.c
> @@ -668,7 +668,7 @@ static int amdgpu_discovery_sysfs_ips(struct amdgpu_device *adev,
>                              le16_to_cpu(ip->hw_id) != ii)
>                                  goto next_ip;
>   
> -                       DRM_DEBUG("match:%d @ ip_offset:%ld", ii, ip_offset);
> +                       DRM_DEBUG("match:%d @ ip_offset:%zu", ii, ip_offset);
>   
>                          /* We have a hw_id match; register the hw
>                           * block if not yet registered.
>
> Regards,
> Luben
>
> On 2022-02-21 12:37, trix@redhat.com wrote:
>> From: Tom Rix <trix@redhat.com>
>>
>> On mips64 allyesconfig, there is this build break
>> amdgpu_discovery.c:671:35: error: format '%ld' expects
>>    argument of type 'long int', but argument 4 has
>>    type 'size_t' {aka 'unsigned int'}
>>    DRM_DEBUG("match:%d @ ip_offset:%ld", ii, ip_offset);
>>
>> For size_t, use %zu.
>>
>> Fixes: a6c40b178092 ("drm/amdgpu: Show IP discovery in sysfs")
>> Signed-off-by: Tom Rix <trix@redhat.com>
>> ---
>>   drivers/gpu/drm/amd/amdgpu/amdgpu_discovery.c | 2 +-
>>   1 file changed, 1 insertion(+), 1 deletion(-)
>>
>> diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_discovery.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_discovery.c
>> index 7c7e28fd912e..58238f67b1d3 100644
>> --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_discovery.c
>> +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_discovery.c
>> @@ -668,7 +668,7 @@ static int amdgpu_discovery_sysfs_ips(struct amdgpu_device *adev,
>>   			    le16_to_cpu(ip->hw_id) != ii)
>>   				goto next_ip;
>>   
>> -			DRM_DEBUG("match:%d @ ip_offset:%ld", ii, ip_offset);
>> +			DRM_DEBUG("match:%d @ ip_offset:%zu", ii, ip_offset);
>>   
>>   			/* We have a hw_id match; register the hw
>>   			 * block if not yet registered.
> Regards,


^ permalink raw reply	[relevance 99%]

* [PATCH] drm/amdgpu: fix printk format for size_t variable
@ 2022-02-21 17:37 99% trix
    0 siblings, 1 reply; 180+ results
From: trix @ 2022-02-21 17:37 UTC (permalink / raw)
  To: alexander.deucher, christian.koenig, Xinhui.Pan, airlied, daniel,
	guchun.chen, Prike.Liang, Hawking.Zhang, luben.tuikov
  Cc: Tom Rix, dri-devel, amd-gfx, linux-kernel

From: Tom Rix <trix@redhat.com>

On mips64 allyesconfig, there is this build break
amdgpu_discovery.c:671:35: error: format '%ld' expects
  argument of type 'long int', but argument 4 has
  type 'size_t' {aka 'unsigned int'}
  DRM_DEBUG("match:%d @ ip_offset:%ld", ii, ip_offset);

For size_t, use %zu.

Fixes: a6c40b178092 ("drm/amdgpu: Show IP discovery in sysfs")
Signed-off-by: Tom Rix <trix@redhat.com>
---
 drivers/gpu/drm/amd/amdgpu/amdgpu_discovery.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_discovery.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_discovery.c
index 7c7e28fd912e..58238f67b1d3 100644
--- a/drivers/gpu/drm/amd/amdgpu/amdgpu_discovery.c
+++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_discovery.c
@@ -668,7 +668,7 @@ static int amdgpu_discovery_sysfs_ips(struct amdgpu_device *adev,
 			    le16_to_cpu(ip->hw_id) != ii)
 				goto next_ip;
 
-			DRM_DEBUG("match:%d @ ip_offset:%ld", ii, ip_offset);
+			DRM_DEBUG("match:%d @ ip_offset:%zu", ii, ip_offset);
 
 			/* We have a hw_id match; register the hw
 			 * block if not yet registered.
-- 
2.26.3


^ permalink raw reply related	[relevance 99%]

* Re: [PATCH] drm/amdkfd: rework criu_restore_bos error handling
  @ 2022-02-19  2:34 99%   ` Tom Rix
  0 siblings, 0 replies; 180+ results
From: Tom Rix @ 2022-02-19  2:34 UTC (permalink / raw)
  To: Felix Kuehling, alexander.deucher, christian.koenig, Xinhui.Pan,
	airlied, daniel, nathan, ndesaulniers, david.yatsin,
	rajneesh.bhardwaj
  Cc: llvm, dri-devel, amd-gfx, linux-kernel


On 2/18/22 10:35 AM, Felix Kuehling wrote:
> Am 2022-02-18 um 12:39 schrieb trix@redhat.com:
>> From: Tom Rix <trix@redhat.com>
>>
>> Clang static analysis reports this problem
>> kfd_chardev.c:2327:2: warning: 1st function call argument
>>    is an uninitialized value
>>    kvfree(bo_privs);
>>    ^~~~~~~~~~~~~~~~
>>
>> If the copy_from_users(bo_buckets, ...) fails, there is a jump to
>> the generic error handler at exit:.  The freeing of bo_privs and
>> unwinding of the dmabuf_fd loop do not need to be done.
>>
>> Add some specific labels for the early failures.
>> Reorder the frees to be the reverse of their allocs.
>>
>> Move the initialize of 'i' back to the loop.
>> The problem with the early frees predates the loop
>> unwinding problem.
>
> I think the existing error handling strategy in this function is fine. 
> Having only one exit label avoids potential issues when using the 
> wrong label. Freeing NULL pointers is not a problem. The loop becomes 
> a noop if i==0 (this was fixed by you in a previous patch). The only 
> real problem I see is that bo_privs is not initialized. So this should 
> really be a one-line or maybe two-line fix:
>
>     struct kfd_criu_bo_bucket *bo_buckets = NULL;
>     struct kfd_criu_bo_priv_data *bo_privs = NULL;

This is the other way I considered to fix the problem. So it will work.

Tom

>
> Regards,
>   Felix
>
>
>>
>> Fixes: 73fa13b6a511 ("drm/amdkfd: CRIU Implement KFD restore ioctl")
>> Signed-off-by: Tom Rix <trix@redhat.com>
>> ---
>>   drivers/gpu/drm/amd/amdkfd/kfd_chardev.c | 15 +++++++++------
>>   1 file changed, 9 insertions(+), 6 deletions(-)
>>
>> diff --git a/drivers/gpu/drm/amd/amdkfd/kfd_chardev.c 
>> b/drivers/gpu/drm/amd/amdkfd/kfd_chardev.c
>> index 965af2a08bc0..1d5f41ac3832 100644
>> --- a/drivers/gpu/drm/amd/amdkfd/kfd_chardev.c
>> +++ b/drivers/gpu/drm/amd/amdkfd/kfd_chardev.c
>> @@ -2102,7 +2102,7 @@ static int criu_restore_bos(struct kfd_process *p,
>>       const bool criu_resume = true;
>>       bool flush_tlbs = false;
>>       int ret = 0, j = 0;
>> -    uint32_t i = 0;
>> +    uint32_t i;
>>         if (*priv_offset + (args->num_bos * sizeof(*bo_privs)) > 
>> max_priv_data_size)
>>           return -EINVAL;
>> @@ -2119,13 +2119,13 @@ static int criu_restore_bos(struct 
>> kfd_process *p,
>>       if (ret) {
>>           pr_err("Failed to copy BOs information from user\n");
>>           ret = -EFAULT;
>> -        goto exit;
>> +        goto free_buckets;
>>       }
>>         bo_privs = kvmalloc_array(args->num_bos, sizeof(*bo_privs), 
>> GFP_KERNEL);
>>       if (!bo_privs) {
>>           ret = -ENOMEM;
>> -        goto exit;
>> +        goto free_buckets;
>>       }
>>         ret = copy_from_user(bo_privs, (void __user *)args->priv_data 
>> + *priv_offset,
>> @@ -2133,12 +2133,12 @@ static int criu_restore_bos(struct 
>> kfd_process *p,
>>       if (ret) {
>>           pr_err("Failed to copy BOs information from user\n");
>>           ret = -EFAULT;
>> -        goto exit;
>> +        goto free_privs;
>>       }
>>       *priv_offset += args->num_bos * sizeof(*bo_privs);
>>         /* Create and map new BOs */
>> -    for (; i < args->num_bos; i++) {
>> +    for (i = 0; i < args->num_bos; i++) {
>>           struct kfd_criu_bo_bucket *bo_bucket;
>>           struct kfd_criu_bo_priv_data *bo_priv;
>>           struct kfd_dev *dev;
>> @@ -2323,8 +2323,11 @@ static int criu_restore_bos(struct kfd_process 
>> *p,
>>           if (bo_buckets[i].alloc_flags & KFD_IOC_ALLOC_MEM_FLAGS_VRAM)
>>               close_fd(bo_buckets[i].dmabuf_fd);
>>       }
>> -    kvfree(bo_buckets);
>> +free_privs:
>>       kvfree(bo_privs);
>> +free_buckets:
>> +    kvfree(bo_buckets);
>> +
>>       return ret;
>>   }
>


^ permalink raw reply	[relevance 99%]

* [PATCH] drm/amdkfd: rework criu_restore_bos error handling
@ 2022-02-18 17:39 89% trix
    0 siblings, 1 reply; 180+ results
From: trix @ 2022-02-18 17:39 UTC (permalink / raw)
  To: Felix.Kuehling, alexander.deucher, christian.koenig, Xinhui.Pan,
	airlied, daniel, nathan, ndesaulniers, david.yatsin,
	rajneesh.bhardwaj
  Cc: Tom Rix, llvm, dri-devel, amd-gfx, linux-kernel

From: Tom Rix <trix@redhat.com>

Clang static analysis reports this problem
kfd_chardev.c:2327:2: warning: 1st function call argument
  is an uninitialized value
  kvfree(bo_privs);
  ^~~~~~~~~~~~~~~~

If the copy_from_users(bo_buckets, ...) fails, there is a jump to
the generic error handler at exit:.  The freeing of bo_privs and
unwinding of the dmabuf_fd loop do not need to be done.

Add some specific labels for the early failures.
Reorder the frees to be the reverse of their allocs.

Move the initialize of 'i' back to the loop.
The problem with the early frees predates the loop
unwinding problem.

Fixes: 73fa13b6a511 ("drm/amdkfd: CRIU Implement KFD restore ioctl")
Signed-off-by: Tom Rix <trix@redhat.com>
---
 drivers/gpu/drm/amd/amdkfd/kfd_chardev.c | 15 +++++++++------
 1 file changed, 9 insertions(+), 6 deletions(-)

diff --git a/drivers/gpu/drm/amd/amdkfd/kfd_chardev.c b/drivers/gpu/drm/amd/amdkfd/kfd_chardev.c
index 965af2a08bc0..1d5f41ac3832 100644
--- a/drivers/gpu/drm/amd/amdkfd/kfd_chardev.c
+++ b/drivers/gpu/drm/amd/amdkfd/kfd_chardev.c
@@ -2102,7 +2102,7 @@ static int criu_restore_bos(struct kfd_process *p,
 	const bool criu_resume = true;
 	bool flush_tlbs = false;
 	int ret = 0, j = 0;
-	uint32_t i = 0;
+	uint32_t i;
 
 	if (*priv_offset + (args->num_bos * sizeof(*bo_privs)) > max_priv_data_size)
 		return -EINVAL;
@@ -2119,13 +2119,13 @@ static int criu_restore_bos(struct kfd_process *p,
 	if (ret) {
 		pr_err("Failed to copy BOs information from user\n");
 		ret = -EFAULT;
-		goto exit;
+		goto free_buckets;
 	}
 
 	bo_privs = kvmalloc_array(args->num_bos, sizeof(*bo_privs), GFP_KERNEL);
 	if (!bo_privs) {
 		ret = -ENOMEM;
-		goto exit;
+		goto free_buckets;
 	}
 
 	ret = copy_from_user(bo_privs, (void __user *)args->priv_data + *priv_offset,
@@ -2133,12 +2133,12 @@ static int criu_restore_bos(struct kfd_process *p,
 	if (ret) {
 		pr_err("Failed to copy BOs information from user\n");
 		ret = -EFAULT;
-		goto exit;
+		goto free_privs;
 	}
 	*priv_offset += args->num_bos * sizeof(*bo_privs);
 
 	/* Create and map new BOs */
-	for (; i < args->num_bos; i++) {
+	for (i = 0; i < args->num_bos; i++) {
 		struct kfd_criu_bo_bucket *bo_bucket;
 		struct kfd_criu_bo_priv_data *bo_priv;
 		struct kfd_dev *dev;
@@ -2323,8 +2323,11 @@ static int criu_restore_bos(struct kfd_process *p,
 		if (bo_buckets[i].alloc_flags & KFD_IOC_ALLOC_MEM_FLAGS_VRAM)
 			close_fd(bo_buckets[i].dmabuf_fd);
 	}
-	kvfree(bo_buckets);
+free_privs:
 	kvfree(bo_privs);
+free_buckets:
+	kvfree(bo_buckets);
+
 	return ret;
 }
 
-- 
2.26.3


^ permalink raw reply related	[relevance 89%]

* [PATCH] drm/amdkfd: fix typo in setting enum value
@ 2022-02-17 16:41 99% trix
  0 siblings, 0 replies; 180+ results
From: trix @ 2022-02-17 16:41 UTC (permalink / raw)
  To: Felix.Kuehling, alexander.deucher, christian.koenig, Xinhui.Pan,
	airlied, daniel, nathan, ndesaulniers, jonathan.kim
  Cc: Tom Rix, llvm, dri-devel, amd-gfx, linux-kernel

From: Tom Rix <trix@redhat.com>

Clang build fails with
kfd_packet_manager_v9.c:267:3: error: implicit conversion
  from enumeration type 'enum mes_map_queues_extended_engine_sel_enum'
  to different enumeration type
  'enum mes_unmap_queues_extended_engine_sel_enum'
   extended_engine_sel__mes_map_queues__sdma0_to_7_sel :
   ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

This looks like a typo, the function is _unmap_, the enum
extended_engine_sel__mes_map_queues__sdma0_to_7_sel  is _map_.
To match the packet->bitfields2.extended_engine_set type
it should be extended_engine_sel__mes_unmap_queues__sdma0_to_7_sel.

Fixes: 009e9a158505 ("drm/amdkfd: navi2x requires extended engines to map and unmap sdma queues")
Signed-off-by: Tom Rix <trix@redhat.com>
---
 drivers/gpu/drm/amd/amdkfd/kfd_packet_manager_v9.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/gpu/drm/amd/amdkfd/kfd_packet_manager_v9.c b/drivers/gpu/drm/amd/amdkfd/kfd_packet_manager_v9.c
index 806a03566a24..18250845a989 100644
--- a/drivers/gpu/drm/amd/amdkfd/kfd_packet_manager_v9.c
+++ b/drivers/gpu/drm/amd/amdkfd/kfd_packet_manager_v9.c
@@ -264,7 +264,7 @@ static int pm_unmap_queues_v9(struct packet_manager *pm, uint32_t *buffer,
 					sizeof(struct pm4_mes_unmap_queues));
 
 	packet->bitfields2.extended_engine_sel = pm_use_ext_eng(pm->dqm->dev) ?
-		extended_engine_sel__mes_map_queues__sdma0_to_7_sel :
+		extended_engine_sel__mes_unmap_queues__sdma0_to_7_sel :
 		extended_engine_sel__mes_unmap_queues__legacy_engine_sel;
 
 	packet->bitfields2.engine_sel =
-- 
2.26.3


^ permalink raw reply related	[relevance 99%]

* [PATCH] drm/amdgpu: fix amdgpu_ras_block_late_init error handler
@ 2022-02-17 15:38 89% trix
  0 siblings, 0 replies; 180+ results
From: trix @ 2022-02-17 15:38 UTC (permalink / raw)
  To: alexander.deucher, christian.koenig, Xinhui.Pan, airlied, daniel,
	nathan, ndesaulniers, Hawking.Zhang, john.clements, tao.zhou1,
	YiPeng.Chai, luben.tuikov, Stanley.Yang, Dennis.Li, mukul.joshi,
	nirmoy.das
  Cc: Tom Rix, llvm, dri-devel, amd-gfx, linux-kernel

From: Tom Rix <trix@redhat.com>

Clang build fails with
amdgpu_ras.c:2416:7: error: variable 'ras_obj' is used uninitialized
  whenever 'if' condition is true
  if (adev->in_suspend || amdgpu_in_reset(adev)) {
  ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

amdgpu_ras.c:2453:6: note: uninitialized use occurs here
 if (ras_obj->ras_cb)
     ^~~~~~~

There is a logic error in the error handler's labels.
ex/ The sysfs: is the last goto label in the normal code but
is the middle of error handler.  Rework the error handler.

cleanup: is the first error, so it's handler should be last.

interrupt: is the second error, it's handler is next.  interrupt:
handles the failure of amdgpu_ras_interrupt_add_hander() by
calling amdgpu_ras_interrupt_remove_handler().  This is wrong,
remove() assumes the interrupt has been setup, not torn down by
add().  Change the goto label to cleanup.

sysfs is the last error, it's handler should be first.  sysfs:
handles the failure of amdgpu_ras_sysfs_create() by calling
amdgpu_ras_sysfs_remove().  But when the create() fails there
is nothing added so there is nothing to remove.  This error
handler is not needed. Remove the error handler and change
goto label to interrupt.

Fixes: b293e891b057 ("drm/amdgpu: add helper function to do common ras_late_init/fini (v3)")
Signed-off-by: Tom Rix <trix@redhat.com>
---
 drivers/gpu/drm/amd/amdgpu/amdgpu_ras.c | 11 +++++------
 1 file changed, 5 insertions(+), 6 deletions(-)

diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_ras.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_ras.c
index b5cd21cb6e58..c5c8a666110f 100644
--- a/drivers/gpu/drm/amd/amdgpu/amdgpu_ras.c
+++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_ras.c
@@ -2432,12 +2432,12 @@ int amdgpu_ras_block_late_init(struct amdgpu_device *adev,
 	if (ras_obj->ras_cb) {
 		r = amdgpu_ras_interrupt_add_handler(adev, ras_block);
 		if (r)
-			goto interrupt;
+			goto cleanup;
 	}
 
 	r = amdgpu_ras_sysfs_create(adev, ras_block);
 	if (r)
-		goto sysfs;
+		goto interrupt;
 
 	/* Those are the cached values at init.
 	 */
@@ -2447,12 +2447,11 @@ int amdgpu_ras_block_late_init(struct amdgpu_device *adev,
 	}
 
 	return 0;
-cleanup:
-	amdgpu_ras_sysfs_remove(adev, ras_block);
-sysfs:
+
+interrupt:
 	if (ras_obj->ras_cb)
 		amdgpu_ras_interrupt_remove_handler(adev, ras_block);
-interrupt:
+cleanup:
 	amdgpu_ras_feature_enable(adev, ras_block, 0);
 	return r;
 }
-- 
2.26.3


^ permalink raw reply related	[relevance 89%]

* [PATCH] drm/amdgpu: check return status before using stable_pstate
@ 2022-02-14 18:22 98% trix
  0 siblings, 0 replies; 180+ results
From: trix @ 2022-02-14 18:22 UTC (permalink / raw)
  To: alexander.deucher, christian.koenig, Xinhui.Pan, airlied, daniel,
	nathan, ndesaulniers, luben.tuikov, david.nieto, nirmoy.das,
	Ken.Xue, Roy.Sun, evan.quan
  Cc: Tom Rix, llvm, dri-devel, amd-gfx, linux-kernel

From: Tom Rix <trix@redhat.com>

Clang static analysis reports this problem
amdgpu_ctx.c:616:26: warning: Assigned value is garbage
  or undefined
  args->out.pstate.flags = stable_pstate;
                         ^ ~~~~~~~~~~~~~
amdgpu_ctx_stable_pstate can fail without setting
stable_pstate.  So check.

Fixes: 8cda7a4f96e4 ("drm/amdgpu/UAPI: add new CTX OP to get/set stable pstates")
Signed-off-by: Tom Rix <trix@redhat.com>
---
 drivers/gpu/drm/amd/amdgpu/amdgpu_ctx.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_ctx.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_ctx.c
index 1c72f6095f08..f522b52725e4 100644
--- a/drivers/gpu/drm/amd/amdgpu/amdgpu_ctx.c
+++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_ctx.c
@@ -613,7 +613,8 @@ int amdgpu_ctx_ioctl(struct drm_device *dev, void *data,
 		if (args->in.flags)
 			return -EINVAL;
 		r = amdgpu_ctx_stable_pstate(adev, fpriv, id, false, &stable_pstate);
-		args->out.pstate.flags = stable_pstate;
+		if (!r)
+			args->out.pstate.flags = stable_pstate;
 		break;
 	case AMDGPU_CTX_OP_SET_STABLE_PSTATE:
 		if (args->in.flags & ~AMDGPU_CTX_STABLE_PSTATE_FLAGS_MASK)
-- 
2.26.3


^ permalink raw reply related	[relevance 98%]

* [PATCH] drm/amdkfd: fix loop error handling
@ 2022-02-10 17:04 96% trix
  0 siblings, 0 replies; 180+ results
From: trix @ 2022-02-10 17:04 UTC (permalink / raw)
  To: Felix.Kuehling, alexander.deucher, christian.koenig, Xinhui.Pan,
	airlied, daniel, nathan, ndesaulniers, rajneesh.bhardwaj,
	david.yatsin
  Cc: Tom Rix, llvm, dri-devel, amd-gfx, linux-kernel

From: Tom Rix <trix@redhat.com>

Clang static analysis reports this problem
kfd_chardev.c:2594:16: warning: The expression is an uninitialized value.
  The computed value will also be garbage
        while (ret && i--) {
                      ^~~

i is a loop variable and this block unwinds a problem in the loop.
When the error happens before the loop, this value is garbage.
Move the initialization of i to its decalaration.

Fixes: be072b06c739 ("drm/amdkfd: CRIU export BOs as prime dmabuf objects")
Signed-off-by: Tom Rix <trix@redhat.com>
---
 drivers/gpu/drm/amd/amdkfd/kfd_chardev.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/gpu/drm/amd/amdkfd/kfd_chardev.c b/drivers/gpu/drm/amd/amdkfd/kfd_chardev.c
index 636391c61cafb..4310ca07af130 100644
--- a/drivers/gpu/drm/amd/amdkfd/kfd_chardev.c
+++ b/drivers/gpu/drm/amd/amdkfd/kfd_chardev.c
@@ -2374,7 +2374,7 @@ static int criu_restore_bos(struct kfd_process *p,
 	const bool criu_resume = true;
 	bool flush_tlbs = false;
 	int ret = 0, j = 0;
-	uint32_t i;
+	uint32_t i = 0;
 
 	if (*priv_offset + (args->num_bos * sizeof(*bo_privs)) > max_priv_data_size)
 		return -EINVAL;
@@ -2410,7 +2410,7 @@ static int criu_restore_bos(struct kfd_process *p,
 	*priv_offset += args->num_bos * sizeof(*bo_privs);
 
 	/* Create and map new BOs */
-	for (i = 0; i < args->num_bos; i++) {
+	for (; i < args->num_bos; i++) {
 		struct kfd_criu_bo_bucket *bo_bucket;
 		struct kfd_criu_bo_priv_data *bo_priv;
 		struct kfd_dev *dev;
-- 
2.26.3


^ permalink raw reply related	[relevance 96%]

* [PATCH] drm/amdkfd: fix freeing an unset pointer
@ 2022-02-09 14:52 99% trix
  0 siblings, 0 replies; 180+ results
From: trix @ 2022-02-09 14:52 UTC (permalink / raw)
  To: Felix.Kuehling, alexander.deucher, christian.koenig, Xinhui.Pan,
	airlied, daniel, nathan, ndesaulniers, david.yatsin,
	rajneesh.bhardwaj
  Cc: Tom Rix, llvm, dri-devel, amd-gfx, linux-kernel

From: Tom Rix <trix@redhat.com>

clang static analysis reports this problem
kfd_chardev.c:2092:2: warning: 1st function call argument
  is an uninitialized value
        kvfree(bo_privs);
        ^~~~~~~~~~~~~~~~

When bo_buckets alloc fails, it jumps to an error handler
that frees the yet to be allocated bo_privs.  Because
bo_buckets is the first error, return directly.

Fixes: 5ccbb057c0a1 ("drm/amdkfd: CRIU Implement KFD checkpoint ioctl")

Signed-off-by: Tom Rix <trix@redhat.com>
---
 drivers/gpu/drm/amd/amdkfd/kfd_chardev.c | 6 ++----
 1 file changed, 2 insertions(+), 4 deletions(-)

diff --git a/drivers/gpu/drm/amd/amdkfd/kfd_chardev.c b/drivers/gpu/drm/amd/amdkfd/kfd_chardev.c
index 64e3b4e3a7126..636391c61cafb 100644
--- a/drivers/gpu/drm/amd/amdkfd/kfd_chardev.c
+++ b/drivers/gpu/drm/amd/amdkfd/kfd_chardev.c
@@ -1982,10 +1982,8 @@ static int criu_checkpoint_bos(struct kfd_process *p,
 	void *mem;
 
 	bo_buckets = kvzalloc(num_bos * sizeof(*bo_buckets), GFP_KERNEL);
-	if (!bo_buckets) {
-		ret = -ENOMEM;
-		goto exit;
-	}
+	if (!bo_buckets)
+		return -ENOMEM;
 
 	bo_privs = kvzalloc(num_bos * sizeof(*bo_privs), GFP_KERNEL);
 	if (!bo_privs) {
-- 
2.26.3


^ permalink raw reply related	[relevance 99%]

* [PATCH] drm/amd/pm: fix error handling
@ 2022-02-05 15:00 96% trix
  0 siblings, 0 replies; 180+ results
From: trix @ 2022-02-05 15:00 UTC (permalink / raw)
  To: evan.quan, alexander.deucher, christian.koenig, Xinhui.Pan,
	airlied, daniel, nathan, ndesaulniers, lijo.lazar, darren.powell,
	guchun.chen, andrey.grodzovsky
  Cc: Tom Rix, llvm, dri-devel, amd-gfx, linux-kernel

From: Tom Rix <trix@redhat.com>

clang static analysis reports this error
amdgpu_smu.c:2289:9: warning: Called function pointer
  is null (null dereference)
        return smu->ppt_funcs->emit_clk_levels(
               ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

There is a logic error in the earlier check of
emit_clk_levels.  The error value is set to
the ret variable but ret is never used.  Return
directly and remove the unneeded ret variable.

Fixes: 5d64f9bbb628 ("amdgpu/pm: Implement new API function "emit" that accepts buffer base and write offset")
Signed-off-by: Tom Rix <trix@redhat.com>
---
 drivers/gpu/drm/amd/pm/swsmu/amdgpu_smu.c | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

diff --git a/drivers/gpu/drm/amd/pm/swsmu/amdgpu_smu.c b/drivers/gpu/drm/amd/pm/swsmu/amdgpu_smu.c
index af368aa1fd0ae..5f3b3745a9b7a 100644
--- a/drivers/gpu/drm/amd/pm/swsmu/amdgpu_smu.c
+++ b/drivers/gpu/drm/amd/pm/swsmu/amdgpu_smu.c
@@ -2274,7 +2274,6 @@ static int smu_emit_ppclk_levels(void *handle, enum pp_clock_type type, char *bu
 {
 	struct smu_context *smu = handle;
 	enum smu_clk_type clk_type;
-	int ret = 0;
 
 	clk_type = smu_convert_to_smuclk(type);
 	if (clk_type == SMU_CLK_COUNT)
@@ -2284,7 +2283,7 @@ static int smu_emit_ppclk_levels(void *handle, enum pp_clock_type type, char *bu
 		return -EOPNOTSUPP;
 
 	if (!smu->ppt_funcs->emit_clk_levels)
-		ret = -ENOENT;
+		return -ENOENT;
 
 	return smu->ppt_funcs->emit_clk_levels(smu, clk_type, buf, offset);
 
-- 
2.26.3


^ permalink raw reply related	[relevance 96%]

* [PATCH] drm/ast: fix using freed memory
@ 2022-02-03 15:23 99% trix
  0 siblings, 0 replies; 180+ results
From: trix @ 2022-02-03 15:23 UTC (permalink / raw)
  To: airlied, tzimmermann, airlied, daniel, nathan, ndesaulniers, maxime
  Cc: Tom Rix, llvm, linux-kernel, dri-devel

From: Tom Rix <trix@redhat.com>

clang static analysis reports this problem
ast_mode.c:1235:3: warning: Use of memory after it is freed
  drm_connector_update_edid_property(&ast_connector->base, edid);
  ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

The second condition on

  if (!flags && ast_connector->i2c)

Means that the edid is not always set.  If the previous block
fails the freed edid value will be used.  So set edid to NULL
after freeing.

Fixes: 55dc449a7c60 ("drm/ast: Handle failed I2C initialization gracefully")
Signed-off-by: Tom Rix <trix@redhat.com>
---
 drivers/gpu/drm/ast/ast_mode.c | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)

diff --git a/drivers/gpu/drm/ast/ast_mode.c b/drivers/gpu/drm/ast/ast_mode.c
index ab52efb15670e..9131dc8a1a2fc 100644
--- a/drivers/gpu/drm/ast/ast_mode.c
+++ b/drivers/gpu/drm/ast/ast_mode.c
@@ -1224,10 +1224,12 @@ static int ast_get_modes(struct drm_connector *connector)
 			return -ENOMEM;
 
 		flags = ast_dp501_read_edid(connector->dev, (u8 *)edid);
-		if (flags)
+		if (flags) {
 			ast->dp501_maxclk = ast_get_dp501_max_clk(connector->dev);
-		else
+		} else {
 			kfree(edid);
+			edid = NULL;
+		}
 	}
 	if (!flags && ast_connector->i2c)
 		edid = drm_get_edid(connector, &ast_connector->i2c->adapter);
-- 
2.26.3


^ permalink raw reply related	[relevance 99%]

* [PATCH] drm/amdgpu: initialize reg_access_ctrl
@ 2022-01-29 14:53 98% trix
  0 siblings, 0 replies; 180+ results
From: trix @ 2022-01-29 14:53 UTC (permalink / raw)
  To: alexander.deucher, christian.koenig, Xinhui.Pan, airlied, daniel,
	nathan, ndesaulniers, PengJu.Zhou, candice.li, Hawking.Zhang,
	john.clements, Jingwen.Chen2, bokun.zhang, victor.skvortsov,
	bernard, lijo.lazar
  Cc: Tom Rix, llvm, dri-devel, amd-gfx, linux-kernel

From: Tom Rix <trix@redhat.com>

clang build fails with
amdgpu_virt.c:878:51: error: variable 'reg_access_ctrl' is
  uninitialized when used here
  ... + 4 * reg_access_ctrl->scratch_reg0;
            ^~~~~~~~~~~~~~~

The reg_access_ctrl ptr is never initialized, so
initialize once we know it is supported.

Fixes: 5d447e296701 ("drm/amdgpu: add helper for rlcg indirect reg access")
Signed-off-by: Tom Rix <trix@redhat.com>
---
 drivers/gpu/drm/amd/amdgpu/amdgpu_virt.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_virt.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_virt.c
index 80c25176c9932..c137652189190 100644
--- a/drivers/gpu/drm/amd/amdgpu/amdgpu_virt.c
+++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_virt.c
@@ -875,6 +875,7 @@ static u32 amdgpu_virt_rlcg_reg_rw(struct amdgpu_device *adev, u32 offset, u32 v
 		return 0;
 	}
 
+	reg_access_ctrl = &adev->gfx.rlc.reg_access_ctrl;
 	scratch_reg0 = (void __iomem *)adev->rmmio + 4 * reg_access_ctrl->scratch_reg0;
 	scratch_reg1 = (void __iomem *)adev->rmmio + 4 * reg_access_ctrl->scratch_reg1;
 	scratch_reg2 = (void __iomem *)adev->rmmio + 4 * reg_access_ctrl->scratch_reg2;
-- 
2.26.3


^ permalink raw reply related	[relevance 98%]

* [PATCH v2] drm/amd/pm: return -ENOTSUPP if there is no get_dpm_ultimate_freq function
@ 2022-01-24 20:18 98% trix
  0 siblings, 0 replies; 180+ results
From: trix @ 2022-01-24 20:18 UTC (permalink / raw)
  To: evan.quan, alexander.deucher, christian.koenig, Xinhui.Pan,
	airlied, daniel, nathan, ndesaulniers, lijo.lazar, darren.powell,
	guchun.chen, Arunpravin.PaneerSelvam, andrey.grodzovsky
  Cc: Tom Rix, llvm, dri-devel, amd-gfx, linux-kernel

From: Tom Rix <trix@redhat.com>

clang static analysis reports this represenative problem
amdgpu_smu.c:144:18: warning: The left operand of '*' is a garbage value
        return clk_freq * 100;
               ~~~~~~~~ ^

If there is no get_dpm_ultimate_freq function,
smu_get_dpm_freq_range returns success without setting the
output min,max parameters.  So return an -ENOTSUPP error.

Fixes: e5ef784b1e17 ("drm/amd/powerplay: revise calling chain on retrieving frequency range")
Signed-off-by: Tom Rix <trix@redhat.com>
---
v2: return error instead of initializing min/max

drivers/gpu/drm/amd/pm/swsmu/amdgpu_smu.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/gpu/drm/amd/pm/swsmu/amdgpu_smu.c b/drivers/gpu/drm/amd/pm/swsmu/amdgpu_smu.c
index 5ace30434e603..264eb09ccfd51 100644
--- a/drivers/gpu/drm/amd/pm/swsmu/amdgpu_smu.c
+++ b/drivers/gpu/drm/amd/pm/swsmu/amdgpu_smu.c
@@ -116,7 +116,7 @@ int smu_get_dpm_freq_range(struct smu_context *smu,
 			   uint32_t *min,
 			   uint32_t *max)
 {
-	int ret = 0;
+	int ret = -ENOTSUPP;
 
 	if (!min && !max)
 		return -EINVAL;
-- 
2.26.3


^ permalink raw reply related	[relevance 98%]

* [PATCH] drm/amd/pm: set min, max to 0 if there is no get_dpm_ultimate_freq function
@ 2022-01-24 13:52 96% trix
  0 siblings, 0 replies; 180+ results
From: trix @ 2022-01-24 13:52 UTC (permalink / raw)
  To: evan.quan, alexander.deucher, christian.koenig, Xinhui.Pan,
	airlied, daniel, nathan, ndesaulniers, lijo.lazar, darren.powell,
	guchun.chen, Arunpravin.PaneerSelvam, andrey.grodzovsky
  Cc: Tom Rix, llvm, dri-devel, amd-gfx, linux-kernel

From: Tom Rix <trix@redhat.com>

clang static analysis reports this represenative problem
amdgpu_smu.c:144:18: warning: The left operand of '*' is a garbage value
        return clk_freq * 100;
               ~~~~~~~~ ^

If there is no get_dpm_ultimate_freq function,
smu_get_dpm_freq_range returns success without setting the
output min,max parameters.  Because this is an extern function,
set the min,max to 0 when there is no get_dpm_ultimate_freq.

Fixes: e5ef784b1e17 ("drm/amd/powerplay: revise calling chain on retrieving frequency range")
Signed-off-by: Tom Rix <trix@redhat.com>
---
 drivers/gpu/drm/amd/pm/swsmu/amdgpu_smu.c | 8 +++++++-
 1 file changed, 7 insertions(+), 1 deletion(-)

diff --git a/drivers/gpu/drm/amd/pm/swsmu/amdgpu_smu.c b/drivers/gpu/drm/amd/pm/swsmu/amdgpu_smu.c
index 5ace30434e603..35fbe51f52eaa 100644
--- a/drivers/gpu/drm/amd/pm/swsmu/amdgpu_smu.c
+++ b/drivers/gpu/drm/amd/pm/swsmu/amdgpu_smu.c
@@ -121,11 +121,17 @@ int smu_get_dpm_freq_range(struct smu_context *smu,
 	if (!min && !max)
 		return -EINVAL;
 
-	if (smu->ppt_funcs->get_dpm_ultimate_freq)
+	if (smu->ppt_funcs->get_dpm_ultimate_freq) {
 		ret = smu->ppt_funcs->get_dpm_ultimate_freq(smu,
 							    clk_type,
 							    min,
 							    max);
+	} else {
+		if (min)
+			*min = 0;
+		if (max)
+			*max = 0;
+	}
 
 	return ret;
 }
-- 
2.26.3


^ permalink raw reply related	[relevance 96%]

* [PATCH] drm/amdkfd: simplify else if to else check of MIGRATION_COPY_DIR
@ 2022-01-22 14:35 99% trix
  0 siblings, 0 replies; 180+ results
From: trix @ 2022-01-22 14:35 UTC (permalink / raw)
  To: Felix.Kuehling, alexander.deucher, christian.koenig, Xinhui.Pan,
	airlied, daniel
  Cc: Tom Rix, dri-devel, amd-gfx, linux-kernel

From: Tom Rix <trix@redhat.com>

The enum MIGRATION_COPY_DIR type has 2 values.  So
the else-if can be converted to an else.

Signed-off-by: Tom Rix <trix@redhat.com>
---
 drivers/gpu/drm/amd/amdkfd/kfd_migrate.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/drivers/gpu/drm/amd/amdkfd/kfd_migrate.c b/drivers/gpu/drm/amd/amdkfd/kfd_migrate.c
index d986f9ee0e1f4..c06c44f37b00e 100644
--- a/drivers/gpu/drm/amd/amdkfd/kfd_migrate.c
+++ b/drivers/gpu/drm/amd/amdkfd/kfd_migrate.c
@@ -146,7 +146,8 @@ svm_migrate_copy_memory_gart(struct amdgpu_device *adev, dma_addr_t *sys,
 			gart_s = svm_migrate_direct_mapping_addr(adev, *vram);
 			r = svm_migrate_gart_map(ring, size, sys, &gart_d, 0);
 
-		} else if (direction == FROM_RAM_TO_VRAM) {
+		} else {
+			/* direction == FROM_RAM_TO_VRAM */
 			r = svm_migrate_gart_map(ring, size, sys, &gart_s,
 						 KFD_IOCTL_SVM_FLAG_GPU_RO);
 			gart_d = svm_migrate_direct_mapping_addr(adev, *vram);
-- 
2.26.3


^ permalink raw reply related	[relevance 99%]

* [PATCH] drm/amdkfd: match the signatures of the real and stub kgd2kfd_probe()
@ 2021-09-30 20:34 99% trix
  0 siblings, 0 replies; 180+ results
From: trix @ 2021-09-30 20:34 UTC (permalink / raw)
  To: Felix.Kuehling, alexander.deucher, christian.koenig, Xinhui.Pan,
	airlied, daniel
  Cc: amd-gfx, dri-devel, linux-kernel, Tom Rix

From: Tom Rix <trix@redhat.com>

When CONFIG_HSA_AMD=n this there is this error
amdgpu_amdkfd.c:75:56: error: incompatible type for
  argument 2 of ‘kgd2kfd_probe’
   75 |  adev->kfd.dev = kgd2kfd_probe((struct kgd_dev *)adev, vf);

amdgpu_amdkfd.h:349:17: note: declared here
  349 | struct kfd_dev *kgd2kfd_probe(struct kgd_dev *kgd,
  struct pci_dev *pdev,

The signature of the stub kgd2kfd_probe() does not match the real one.
So change the stub to match.

Fixes: 920f37e6a3fc ("drm/amdkfd: clean up parameters in kgd2kfd_probe")
Signed-off-by: Tom Rix <trix@redhat.com>
---
 drivers/gpu/drm/amd/amdgpu/amdgpu_amdkfd.h | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_amdkfd.h b/drivers/gpu/drm/amd/amdgpu/amdgpu_amdkfd.h
index 38d883dffc20..69de31754907 100644
--- a/drivers/gpu/drm/amd/amdgpu/amdgpu_amdkfd.h
+++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_amdkfd.h
@@ -346,8 +346,7 @@ static inline void kgd2kfd_exit(void)
 }
 
 static inline
-struct kfd_dev *kgd2kfd_probe(struct kgd_dev *kgd, struct pci_dev *pdev,
-					unsigned int asic_type, bool vf)
+struct kfd_dev *kgd2kfd_probe(struct kgd_dev *kgd, bool vf)
 {
 	return NULL;
 }
-- 
2.26.3


^ permalink raw reply related	[relevance 99%]

* [PATCH] drm/nouveau/kms/nv50-: use DRM_NOUVEAU_BACKLIGHT consistently
@ 2021-07-24 20:27 95% trix
  0 siblings, 0 replies; 180+ results
From: trix @ 2021-07-24 20:27 UTC (permalink / raw)
  To: bskeggs, airlied, daniel, lyude, nikola.cornij, ville.syrjala
  Cc: nouveau, linux-kernel, dri-devel, Tom Rix

From: Tom Rix <trix@redhat.com>

A build error when DRM_NOUVEAU_BACKLIGHT is not defined
disp.c:1665:52: error: 'struct nouveau_connector' has no
  member named 'backlight'

Use ifdef's similar to elsewhere in disp.c to conditionally
use the new backlight support.

Move scope of drm to where it is used, inside the backlight error
reporting.

Remove shadow ret decl.

Fixes: 6eca310e8924 ("drm/nouveau/kms/nv50-: Add basic DPCD backlight support for nouveau")
Signed-off-by: Tom Rix <trix@redhat.com>
---
 drivers/gpu/drm/nouveau/dispnv50/disp.c | 11 ++++++++---
 1 file changed, 8 insertions(+), 3 deletions(-)

diff --git a/drivers/gpu/drm/nouveau/dispnv50/disp.c b/drivers/gpu/drm/nouveau/dispnv50/disp.c
index 093e1f7163b31..6e957041edfb5 100644
--- a/drivers/gpu/drm/nouveau/dispnv50/disp.c
+++ b/drivers/gpu/drm/nouveau/dispnv50/disp.c
@@ -1659,23 +1659,28 @@ static void
 nv50_sor_atomic_disable(struct drm_encoder *encoder, struct drm_atomic_state *state)
 {
 	struct nouveau_encoder *nv_encoder = nouveau_encoder(encoder);
-	struct nouveau_drm *drm = nouveau_drm(nv_encoder->base.base.dev);
 	struct nouveau_crtc *nv_crtc = nouveau_crtc(nv_encoder->crtc);
 	struct nouveau_connector *nv_connector = nv50_outp_get_old_connector(state, nv_encoder);
+#ifdef CONFIG_DRM_NOUVEAU_BACKLIGHT
 	struct nouveau_backlight *backlight = nv_connector->backlight;
+#endif
 	struct drm_dp_aux *aux = &nv_connector->aux;
 	int ret;
 	u8 pwr;
 
+#ifdef CONFIG_DRM_NOUVEAU_BACKLIGHT
 	if (backlight && backlight->uses_dpcd) {
 		ret = drm_edp_backlight_disable(aux, &backlight->edp_info);
-		if (ret < 0)
+		if (ret < 0) {
+			struct nouveau_drm *drm = nouveau_drm(nv_encoder->base.base.dev);
 			NV_ERROR(drm, "Failed to disable backlight on [CONNECTOR:%d:%s]: %d\n",
 				 nv_connector->base.base.id, nv_connector->base.name, ret);
+		}
 	}
+#endif
 
 	if (nv_encoder->dcb->type == DCB_OUTPUT_DP) {
-		int ret = drm_dp_dpcd_readb(aux, DP_SET_POWER, &pwr);
+		ret = drm_dp_dpcd_readb(aux, DP_SET_POWER, &pwr);
 
 		if (ret == 0) {
 			pwr &= ~DP_SET_POWER_MASK;
-- 
2.26.3


^ permalink raw reply related	[relevance 95%]

* [PATCH] drm/amdgpu: initialize amdgpu_ras_query_error_count() error count parameters
@ 2021-07-02 19:52 99% trix
  0 siblings, 0 replies; 180+ results
From: trix @ 2021-07-02 19:52 UTC (permalink / raw)
  To: alexander.deucher, christian.koenig, Xinhui.Pan, airlied, daniel,
	Hawking.Zhang, Dennis.Li, guchun.chen, luben.tuikov,
	Stanley.Yang, nirmoy.das
  Cc: Tom Rix, dri-devel, amd-gfx, linux-kernel

From: Tom Rix <trix@redhat.com>

Static analysis reports this problem
amdgpu_ras.c:2324:2: warning: 2nd function call argument is an
  uninitialized value
        atomic_set(&con->ras_ce_count, ce_count);
        ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

ce_count is normally set by the earlier call to
amdgpu_ras_query_error_count().  But amdgpu_ras_query_error_count()
can return early without setting, leaving its error count parameters
in a garbage state.

Initialize the error count parameters earlier.

Fixes: a46751fbcde5 ("drm/amdgpu: Fix RAS function interface")
Signed-off-by: Tom Rix <trix@redhat.com>
---
 drivers/gpu/drm/amd/amdgpu/amdgpu_ras.c | 6 ++++++
 1 file changed, 6 insertions(+)

diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_ras.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_ras.c
index 875874ea745ec..c80fa545aa2b8 100644
--- a/drivers/gpu/drm/amd/amdgpu/amdgpu_ras.c
+++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_ras.c
@@ -1056,6 +1056,12 @@ void amdgpu_ras_query_error_count(struct amdgpu_device *adev,
 	struct ras_manager *obj;
 	unsigned long ce, ue;
 
+	if (ce_count)
+		*ce_count = 0;
+
+	if (ue_count)
+		*ue_count = 0;
+
 	if (!adev->ras_enabled || !con)
 		return;
 
-- 
2.26.3


^ permalink raw reply related	[relevance 99%]

* [PATCH] drm/amd/pm: initialize variable
@ 2021-04-30 17:16 99% trix
  0 siblings, 0 replies; 180+ results
From: trix @ 2021-04-30 17:16 UTC (permalink / raw)
  To: alexander.deucher, christian.koenig, airlied, daniel, evan.quan,
	nirmoy.das, kevin1.wang, ray.huang, darren.powell
  Cc: Tom Rix, dri-devel, amd-gfx, linux-kernel

From: Tom Rix <trix@redhat.com>

Static analysis reports this problem

amdgpu_pm.c:478:16: warning: The right operand of '<' is a garbage value
  for (i = 0; i < data.nums; i++) {
                ^ ~~~~~~~~~

In some cases data is not set.  Initialize to 0 and flag not setting
data as an error with the existing check.

Signed-off-by: Tom Rix <trix@redhat.com>
---
 drivers/gpu/drm/amd/pm/amdgpu_pm.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/gpu/drm/amd/pm/amdgpu_pm.c b/drivers/gpu/drm/amd/pm/amdgpu_pm.c
index 4e459ef632ef..9a54066ec0af 100644
--- a/drivers/gpu/drm/amd/pm/amdgpu_pm.c
+++ b/drivers/gpu/drm/amd/pm/amdgpu_pm.c
@@ -451,7 +451,7 @@ static ssize_t amdgpu_get_pp_cur_state(struct device *dev,
 	struct drm_device *ddev = dev_get_drvdata(dev);
 	struct amdgpu_device *adev = drm_to_adev(ddev);
 	const struct amd_pm_funcs *pp_funcs = adev->powerplay.pp_funcs;
-	struct pp_states_info data;
+	struct pp_states_info data = {0};
 	enum amd_pm_state_type pm = 0;
 	int i = 0, ret = 0;
 
-- 
2.26.3

_______________________________________________
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel

^ permalink raw reply related	[relevance 99%]

* Re: [PATCH RFC 0/3] Adds support to allow the bitstream configuration from pre-allocated dma-buffer
  @ 2021-04-02 14:35 99% ` Tom Rix
  0 siblings, 0 replies; 180+ results
From: Tom Rix @ 2021-04-02 14:35 UTC (permalink / raw)
  To: Nava kishore Manne, mdf, robh+dt, michal.simek, sumit.semwal,
	christian.koenig, linux-fpga, devicetree, linux-kernel,
	linux-arm-kernel, linux-media, dri-devel, linaro-mm-sig, git

Please add to this patch cover letter what you want to discuss.

Got this new feature, not sure about ...

Tom

On 4/2/21 2:09 AM, Nava kishore Manne wrote:
> Nava kishore Manne (3):
>   fpga: region: Add fpga-region property 'fpga-config-from-dmabuf'
>   fpga: support loading from a pre-allocated buffer
>   fpga: zynqmp: Use the scatterlist interface
>
>  .../devicetree/bindings/fpga/fpga-region.txt  |   2 +
>  drivers/fpga/fpga-mgr.c                       | 126 +++++++++++++++++-
>  drivers/fpga/of-fpga-region.c                 |   3 +
>  drivers/fpga/zynqmp-fpga.c                    |  35 +++++
>  include/linux/fpga/fpga-mgr.h                 |   6 +-
>  5 files changed, 169 insertions(+), 3 deletions(-)
>

_______________________________________________
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel

^ permalink raw reply	[relevance 99%]

* Re: [PATCH] amdgpu: avoid incorrect %hu format string
  @ 2021-03-22 14:08 99% ` Tom Rix
  0 siblings, 0 replies; 180+ results
From: Tom Rix @ 2021-03-22 14:08 UTC (permalink / raw)
  To: Arnd Bergmann, Alex Deucher, Christian König, David Airlie,
	Daniel Vetter
  Cc: Sonny Jiang, Arnd Bergmann, dri-devel, xinhui pan,
	Nick Desaulniers, linux-kernel, amd-gfx, Nathan Chancellor,
	clang-built-linux, Chen Li, Lee Jones


On 3/22/21 4:54 AM, Arnd Bergmann wrote:
> From: Arnd Bergmann <arnd@arndb.de>
>
> clang points out that the %hu format string does not match the type
> of the variables here:
>
> drivers/gpu/drm/amd/amdgpu/amdgpu_uvd.c:263:7: warning: format specifies type 'unsigned short' but the argument has type 'unsigned int' [-Wformat]
>                                   version_major, version_minor);
>                                   ^~~~~~~~~~~~~
> include/drm/drm_print.h:498:19: note: expanded from macro 'DRM_ERROR'
>         __drm_err(fmt, ##__VA_ARGS__)
>                   ~~~    ^~~~~~~~~~~
>
> Change it to a regular %u, the same way a previous patch did for
> another instance of the same warning.

It would be good to explicitly call out the change.

ex/ do you mean mine ?

0b437e64e0af ("drm/amdgpu: remove h from printk format specifier")

This was for a different reason.

imo, you do not need to include what another patch did.

so you could also just remove this bit from the commit log.


The change itself looks good.

Reviewed-by: Tom Rix <trix@redhat.com>

>
> Fixes: 0b437e64e0af ("drm/amdgpu: remove h from printk format specifier")
> Signed-off-by: Arnd Bergmann <arnd@arndb.de>
> ---
>  drivers/gpu/drm/amd/amdgpu/amdgpu_uvd.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_uvd.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_uvd.c
> index e2ed4689118a..c6dbc0801604 100644
> --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_uvd.c
> +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_uvd.c
> @@ -259,7 +259,7 @@ int amdgpu_uvd_sw_init(struct amdgpu_device *adev)
>  		if ((adev->asic_type == CHIP_POLARIS10 ||
>  		     adev->asic_type == CHIP_POLARIS11) &&
>  		    (adev->uvd.fw_version < FW_1_66_16))
> -			DRM_ERROR("POLARIS10/11 UVD firmware version %hu.%hu is too old.\n",
> +			DRM_ERROR("POLARIS10/11 UVD firmware version %u.%u is too old.\n",
>  				  version_major, version_minor);
>  	} else {
>  		unsigned int enc_major, enc_minor, dec_minor;

_______________________________________________
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel

^ permalink raw reply	[relevance 99%]

* Re: [PATCH] drm/i915: remove h from printk format specifier
  @ 2020-12-15 19:00 99%   ` Tom Rix
  0 siblings, 0 replies; 180+ results
From: Tom Rix @ 2020-12-15 19:00 UTC (permalink / raw)
  To: Chris Wilson, airlied, daniel, daniele.ceraolospurio,
	jani.nikula, joonas.lahtinen, lionel.g.landwerlin, rodrigo.vivi,
	tejaskumarx.surendrakumar.upadhyay, tvrtko.ursulin,
	venkata.s.dhanalakota
  Cc: intel-gfx, linux-kernel, dri-devel


On 12/15/20 10:13 AM, Chris Wilson wrote:
> Quoting trix@redhat.com (2020-12-15 14:41:01)
>> From: Tom Rix <trix@redhat.com>
>>
>> See Documentation/core-api/printk-formats.rst.
>> h should no longer be used in the format specifier for printk.
> It's understood by format_decode().
> * 'h', 'l', or 'L' for integer fields
>
> At least reference commit cbacb5ab0aa0 ("docs: printk-formats: Stop
> encouraging use of unnecessary %h[xudi] and %hh[xudi]") as to why the
> printk-formats.rst was altered so we know the code is merely in bad
> taste and not using undefined behaviour of printk.

Ok, i will fix this after the first run of patches.

Tom

> -Chris
>

_______________________________________________
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel

^ permalink raw reply	[relevance 99%]

* Re: [PATCH] drm/amdgpu: remove h from printk format specifier
  @ 2020-12-15 15:06 99%   ` Tom Rix
  0 siblings, 0 replies; 180+ results
From: Tom Rix @ 2020-12-15 15:06 UTC (permalink / raw)
  To: Christian König, alexander.deucher, airlied, daniel,
	lee.jones, Felix.Kuehling, nirmoy.das, sonny.jiang, xinhui.pan,
	colin.king, James.Zhu, leo.liu, thong.thai, vegopala,
	boyuan.zhang, Monk.Liu, mh12gx2825
  Cc: dri-devel, amd-gfx, linux-kernel


On 12/15/20 6:47 AM, Christian König wrote:
> Am 15.12.20 um 15:38 schrieb trix@redhat.com:
>> From: Tom Rix <trix@redhat.com>
>>
>> See Documentation/core-api/printk-formats.rst.
>> h should no longer be used in the format specifier for printk.
>
> In general looks valid to me, but my question is how does that work?
>
> I mean we specify h here because it is a short int. Are ints always 32bit on the stack?

The type of the argument is promoted to int.  This was discussed earlier here

https://lore.kernel.org/lkml/a68114afb134b8633905f5a25ae7c4e6799ce8f1.camel@perches.com/

Tom

>
> Thanks,
> Christian.
>
>>
>> Signed-off-by: Tom Rix <trix@redhat.com>
>> ---
>>   drivers/gpu/drm/amd/amdgpu/amdgpu_uvd.c | 4 ++--
>>   drivers/gpu/drm/amd/amdgpu/amdgpu_vce.c | 2 +-
>>   drivers/gpu/drm/amd/amdgpu/amdgpu_vcn.c | 4 ++--
>>   3 files changed, 5 insertions(+), 5 deletions(-)
>>
>> diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_uvd.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_uvd.c
>> index 7c5b60e53482..8b989670ed66 100644
>> --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_uvd.c
>> +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_uvd.c
>> @@ -240,7 +240,7 @@ int amdgpu_uvd_sw_init(struct amdgpu_device *adev)
>>             version_major = (le32_to_cpu(hdr->ucode_version) >> 24) & 0xff;
>>           version_minor = (le32_to_cpu(hdr->ucode_version) >> 8) & 0xff;
>> -        DRM_INFO("Found UVD firmware Version: %hu.%hu Family ID: %hu\n",
>> +        DRM_INFO("Found UVD firmware Version: %u.%u Family ID: %u\n",
>>               version_major, version_minor, family_id);
>>             /*
>> @@ -267,7 +267,7 @@ int amdgpu_uvd_sw_init(struct amdgpu_device *adev)
>>           dec_minor = (le32_to_cpu(hdr->ucode_version) >> 8) & 0xff;
>>           enc_minor = (le32_to_cpu(hdr->ucode_version) >> 24) & 0x3f;
>>           enc_major = (le32_to_cpu(hdr->ucode_version) >> 30) & 0x3;
>> -        DRM_INFO("Found UVD firmware ENC: %hu.%hu DEC: .%hu Family ID: %hu\n",
>> +        DRM_INFO("Found UVD firmware ENC: %u.%u DEC: .%u Family ID: %u\n",
>>               enc_major, enc_minor, dec_minor, family_id);
>>             adev->uvd.max_handles = AMDGPU_MAX_UVD_HANDLES;
>> diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_vce.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_vce.c
>> index 4861f8ddc1b5..ea6a62f67e38 100644
>> --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_vce.c
>> +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_vce.c
>> @@ -179,7 +179,7 @@ int amdgpu_vce_sw_init(struct amdgpu_device *adev, unsigned long size)
>>       version_major = (ucode_version >> 20) & 0xfff;
>>       version_minor = (ucode_version >> 8) & 0xfff;
>>       binary_id = ucode_version & 0xff;
>> -    DRM_INFO("Found VCE firmware Version: %hhd.%hhd Binary ID: %hhd\n",
>> +    DRM_INFO("Found VCE firmware Version: %d.%d Binary ID: %d\n",
>>           version_major, version_minor, binary_id);
>>       adev->vce.fw_version = ((version_major << 24) | (version_minor << 16) |
>>                   (binary_id << 8));
>> diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_vcn.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_vcn.c
>> index 1e756186e3f8..99b82f3c2617 100644
>> --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_vcn.c
>> +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_vcn.c
>> @@ -181,7 +181,7 @@ int amdgpu_vcn_sw_init(struct amdgpu_device *adev)
>>           enc_major = fw_check;
>>           dec_ver = (le32_to_cpu(hdr->ucode_version) >> 24) & 0xf;
>>           vep = (le32_to_cpu(hdr->ucode_version) >> 28) & 0xf;
>> -        DRM_INFO("Found VCN firmware Version ENC: %hu.%hu DEC: %hu VEP: %hu Revision: %hu\n",
>> +        DRM_INFO("Found VCN firmware Version ENC: %u.%u DEC: %u VEP: %u Revision: %u\n",
>>               enc_major, enc_minor, dec_ver, vep, fw_rev);
>>       } else {
>>           unsigned int version_major, version_minor, family_id;
>> @@ -189,7 +189,7 @@ int amdgpu_vcn_sw_init(struct amdgpu_device *adev)
>>           family_id = le32_to_cpu(hdr->ucode_version) & 0xff;
>>           version_major = (le32_to_cpu(hdr->ucode_version) >> 24) & 0xff;
>>           version_minor = (le32_to_cpu(hdr->ucode_version) >> 8) & 0xff;
>> -        DRM_INFO("Found VCN firmware Version: %hu.%hu Family ID: %hu\n",
>> +        DRM_INFO("Found VCN firmware Version: %u.%u Family ID: %u\n",
>>               version_major, version_minor, family_id);
>>       }
>>   
>

_______________________________________________
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel

^ permalink raw reply	[relevance 99%]

* [PATCH] drm/radeon: remove h from printk format specifier
@ 2020-12-15 14:42 96% trix
  0 siblings, 0 replies; 180+ results
From: trix @ 2020-12-15 14:42 UTC (permalink / raw)
  To: alexander.deucher, christian.koenig, airlied, daniel
  Cc: Tom Rix, dri-devel, amd-gfx, linux-kernel

From: Tom Rix <trix@redhat.com>

See Documentation/core-api/printk-formats.rst.
h should no longer be used in the format specifier for printk.

Signed-off-by: Tom Rix <trix@redhat.com>
---
 drivers/gpu/drm/radeon/radeon_uvd.c | 2 +-
 drivers/gpu/drm/radeon/radeon_vce.c | 2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/gpu/drm/radeon/radeon_uvd.c b/drivers/gpu/drm/radeon/radeon_uvd.c
index 57fb3eb3a4b4..39c1c339be7b 100644
--- a/drivers/gpu/drm/radeon/radeon_uvd.c
+++ b/drivers/gpu/drm/radeon/radeon_uvd.c
@@ -155,7 +155,7 @@ int radeon_uvd_init(struct radeon_device *rdev)
 			family_id = le32_to_cpu(hdr->ucode_version) & 0xff;
 			version_major = (le32_to_cpu(hdr->ucode_version) >> 24) & 0xff;
 			version_minor = (le32_to_cpu(hdr->ucode_version) >> 8) & 0xff;
-			DRM_INFO("Found UVD firmware Version: %hu.%hu Family ID: %hu\n",
+			DRM_INFO("Found UVD firmware Version: %u.%u Family ID: %u\n",
 				 version_major, version_minor, family_id);
 
 			/*
diff --git a/drivers/gpu/drm/radeon/radeon_vce.c b/drivers/gpu/drm/radeon/radeon_vce.c
index 5e8006444704..a450497368b2 100644
--- a/drivers/gpu/drm/radeon/radeon_vce.c
+++ b/drivers/gpu/drm/radeon/radeon_vce.c
@@ -122,7 +122,7 @@ int radeon_vce_init(struct radeon_device *rdev)
 	if (sscanf(c, "%2u]", &rdev->vce.fb_version) != 1)
 		return -EINVAL;
 
-	DRM_INFO("Found VCE firmware/feedback version %hhd.%hhd.%hhd / %d!\n",
+	DRM_INFO("Found VCE firmware/feedback version %d.%d.%d / %d!\n",
 		 start, mid, end, rdev->vce.fb_version);
 
 	rdev->vce.fw_version = (start << 24) | (mid << 16) | (end << 8);
-- 
2.27.0

_______________________________________________
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel

^ permalink raw reply related	[relevance 96%]

* [PATCH] drm/i915: remove h from printk format specifier
@ 2020-12-15 14:41 99% trix
    0 siblings, 1 reply; 180+ results
From: trix @ 2020-12-15 14:41 UTC (permalink / raw)
  To: jani.nikula, joonas.lahtinen, rodrigo.vivi, airlied, daniel,
	chris, tvrtko.ursulin, daniele.ceraolospurio,
	tejaskumarx.surendrakumar.upadhyay, lionel.g.landwerlin,
	venkata.s.dhanalakota
  Cc: Tom Rix, intel-gfx, linux-kernel, dri-devel

From: Tom Rix <trix@redhat.com>

See Documentation/core-api/printk-formats.rst.
h should no longer be used in the format specifier for printk.

Signed-off-by: Tom Rix <trix@redhat.com>
---
 drivers/gpu/drm/i915/gt/intel_sseu.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/gpu/drm/i915/gt/intel_sseu.c b/drivers/gpu/drm/i915/gt/intel_sseu.c
index 8a72e0fe34ca..80be9e818a6b 100644
--- a/drivers/gpu/drm/i915/gt/intel_sseu.c
+++ b/drivers/gpu/drm/i915/gt/intel_sseu.c
@@ -755,7 +755,7 @@ void intel_sseu_print_topology(const struct sseu_dev_info *sseu,
 		for (ss = 0; ss < sseu->max_subslices; ss++) {
 			u16 enabled_eus = sseu_get_eus(sseu, s, ss);
 
-			drm_printf(p, "\tsubslice%d: %u EUs (0x%hx)\n",
+			drm_printf(p, "\tsubslice%d: %u EUs (0x%x)\n",
 				   ss, hweight16(enabled_eus), enabled_eus);
 		}
 	}
-- 
2.27.0

_______________________________________________
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel

^ permalink raw reply related	[relevance 99%]

* [PATCH] drm/amdgpu: remove h from printk format specifier
@ 2020-12-15 14:38 83% trix
    0 siblings, 1 reply; 180+ results
From: trix @ 2020-12-15 14:38 UTC (permalink / raw)
  To: alexander.deucher, christian.koenig, airlied, daniel, lee.jones,
	Felix.Kuehling, nirmoy.das, sonny.jiang, xinhui.pan, colin.king,
	James.Zhu, leo.liu, thong.thai, vegopala, boyuan.zhang, Monk.Liu,
	mh12gx2825
  Cc: Tom Rix, dri-devel, amd-gfx, linux-kernel

From: Tom Rix <trix@redhat.com>

See Documentation/core-api/printk-formats.rst.
h should no longer be used in the format specifier for printk.

Signed-off-by: Tom Rix <trix@redhat.com>
---
 drivers/gpu/drm/amd/amdgpu/amdgpu_uvd.c | 4 ++--
 drivers/gpu/drm/amd/amdgpu/amdgpu_vce.c | 2 +-
 drivers/gpu/drm/amd/amdgpu/amdgpu_vcn.c | 4 ++--
 3 files changed, 5 insertions(+), 5 deletions(-)

diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_uvd.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_uvd.c
index 7c5b60e53482..8b989670ed66 100644
--- a/drivers/gpu/drm/amd/amdgpu/amdgpu_uvd.c
+++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_uvd.c
@@ -240,7 +240,7 @@ int amdgpu_uvd_sw_init(struct amdgpu_device *adev)
 
 		version_major = (le32_to_cpu(hdr->ucode_version) >> 24) & 0xff;
 		version_minor = (le32_to_cpu(hdr->ucode_version) >> 8) & 0xff;
-		DRM_INFO("Found UVD firmware Version: %hu.%hu Family ID: %hu\n",
+		DRM_INFO("Found UVD firmware Version: %u.%u Family ID: %u\n",
 			version_major, version_minor, family_id);
 
 		/*
@@ -267,7 +267,7 @@ int amdgpu_uvd_sw_init(struct amdgpu_device *adev)
 		dec_minor = (le32_to_cpu(hdr->ucode_version) >> 8) & 0xff;
 		enc_minor = (le32_to_cpu(hdr->ucode_version) >> 24) & 0x3f;
 		enc_major = (le32_to_cpu(hdr->ucode_version) >> 30) & 0x3;
-		DRM_INFO("Found UVD firmware ENC: %hu.%hu DEC: .%hu Family ID: %hu\n",
+		DRM_INFO("Found UVD firmware ENC: %u.%u DEC: .%u Family ID: %u\n",
 			enc_major, enc_minor, dec_minor, family_id);
 
 		adev->uvd.max_handles = AMDGPU_MAX_UVD_HANDLES;
diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_vce.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_vce.c
index 4861f8ddc1b5..ea6a62f67e38 100644
--- a/drivers/gpu/drm/amd/amdgpu/amdgpu_vce.c
+++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_vce.c
@@ -179,7 +179,7 @@ int amdgpu_vce_sw_init(struct amdgpu_device *adev, unsigned long size)
 	version_major = (ucode_version >> 20) & 0xfff;
 	version_minor = (ucode_version >> 8) & 0xfff;
 	binary_id = ucode_version & 0xff;
-	DRM_INFO("Found VCE firmware Version: %hhd.%hhd Binary ID: %hhd\n",
+	DRM_INFO("Found VCE firmware Version: %d.%d Binary ID: %d\n",
 		version_major, version_minor, binary_id);
 	adev->vce.fw_version = ((version_major << 24) | (version_minor << 16) |
 				(binary_id << 8));
diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_vcn.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_vcn.c
index 1e756186e3f8..99b82f3c2617 100644
--- a/drivers/gpu/drm/amd/amdgpu/amdgpu_vcn.c
+++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_vcn.c
@@ -181,7 +181,7 @@ int amdgpu_vcn_sw_init(struct amdgpu_device *adev)
 		enc_major = fw_check;
 		dec_ver = (le32_to_cpu(hdr->ucode_version) >> 24) & 0xf;
 		vep = (le32_to_cpu(hdr->ucode_version) >> 28) & 0xf;
-		DRM_INFO("Found VCN firmware Version ENC: %hu.%hu DEC: %hu VEP: %hu Revision: %hu\n",
+		DRM_INFO("Found VCN firmware Version ENC: %u.%u DEC: %u VEP: %u Revision: %u\n",
 			enc_major, enc_minor, dec_ver, vep, fw_rev);
 	} else {
 		unsigned int version_major, version_minor, family_id;
@@ -189,7 +189,7 @@ int amdgpu_vcn_sw_init(struct amdgpu_device *adev)
 		family_id = le32_to_cpu(hdr->ucode_version) & 0xff;
 		version_major = (le32_to_cpu(hdr->ucode_version) >> 24) & 0xff;
 		version_minor = (le32_to_cpu(hdr->ucode_version) >> 8) & 0xff;
-		DRM_INFO("Found VCN firmware Version: %hu.%hu Family ID: %hu\n",
+		DRM_INFO("Found VCN firmware Version: %u.%u Family ID: %u\n",
 			version_major, version_minor, family_id);
 	}
 
-- 
2.27.0

_______________________________________________
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel

^ permalink raw reply related	[relevance 83%]

* [PATCH] omapfb: fbcon: remove trailing semicolon in macro definition
@ 2020-11-27 19:05 96% trix
  0 siblings, 0 replies; 180+ results
From: trix @ 2020-11-27 19:05 UTC (permalink / raw)
  To: b.zolnierkie, pakki001
  Cc: Tom Rix, linux-fbdev, linux-omap, linux-kernel, dri-devel

From: Tom Rix <trix@redhat.com>

The macro use will already have a semicolon.

Signed-off-by: Tom Rix <trix@redhat.com>
---
 drivers/video/fbdev/omap2/omapfb/dss/dispc-compat.c | 2 +-
 drivers/video/fbdev/omap2/omapfb/dss/dsi.c          | 2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/video/fbdev/omap2/omapfb/dss/dispc-compat.c b/drivers/video/fbdev/omap2/omapfb/dss/dispc-compat.c
index 3417618310ff..cc2ad787d493 100644
--- a/drivers/video/fbdev/omap2/omapfb/dss/dispc-compat.c
+++ b/drivers/video/fbdev/omap2/omapfb/dss/dispc-compat.c
@@ -75,7 +75,7 @@ static void dispc_dump_irqs(struct seq_file *s)
 
 	seq_printf(s, "irqs %d\n", stats.irq_count);
 #define PIS(x) \
-	seq_printf(s, "%-20s %10d\n", #x, stats.irqs[ffs(DISPC_IRQ_##x)-1]);
+	seq_printf(s, "%-20s %10d\n", #x, stats.irqs[ffs(DISPC_IRQ_##x)-1])
 
 	PIS(FRAMEDONE);
 	PIS(VSYNC);
diff --git a/drivers/video/fbdev/omap2/omapfb/dss/dsi.c b/drivers/video/fbdev/omap2/omapfb/dss/dsi.c
index 6f9c25fec994..101fa66f9b58 100644
--- a/drivers/video/fbdev/omap2/omapfb/dss/dsi.c
+++ b/drivers/video/fbdev/omap2/omapfb/dss/dsi.c
@@ -1554,7 +1554,7 @@ static void dsi_dump_dsidev_irqs(struct platform_device *dsidev,
 
 	seq_printf(s, "irqs %d\n", stats.irq_count);
 #define PIS(x) \
-	seq_printf(s, "%-20s %10d\n", #x, stats.dsi_irqs[ffs(DSI_IRQ_##x)-1]);
+	seq_printf(s, "%-20s %10d\n", #x, stats.dsi_irqs[ffs(DSI_IRQ_##x)-1])
 
 	seq_printf(s, "-- DSI%d interrupts --\n", dsi->module_id + 1);
 	PIS(VC0);
-- 
2.18.4

_______________________________________________
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel

^ permalink raw reply related	[relevance 96%]

* [PATCH] drm/i915: remove trailing semicolon in macro definition
@ 2020-11-27 16:28 99% trix
  0 siblings, 0 replies; 180+ results
From: trix @ 2020-11-27 16:28 UTC (permalink / raw)
  To: jani.nikula, joonas.lahtinen, rodrigo.vivi, airlied, daniel
  Cc: Tom Rix, intel-gfx, linux-kernel, dri-devel

From: Tom Rix <trix@redhat.com>

The macro use will already have a semicolon.

Signed-off-by: Tom Rix <trix@redhat.com>
---
 drivers/gpu/drm/i915/intel_device_info.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/gpu/drm/i915/intel_device_info.c b/drivers/gpu/drm/i915/intel_device_info.c
index e67cec8fa2aa..ef767f04c37c 100644
--- a/drivers/gpu/drm/i915/intel_device_info.c
+++ b/drivers/gpu/drm/i915/intel_device_info.c
@@ -104,7 +104,7 @@ void intel_device_info_print_static(const struct intel_device_info *info,
 	drm_printf(p, "ppgtt-type: %d\n", info->ppgtt_type);
 	drm_printf(p, "dma_mask_size: %u\n", info->dma_mask_size);
 
-#define PRINT_FLAG(name) drm_printf(p, "%s: %s\n", #name, yesno(info->name));
+#define PRINT_FLAG(name) drm_printf(p, "%s: %s\n", #name, yesno(info->name))
 	DEV_INFO_FOR_EACH_FLAG(PRINT_FLAG);
 #undef PRINT_FLAG
 
-- 
2.18.4

_______________________________________________
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel

^ permalink raw reply related	[relevance 99%]

* [PATCH] drm/amdgpu/display: remove trailing semicolon in macro definition
@ 2020-11-27 16:26 99% trix
  0 siblings, 0 replies; 180+ results
From: trix @ 2020-11-27 16:26 UTC (permalink / raw)
  To: alexander.deucher, christian.koenig, airlied, daniel,
	Hawking.Zhang, evan.quan, Felix.Kuehling, luben.tuikov,
	Dennis.Li, andrey.grodzovsky, Joseph.Greathouse, jonathan.kim
  Cc: Tom Rix, dri-devel, amd-gfx, linux-kernel

From: Tom Rix <trix@redhat.com>

The macro use will already have a semicolon.

Signed-off-by: Tom Rix <trix@redhat.com>
---
 drivers/gpu/drm/amd/amdgpu/amdgpu.h | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu.h b/drivers/gpu/drm/amd/amdgpu/amdgpu.h
index f9c81bc21ba4..301e93c9e72a 100644
--- a/drivers/gpu/drm/amd/amdgpu/amdgpu.h
+++ b/drivers/gpu/drm/amd/amdgpu/amdgpu.h
@@ -1213,7 +1213,7 @@ int emu_soc_asic_init(struct amdgpu_device *adev);
 #define amdgpu_asic_update_umd_stable_pstate(adev, enter) \
 	((adev)->asic_funcs->update_umd_stable_pstate ? (adev)->asic_funcs->update_umd_stable_pstate((adev), (enter)) : 0)
 
-#define amdgpu_inc_vram_lost(adev) atomic_inc(&((adev)->vram_lost_counter));
+#define amdgpu_inc_vram_lost(adev) atomic_inc(&((adev)->vram_lost_counter))
 
 /* Common functions */
 bool amdgpu_device_has_job_running(struct amdgpu_device *adev);
-- 
2.18.4

_______________________________________________
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel

^ permalink raw reply related	[relevance 99%]

* Re: [RFC] MAINTAINERS tag for cleanup robot
  @ 2020-11-23 17:06 98%       ` Tom Rix
  0 siblings, 0 replies; 180+ results
From: Tom Rix @ 2020-11-23 17:06 UTC (permalink / raw)
  To: Joe Perches, clang-built-linux
  Cc: linux-hyperv, kvm, linux-fbdev, dri-devel, platform-driver-x86,
	ibm-acpi-devel, keyrings, linux-mtd, linux-scsi, amd-gfx,
	cluster-devel, linux-acpi, tboot-devel, coreteam, xen-devel,
	MPT-FusionLinux.pdl, linux-media, alsa-devel, intel-gfx,
	ecryptfs, linux-omap, devel, linux-nfs, netdev, linux-usb,
	linux-wireless, linux-kernel, linux-bluetooth, netfilter-devel,
	linux-crypto, patches, linux-fsdevel, bpf


On 11/22/20 10:22 AM, Joe Perches wrote:
> On Sun, 2020-11-22 at 08:33 -0800, Tom Rix wrote:
>> On 11/21/20 9:10 AM, Joe Perches wrote:
>>> On Sat, 2020-11-21 at 08:50 -0800, trix@redhat.com wrote:
>>>> A difficult part of automating commits is composing the subsystem
>>>> preamble in the commit log.  For the ongoing effort of a fixer producing
>>>> one or two fixes a release the use of 'treewide:' does not seem appropriate.
>>>>
>>>> It would be better if the normal prefix was used.  Unfortunately normal is
>>>> not consistent across the tree.
>>>>
>>>> So I am looking for comments for adding a new tag to the MAINTAINERS file
>>>>
>>>> 	D: Commit subsystem prefix
>>>>
>>>> ex/ for FPGA DFL DRIVERS
>>>>
>>>> 	D: fpga: dfl:
>>> I'm all for it.  Good luck with the effort.  It's not completely trivial.
>>>
>>> From a decade ago:
>>>
>>> https://lore.kernel.org/lkml/1289919077.28741.50.camel@Joe-Laptop/
>>>
>>> (and that thread started with extra semicolon patches too)
>> Reading the history, how about this.
>>
>> get_maintainer.pl outputs a single prefix, if multiple files have the
>> same prefix it works, if they don't its an error.
>>
>> Another script 'commit_one_file.sh' does the call to get_mainainter.pl
>> to get the prefix and be called by run-clang-tools.py to get the fixer
>> specific message.
> It's not whether the script used is get_maintainer or any other script,
> the question is really if the MAINTAINERS file is the appropriate place
> to store per-subsystem patch specific prefixes.
>
> It is.
>
> Then the question should be how are the forms described and what is the
> inheritance priority.  My preference would be to have a default of
> inherit the parent base and add basename(subsystem dirname).
>
> Commit history seems to have standardized on using colons as the separator
> between the commit prefix and the subject.
>
> A good mechanism to explore how various subsystems have uses prefixes in
> the past might be something like:
>
> $ git log --no-merges --pretty='%s' -<commit_count> <subsystem_path> | \
>   perl -n -e 'print substr($_, 0, rindex($_, ":") + 1) . "\n";' | \
>   sort | uniq -c | sort -rn

Thanks, I have shamelessly stolen this line and limited the commits to the maintainer.

I will post something once the generation of the prefixes is done.

Tom

_______________________________________________
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel

^ permalink raw reply	[relevance 98%]

* Re: [RFC] MAINTAINERS tag for cleanup robot
  @ 2020-11-22 16:33 95%   ` Tom Rix
    0 siblings, 1 reply; 180+ results
From: Tom Rix @ 2020-11-22 16:33 UTC (permalink / raw)
  To: Joe Perches, clang-built-linux
  Cc: linux-hyperv, kvm, linux-fbdev, dri-devel, platform-driver-x86,
	ibm-acpi-devel, keyrings, linux-mtd, linux-scsi, amd-gfx,
	cluster-devel, linux-acpi, tboot-devel, coreteam, xen-devel,
	MPT-FusionLinux.pdl, linux-media, alsa-devel, intel-gfx,
	ecryptfs, linux-omap, devel, linux-nfs, netdev, linux-usb,
	linux-wireless, linux-kernel, linux-bluetooth, netfilter-devel,
	linux-crypto, patches, linux-fsdevel, bpf


On 11/21/20 9:10 AM, Joe Perches wrote:
> On Sat, 2020-11-21 at 08:50 -0800, trix@redhat.com wrote:
>> A difficult part of automating commits is composing the subsystem
>> preamble in the commit log.  For the ongoing effort of a fixer producing
>> one or two fixes a release the use of 'treewide:' does not seem appropriate.
>>
>> It would be better if the normal prefix was used.  Unfortunately normal is
>> not consistent across the tree.
>>
>> So I am looking for comments for adding a new tag to the MAINTAINERS file
>>
>> 	D: Commit subsystem prefix
>>
>> ex/ for FPGA DFL DRIVERS
>>
>> 	D: fpga: dfl:
> I'm all for it.  Good luck with the effort.  It's not completely trivial.
>
> From a decade ago:
>
> https://lore.kernel.org/lkml/1289919077.28741.50.camel@Joe-Laptop/
>
> (and that thread started with extra semicolon patches too)

Reading the history, how about this.

get_mataintainer.pl outputs a single prefix, if multiple files have the same prefix it works, if they don't its an error.

Another script 'commit_one_file.sh' does the call to get_mainainter.pl to get the prefix and be called by run-clang-tools.py to get the fixer specific message.

Defer minimizing the commits by combining similar subsystems till later.

In a steady state case, this should be uncommon.


>
>> Continuing with cleaning up clang's -Wextra-semi-stmt
>> diff --git a/Makefile b/Makefile
> []
>> @@ -1567,20 +1567,21 @@ help:
>>  	 echo  ''
>>  	@echo  'Static analysers:'
>>  	@echo  '  checkstack      - Generate a list of stack hogs'
>>  	@echo  '  versioncheck    - Sanity check on version.h usage'
>>  	@echo  '  includecheck    - Check for duplicate included header files'
>>  	@echo  '  export_report   - List the usages of all exported symbols'
>>  	@echo  '  headerdep       - Detect inclusion cycles in headers'
>>  	@echo  '  coccicheck      - Check with Coccinelle'
>>  	@echo  '  clang-analyzer  - Check with clang static analyzer'
>>  	@echo  '  clang-tidy      - Check with clang-tidy'
>> +	@echo  '  clang-tidy-fix  - Check and fix with clang-tidy'
> A pity the ordering of the code below isn't the same as the above.

Taken care thanks!

Tom


_______________________________________________
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel

^ permalink raw reply	[relevance 95%]

* Re: [RFC] MAINTAINERS tag for cleanup robot
       [not found]         ` <20201122145635.GG4327@casper.infradead.org>
@ 2020-11-22 16:10 93%       ` Tom Rix
  0 siblings, 0 replies; 180+ results
From: Tom Rix @ 2020-11-22 16:10 UTC (permalink / raw)
  To: Matthew Wilcox
  Cc: linux-hyperv, kvm, linux-fbdev, dri-devel, platform-driver-x86,
	ibm-acpi-devel, keyrings, linux-mtd, linux-scsi,
	clang-built-linux, amd-gfx, cluster-devel, linux-acpi,
	tboot-devel, coreteam, xen-devel, MPT-FusionLinux.pdl,
	linux-media, alsa-devel, intel-gfx, ecryptfs, linux-fsdevel,
	linux-omap, devel, linux-nfs, netdev, linux-usb, linux-wireless,
	linux-kernel, linux-bluetooth, netfilter-devel, linux-crypto,
	patches, joe, bpf


On 11/22/20 6:56 AM, Matthew Wilcox wrote:
> On Sun, Nov 22, 2020 at 06:46:46AM -0800, Tom Rix wrote:
>> On 11/21/20 7:23 PM, Matthew Wilcox wrote:
>>> On Sat, Nov 21, 2020 at 08:50:58AM -0800, trix@redhat.com wrote:
>>>> The fixer review is
>>>> https://reviews.llvm.org/D91789
>>>>
>>>> A run over allyesconfig for x86_64 finds 62 issues, 5 are false positives.
>>>> The false positives are caused by macros passed to other macros and by
>>>> some macro expansions that did not have an extra semicolon.
>>>>
>>>> This cleans up about 1,000 of the current 10,000 -Wextra-semi-stmt
>>>> warnings in linux-next.
>>> Are any of them not false-positives?  It's all very well to enable
>>> stricter warnings, but if they don't fix any bugs, they're just churn.
>>>
>> While enabling additional warnings may be a side effect of this effort
>>
>> the primary goal is to set up a cleaning robot. After that a refactoring robot.
> Why do we need such a thing?  Again, it sounds like more churn.
> It's really annoying when I'm working on something important that gets
> derailed by pointless churn.  Churn also makes it harder to backport
> patches to earlier kernels.
>
A refactoring example on moving to treewide, consistent use of a new api may help.

Consider

2efc459d06f1630001e3984854848a5647086232

sysfs: Add sysfs_emit and sysfs_emit_at to format sysfs output

A new api for printing in the sysfs.  How do we use it treewide ?

Done manually, it would be a heroic effort requiring high level maintainers pushing and likely only get partially done.

If a refactoring programatic fixit is done and validated on a one subsystem, it can run on all the subsystems.

The effort is a couple of weeks to write and validate the fixer, hours to run over the tree.

It won't be perfect but will be better than doing it manually.

Tom

_______________________________________________
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel

^ permalink raw reply	[relevance 93%]

* Re: [RFC] MAINTAINERS tag for cleanup robot
       [not found]     ` <20201122032304.GE4327@casper.infradead.org>
@ 2020-11-22 14:46 98%   ` Tom Rix
       [not found]         ` <20201122145635.GG4327@casper.infradead.org>
  0 siblings, 1 reply; 180+ results
From: Tom Rix @ 2020-11-22 14:46 UTC (permalink / raw)
  To: Matthew Wilcox
  Cc: linux-hyperv, kvm, linux-fbdev, dri-devel, platform-driver-x86,
	ibm-acpi-devel, keyrings, linux-mtd, linux-scsi,
	clang-built-linux, amd-gfx, cluster-devel, linux-acpi,
	tboot-devel, coreteam, xen-devel, MPT-FusionLinux.pdl,
	linux-media, alsa-devel, intel-gfx, ecryptfs, linux-fsdevel,
	linux-omap, devel, linux-nfs, netdev, linux-usb, linux-wireless,
	linux-kernel, linux-bluetooth, netfilter-devel, linux-crypto,
	patches, joe, bpf


On 11/21/20 7:23 PM, Matthew Wilcox wrote:
> On Sat, Nov 21, 2020 at 08:50:58AM -0800, trix@redhat.com wrote:
>> The fixer review is
>> https://reviews.llvm.org/D91789
>>
>> A run over allyesconfig for x86_64 finds 62 issues, 5 are false positives.
>> The false positives are caused by macros passed to other macros and by
>> some macro expansions that did not have an extra semicolon.
>>
>> This cleans up about 1,000 of the current 10,000 -Wextra-semi-stmt
>> warnings in linux-next.
> Are any of them not false-positives?  It's all very well to enable
> stricter warnings, but if they don't fix any bugs, they're just churn.
>
While enabling additional warnings may be a side effect of this effort

the primary goal is to set up a cleaning robot. After that a refactoring robot.

Tom

_______________________________________________
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel

^ permalink raw reply	[relevance 98%]

* [RFC] MAINTAINERS tag for cleanup robot
@ 2020-11-21 16:50 66% trix
         [not found]     ` <20201122032304.GE4327@casper.infradead.org>
  0 siblings, 2 replies; 180+ results
From: trix @ 2020-11-21 16:50 UTC (permalink / raw)
  To: trix, joe, clang-built-linux
  Cc: linux-hyperv, kvm, linux-fbdev, dri-devel, platform-driver-x86,
	ibm-acpi-devel, keyrings, linux-mtd, linux-scsi, amd-gfx,
	cluster-devel, linux-acpi, tboot-devel, coreteam, xen-devel,
	MPT-FusionLinux.pdl, linux-media, alsa-devel, intel-gfx,
	ecryptfs, linux-omap, devel, linux-nfs, netdev, linux-usb,
	linux-wireless, linux-kernel, linux-bluetooth, netfilter-devel,
	linux-crypto, patches, linux-fsdevel, bpf

A difficult part of automating commits is composing the subsystem
preamble in the commit log.  For the ongoing effort of a fixer producing
one or two fixes a release the use of 'treewide:' does not seem appropriate.

It would be better if the normal prefix was used.  Unfortunately normal is
not consistent across the tree.

So I am looking for comments for adding a new tag to the MAINTAINERS file

	D: Commit subsystem prefix

ex/ for FPGA DFL DRIVERS

	D: fpga: dfl:

Continuing with cleaning up clang's -Wextra-semi-stmt

A significant number of warnings are caused by function like macros with
a trailing semicolon.  For example.

#define FOO(a) a++; <-- extra, unneeded semicolon
void bar() {
	int v = 0;
	FOO(a);
} 

Clang will warn at the FOO(a); expansion location. Instead of removing
the semicolon there,  the fixer removes semicolon from the macro
definition.  After the fixer, the code will be:

#define FOO(a) a++
void bar() {
	int v = 0;
	FOO(a);
} 

The fixer review is
https://reviews.llvm.org/D91789

A run over allyesconfig for x86_64 finds 62 issues, 5 are false positives.
The false positives are caused by macros passed to other macros and by
some macro expansions that did not have an extra semicolon.

This cleans up about 1,000 of the current 10,000 -Wextra-semi-stmt
warnings in linux-next.

An update to [RFC] clang tooling cleanup
This change adds the clang-tidy-fix as a top level target and
uses it to do the cleaning.  The next iteration will do a loop of
cleaners.  This will mean breaking clang-tidy-fix out into its own
processing function 'run_fixers'.

Makefile: Add toplevel target clang-tidy-fix to makefile

Calls clang-tidy with -fix option for a set of checkers that
programatically fixes the kernel source in place, treewide.

Signed-off-by: Tom Rix <trix@redhat.com>
---
 Makefile                               |  7 ++++---
 scripts/clang-tools/run-clang-tools.py | 20 +++++++++++++++++---
 2 files changed, 21 insertions(+), 6 deletions(-)

diff --git a/Makefile b/Makefile
index 47a8add4dd28..57756dbb767b 100644
--- a/Makefile
+++ b/Makefile
@@ -1567,20 +1567,21 @@ help:
 	 echo  ''
 	@echo  'Static analysers:'
 	@echo  '  checkstack      - Generate a list of stack hogs'
 	@echo  '  versioncheck    - Sanity check on version.h usage'
 	@echo  '  includecheck    - Check for duplicate included header files'
 	@echo  '  export_report   - List the usages of all exported symbols'
 	@echo  '  headerdep       - Detect inclusion cycles in headers'
 	@echo  '  coccicheck      - Check with Coccinelle'
 	@echo  '  clang-analyzer  - Check with clang static analyzer'
 	@echo  '  clang-tidy      - Check with clang-tidy'
+	@echo  '  clang-tidy-fix  - Check and fix with clang-tidy'
 	@echo  ''
 	@echo  'Tools:'
 	@echo  '  nsdeps          - Generate missing symbol namespace dependencies'
 	@echo  ''
 	@echo  'Kernel selftest:'
 	@echo  '  kselftest         - Build and run kernel selftest'
 	@echo  '                      Build, install, and boot kernel before'
 	@echo  '                      running kselftest on it'
 	@echo  '                      Run as root for full coverage'
 	@echo  '  kselftest-all     - Build kernel selftest'
@@ -1842,30 +1843,30 @@ nsdeps: modules
 quiet_cmd_gen_compile_commands = GEN     $@
       cmd_gen_compile_commands = $(PYTHON3) $< -a $(AR) -o $@ $(filter-out $<, $(real-prereqs))
 
 $(extmod-prefix)compile_commands.json: scripts/clang-tools/gen_compile_commands.py \
 	$(if $(KBUILD_EXTMOD),,$(KBUILD_VMLINUX_OBJS) $(KBUILD_VMLINUX_LIBS)) \
 	$(if $(CONFIG_MODULES), $(MODORDER)) FORCE
 	$(call if_changed,gen_compile_commands)
 
 targets += $(extmod-prefix)compile_commands.json
 
-PHONY += clang-tidy clang-analyzer
+PHONY += clang-tidy-fix clang-tidy clang-analyzer
 
 ifdef CONFIG_CC_IS_CLANG
 quiet_cmd_clang_tools = CHECK   $<
       cmd_clang_tools = $(PYTHON3) $(srctree)/scripts/clang-tools/run-clang-tools.py $@ $<
 
-clang-tidy clang-analyzer: $(extmod-prefix)compile_commands.json
+clang-tidy-fix clang-tidy clang-analyzer: $(extmod-prefix)compile_commands.json
 	$(call cmd,clang_tools)
 else
-clang-tidy clang-analyzer:
+clang-tidy-fix clang-tidy clang-analyzer:
 	@echo "$@ requires CC=clang" >&2
 	@false
 endif
 
 # Scripts to check various things for consistency
 # ---------------------------------------------------------------------------
 
 PHONY += includecheck versioncheck coccicheck export_report
 
 includecheck:
diff --git a/scripts/clang-tools/run-clang-tools.py b/scripts/clang-tools/run-clang-tools.py
index fa7655c7cec0..c177ca822c56 100755
--- a/scripts/clang-tools/run-clang-tools.py
+++ b/scripts/clang-tools/run-clang-tools.py
@@ -22,43 +22,57 @@ def parse_arguments():
     Returns:
         args: Dict of parsed args
         Has keys: [path, type]
     """
     usage = """Run clang-tidy or the clang static-analyzer on a
         compilation database."""
     parser = argparse.ArgumentParser(description=usage)
 
     type_help = "Type of analysis to be performed"
     parser.add_argument("type",
-                        choices=["clang-tidy", "clang-analyzer"],
+                        choices=["clang-tidy-fix", "clang-tidy", "clang-analyzer"],
                         help=type_help)
     path_help = "Path to the compilation database to parse"
     parser.add_argument("path", type=str, help=path_help)
 
     return parser.parse_args()
 
 
 def init(l, a):
     global lock
     global args
     lock = l
     args = a
 
 
 def run_analysis(entry):
     # Disable all checks, then re-enable the ones we want
     checks = "-checks=-*,"
-    if args.type == "clang-tidy":
+    fix = ""
+    header_filter = ""
+    if args.type == "clang-tidy-fix":
+        checks += "linuxkernel-macro-trailing-semi"
+        #
+        # Fix this
+        # #define M(a) a++; <-- clang-tidy fixes the problem here
+        # int f() {
+        #   int v = 0;
+        #   M(v);  <-- clang reports problem here
+        #   return v;
+        # }
+        fix += "-fix"
+        header_filter += "-header-filter=.*"
+    elif args.type == "clang-tidy":
         checks += "linuxkernel-*"
     else:
         checks += "clang-analyzer-*"
-    p = subprocess.run(["clang-tidy", "-p", args.path, checks, entry["file"]],
+    p = subprocess.run(["clang-tidy", "-p", args.path, checks, header_filter, fix, entry["file"]],
                        stdout=subprocess.PIPE,
                        stderr=subprocess.STDOUT,
                        cwd=entry["directory"])
     with lock:
         sys.stderr.buffer.write(p.stdout)
 
 
 def main():
     args = parse_arguments()
 
-- 
2.18.4

_______________________________________________
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel

^ permalink raw reply related	[relevance 66%]

* Re: Subject: [RFC] clang tooling cleanups
  @ 2020-11-10 13:12 99%   ` Tom Rix
  0 siblings, 0 replies; 180+ results
From: Tom Rix @ 2020-11-10 13:12 UTC (permalink / raw)
  To: Joe Perches, linux-kernel, clang-built-linux, cocci
  Cc: alsa-devel, linux-aspeed, linux-iio, dri-devel, linux-stm32,
	linux-rtc, linux-samsung-soc, linux-scsi, linux-rdma, qat-linux,
	amd-gfx, linux-pm, linux-mediatek, linux-rpi-kernel, linux-tegra,
	linux-amlogic, linux-nfs, netdev, linux-mmc, tipc-discussion,
	linux-crypto, linux-btrfs


On 11/9/20 6:52 PM, Joe Perches wrote:
> On Tue, 2020-10-27 at 09:42 -0700, trix@redhat.com wrote:
>> This rfc will describe
>> An upcoming treewide cleanup.
>> How clang tooling was used to programatically do the clean up.
>> Solicit opinions on how to generally use clang tooling.
>>
>> The clang warning -Wextra-semi-stmt produces about 10k warnings.
>> Reviewing these, a subset of semicolon after a switch looks safe to
>> fix all the time.  An example problem
>>
>> void foo(int a) {
>>      switch(a) {
>>      	       case 1:
>> 	       ...
>>      }; <--- extra semicolon
>> }
>>
>> Treewide, there are about 100 problems in 50 files for x86_64 allyesconfig.
>> These fixes will be the upcoming cleanup.
> coccinelle already does some of these.
>
> For instance: scripts/coccinelle/misc/semicolon.cocci
>
> Perhaps some tool coordination can be done here as
> coccinelle/checkpatch/clang/Lindent call all be used
> to do some facet or another of these cleanup issues.

Thanks for pointing this out.

I will take a look at it.

Tom

>
>

_______________________________________________
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel

^ permalink raw reply	[relevance 99%]

* [PATCH] drm/amd/display: remove unneeded semicolon
@ 2020-10-27 20:07 97% trix
  0 siblings, 0 replies; 180+ results
From: trix @ 2020-10-27 20:07 UTC (permalink / raw)
  To: harry.wentland, sunpeng.li, alexander.deucher, christian.koenig,
	airlied, daniel, Rodrigo.Siqueira, Anthony.Koo, Aric.Cyr,
	Tony.Cheng, Igor.Kravchenko, Charlene.Liu, colin.king,
	Wenjing.Liu, joseph.gravenor, Bhawanpreet.Lakha
  Cc: Tom Rix, dri-devel, amd-gfx, linux-kernel

From: Tom Rix <trix@redhat.com>

A semicolon is not needed after a switch statement.

Signed-off-by: Tom Rix <trix@redhat.com>
---
 drivers/gpu/drm/amd/display/dc/dce112/dce112_resource.c | 2 +-
 drivers/gpu/drm/amd/display/modules/hdcp/hdcp_log.c     | 2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/gpu/drm/amd/display/dc/dce112/dce112_resource.c b/drivers/gpu/drm/amd/display/dc/dce112/dce112_resource.c
index 7b4b2304bbff..5feb804af4be 100644
--- a/drivers/gpu/drm/amd/display/dc/dce112/dce112_resource.c
+++ b/drivers/gpu/drm/amd/display/dc/dce112/dce112_resource.c
@@ -858,7 +858,7 @@ static struct clock_source *find_matching_pll(
 		return pool->clock_sources[DCE112_CLK_SRC_PLL5];
 	default:
 		return NULL;
-	};
+	}
 
 	return 0;
 }
diff --git a/drivers/gpu/drm/amd/display/modules/hdcp/hdcp_log.c b/drivers/gpu/drm/amd/display/modules/hdcp/hdcp_log.c
index fb6a19d020f9..ee5230ccf3c4 100644
--- a/drivers/gpu/drm/amd/display/modules/hdcp/hdcp_log.c
+++ b/drivers/gpu/drm/amd/display/modules/hdcp/hdcp_log.c
@@ -280,6 +280,6 @@ char *mod_hdcp_state_id_to_str(int32_t id)
 		return "D2_A9_VALIDATE_STREAM_READY";
 	default:
 		return "UNKNOWN_STATE_ID";
-	};
+	}
 }
 
-- 
2.18.1

_______________________________________________
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel

^ permalink raw reply related	[relevance 97%]

* [PATCH] drm/amdgpu: remove unneeded semicolon
@ 2020-10-27 19:07 98% trix
  0 siblings, 0 replies; 180+ results
From: trix @ 2020-10-27 19:07 UTC (permalink / raw)
  To: alexander.deucher, christian.koenig, airlied, daniel,
	jonathan.kim, harish.kasiviswanathan, Felix.Kuehling, zhengbin13,
	luben.tuikov, Joseph.Greathouse, Hawking.Zhang, guchun.chen,
	john.clements, tao.zhou1, Dennis.Li, Stanley.Yang
  Cc: Tom Rix, dri-devel, amd-gfx, linux-kernel

From: Tom Rix <trix@redhat.com>

A semicolon is not needed after a switch statement.

Signed-off-by: Tom Rix <trix@redhat.com>
---
 drivers/gpu/drm/amd/amdgpu/amdgpu_pmu.c | 2 +-
 drivers/gpu/drm/amd/amdgpu/amdgpu_ras.c | 2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_pmu.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_pmu.c
index 1b213c4ddfcb..19c0a3655228 100644
--- a/drivers/gpu/drm/amd/amdgpu/amdgpu_pmu.c
+++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_pmu.c
@@ -654,7 +654,7 @@ int amdgpu_pmu_init(struct amdgpu_device *adev)
 
 	default:
 		return 0;
-	};
+	}
 
 	return ret;
 }
diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_ras.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_ras.c
index 8bf6a7c056bc..a61cf8cfbfc3 100644
--- a/drivers/gpu/drm/amd/amdgpu/amdgpu_ras.c
+++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_ras.c
@@ -953,7 +953,7 @@ static char *amdgpu_ras_badpage_flags_str(unsigned int flags)
 	case AMDGPU_RAS_RETIRE_PAGE_FAULT:
 	default:
 		return "F";
-	};
+	}
 }
 
 /**
-- 
2.18.1

_______________________________________________
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel

^ permalink raw reply related	[relevance 98%]

* Subject: [RFC] clang tooling cleanups
@ 2020-10-27 16:42 72% trix
    0 siblings, 1 reply; 180+ results
From: trix @ 2020-10-27 16:42 UTC (permalink / raw)
  To: linux-kernel, clang-built-linux
  Cc: alsa-devel, linux-aspeed, linux-iio, From : Tom Rix,
	dri-devel, linux-stm32, linux-rtc, linux-samsung-soc, linux-scsi,
	linux-rdma, qat-linux, amd-gfx, linux-pm, linux-mediatek,
	linux-rpi-kernel, linux-tegra, linux-amlogic, linux-nfs, netdev,
	linux-mmc, tipc-discussion, linux-crypto, linux-btrfs

This rfc will describe
An upcoming treewide cleanup.
How clang tooling was used to programatically do the clean up.
Solicit opinions on how to generally use clang tooling.

The clang warning -Wextra-semi-stmt produces about 10k warnings.
Reviewing these, a subset of semicolon after a switch looks safe to
fix all the time.  An example problem

void foo(int a) {
     switch(a) {
     	       case 1:
	       ...
     }; <--- extra semicolon
}

Treewide, there are about 100 problems in 50 files for x86_64 allyesconfig.
These fixes will be the upcoming cleanup.

clang already supports fixing this problem. Add to your command line

  clang -c -Wextra-semi-stmt -Xclang -fixit foo.c

  foo.c:8:3: warning: empty expression statement has no effect;
    remove unnecessary ';' to silence this warning [-Wextra-semi-stmt]
        };
         ^
  foo.c:8:3: note: FIX-IT applied suggested code changes
  1 warning generated.

The big problem is using this treewide is it will fix all 10k problems.
10k changes to analyze and upstream is not practical.

Another problem is the generic fixer only removes the semicolon.
So empty lines with some tabs need to be manually cleaned.

What is needed is a more precise fixer.

Enter clang-tidy.
https://clang.llvm.org/extra/clang-tidy/

Already part of the static checker infrastructure, invoke on the clang
build with
  make clang-tidy

It is only a matter of coding up a specific checker for the cleanup.
Upstream this is review is happening here
https://reviews.llvm.org/D90180

The development of a checker/fixer is
Start with a reproducer

void foo (int a) {
  switch (a) {};
}

Generate the abstract syntax tree (AST)

  clang -Xclang -ast-dump foo.c

`-FunctionDecl 
  |-ParmVarDecl 
  `-CompoundStmt 
    |-SwitchStmt 
    | |-ImplicitCastExpr
    | | `-DeclRefExpr
    | `-CompoundStmt
    `-NullStmt

Write a matcher to get you most of the way

void SwitchSemiCheck::registerMatchers(MatchFinder *Finder) {
  Finder->addMatcher(
      compoundStmt(has(switchStmt().bind("switch"))).bind("comp"), this);
}

The 'bind' method is important, it allows a string to be associated
with a node in the AST.  In this case these are

`-FunctionDecl 
  |-ParmVarDecl 
  `-CompoundStmt <-------- comp
    |-SwitchStmt <-------- switch
    | |-ImplicitCastExpr
    | | `-DeclRefExpr
    | `-CompoundStmt
    `-NullStmt

When a match is made the 'check' method will be called.

  void SwitchSemiCheck::check(const MatchFinder::MatchResult &Result) {
    auto *C = Result.Nodes.getNodeAs<CompoundStmt>("comp");
    auto *S = Result.Nodes.getNodeAs<SwitchStmt>("switch");

This is where the string in the bind calls are changed to nodes

`-FunctionDecl 
  |-ParmVarDecl 
  `-CompoundStmt <-------- comp, C
    |-SwitchStmt <-------- switch, S
    | |-ImplicitCastExpr
    | | `-DeclRefExpr
    | `-CompoundStmt
    `-NullStmt <---------- looking for N

And then more logic to find the NullStmt

  auto Current = C->body_begin();
  auto Next = Current;
  Next++;
  while (Next != C->body_end()) {
    if (*Current == S) {
      if (const auto *N = dyn_cast<NullStmt>(*Next)) {

When it is found, a warning is printed and a FixItHint is proposed.

  auto H = FixItHint::CreateReplacement(
    SourceRange(S->getBody()->getEndLoc(), N->getSemiLoc()), "}");
  diag(N->getSemiLoc(), "unneeded semicolon") << H;

This fixit replaces from the end of switch to the semicolon with a
'}'.  Because the end of the switch is '}' this has the effect of
removing all the whitespace as well as the semicolon.

Because of the checker's placement in clang-tidy existing linuxkernel
checkers, all that was needed to fix the tree was to add a '-fix'to the
build's clang-tidy call.

I am looking for opinions on what we want to do specifically with
cleanups and generally about other source-to-source programmatic
changes to the code base.

For cleanups, I think we need a new toplevel target

clang-tidy-fix

And an explicit list of fixers that have a very high (100%?) fix rate.

Ideally a bot should make the changes, but a bot could also nag folks.
Is there interest in a bot making the changes? Does one already exist?

The general source-to-source is a bit blue sky.  Ex/ could automagicly
refactor api, outline similar cut-n-pasted functions etc. Anything on
someone's wishlist you want to try out ?

Signed-off-by: Tom Rix <trix@redhat.com>

_______________________________________________
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel

^ permalink raw reply	[relevance 72%]

* Re: [RFC] treewide: cleanup unreachable breaks
  @ 2020-10-20 14:09 90%       ` Tom Rix
  0 siblings, 0 replies; 180+ results
From: Tom Rix @ 2020-10-20 14:09 UTC (permalink / raw)
  To: Jason Gunthorpe, Nick Desaulniers
  Cc: alsa-devel, clang-built-linux, Greg KH, linux-iio, nouveau,
	storagedev, dri-devel, virtualization, keyrings, linux-mtd,
	ath10k, linux-stm32, usb-storage, linux-watchdog, devel,
	linux-samsung-soc, linux-scsi, linux-nvdimm, amd-gfx list,
	linux-acpi, intel-wired-lan, industrypack-devel, linux-pci,
	spice-devel, MPT-FusionLinux.pdl, linux-media, linux-serial,
	linux-nfc, linux-pm, linux-can, linux-block, linux-gpio,
	xen-devel, linux-amlogic, openipmi-developer,
	platform-driver-x86, linux-integrity, Linux ARM, linux-edac,
	George Burgess, Network Development, linux-usb, linux-wireless,
	LKML, linux-security-module,
	open list:HARDWARE RANDOM NUMBER GENERATOR CORE, patches, bpf,
	ocfs2-devel, linux-power


On 10/19/20 4:05 PM, Jason Gunthorpe wrote:
> On Mon, Oct 19, 2020 at 12:42:15PM -0700, Nick Desaulniers wrote:
>> On Sat, Oct 17, 2020 at 10:43 PM Greg KH <gregkh@linuxfoundation.org> wrote:
>>> On Sat, Oct 17, 2020 at 09:09:28AM -0700, trix@redhat.com wrote:
>>>> From: Tom Rix <trix@redhat.com>
>>>>
>>>> This is a upcoming change to clean up a new warning treewide.
>>>> I am wondering if the change could be one mega patch (see below) or
>>>> normal patch per file about 100 patches or somewhere half way by collecting
>>>> early acks.
>>> Please break it up into one-patch-per-subsystem, like normal, and get it
>>> merged that way.
>>>
>>> Sending us a patch, without even a diffstat to review, isn't going to
>>> get you very far...
>> Tom,
>> If you're able to automate this cleanup, I suggest checking in a
>> script that can be run on a directory.  Then for each subsystem you
>> can say in your commit "I ran scripts/fix_whatever.py on this subdir."
>>  Then others can help you drive the tree wide cleanup.  Then we can
>> enable -Wunreachable-code-break either by default, or W=2 right now
>> might be a good idea.
> I remember using clang-modernize in the past to fix issues very
> similar to this, if clang machinery can generate the warning, can't
> something like clang-tidy directly generate the patch?

Yes clang-tidy and similar are good tools.

Sometimes they change too much and your time shifts

from editing to analyzing and dropping changes.


I am looking at them for auto changing api.

When i have something greater than half baked i will post.

Tom

>
> You can send me a patch for drivers/infiniband/* as well
>
> Thanks,
> Jason
>

_______________________________________________
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel

^ permalink raw reply	[relevance 90%]

* Re: [RFC] treewide: cleanup unreachable breaks
    @ 2020-10-20 13:55 89%     ` Tom Rix
  1 sibling, 0 replies; 180+ results
From: Tom Rix @ 2020-10-20 13:55 UTC (permalink / raw)
  To: Nick Desaulniers
  Cc: alsa-devel, clang-built-linux, Greg KH, linux-iio, nouveau,
	storagedev, dri-devel, virtualization, keyrings, linux-mtd,
	ath10k, linux-stm32, usb-storage, linux-watchdog, devel,
	linux-samsung-soc, linux-scsi, linux-nvdimm, amd-gfx list,
	linux-acpi, intel-wired-lan, industrypack-devel, linux-pci,
	spice-devel, MPT-FusionLinux.pdl, linux-media, linux-serial,
	linux-nfc, linux-pm, linux-can, linux-block, linux-gpio,
	xen-devel, linux-amlogic, openipmi-developer,
	platform-driver-x86, linux-integrity, Linux ARM, linux-edac,
	George Burgess, Network Development, linux-usb, linux-wireless,
	LKML, linux-security-module,
	open list:HARDWARE RANDOM NUMBER GENERATOR CORE, patches,
	Joe Perches, bpf, ocfs2-devel, linux-power


On 10/19/20 12:42 PM, Nick Desaulniers wrote:
> On Sat, Oct 17, 2020 at 10:43 PM Greg KH <gregkh@linuxfoundation.org> wrote:
>> On Sat, Oct 17, 2020 at 09:09:28AM -0700, trix@redhat.com wrote:
>>> From: Tom Rix <trix@redhat.com>
>>>
>>> This is a upcoming change to clean up a new warning treewide.
>>> I am wondering if the change could be one mega patch (see below) or
>>> normal patch per file about 100 patches or somewhere half way by collecting
>>> early acks.
>> Please break it up into one-patch-per-subsystem, like normal, and get it
>> merged that way.
>>
>> Sending us a patch, without even a diffstat to review, isn't going to
>> get you very far...
> Tom,
> If you're able to automate this cleanup, I suggest checking in a
> script that can be run on a directory.  Then for each subsystem you
> can say in your commit "I ran scripts/fix_whatever.py on this subdir."
>  Then others can help you drive the tree wide cleanup.  Then we can
> enable -Wunreachable-code-break either by default, or W=2 right now
> might be a good idea.

I should have waited for Joe Perches's fixer addition to checkpatch :)

The easy fixes I did only cover about 1/2 of the problems.

Remaining are mostly nested switches, which from a complexity standpoint is bad.

>
> Ah, George (gbiv@, cc'ed), did an analysis recently of
> `-Wunreachable-code-loop-increment`, `-Wunreachable-code-break`, and
> `-Wunreachable-code-return` for Android userspace.  From the review:
> ```
> Spoilers: of these, it seems useful to turn on
> -Wunreachable-code-loop-increment and -Wunreachable-code-return by
> default for Android

In my simple add-a-cflag bot, i see there are about 250

issues for -Wunreachable-code-return.

I'll see about doing this one next.

> ...
> While these conventions about always having break arguably became
> obsolete when we enabled -Wfallthrough, my sample turned up zero
> potential bugs caught by this warning, and we'd need to put a lot of
> effort into getting a clean tree. So this warning doesn't seem to be
> worth it.
> ```
> Looks like there's an order of magnitude of `-Wunreachable-code-break`
> than the other two.
>
> We probably should add all 3 to W=2 builds (wrapped in cc-option).
> I've filed https://github.com/ClangBuiltLinux/linux/issues/1180 to
> follow up on.

Yes, i think think these should be added.

Tom

_______________________________________________
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel

^ permalink raw reply	[relevance 89%]

* [PATCH] drm: remove unneeded break
@ 2020-10-19 16:31 82% trix
  0 siblings, 0 replies; 180+ results
From: trix @ 2020-10-19 16:31 UTC (permalink / raw)
  To: airlied, tzimmermann, airlied, daniel, bskeggs, kraxel, gustavoars
  Cc: nouveau, linux-kernel, dri-devel, virtualization, Tom Rix, spice-devel

From: Tom Rix <trix@redhat.com>

A break is not needed if it is preceded by a return or break

Signed-off-by: Tom Rix <trix@redhat.com>
---
 drivers/gpu/drm/mgag200/mgag200_mode.c           | 5 -----
 drivers/gpu/drm/nouveau/nvkm/subdev/bios/pll.c   | 1 -
 drivers/gpu/drm/nouveau/nvkm/subdev/clk/mcp77.c  | 3 ---
 drivers/gpu/drm/nouveau/nvkm/subdev/fb/ramnv50.c | 1 -
 drivers/gpu/drm/nouveau/nvkm/subdev/top/gk104.c  | 1 -
 drivers/gpu/drm/qxl/qxl_ioctl.c                  | 1 -
 6 files changed, 12 deletions(-)

diff --git a/drivers/gpu/drm/mgag200/mgag200_mode.c b/drivers/gpu/drm/mgag200/mgag200_mode.c
index 38672f9e5c4f..bbe4e60dfd08 100644
--- a/drivers/gpu/drm/mgag200/mgag200_mode.c
+++ b/drivers/gpu/drm/mgag200/mgag200_mode.c
@@ -794,21 +794,16 @@ static int mgag200_crtc_set_plls(struct mga_device *mdev, long clock)
 	case G200_SE_A:
 	case G200_SE_B:
 		return mga_g200se_set_plls(mdev, clock);
-		break;
 	case G200_WB:
 	case G200_EW3:
 		return mga_g200wb_set_plls(mdev, clock);
-		break;
 	case G200_EV:
 		return mga_g200ev_set_plls(mdev, clock);
-		break;
 	case G200_EH:
 	case G200_EH3:
 		return mga_g200eh_set_plls(mdev, clock);
-		break;
 	case G200_ER:
 		return mga_g200er_set_plls(mdev, clock);
-		break;
 	}
 
 	misc = RREG8(MGA_MISC_IN);
diff --git a/drivers/gpu/drm/nouveau/nvkm/subdev/bios/pll.c b/drivers/gpu/drm/nouveau/nvkm/subdev/bios/pll.c
index 350f10a3de37..2ec84b8a3b3a 100644
--- a/drivers/gpu/drm/nouveau/nvkm/subdev/bios/pll.c
+++ b/drivers/gpu/drm/nouveau/nvkm/subdev/bios/pll.c
@@ -123,7 +123,6 @@ pll_map(struct nvkm_bios *bios)
 	case NV_20:
 	case NV_30:
 		return nv04_pll_mapping;
-		break;
 	case NV_40:
 		return nv40_pll_mapping;
 	case NV_50:
diff --git a/drivers/gpu/drm/nouveau/nvkm/subdev/clk/mcp77.c b/drivers/gpu/drm/nouveau/nvkm/subdev/clk/mcp77.c
index efa50274df97..4884eb4a9221 100644
--- a/drivers/gpu/drm/nouveau/nvkm/subdev/clk/mcp77.c
+++ b/drivers/gpu/drm/nouveau/nvkm/subdev/clk/mcp77.c
@@ -140,17 +140,14 @@ mcp77_clk_read(struct nvkm_clk *base, enum nv_clk_src src)
 		break;
 	case nv_clk_src_mem:
 		return 0;
-		break;
 	case nv_clk_src_vdec:
 		P = (read_div(clk) & 0x00000700) >> 8;
 
 		switch (mast & 0x00400000) {
 		case 0x00400000:
 			return nvkm_clk_read(&clk->base, nv_clk_src_core) >> P;
-			break;
 		default:
 			return 500000 >> P;
-			break;
 		}
 		break;
 	default:
diff --git a/drivers/gpu/drm/nouveau/nvkm/subdev/fb/ramnv50.c b/drivers/gpu/drm/nouveau/nvkm/subdev/fb/ramnv50.c
index 2ccb4b6be153..7b1eb44ff3da 100644
--- a/drivers/gpu/drm/nouveau/nvkm/subdev/fb/ramnv50.c
+++ b/drivers/gpu/drm/nouveau/nvkm/subdev/fb/ramnv50.c
@@ -171,7 +171,6 @@ nv50_ram_timing_read(struct nv50_ram *ram, u32 *timing)
 		break;
 	default:
 		return -ENOSYS;
-		break;
 	}
 
 	T(WR) = ((timing[1] >> 24) & 0xff) - 1 - T(CWL);
diff --git a/drivers/gpu/drm/nouveau/nvkm/subdev/top/gk104.c b/drivers/gpu/drm/nouveau/nvkm/subdev/top/gk104.c
index e01746ce9fc4..1156634533f9 100644
--- a/drivers/gpu/drm/nouveau/nvkm/subdev/top/gk104.c
+++ b/drivers/gpu/drm/nouveau/nvkm/subdev/top/gk104.c
@@ -90,7 +90,6 @@ gk104_top_oneinit(struct nvkm_top *top)
 		case 0x00000010: B_(NVDEC ); break;
 		case 0x00000013: B_(CE    ); break;
 		case 0x00000014: C_(GSP   ); break;
-			break;
 		default:
 			break;
 		}
diff --git a/drivers/gpu/drm/qxl/qxl_ioctl.c b/drivers/gpu/drm/qxl/qxl_ioctl.c
index 5cea6eea72ab..2072ddc9549c 100644
--- a/drivers/gpu/drm/qxl/qxl_ioctl.c
+++ b/drivers/gpu/drm/qxl/qxl_ioctl.c
@@ -160,7 +160,6 @@ static int qxl_process_single_command(struct qxl_device *qdev,
 	default:
 		DRM_DEBUG("Only draw commands in execbuffers\n");
 		return -EINVAL;
-		break;
 	}
 
 	if (cmd->command_size > PAGE_SIZE - sizeof(union qxl_release_info))
-- 
2.18.1

_______________________________________________
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel

^ permalink raw reply related	[relevance 82%]

* [PATCH] drm/amdgpu: remove unneeded break
@ 2020-10-19 14:43 74% trix
  0 siblings, 0 replies; 180+ results
From: trix @ 2020-10-19 14:43 UTC (permalink / raw)
  To: harry.wentland, sunpeng.li, alexander.deucher, christian.koenig,
	airlied, daniel, issor.oruam, Anthony.Koo, Rodrigo.Siqueira,
	Tony.Cheng, Charlene.Liu, yogesh.mohanmarimuthu, Aric.Cyr,
	Igor.Kravchenko, colin.king, tao.zhou1, Dennis.Li,
	mario.kleiner.de
  Cc: Tom Rix, dri-devel, amd-gfx, linux-kernel

From: Tom Rix <trix@redhat.com>

A break is not needed if it is preceded by a return or break

Signed-off-by: Tom Rix <trix@redhat.com>
---
 drivers/gpu/drm/amd/display/dc/dce/dce_transform.c      | 1 -
 drivers/gpu/drm/amd/display/dc/dce100/dce100_resource.c | 7 -------
 drivers/gpu/drm/amd/display/dc/dce110/dce110_resource.c | 7 -------
 drivers/gpu/drm/amd/display/dc/dce112/dce112_resource.c | 7 -------
 drivers/gpu/drm/amd/display/dc/dce120/dce120_resource.c | 7 -------
 drivers/gpu/drm/amd/display/dc/dce60/dce60_resource.c   | 7 -------
 drivers/gpu/drm/amd/display/dc/dce80/dce80_resource.c   | 7 -------
 7 files changed, 43 deletions(-)

diff --git a/drivers/gpu/drm/amd/display/dc/dce/dce_transform.c b/drivers/gpu/drm/amd/display/dc/dce/dce_transform.c
index 2a32b66959ba..130a0a0c8332 100644
--- a/drivers/gpu/drm/amd/display/dc/dce/dce_transform.c
+++ b/drivers/gpu/drm/amd/display/dc/dce/dce_transform.c
@@ -1330,7 +1330,6 @@ static bool configure_graphics_mode(
 			REG_SET(OUTPUT_CSC_CONTROL, 0,
 				OUTPUT_CSC_GRPH_MODE, 0);
 			break;
-			break;
 		case COLOR_SPACE_SRGB_LIMITED:
 			/* TV RGB */
 			REG_SET(OUTPUT_CSC_CONTROL, 0,
diff --git a/drivers/gpu/drm/amd/display/dc/dce100/dce100_resource.c b/drivers/gpu/drm/amd/display/dc/dce100/dce100_resource.c
index d741787f75dc..42c7d157da32 100644
--- a/drivers/gpu/drm/amd/display/dc/dce100/dce100_resource.c
+++ b/drivers/gpu/drm/amd/display/dc/dce100/dce100_resource.c
@@ -418,25 +418,18 @@ static int map_transmitter_id_to_phy_instance(
 	switch (transmitter) {
 	case TRANSMITTER_UNIPHY_A:
 		return 0;
-	break;
 	case TRANSMITTER_UNIPHY_B:
 		return 1;
-	break;
 	case TRANSMITTER_UNIPHY_C:
 		return 2;
-	break;
 	case TRANSMITTER_UNIPHY_D:
 		return 3;
-	break;
 	case TRANSMITTER_UNIPHY_E:
 		return 4;
-	break;
 	case TRANSMITTER_UNIPHY_F:
 		return 5;
-	break;
 	case TRANSMITTER_UNIPHY_G:
 		return 6;
-	break;
 	default:
 		ASSERT(0);
 		return 0;
diff --git a/drivers/gpu/drm/amd/display/dc/dce110/dce110_resource.c b/drivers/gpu/drm/amd/display/dc/dce110/dce110_resource.c
index 2bbfa2e176a9..382581c4a674 100644
--- a/drivers/gpu/drm/amd/display/dc/dce110/dce110_resource.c
+++ b/drivers/gpu/drm/amd/display/dc/dce110/dce110_resource.c
@@ -471,25 +471,18 @@ static int map_transmitter_id_to_phy_instance(
 	switch (transmitter) {
 	case TRANSMITTER_UNIPHY_A:
 		return 0;
-	break;
 	case TRANSMITTER_UNIPHY_B:
 		return 1;
-	break;
 	case TRANSMITTER_UNIPHY_C:
 		return 2;
-	break;
 	case TRANSMITTER_UNIPHY_D:
 		return 3;
-	break;
 	case TRANSMITTER_UNIPHY_E:
 		return 4;
-	break;
 	case TRANSMITTER_UNIPHY_F:
 		return 5;
-	break;
 	case TRANSMITTER_UNIPHY_G:
 		return 6;
-	break;
 	default:
 		ASSERT(0);
 		return 0;
diff --git a/drivers/gpu/drm/amd/display/dc/dce112/dce112_resource.c b/drivers/gpu/drm/amd/display/dc/dce112/dce112_resource.c
index b622b4b1dac3..7b4b2304bbff 100644
--- a/drivers/gpu/drm/amd/display/dc/dce112/dce112_resource.c
+++ b/drivers/gpu/drm/amd/display/dc/dce112/dce112_resource.c
@@ -446,25 +446,18 @@ static int map_transmitter_id_to_phy_instance(
 	switch (transmitter) {
 	case TRANSMITTER_UNIPHY_A:
 		return 0;
-	break;
 	case TRANSMITTER_UNIPHY_B:
 		return 1;
-	break;
 	case TRANSMITTER_UNIPHY_C:
 		return 2;
-	break;
 	case TRANSMITTER_UNIPHY_D:
 		return 3;
-	break;
 	case TRANSMITTER_UNIPHY_E:
 		return 4;
-	break;
 	case TRANSMITTER_UNIPHY_F:
 		return 5;
-	break;
 	case TRANSMITTER_UNIPHY_G:
 		return 6;
-	break;
 	default:
 		ASSERT(0);
 		return 0;
diff --git a/drivers/gpu/drm/amd/display/dc/dce120/dce120_resource.c b/drivers/gpu/drm/amd/display/dc/dce120/dce120_resource.c
index 16fe7344702f..3d782b7c86cb 100644
--- a/drivers/gpu/drm/amd/display/dc/dce120/dce120_resource.c
+++ b/drivers/gpu/drm/amd/display/dc/dce120/dce120_resource.c
@@ -383,25 +383,18 @@ static int map_transmitter_id_to_phy_instance(
 	switch (transmitter) {
 	case TRANSMITTER_UNIPHY_A:
 		return 0;
-	break;
 	case TRANSMITTER_UNIPHY_B:
 		return 1;
-	break;
 	case TRANSMITTER_UNIPHY_C:
 		return 2;
-	break;
 	case TRANSMITTER_UNIPHY_D:
 		return 3;
-	break;
 	case TRANSMITTER_UNIPHY_E:
 		return 4;
-	break;
 	case TRANSMITTER_UNIPHY_F:
 		return 5;
-	break;
 	case TRANSMITTER_UNIPHY_G:
 		return 6;
-	break;
 	default:
 		ASSERT(0);
 		return 0;
diff --git a/drivers/gpu/drm/amd/display/dc/dce60/dce60_resource.c b/drivers/gpu/drm/amd/display/dc/dce60/dce60_resource.c
index 5a5a9cb77acb..e9dd78c484d6 100644
--- a/drivers/gpu/drm/amd/display/dc/dce60/dce60_resource.c
+++ b/drivers/gpu/drm/amd/display/dc/dce60/dce60_resource.c
@@ -453,25 +453,18 @@ static int map_transmitter_id_to_phy_instance(
 	switch (transmitter) {
 	case TRANSMITTER_UNIPHY_A:
 		return 0;
-	break;
 	case TRANSMITTER_UNIPHY_B:
 		return 1;
-	break;
 	case TRANSMITTER_UNIPHY_C:
 		return 2;
-	break;
 	case TRANSMITTER_UNIPHY_D:
 		return 3;
-	break;
 	case TRANSMITTER_UNIPHY_E:
 		return 4;
-	break;
 	case TRANSMITTER_UNIPHY_F:
 		return 5;
-	break;
 	case TRANSMITTER_UNIPHY_G:
 		return 6;
-	break;
 	default:
 		ASSERT(0);
 		return 0;
diff --git a/drivers/gpu/drm/amd/display/dc/dce80/dce80_resource.c b/drivers/gpu/drm/amd/display/dc/dce80/dce80_resource.c
index 0eae8cd35f9a..9dbf658162cd 100644
--- a/drivers/gpu/drm/amd/display/dc/dce80/dce80_resource.c
+++ b/drivers/gpu/drm/amd/display/dc/dce80/dce80_resource.c
@@ -458,25 +458,18 @@ static int map_transmitter_id_to_phy_instance(
 	switch (transmitter) {
 	case TRANSMITTER_UNIPHY_A:
 		return 0;
-	break;
 	case TRANSMITTER_UNIPHY_B:
 		return 1;
-	break;
 	case TRANSMITTER_UNIPHY_C:
 		return 2;
-	break;
 	case TRANSMITTER_UNIPHY_D:
 		return 3;
-	break;
 	case TRANSMITTER_UNIPHY_E:
 		return 4;
-	break;
 	case TRANSMITTER_UNIPHY_F:
 		return 5;
-	break;
 	case TRANSMITTER_UNIPHY_G:
 		return 6;
-	break;
 	default:
 		ASSERT(0);
 		return 0;
-- 
2.18.1

_______________________________________________
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel

^ permalink raw reply related	[relevance 74%]

* Re: [RFC] treewide: cleanup unreachable breaks
  @ 2020-10-18 14:04 95%   ` Tom Rix
    1 sibling, 0 replies; 180+ results
From: Tom Rix @ 2020-10-18 14:04 UTC (permalink / raw)
  To: Greg KH
  Cc: alsa-devel, clang-built-linux, linux-iio, nouveau, storagedev,
	dri-devel, virtualization, keyrings, linux-mtd, ath10k,
	linux-stm32, usb-storage, linux-watchdog, devel,
	linux-samsung-soc, linux-scsi, linux-nvdimm, amd-gfx, linux-acpi,
	intel-wired-lan, industrypack-devel, linux-pci, spice-devel,
	MPT-FusionLinux.pdl, linux-media, linux-serial, linux-nfc,
	linux-pm, linux-can, linux-block, linux-gpio, xen-devel,
	linux-amlogic, openipmi-developer, platform-driver-x86,
	linux-integrity, linux-arm-kernel, linux-edac, netdev, linux-usb,
	linux-wireless, linux-kernel, linux-security-module,
	linux-crypto, patches, bpf, ocfs2-devel, linux-power


On 10/17/20 10:43 PM, Greg KH wrote:
> On Sat, Oct 17, 2020 at 09:09:28AM -0700, trix@redhat.com wrote:
>> From: Tom Rix <trix@redhat.com>
>>
>> This is a upcoming change to clean up a new warning treewide.
>> I am wondering if the change could be one mega patch (see below) or
>> normal patch per file about 100 patches or somewhere half way by collecting
>> early acks.
> Please break it up into one-patch-per-subsystem, like normal, and get it
> merged that way.

OK.

Thanks,

Tom

>
> Sending us a patch, without even a diffstat to review, isn't going to
> get you very far...
>
> thanks,
>
> greg k-h
>

_______________________________________________
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel

^ permalink raw reply	[relevance 95%]

* [RFC] treewide: cleanup unreachable breaks
@ 2020-10-17 16:09 15% trix
    0 siblings, 1 reply; 180+ results
From: trix @ 2020-10-17 16:09 UTC (permalink / raw)
  To: linux-kernel
  Cc: alsa-devel, clang-built-linux, linux-iio, nouveau, storagedev,
	dri-devel, virtualization, keyrings, linux-mtd, ath10k,
	linux-stm32, usb-storage, linux-watchdog, devel,
	linux-samsung-soc, linux-scsi, linux-nvdimm, amd-gfx, linux-acpi,
	intel-wired-lan, industrypack-devel, linux-pci, spice-devel,
	MPT-FusionLinux.pdl, linux-media, linux-serial, linux-nfc,
	linux-pm, Tom Rix, linux-can, linux-block, linux-gpio, xen-devel,
	linux-amlogic, openipmi-developer, platform-driver-x86,
	linux-integrity, linux-arm-kernel, linux-edac, netdev, linux-usb,
	linux-wireless, linux-security-module, linux-crypto, patches,
	bpf, ocfs2-devel, linux-power

From: Tom Rix <trix@redhat.com>

This is a upcoming change to clean up a new warning treewide.
I am wondering if the change could be one mega patch (see below) or
normal patch per file about 100 patches or somewhere half way by collecting
early acks.

clang has a number of useful, new warnings see
https://clang.llvm.org/docs/DiagnosticsReference.html

This change cleans up -Wunreachable-code-break
https://clang.llvm.org/docs/DiagnosticsReference.html#wunreachable-code-break
for 266 of 485 warnings in this week's linux-next, allyesconfig on x86_64.

The method of fixing was to look for warnings where the preceding statement
was a simple statement and by inspection made the subsequent break unneeded.
In order of frequency these look like

return and break

 	switch (c->x86_vendor) {
 	case X86_VENDOR_INTEL:
 		intel_p5_mcheck_init(c);
 		return 1;
-		break;

goto and break

 	default:
 		operation = 0; /* make gcc happy */
 		goto fail_response;
-		break;

break and break
 		case COLOR_SPACE_SRGB:
 			/* by pass */
 			REG_SET(OUTPUT_CSC_CONTROL, 0,
 				OUTPUT_CSC_GRPH_MODE, 0);
 			break;
-			break;

The exception to the simple statement, is a switch case with a block
and the end of block is a return

 			struct obj_buffer *buff = r->ptr;
 			return scnprintf(str, PRIV_STR_SIZE,
 					"size=%u\naddr=0x%X\n", buff->size,
 					buff->addr);
 		}
-		break;

Not considered obvious and excluded, breaks after
multi level switches
complicated if-else if-else blocks
panic() or similar calls

And there is an odd addition of a 'fallthrough' in drivers/tty/nozomi.c

Tom

---

diff --git a/arch/x86/kernel/cpu/mce/core.c b/arch/x86/kernel/cpu/mce/core.c
index 1c08cb9eb9f6..16ce86aed8e2 100644
--- a/arch/x86/kernel/cpu/mce/core.c
+++ b/arch/x86/kernel/cpu/mce/core.c
@@ -1809,15 +1809,13 @@ static int __mcheck_cpu_ancient_init(struct cpuinfo_x86 *c)
 
 	switch (c->x86_vendor) {
 	case X86_VENDOR_INTEL:
 		intel_p5_mcheck_init(c);
 		return 1;
-		break;
 	case X86_VENDOR_CENTAUR:
 		winchip_mcheck_init(c);
 		return 1;
-		break;
 	default:
 		return 0;
 	}
 
 	return 0;
diff --git a/arch/x86/kernel/cpu/microcode/amd.c b/arch/x86/kernel/cpu/microcode/amd.c
index 3f6b137ef4e6..3d4a48336084 100644
--- a/arch/x86/kernel/cpu/microcode/amd.c
+++ b/arch/x86/kernel/cpu/microcode/amd.c
@@ -213,11 +213,10 @@ static unsigned int __verify_patch_size(u8 family, u32 sh_psize, size_t buf_size
 		max_size = F14H_MPB_MAX_SIZE;
 		break;
 	default:
 		WARN(1, "%s: WTF family: 0x%x\n", __func__, family);
 		return 0;
-		break;
 	}
 
 	if (sh_psize > min_t(u32, buf_size, max_size))
 		return 0;
 
diff --git a/drivers/acpi/utils.c b/drivers/acpi/utils.c
index 838b719ec7ce..d5411a166685 100644
--- a/drivers/acpi/utils.c
+++ b/drivers/acpi/utils.c
@@ -102,11 +102,10 @@ acpi_extract_package(union acpi_object *package,
 				printk(KERN_WARNING PREFIX "Invalid package element"
 					      " [%d]: got number, expecting"
 					      " [%c]\n",
 					      i, format_string[i]);
 				return AE_BAD_DATA;
-				break;
 			}
 			break;
 
 		case ACPI_TYPE_STRING:
 		case ACPI_TYPE_BUFFER:
@@ -127,11 +126,10 @@ acpi_extract_package(union acpi_object *package,
 				printk(KERN_WARNING PREFIX "Invalid package element"
 					      " [%d] got string/buffer,"
 					      " expecting [%c]\n",
 					      i, format_string[i]);
 				return AE_BAD_DATA;
-				break;
 			}
 			break;
 		case ACPI_TYPE_LOCAL_REFERENCE:
 			switch (format_string[i]) {
 			case 'R':
@@ -142,22 +140,20 @@ acpi_extract_package(union acpi_object *package,
 				printk(KERN_WARNING PREFIX "Invalid package element"
 					      " [%d] got reference,"
 					      " expecting [%c]\n",
 					      i, format_string[i]);
 				return AE_BAD_DATA;
-				break;
 			}
 			break;
 
 		case ACPI_TYPE_PACKAGE:
 		default:
 			ACPI_DEBUG_PRINT((ACPI_DB_INFO,
 					  "Found unsupported element at index=%d\n",
 					  i));
 			/* TBD: handle nested packages... */
 			return AE_SUPPORT;
-			break;
 		}
 	}
 
 	/*
 	 * Validate output buffer.
diff --git a/drivers/base/power/main.c b/drivers/base/power/main.c
index 205a06752ca9..c7ac49042cee 100644
--- a/drivers/base/power/main.c
+++ b/drivers/base/power/main.c
@@ -361,11 +361,10 @@ static pm_callback_t pm_op(const struct dev_pm_ops *ops, pm_message_t state)
 	case PM_EVENT_HIBERNATE:
 		return ops->poweroff;
 	case PM_EVENT_THAW:
 	case PM_EVENT_RECOVER:
 		return ops->thaw;
-		break;
 	case PM_EVENT_RESTORE:
 		return ops->restore;
 #endif /* CONFIG_HIBERNATE_CALLBACKS */
 	}
 
diff --git a/drivers/block/xen-blkback/blkback.c b/drivers/block/xen-blkback/blkback.c
index adfc9352351d..f769fbd1b4c4 100644
--- a/drivers/block/xen-blkback/blkback.c
+++ b/drivers/block/xen-blkback/blkback.c
@@ -1267,11 +1267,10 @@ static int dispatch_rw_block_io(struct xen_blkif_ring *ring,
 		operation_flags = REQ_PREFLUSH;
 		break;
 	default:
 		operation = 0; /* make gcc happy */
 		goto fail_response;
-		break;
 	}
 
 	/* Check that the number of segments is sane. */
 	nseg = req->operation == BLKIF_OP_INDIRECT ?
 	       req->u.indirect.nr_segments : req->u.rw.nr_segments;
diff --git a/drivers/char/ipmi/ipmi_devintf.c b/drivers/char/ipmi/ipmi_devintf.c
index f7b1c004a12b..3dd1d5abb298 100644
--- a/drivers/char/ipmi/ipmi_devintf.c
+++ b/drivers/char/ipmi/ipmi_devintf.c
@@ -488,11 +488,10 @@ static long ipmi_ioctl(struct file   *file,
 			rv = -EFAULT;
 			break;
 		}
 
 		return ipmi_set_my_address(priv->user, val.channel, val.value);
-		break;
 	}
 
 	case IPMICTL_GET_MY_CHANNEL_ADDRESS_CMD:
 	{
 		struct ipmi_channel_lun_address_set val;
diff --git a/drivers/char/lp.c b/drivers/char/lp.c
index 0ec73917d8dd..862c2fd933c7 100644
--- a/drivers/char/lp.c
+++ b/drivers/char/lp.c
@@ -620,11 +620,10 @@ static int lp_do_ioctl(unsigned int minor, unsigned int cmd,
 		case LPWAIT:
 			LP_WAIT(minor) = arg;
 			break;
 		case LPSETIRQ:
 			return -EINVAL;
-			break;
 		case LPGETIRQ:
 			if (copy_to_user(argp, &LP_IRQ(minor),
 					sizeof(int)))
 				return -EFAULT;
 			break;
diff --git a/drivers/char/mwave/mwavedd.c b/drivers/char/mwave/mwavedd.c
index e43c876a9223..11272d605ecd 100644
--- a/drivers/char/mwave/mwavedd.c
+++ b/drivers/char/mwave/mwavedd.c
@@ -401,11 +401,10 @@ static long mwave_ioctl(struct file *file, unsigned int iocmd,
 		}
 			break;
 	
 		default:
 			return -ENOTTY;
-			break;
 	} /* switch */
 
 	PRINTK_2(TRACE_MWAVE, "mwavedd::mwave_ioctl, exit retval %x\n", retval);
 
 	return retval;
diff --git a/drivers/crypto/atmel-sha.c b/drivers/crypto/atmel-sha.c
index 75ccf41a7cb9..0eb6f54e3b66 100644
--- a/drivers/crypto/atmel-sha.c
+++ b/drivers/crypto/atmel-sha.c
@@ -457,11 +457,10 @@ static int atmel_sha_init(struct ahash_request *req)
 		ctx->flags |= SHA_FLAGS_SHA512;
 		ctx->block_size = SHA512_BLOCK_SIZE;
 		break;
 	default:
 		return -EINVAL;
-		break;
 	}
 
 	ctx->bufcnt = 0;
 	ctx->digcnt[0] = 0;
 	ctx->digcnt[1] = 0;
diff --git a/drivers/edac/amd64_edac.c b/drivers/edac/amd64_edac.c
index fcc08bbf6945..386a3a4cf279 100644
--- a/drivers/edac/amd64_edac.c
+++ b/drivers/edac/amd64_edac.c
@@ -2459,38 +2459,30 @@ static int map_err_sym_to_channel(int err_sym, int sym_size)
 	if (sym_size == 4)
 		switch (err_sym) {
 		case 0x20:
 		case 0x21:
 			return 0;
-			break;
 		case 0x22:
 		case 0x23:
 			return 1;
-			break;
 		default:
 			return err_sym >> 4;
-			break;
 		}
 	/* x8 symbols */
 	else
 		switch (err_sym) {
 		/* imaginary bits not in a DIMM */
 		case 0x10:
 			WARN(1, KERN_ERR "Invalid error symbol: 0x%x\n",
 					  err_sym);
 			return -1;
-			break;
-
 		case 0x11:
 			return 0;
-			break;
 		case 0x12:
 			return 1;
-			break;
 		default:
 			return err_sym >> 3;
-			break;
 		}
 	return -1;
 }
 
 static int get_channel_from_ecc_syndrome(struct mem_ctl_info *mci, u16 syndrome)
diff --git a/drivers/gpio/gpio-bd70528.c b/drivers/gpio/gpio-bd70528.c
index 45b3da8da336..931e5765fe92 100644
--- a/drivers/gpio/gpio-bd70528.c
+++ b/drivers/gpio/gpio-bd70528.c
@@ -69,21 +69,18 @@ static int bd70528_gpio_set_config(struct gpio_chip *chip, unsigned int offset,
 	case PIN_CONFIG_DRIVE_OPEN_DRAIN:
 		return regmap_update_bits(bdgpio->chip.regmap,
 					  GPIO_OUT_REG(offset),
 					  BD70528_GPIO_DRIVE_MASK,
 					  BD70528_GPIO_OPEN_DRAIN);
-		break;
 	case PIN_CONFIG_DRIVE_PUSH_PULL:
 		return regmap_update_bits(bdgpio->chip.regmap,
 					  GPIO_OUT_REG(offset),
 					  BD70528_GPIO_DRIVE_MASK,
 					  BD70528_GPIO_PUSH_PULL);
-		break;
 	case PIN_CONFIG_INPUT_DEBOUNCE:
 		return bd70528_set_debounce(bdgpio, offset,
 					    pinconf_to_config_argument(config));
-		break;
 	default:
 		break;
 	}
 	return -ENOTSUPP;
 }
diff --git a/drivers/gpu/drm/amd/display/dc/dce/dce_transform.c b/drivers/gpu/drm/amd/display/dc/dce/dce_transform.c
index 2a32b66959ba..130a0a0c8332 100644
--- a/drivers/gpu/drm/amd/display/dc/dce/dce_transform.c
+++ b/drivers/gpu/drm/amd/display/dc/dce/dce_transform.c
@@ -1328,11 +1328,10 @@ static bool configure_graphics_mode(
 		case COLOR_SPACE_SRGB:
 			/* by pass */
 			REG_SET(OUTPUT_CSC_CONTROL, 0,
 				OUTPUT_CSC_GRPH_MODE, 0);
 			break;
-			break;
 		case COLOR_SPACE_SRGB_LIMITED:
 			/* TV RGB */
 			REG_SET(OUTPUT_CSC_CONTROL, 0,
 				OUTPUT_CSC_GRPH_MODE, 1);
 			break;
diff --git a/drivers/gpu/drm/amd/display/dc/dce100/dce100_resource.c b/drivers/gpu/drm/amd/display/dc/dce100/dce100_resource.c
index d741787f75dc..42c7d157da32 100644
--- a/drivers/gpu/drm/amd/display/dc/dce100/dce100_resource.c
+++ b/drivers/gpu/drm/amd/display/dc/dce100/dce100_resource.c
@@ -416,29 +416,22 @@ static int map_transmitter_id_to_phy_instance(
 	enum transmitter transmitter)
 {
 	switch (transmitter) {
 	case TRANSMITTER_UNIPHY_A:
 		return 0;
-	break;
 	case TRANSMITTER_UNIPHY_B:
 		return 1;
-	break;
 	case TRANSMITTER_UNIPHY_C:
 		return 2;
-	break;
 	case TRANSMITTER_UNIPHY_D:
 		return 3;
-	break;
 	case TRANSMITTER_UNIPHY_E:
 		return 4;
-	break;
 	case TRANSMITTER_UNIPHY_F:
 		return 5;
-	break;
 	case TRANSMITTER_UNIPHY_G:
 		return 6;
-	break;
 	default:
 		ASSERT(0);
 		return 0;
 	}
 }
diff --git a/drivers/gpu/drm/amd/display/dc/dce110/dce110_resource.c b/drivers/gpu/drm/amd/display/dc/dce110/dce110_resource.c
index 2bbfa2e176a9..382581c4a674 100644
--- a/drivers/gpu/drm/amd/display/dc/dce110/dce110_resource.c
+++ b/drivers/gpu/drm/amd/display/dc/dce110/dce110_resource.c
@@ -469,29 +469,22 @@ static int map_transmitter_id_to_phy_instance(
 	enum transmitter transmitter)
 {
 	switch (transmitter) {
 	case TRANSMITTER_UNIPHY_A:
 		return 0;
-	break;
 	case TRANSMITTER_UNIPHY_B:
 		return 1;
-	break;
 	case TRANSMITTER_UNIPHY_C:
 		return 2;
-	break;
 	case TRANSMITTER_UNIPHY_D:
 		return 3;
-	break;
 	case TRANSMITTER_UNIPHY_E:
 		return 4;
-	break;
 	case TRANSMITTER_UNIPHY_F:
 		return 5;
-	break;
 	case TRANSMITTER_UNIPHY_G:
 		return 6;
-	break;
 	default:
 		ASSERT(0);
 		return 0;
 	}
 }
diff --git a/drivers/gpu/drm/amd/display/dc/dce112/dce112_resource.c b/drivers/gpu/drm/amd/display/dc/dce112/dce112_resource.c
index b622b4b1dac3..7b4b2304bbff 100644
--- a/drivers/gpu/drm/amd/display/dc/dce112/dce112_resource.c
+++ b/drivers/gpu/drm/amd/display/dc/dce112/dce112_resource.c
@@ -444,29 +444,22 @@ static int map_transmitter_id_to_phy_instance(
 	enum transmitter transmitter)
 {
 	switch (transmitter) {
 	case TRANSMITTER_UNIPHY_A:
 		return 0;
-	break;
 	case TRANSMITTER_UNIPHY_B:
 		return 1;
-	break;
 	case TRANSMITTER_UNIPHY_C:
 		return 2;
-	break;
 	case TRANSMITTER_UNIPHY_D:
 		return 3;
-	break;
 	case TRANSMITTER_UNIPHY_E:
 		return 4;
-	break;
 	case TRANSMITTER_UNIPHY_F:
 		return 5;
-	break;
 	case TRANSMITTER_UNIPHY_G:
 		return 6;
-	break;
 	default:
 		ASSERT(0);
 		return 0;
 	}
 }
diff --git a/drivers/gpu/drm/amd/display/dc/dce120/dce120_resource.c b/drivers/gpu/drm/amd/display/dc/dce120/dce120_resource.c
index 16fe7344702f..3d782b7c86cb 100644
--- a/drivers/gpu/drm/amd/display/dc/dce120/dce120_resource.c
+++ b/drivers/gpu/drm/amd/display/dc/dce120/dce120_resource.c
@@ -381,29 +381,22 @@ static int map_transmitter_id_to_phy_instance(
 	enum transmitter transmitter)
 {
 	switch (transmitter) {
 	case TRANSMITTER_UNIPHY_A:
 		return 0;
-	break;
 	case TRANSMITTER_UNIPHY_B:
 		return 1;
-	break;
 	case TRANSMITTER_UNIPHY_C:
 		return 2;
-	break;
 	case TRANSMITTER_UNIPHY_D:
 		return 3;
-	break;
 	case TRANSMITTER_UNIPHY_E:
 		return 4;
-	break;
 	case TRANSMITTER_UNIPHY_F:
 		return 5;
-	break;
 	case TRANSMITTER_UNIPHY_G:
 		return 6;
-	break;
 	default:
 		ASSERT(0);
 		return 0;
 	}
 }
diff --git a/drivers/gpu/drm/amd/display/dc/dce60/dce60_resource.c b/drivers/gpu/drm/amd/display/dc/dce60/dce60_resource.c
index 5a5a9cb77acb..e9dd78c484d6 100644
--- a/drivers/gpu/drm/amd/display/dc/dce60/dce60_resource.c
+++ b/drivers/gpu/drm/amd/display/dc/dce60/dce60_resource.c
@@ -451,29 +451,22 @@ static int map_transmitter_id_to_phy_instance(
 	enum transmitter transmitter)
 {
 	switch (transmitter) {
 	case TRANSMITTER_UNIPHY_A:
 		return 0;
-	break;
 	case TRANSMITTER_UNIPHY_B:
 		return 1;
-	break;
 	case TRANSMITTER_UNIPHY_C:
 		return 2;
-	break;
 	case TRANSMITTER_UNIPHY_D:
 		return 3;
-	break;
 	case TRANSMITTER_UNIPHY_E:
 		return 4;
-	break;
 	case TRANSMITTER_UNIPHY_F:
 		return 5;
-	break;
 	case TRANSMITTER_UNIPHY_G:
 		return 6;
-	break;
 	default:
 		ASSERT(0);
 		return 0;
 	}
 }
diff --git a/drivers/gpu/drm/amd/display/dc/dce80/dce80_resource.c b/drivers/gpu/drm/amd/display/dc/dce80/dce80_resource.c
index 0eae8cd35f9a..9dbf658162cd 100644
--- a/drivers/gpu/drm/amd/display/dc/dce80/dce80_resource.c
+++ b/drivers/gpu/drm/amd/display/dc/dce80/dce80_resource.c
@@ -456,29 +456,22 @@ static int map_transmitter_id_to_phy_instance(
 	enum transmitter transmitter)
 {
 	switch (transmitter) {
 	case TRANSMITTER_UNIPHY_A:
 		return 0;
-	break;
 	case TRANSMITTER_UNIPHY_B:
 		return 1;
-	break;
 	case TRANSMITTER_UNIPHY_C:
 		return 2;
-	break;
 	case TRANSMITTER_UNIPHY_D:
 		return 3;
-	break;
 	case TRANSMITTER_UNIPHY_E:
 		return 4;
-	break;
 	case TRANSMITTER_UNIPHY_F:
 		return 5;
-	break;
 	case TRANSMITTER_UNIPHY_G:
 		return 6;
-	break;
 	default:
 		ASSERT(0);
 		return 0;
 	}
 }
diff --git a/drivers/gpu/drm/mgag200/mgag200_mode.c b/drivers/gpu/drm/mgag200/mgag200_mode.c
index 38672f9e5c4f..bbe4e60dfd08 100644
--- a/drivers/gpu/drm/mgag200/mgag200_mode.c
+++ b/drivers/gpu/drm/mgag200/mgag200_mode.c
@@ -792,25 +792,20 @@ static int mgag200_crtc_set_plls(struct mga_device *mdev, long clock)
 	case G200_AGP:
 		return mgag200_g200_set_plls(mdev, clock);
 	case G200_SE_A:
 	case G200_SE_B:
 		return mga_g200se_set_plls(mdev, clock);
-		break;
 	case G200_WB:
 	case G200_EW3:
 		return mga_g200wb_set_plls(mdev, clock);
-		break;
 	case G200_EV:
 		return mga_g200ev_set_plls(mdev, clock);
-		break;
 	case G200_EH:
 	case G200_EH3:
 		return mga_g200eh_set_plls(mdev, clock);
-		break;
 	case G200_ER:
 		return mga_g200er_set_plls(mdev, clock);
-		break;
 	}
 
 	misc = RREG8(MGA_MISC_IN);
 	misc &= ~MGAREG_MISC_CLK_SEL_MASK;
 	misc |= MGAREG_MISC_CLK_SEL_MGA_MSK;
diff --git a/drivers/gpu/drm/nouveau/nvkm/subdev/bios/pll.c b/drivers/gpu/drm/nouveau/nvkm/subdev/bios/pll.c
index 350f10a3de37..2ec84b8a3b3a 100644
--- a/drivers/gpu/drm/nouveau/nvkm/subdev/bios/pll.c
+++ b/drivers/gpu/drm/nouveau/nvkm/subdev/bios/pll.c
@@ -121,11 +121,10 @@ pll_map(struct nvkm_bios *bios)
 	case NV_10:
 	case NV_11:
 	case NV_20:
 	case NV_30:
 		return nv04_pll_mapping;
-		break;
 	case NV_40:
 		return nv40_pll_mapping;
 	case NV_50:
 		if (device->chipset == 0x50)
 			return nv50_pll_mapping;
diff --git a/drivers/gpu/drm/nouveau/nvkm/subdev/clk/mcp77.c b/drivers/gpu/drm/nouveau/nvkm/subdev/clk/mcp77.c
index efa50274df97..4884eb4a9221 100644
--- a/drivers/gpu/drm/nouveau/nvkm/subdev/clk/mcp77.c
+++ b/drivers/gpu/drm/nouveau/nvkm/subdev/clk/mcp77.c
@@ -138,21 +138,18 @@ mcp77_clk_read(struct nvkm_clk *base, enum nv_clk_src src)
 		case 0x00000030: return read_pll(clk, 0x004020) >> P;
 		}
 		break;
 	case nv_clk_src_mem:
 		return 0;
-		break;
 	case nv_clk_src_vdec:
 		P = (read_div(clk) & 0x00000700) >> 8;
 
 		switch (mast & 0x00400000) {
 		case 0x00400000:
 			return nvkm_clk_read(&clk->base, nv_clk_src_core) >> P;
-			break;
 		default:
 			return 500000 >> P;
-			break;
 		}
 		break;
 	default:
 		break;
 	}
diff --git a/drivers/gpu/drm/nouveau/nvkm/subdev/fb/ramnv50.c b/drivers/gpu/drm/nouveau/nvkm/subdev/fb/ramnv50.c
index 2ccb4b6be153..7b1eb44ff3da 100644
--- a/drivers/gpu/drm/nouveau/nvkm/subdev/fb/ramnv50.c
+++ b/drivers/gpu/drm/nouveau/nvkm/subdev/fb/ramnv50.c
@@ -169,11 +169,10 @@ nv50_ram_timing_read(struct nv50_ram *ram, u32 *timing)
 	case NVKM_RAM_TYPE_GDDR3:
 		T(CWL) = ((timing[2] & 0xff000000) >> 24) + 1;
 		break;
 	default:
 		return -ENOSYS;
-		break;
 	}
 
 	T(WR) = ((timing[1] >> 24) & 0xff) - 1 - T(CWL);
 
 	return 0;
diff --git a/drivers/gpu/drm/nouveau/nvkm/subdev/top/gk104.c b/drivers/gpu/drm/nouveau/nvkm/subdev/top/gk104.c
index e01746ce9fc4..1156634533f9 100644
--- a/drivers/gpu/drm/nouveau/nvkm/subdev/top/gk104.c
+++ b/drivers/gpu/drm/nouveau/nvkm/subdev/top/gk104.c
@@ -88,11 +88,10 @@ gk104_top_oneinit(struct nvkm_top *top)
 		case 0x0000000e: B_(NVENC ); break;
 		case 0x0000000f: A_(NVENC1); break;
 		case 0x00000010: B_(NVDEC ); break;
 		case 0x00000013: B_(CE    ); break;
 		case 0x00000014: C_(GSP   ); break;
-			break;
 		default:
 			break;
 		}
 
 		nvkm_debug(subdev, "%02x.%d (%8s): addr %06x fault %2d "
diff --git a/drivers/gpu/drm/qxl/qxl_ioctl.c b/drivers/gpu/drm/qxl/qxl_ioctl.c
index 5cea6eea72ab..2072ddc9549c 100644
--- a/drivers/gpu/drm/qxl/qxl_ioctl.c
+++ b/drivers/gpu/drm/qxl/qxl_ioctl.c
@@ -158,11 +158,10 @@ static int qxl_process_single_command(struct qxl_device *qdev,
 	case QXL_CMD_SURFACE:
 	case QXL_CMD_CURSOR:
 	default:
 		DRM_DEBUG("Only draw commands in execbuffers\n");
 		return -EINVAL;
-		break;
 	}
 
 	if (cmd->command_size > PAGE_SIZE - sizeof(union qxl_release_info))
 		return -EINVAL;
 
diff --git a/drivers/iio/adc/meson_saradc.c b/drivers/iio/adc/meson_saradc.c
index e03988698755..66dc452d643a 100644
--- a/drivers/iio/adc/meson_saradc.c
+++ b/drivers/iio/adc/meson_saradc.c
@@ -591,17 +591,15 @@ static int meson_sar_adc_iio_info_read_raw(struct iio_dev *indio_dev,
 
 	switch (mask) {
 	case IIO_CHAN_INFO_RAW:
 		return meson_sar_adc_get_sample(indio_dev, chan, NO_AVERAGING,
 						ONE_SAMPLE, val);
-		break;
 
 	case IIO_CHAN_INFO_AVERAGE_RAW:
 		return meson_sar_adc_get_sample(indio_dev, chan,
 						MEAN_AVERAGING, EIGHT_SAMPLES,
 						val);
-		break;
 
 	case IIO_CHAN_INFO_SCALE:
 		if (chan->type == IIO_VOLTAGE) {
 			ret = regulator_get_voltage(priv->vref);
 			if (ret < 0) {
diff --git a/drivers/iio/imu/bmi160/bmi160_core.c b/drivers/iio/imu/bmi160/bmi160_core.c
index 222ebb26f013..431076dc0d2c 100644
--- a/drivers/iio/imu/bmi160/bmi160_core.c
+++ b/drivers/iio/imu/bmi160/bmi160_core.c
@@ -484,11 +484,10 @@ static int bmi160_write_raw(struct iio_dev *indio_dev,
 
 	switch (mask) {
 	case IIO_CHAN_INFO_SCALE:
 		return bmi160_set_scale(data,
 					bmi160_to_sensor(chan->type), val2);
-		break;
 	case IIO_CHAN_INFO_SAMP_FREQ:
 		return bmi160_set_odr(data, bmi160_to_sensor(chan->type),
 				      val, val2);
 	default:
 		return -EINVAL;
diff --git a/drivers/ipack/devices/ipoctal.c b/drivers/ipack/devices/ipoctal.c
index d480a514c983..3940714e4397 100644
--- a/drivers/ipack/devices/ipoctal.c
+++ b/drivers/ipack/devices/ipoctal.c
@@ -542,11 +542,10 @@ static void ipoctal_set_termios(struct tty_struct *tty,
 		mr1 |= MR1_RxRTS_CONTROL_OFF;
 		mr2 |= MR2_TxRTS_CONTROL_ON | MR2_CTS_ENABLE_TX_OFF;
 		break;
 	default:
 		return;
-		break;
 	}
 
 	baud = tty_get_baud_rate(tty);
 	tty_termios_encode_baud_rate(&tty->termios, baud, baud);
 
diff --git a/drivers/media/dvb-frontends/drx39xyj/drxj.c b/drivers/media/dvb-frontends/drx39xyj/drxj.c
index 237b9d04c076..37b32d9b398d 100644
--- a/drivers/media/dvb-frontends/drx39xyj/drxj.c
+++ b/drivers/media/dvb-frontends/drx39xyj/drxj.c
@@ -2323,11 +2323,10 @@ hi_command(struct i2c_device_addr *dev_addr, const struct drxj_hi_cmd *cmd, u16
 		/* No parameters */
 		break;
 
 	default:
 		return -EINVAL;
-		break;
 	}
 
 	/* Write command */
 	rc = drxj_dap_write_reg16(dev_addr, SIO_HI_RA_RAM_CMD__A, cmd->cmd, 0);
 	if (rc != 0) {
@@ -3592,11 +3591,10 @@ static int ctrl_set_uio_cfg(struct drx_demod_instance *demod, struct drxuio_cfg
 				goto rw_error;
 			}
 			break;
 		default:
 			return -EINVAL;
-			break;
 		}		/* switch ( uio_cfg->mode ) */
 		break;
       /*====================================================================*/
 	case DRX_UIO3:
 		/* DRX_UIO3: GPIO UIO-3 */
@@ -3616,11 +3614,10 @@ static int ctrl_set_uio_cfg(struct drx_demod_instance *demod, struct drxuio_cfg
 				goto rw_error;
 			}
 			break;
 		default:
 			return -EINVAL;
-			break;
 		}		/* switch ( uio_cfg->mode ) */
 		break;
       /*====================================================================*/
 	case DRX_UIO4:
 		/* DRX_UIO4: IRQN UIO-4 */
@@ -3640,11 +3637,10 @@ static int ctrl_set_uio_cfg(struct drx_demod_instance *demod, struct drxuio_cfg
 			ext_attr->uio_irqn_mode = uio_cfg->mode;
 			break;
 		case DRX_UIO_MODE_FIRMWARE0:
 		default:
 			return -EINVAL;
-			break;
 		}		/* switch ( uio_cfg->mode ) */
 		break;
       /*====================================================================*/
 	default:
 		return -EINVAL;
@@ -10951,11 +10947,10 @@ ctrl_set_standard(struct drx_demod_instance *demod, enum drx_standard *standard)
 		}
 		break;
 	default:
 		ext_attr->standard = DRX_STANDARD_UNKNOWN;
 		return -EINVAL;
-		break;
 	}
 
 	return 0;
 rw_error:
 	/* Don't know what the standard is now ... try again */
@@ -11072,11 +11067,10 @@ ctrl_power_mode(struct drx_demod_instance *demod, enum drx_power_mode *mode)
 		sio_cc_pwd_mode = SIO_CC_PWD_MODE_LEVEL_OSC;
 		break;
 	default:
 		/* Unknow sleep mode */
 		return -EINVAL;
-		break;
 	}
 
 	/* Check if device needs to be powered up */
 	if ((common_attr->current_power_mode != DRX_POWER_UP)) {
 		rc = power_up_device(demod);
@@ -11894,11 +11888,10 @@ static int drx_ctrl_u_code(struct drx_demod_instance *demod,
 			}
 			break;
 		}
 		default:
 			return -EINVAL;
-			break;
 
 		}
 		mc_data += mc_block_nr_bytes;
 	}
 
diff --git a/drivers/media/dvb-frontends/drxd_hard.c b/drivers/media/dvb-frontends/drxd_hard.c
index 45f982863904..a7eb81df88c2 100644
--- a/drivers/media/dvb-frontends/drxd_hard.c
+++ b/drivers/media/dvb-frontends/drxd_hard.c
@@ -1620,11 +1620,10 @@ static int CorrectSysClockDeviation(struct drxd_state *state)
 		case 6000000:
 			bandwidth = DRXD_BANDWIDTH_6MHZ_IN_HZ;
 			break;
 		default:
 			return -1;
-			break;
 		}
 
 		/* Compute new sysclock value
 		   sysClockFreq = (((incr + 2^23)*bandwidth)/2^21)/1000 */
 		incr += (1 << 23);
diff --git a/drivers/media/dvb-frontends/nxt200x.c b/drivers/media/dvb-frontends/nxt200x.c
index 35b83b1dd82c..200b6dbc75f8 100644
--- a/drivers/media/dvb-frontends/nxt200x.c
+++ b/drivers/media/dvb-frontends/nxt200x.c
@@ -166,11 +166,10 @@ static int nxt200x_writereg_multibyte (struct nxt200x_state* state, u8 reg, u8*
 			len2 = ((attr << 4) | 0x10) | len;
 			buf = 0x80;
 			break;
 		default:
 			return -EINVAL;
-			break;
 	}
 
 	/* set multi register length */
 	nxt200x_writebytes(state, 0x34, &len2, 1);
 
@@ -188,11 +187,10 @@ static int nxt200x_writereg_multibyte (struct nxt200x_state* state, u8 reg, u8*
 			if (buf == 0)
 				return 0;
 			break;
 		default:
 			return -EINVAL;
-			break;
 	}
 
 	pr_warn("Error writing multireg register 0x%02X\n", reg);
 
 	return 0;
@@ -214,11 +212,10 @@ static int nxt200x_readreg_multibyte (struct nxt200x_state* state, u8 reg, u8* d
 			nxt200x_writebytes(state, 0x34, &len2, 1);
 
 			/* read the actual data */
 			nxt200x_readbytes(state, reg, data, len);
 			return 0;
-			break;
 		case NXT2004:
 			/* probably not right, but gives correct values */
 			attr = 0x02;
 			if (reg & 0x80) {
 				attr = attr << 1;
@@ -237,14 +234,12 @@ static int nxt200x_readreg_multibyte (struct nxt200x_state* state, u8 reg, u8* d
 			/* read the actual data */
 			for(i = 0; i < len; i++) {
 				nxt200x_readbytes(state, 0x36 + i, &data[i], 1);
 			}
 			return 0;
-			break;
 		default:
 			return -EINVAL;
-			break;
 	}
 }
 
 static void nxt200x_microcontroller_stop (struct nxt200x_state* state)
 {
@@ -372,11 +367,10 @@ static int nxt200x_writetuner (struct nxt200x_state* state, u8* data)
 			}
 			pr_warn("timeout error writing to tuner\n");
 			break;
 		default:
 			return -EINVAL;
-			break;
 	}
 	return 0;
 }
 
 static void nxt200x_agc_reset(struct nxt200x_state* state)
@@ -553,11 +547,10 @@ static int nxt200x_setup_frontend_parameters(struct dvb_frontend *fe)
 			if (state->config->set_ts_params)
 				state->config->set_ts_params(fe, 0);
 			break;
 		default:
 			return -EINVAL;
-			break;
 	}
 
 	if (fe->ops.tuner_ops.calc_regs) {
 		/* get tuning information */
 		fe->ops.tuner_ops.calc_regs(fe, buf, 5);
@@ -578,11 +571,10 @@ static int nxt200x_setup_frontend_parameters(struct dvb_frontend *fe)
 		case VSB_8:
 			buf[0] = 0x70;
 			break;
 		default:
 			return -EINVAL;
-			break;
 	}
 	nxt200x_writebytes(state, 0x42, buf, 1);
 
 	/* configure sdm */
 	switch (state->demod_chip) {
@@ -592,11 +584,10 @@ static int nxt200x_setup_frontend_parameters(struct dvb_frontend *fe)
 		case NXT2004:
 			buf[0] = 0x07;
 			break;
 		default:
 			return -EINVAL;
-			break;
 	}
 	nxt200x_writebytes(state, 0x57, buf, 1);
 
 	/* write sdm1 input */
 	buf[0] = 0x10;
@@ -608,11 +599,10 @@ static int nxt200x_setup_frontend_parameters(struct dvb_frontend *fe)
 		case NXT2004:
 			nxt200x_writebytes(state, 0x58, buf, 2);
 			break;
 		default:
 			return -EINVAL;
-			break;
 	}
 
 	/* write sdmx input */
 	switch (p->modulation) {
 		case QAM_64:
@@ -624,11 +614,10 @@ static int nxt200x_setup_frontend_parameters(struct dvb_frontend *fe)
 		case VSB_8:
 				buf[0] = 0x60;
 				break;
 		default:
 				return -EINVAL;
-				break;
 	}
 	buf[1] = 0x00;
 	switch (state->demod_chip) {
 		case NXT2002:
 			nxt200x_writereg_multibyte(state, 0x5C, buf, 2);
@@ -636,11 +625,10 @@ static int nxt200x_setup_frontend_parameters(struct dvb_frontend *fe)
 		case NXT2004:
 			nxt200x_writebytes(state, 0x5C, buf, 2);
 			break;
 		default:
 			return -EINVAL;
-			break;
 	}
 
 	/* write adc power lpf fc */
 	buf[0] = 0x05;
 	nxt200x_writebytes(state, 0x43, buf, 1);
@@ -662,11 +650,10 @@ static int nxt200x_setup_frontend_parameters(struct dvb_frontend *fe)
 		case NXT2004:
 			nxt200x_writebytes(state, 0x4B, buf, 2);
 			break;
 		default:
 			return -EINVAL;
-			break;
 	}
 
 	/* write kg1 */
 	buf[0] = 0x00;
 	nxt200x_writebytes(state, 0x4D, buf, 1);
@@ -718,11 +705,10 @@ static int nxt200x_setup_frontend_parameters(struct dvb_frontend *fe)
 		case VSB_8:
 				buf[0] = 0x00;
 				break;
 		default:
 				return -EINVAL;
-				break;
 	}
 	nxt200x_writebytes(state, 0x30, buf, 1);
 
 	/* write agc control reg */
 	buf[0] = 0x00;
@@ -740,11 +726,10 @@ static int nxt200x_setup_frontend_parameters(struct dvb_frontend *fe)
 			nxt200x_writebytes(state, 0x49, buf, 2);
 			nxt200x_writebytes(state, 0x4B, buf, 2);
 			break;
 		default:
 			return -EINVAL;
-			break;
 	}
 
 	/* write agc control reg */
 	buf[0] = 0x04;
 	nxt200x_writebytes(state, 0x41, buf, 1);
@@ -1112,11 +1097,10 @@ static int nxt200x_init(struct dvb_frontend* fe)
 			case NXT2004:
 				ret = nxt2004_init(fe);
 				break;
 			default:
 				return -EINVAL;
-				break;
 		}
 		state->initialised = 1;
 	}
 	return ret;
 }
diff --git a/drivers/media/dvb-frontends/si21xx.c b/drivers/media/dvb-frontends/si21xx.c
index a116eff417f2..e31eb2c5cc4c 100644
--- a/drivers/media/dvb-frontends/si21xx.c
+++ b/drivers/media/dvb-frontends/si21xx.c
@@ -462,14 +462,12 @@ static int si21xx_set_voltage(struct dvb_frontend *fe, enum fe_sec_voltage volt)
 	val = (0x80 | si21_readreg(state, LNB_CTRL_REG_1));
 
 	switch (volt) {
 	case SEC_VOLTAGE_18:
 		return si21_writereg(state, LNB_CTRL_REG_1, val | 0x40);
-		break;
 	case SEC_VOLTAGE_13:
 		return si21_writereg(state, LNB_CTRL_REG_1, (val & ~0x40));
-		break;
 	default:
 		return -EINVAL;
 	}
 }
 
diff --git a/drivers/media/tuners/mt2063.c b/drivers/media/tuners/mt2063.c
index 2240d214dfac..d105431a2e2d 100644
--- a/drivers/media/tuners/mt2063.c
+++ b/drivers/media/tuners/mt2063.c
@@ -1847,11 +1847,10 @@ static int mt2063_init(struct dvb_frontend *fe)
 		def = MT2063B0_defaults;
 		break;
 
 	default:
 		return -ENODEV;
-		break;
 	}
 
 	while (status >= 0 && *def) {
 		u8 reg = *def++;
 		u8 val = *def++;
diff --git a/drivers/message/fusion/mptbase.c b/drivers/message/fusion/mptbase.c
index 9903e9660a38..3078fac34e51 100644
--- a/drivers/message/fusion/mptbase.c
+++ b/drivers/message/fusion/mptbase.c
@@ -471,11 +471,10 @@ mpt_turbo_reply(MPT_ADAPTER *ioc, u32 pa)
 			req_idx = pa & 0x0000FFFF;
 			mf = MPT_INDEX_2_MFPTR(ioc, req_idx);
 			mpt_free_msg_frame(ioc, mf);
 			mb();
 			return;
-			break;
 		}
 		mr = (MPT_FRAME_HDR *) CAST_U32_TO_PTR(pa);
 		break;
 	case MPI_CONTEXT_REPLY_TYPE_SCSI_TARGET:
 		cb_idx = mpt_get_cb_idx(MPTSTM_DRIVER);
diff --git a/drivers/misc/mei/hbm.c b/drivers/misc/mei/hbm.c
index a97eb5d47705..686e8b6a4c55 100644
--- a/drivers/misc/mei/hbm.c
+++ b/drivers/misc/mei/hbm.c
@@ -1375,11 +1375,10 @@ int mei_hbm_dispatch(struct mei_device *dev, struct mei_msg_hdr *hdr)
 
 		dev->dev_state = MEI_DEV_POWER_DOWN;
 		dev_info(dev->dev, "hbm: stop response: resetting.\n");
 		/* force the reset */
 		return -EPROTO;
-		break;
 
 	case CLIENT_DISCONNECT_REQ_CMD:
 		dev_dbg(dev->dev, "hbm: disconnect request: message received\n");
 
 		disconnect_req = (struct hbm_client_connect_request *)mei_msg;
diff --git a/drivers/mtd/mtdchar.c b/drivers/mtd/mtdchar.c
index b40f46a43fc6..323035d4f2d0 100644
--- a/drivers/mtd/mtdchar.c
+++ b/drivers/mtd/mtdchar.c
@@ -879,21 +879,19 @@ static int mtdchar_ioctl(struct file *file, u_int cmd, u_long arg)
 		loff_t offs;
 
 		if (copy_from_user(&offs, argp, sizeof(loff_t)))
 			return -EFAULT;
 		return mtd_block_isbad(mtd, offs);
-		break;
 	}
 
 	case MEMSETBADBLOCK:
 	{
 		loff_t offs;
 
 		if (copy_from_user(&offs, argp, sizeof(loff_t)))
 			return -EFAULT;
 		return mtd_block_markbad(mtd, offs);
-		break;
 	}
 
 	case OTPSELECT:
 	{
 		int mode;
diff --git a/drivers/net/can/spi/mcp251xfd/mcp251xfd-core.c b/drivers/net/can/spi/mcp251xfd/mcp251xfd-core.c
index c3f49543ff26..9c215f7c5f81 100644
--- a/drivers/net/can/spi/mcp251xfd/mcp251xfd-core.c
+++ b/drivers/net/can/spi/mcp251xfd/mcp251xfd-core.c
@@ -73,15 +73,15 @@ static const struct can_bittiming_const mcp251xfd_data_bittiming_const = {
 
 static const char *__mcp251xfd_get_model_str(enum mcp251xfd_model model)
 {
 	switch (model) {
 	case MCP251XFD_MODEL_MCP2517FD:
-		return "MCP2517FD"; break;
+		return "MCP2517FD";
 	case MCP251XFD_MODEL_MCP2518FD:
-		return "MCP2518FD"; break;
+		return "MCP2518FD";
 	case MCP251XFD_MODEL_MCP251XFD:
-		return "MCP251xFD"; break;
+		return "MCP251xFD";
 	}
 
 	return "<unknown>";
 }
 
@@ -93,25 +93,25 @@ mcp251xfd_get_model_str(const struct mcp251xfd_priv *priv)
 
 static const char *mcp251xfd_get_mode_str(const u8 mode)
 {
 	switch (mode) {
 	case MCP251XFD_REG_CON_MODE_MIXED:
-		return "Mixed (CAN FD/CAN 2.0)"; break;
+		return "Mixed (CAN FD/CAN 2.0)";
 	case MCP251XFD_REG_CON_MODE_SLEEP:
-		return "Sleep"; break;
+		return "Sleep";
 	case MCP251XFD_REG_CON_MODE_INT_LOOPBACK:
-		return "Internal Loopback"; break;
+		return "Internal Loopback";
 	case MCP251XFD_REG_CON_MODE_LISTENONLY:
-		return "Listen Only"; break;
+		return "Listen Only";
 	case MCP251XFD_REG_CON_MODE_CONFIG:
-		return "Configuration"; break;
+		return "Configuration";
 	case MCP251XFD_REG_CON_MODE_EXT_LOOPBACK:
-		return "External Loopback"; break;
+		return "External Loopback";
 	case MCP251XFD_REG_CON_MODE_CAN2_0:
-		return "CAN 2.0"; break;
+		return "CAN 2.0";
 	case MCP251XFD_REG_CON_MODE_RESTRICTED:
-		return "Restricted Operation"; break;
+		return "Restricted Operation";
 	}
 
 	return "<unknown>";
 }
 
diff --git a/drivers/net/ethernet/aquantia/atlantic/aq_nic.c b/drivers/net/ethernet/aquantia/atlantic/aq_nic.c
index 0f865daeb36d..bf5e0e9bd0e2 100644
--- a/drivers/net/ethernet/aquantia/atlantic/aq_nic.c
+++ b/drivers/net/ethernet/aquantia/atlantic/aq_nic.c
@@ -1161,11 +1161,10 @@ int aq_nic_set_link_ksettings(struct aq_nic_s *self,
 			break;
 
 		default:
 			err = -1;
 			goto err_exit;
-		break;
 		}
 		if (!(self->aq_nic_cfg.aq_hw_caps->link_speed_msk & rate)) {
 			err = -1;
 			goto err_exit;
 		}
diff --git a/drivers/net/ethernet/cisco/enic/enic_ethtool.c b/drivers/net/ethernet/cisco/enic/enic_ethtool.c
index a4dd52bba2c3..1a9803f2073e 100644
--- a/drivers/net/ethernet/cisco/enic/enic_ethtool.c
+++ b/drivers/net/ethernet/cisco/enic/enic_ethtool.c
@@ -432,11 +432,10 @@ static int enic_grxclsrule(struct enic *enic, struct ethtool_rxnfc *cmd)
 	case IPPROTO_UDP:
 		fsp->flow_type = UDP_V4_FLOW;
 		break;
 	default:
 		return -EINVAL;
-		break;
 	}
 
 	fsp->h_u.tcp_ip4_spec.ip4src = flow_get_u32_src(&n->keys);
 	fsp->m_u.tcp_ip4_spec.ip4src = (__u32)~0;
 
diff --git a/drivers/net/ethernet/intel/ixgbe/ixgbe_x540.c b/drivers/net/ethernet/intel/ixgbe/ixgbe_x540.c
index de563cfd294d..4b93ba149ec5 100644
--- a/drivers/net/ethernet/intel/ixgbe/ixgbe_x540.c
+++ b/drivers/net/ethernet/intel/ixgbe/ixgbe_x540.c
@@ -348,11 +348,10 @@ static s32 ixgbe_calc_eeprom_checksum_X540(struct ixgbe_hw *hw)
 			continue;
 
 		if (ixgbe_read_eerd_generic(hw, pointer, &length)) {
 			hw_dbg(hw, "EEPROM read failed\n");
 			return IXGBE_ERR_EEPROM;
-			break;
 		}
 
 		/* Skip pointer section if length is invalid. */
 		if (length == 0xFFFF || length == 0 ||
 		    (pointer + length) >= hw->eeprom.word_size)
diff --git a/drivers/net/wan/lmc/lmc_proto.c b/drivers/net/wan/lmc/lmc_proto.c
index e8b0b902b424..4e9cc83b615a 100644
--- a/drivers/net/wan/lmc/lmc_proto.c
+++ b/drivers/net/wan/lmc/lmc_proto.c
@@ -87,21 +87,17 @@ void lmc_proto_close(lmc_softc_t *sc)
 __be16 lmc_proto_type(lmc_softc_t *sc, struct sk_buff *skb) /*FOLD00*/
 {
     switch(sc->if_type){
     case LMC_PPP:
 	    return hdlc_type_trans(skb, sc->lmc_device);
-	    break;
     case LMC_NET:
         return htons(ETH_P_802_2);
-        break;
     case LMC_RAW: /* Packet type for skbuff kind of useless */
         return htons(ETH_P_802_2);
-        break;
     default:
         printk(KERN_WARNING "%s: No protocol set for this interface, assuming 802.2 (which is wrong!!)\n", sc->name);
         return htons(ETH_P_802_2);
-        break;
     }
 }
 
 void lmc_proto_netif(lmc_softc_t *sc, struct sk_buff *skb) /*FOLD00*/
 {
diff --git a/drivers/net/wireless/ath/ath10k/htt_rx.c b/drivers/net/wireless/ath/ath10k/htt_rx.c
index 5c1af2021883..9c4e6cf2137a 100644
--- a/drivers/net/wireless/ath/ath10k/htt_rx.c
+++ b/drivers/net/wireless/ath/ath10k/htt_rx.c
@@ -3876,11 +3876,10 @@ bool ath10k_htt_t2h_msg_handler(struct ath10k *ar, struct sk_buff *skb)
 		atomic_inc(&htt->num_mpdus_ready);
 
 		return ath10k_htt_rx_proc_rx_frag_ind(htt,
 						      &resp->rx_frag_ind,
 						      skb);
-		break;
 	}
 	case HTT_T2H_MSG_TYPE_TEST:
 		break;
 	case HTT_T2H_MSG_TYPE_STATS_CONF:
 		trace_ath10k_htt_stats(ar, skb->data, skb->len);
diff --git a/drivers/net/wireless/ath/ath6kl/testmode.c b/drivers/net/wireless/ath/ath6kl/testmode.c
index f3906dbe5495..89c7c4e25169 100644
--- a/drivers/net/wireless/ath/ath6kl/testmode.c
+++ b/drivers/net/wireless/ath/ath6kl/testmode.c
@@ -92,11 +92,10 @@ int ath6kl_tm_cmd(struct wiphy *wiphy, struct wireless_dev *wdev,
 
 		ath6kl_wmi_test_cmd(ar->wmi, buf, buf_len);
 
 		return 0;
 
-		break;
 	case ATH6KL_TM_CMD_RX_REPORT:
 	default:
 		return -EOPNOTSUPP;
 	}
 }
diff --git a/drivers/net/wireless/ath/ath9k/hw.c b/drivers/net/wireless/ath/ath9k/hw.c
index 6609ce122e6e..b66eeb577272 100644
--- a/drivers/net/wireless/ath/ath9k/hw.c
+++ b/drivers/net/wireless/ath/ath9k/hw.c
@@ -2306,11 +2306,10 @@ void ath9k_hw_beaconinit(struct ath_hw *ah, u32 next_beacon, u32 beacon_period)
 		break;
 	default:
 		ath_dbg(ath9k_hw_common(ah), BEACON,
 			"%s: unsupported opmode: %d\n", __func__, ah->opmode);
 		return;
-		break;
 	}
 
 	REG_WRITE(ah, AR_BEACON_PERIOD, beacon_period);
 	REG_WRITE(ah, AR_DMA_BEACON_PERIOD, beacon_period);
 	REG_WRITE(ah, AR_SWBA_PERIOD, beacon_period);
diff --git a/drivers/net/wireless/intel/iwlwifi/mvm/mac-ctxt.c b/drivers/net/wireless/intel/iwlwifi/mvm/mac-ctxt.c
index cbdebefb854a..8698ca4d30de 100644
--- a/drivers/net/wireless/intel/iwlwifi/mvm/mac-ctxt.c
+++ b/drivers/net/wireless/intel/iwlwifi/mvm/mac-ctxt.c
@@ -1200,17 +1200,15 @@ static int iwl_mvm_mac_ctx_send(struct iwl_mvm *mvm, struct ieee80211_vif *vif,
 	switch (vif->type) {
 	case NL80211_IFTYPE_STATION:
 		return iwl_mvm_mac_ctxt_cmd_sta(mvm, vif, action,
 						force_assoc_off,
 						bssid_override);
-		break;
 	case NL80211_IFTYPE_AP:
 		if (!vif->p2p)
 			return iwl_mvm_mac_ctxt_cmd_ap(mvm, vif, action);
 		else
 			return iwl_mvm_mac_ctxt_cmd_go(mvm, vif, action);
-		break;
 	case NL80211_IFTYPE_MONITOR:
 		return iwl_mvm_mac_ctxt_cmd_listener(mvm, vif, action);
 	case NL80211_IFTYPE_P2P_DEVICE:
 		return iwl_mvm_mac_ctxt_cmd_p2p_device(mvm, vif, action);
 	case NL80211_IFTYPE_ADHOC:
diff --git a/drivers/net/wireless/intersil/p54/eeprom.c b/drivers/net/wireless/intersil/p54/eeprom.c
index 5bd35c147e19..3ca9d26df174 100644
--- a/drivers/net/wireless/intersil/p54/eeprom.c
+++ b/drivers/net/wireless/intersil/p54/eeprom.c
@@ -868,11 +868,10 @@ int p54_parse_eeprom(struct ieee80211_hw *dev, void *eeprom, int len)
 				err = -ENOMSG;
 				goto err;
 			} else {
 				goto good_eeprom;
 			}
-			break;
 		default:
 			break;
 		}
 
 		crc16 = crc_ccitt(crc16, (u8 *)entry, (entry_len + 1) * 2);
diff --git a/drivers/net/wireless/intersil/prism54/oid_mgt.c b/drivers/net/wireless/intersil/prism54/oid_mgt.c
index 9fd307ca4b6d..7b251ae90a68 100644
--- a/drivers/net/wireless/intersil/prism54/oid_mgt.c
+++ b/drivers/net/wireless/intersil/prism54/oid_mgt.c
@@ -785,21 +785,19 @@ mgt_response_to_str(enum oid_num_t n, union oid_res_t *r, char *str)
 			struct obj_buffer *buff = r->ptr;
 			return scnprintf(str, PRIV_STR_SIZE,
 					"size=%u\naddr=0x%X\n", buff->size,
 					buff->addr);
 		}
-		break;
 	case OID_TYPE_BSS:{
 			struct obj_bss *bss = r->ptr;
 			return scnprintf(str, PRIV_STR_SIZE,
 					"age=%u\nchannel=%u\n"
 					"capinfo=0x%X\nrates=0x%X\n"
 					"basic_rates=0x%X\n", bss->age,
 					bss->channel, bss->capinfo,
 					bss->rates, bss->basic_rates);
 		}
-		break;
 	case OID_TYPE_BSSLIST:{
 			struct obj_bsslist *list = r->ptr;
 			int i, k;
 			k = scnprintf(str, PRIV_STR_SIZE, "nr=%u\n", list->nr);
 			for (i = 0; i < list->nr; i++)
@@ -812,53 +810,47 @@ mgt_response_to_str(enum oid_num_t n, union oid_res_t *r, char *str)
 					      list->bsslist[i].capinfo,
 					      list->bsslist[i].rates,
 					      list->bsslist[i].basic_rates);
 			return k;
 		}
-		break;
 	case OID_TYPE_FREQUENCIES:{
 			struct obj_frequencies *freq = r->ptr;
 			int i, t;
 			printk("nr : %u\n", freq->nr);
 			t = scnprintf(str, PRIV_STR_SIZE, "nr=%u\n", freq->nr);
 			for (i = 0; i < freq->nr; i++)
 				t += scnprintf(str + t, PRIV_STR_SIZE - t,
 					      "mhz[%u]=%u\n", i, freq->mhz[i]);
 			return t;
 		}
-		break;
 	case OID_TYPE_MLME:{
 			struct obj_mlme *mlme = r->ptr;
 			return scnprintf(str, PRIV_STR_SIZE,
 					"id=0x%X\nstate=0x%X\ncode=0x%X\n",
 					mlme->id, mlme->state, mlme->code);
 		}
-		break;
 	case OID_TYPE_MLMEEX:{
 			struct obj_mlmeex *mlme = r->ptr;
 			return scnprintf(str, PRIV_STR_SIZE,
 					"id=0x%X\nstate=0x%X\n"
 					"code=0x%X\nsize=0x%X\n", mlme->id,
 					mlme->state, mlme->code, mlme->size);
 		}
-		break;
 	case OID_TYPE_ATTACH:{
 			struct obj_attachment *attach = r->ptr;
 			return scnprintf(str, PRIV_STR_SIZE,
 					"id=%d\nsize=%d\n",
 					attach->id,
 					attach->size);
 		}
-		break;
 	case OID_TYPE_SSID:{
 			struct obj_ssid *ssid = r->ptr;
 			return scnprintf(str, PRIV_STR_SIZE,
 					"length=%u\noctets=%.*s\n",
 					ssid->length, ssid->length,
 					ssid->octets);
 		}
-		break;
 	case OID_TYPE_KEY:{
 			struct obj_key *key = r->ptr;
 			int t, i;
 			t = scnprintf(str, PRIV_STR_SIZE,
 				     "type=0x%X\nlength=0x%X\nkey=0x",
@@ -867,11 +859,10 @@ mgt_response_to_str(enum oid_num_t n, union oid_res_t *r, char *str)
 				t += scnprintf(str + t, PRIV_STR_SIZE - t,
 					      "%02X:", key->key[i]);
 			t += scnprintf(str + t, PRIV_STR_SIZE - t, "\n");
 			return t;
 		}
-		break;
 	case OID_TYPE_RAW:
 	case OID_TYPE_ADDR:{
 			unsigned char *buff = r->ptr;
 			int t, i;
 			t = scnprintf(str, PRIV_STR_SIZE, "hex data=");
@@ -879,11 +870,10 @@ mgt_response_to_str(enum oid_num_t n, union oid_res_t *r, char *str)
 				t += scnprintf(str + t, PRIV_STR_SIZE - t,
 					      "%02X:", buff[i]);
 			t += scnprintf(str + t, PRIV_STR_SIZE - t, "\n");
 			return t;
 		}
-		break;
 	default:
 		BUG();
 	}
 	return 0;
 }
diff --git a/drivers/net/wireless/realtek/rtlwifi/rtl8188ee/hw.c b/drivers/net/wireless/realtek/rtlwifi/rtl8188ee/hw.c
index 63f9ea21962f..bd9160b166c5 100644
--- a/drivers/net/wireless/realtek/rtlwifi/rtl8188ee/hw.c
+++ b/drivers/net/wireless/realtek/rtlwifi/rtl8188ee/hw.c
@@ -1224,11 +1224,10 @@ static int _rtl88ee_set_media_status(struct ieee80211_hw *hw,
 			"Set Network type to AP!\n");
 		break;
 	default:
 		pr_err("Network type %d not support!\n", type);
 		return 1;
-		break;
 	}
 
 	/* MSR_INFRA == Link in infrastructure network;
 	 * MSR_ADHOC == Link in ad hoc network;
 	 * Therefore, check link state is necessary.
diff --git a/drivers/net/wireless/realtek/rtlwifi/rtl8723ae/hw.c b/drivers/net/wireless/realtek/rtlwifi/rtl8723ae/hw.c
index a36dc6e726d2..f8a1de6e9849 100644
--- a/drivers/net/wireless/realtek/rtlwifi/rtl8723ae/hw.c
+++ b/drivers/net/wireless/realtek/rtlwifi/rtl8723ae/hw.c
@@ -1130,11 +1130,10 @@ static int _rtl8723e_set_media_status(struct ieee80211_hw *hw,
 			"Set Network type to AP!\n");
 		break;
 	default:
 		pr_err("Network type %d not support!\n", type);
 		return 1;
-		break;
 	}
 
 	/* MSR_INFRA == Link in infrastructure network;
 	 * MSR_ADHOC == Link in ad hoc network;
 	 * Therefore, check link state is necessary.
diff --git a/drivers/net/wireless/realtek/rtlwifi/rtl8821ae/phy.c b/drivers/net/wireless/realtek/rtlwifi/rtl8821ae/phy.c
index f41a7643b9c4..225b8cd44f23 100644
--- a/drivers/net/wireless/realtek/rtlwifi/rtl8821ae/phy.c
+++ b/drivers/net/wireless/realtek/rtlwifi/rtl8821ae/phy.c
@@ -2083,16 +2083,14 @@ bool rtl8812ae_phy_config_rf_with_headerfile(struct ieee80211_hw *hw,
 	switch (rfpath) {
 	case RF90_PATH_A:
 		return __rtl8821ae_phy_config_with_headerfile(hw,
 				radioa_array_table_a, radioa_arraylen_a,
 				_rtl8821ae_config_rf_radio_a);
-		break;
 	case RF90_PATH_B:
 		return __rtl8821ae_phy_config_with_headerfile(hw,
 				radioa_array_table_b, radioa_arraylen_b,
 				_rtl8821ae_config_rf_radio_b);
-		break;
 	case RF90_PATH_C:
 	case RF90_PATH_D:
 		pr_err("switch case %#x not processed\n", rfpath);
 		break;
 	}
@@ -2114,11 +2112,10 @@ bool rtl8821ae_phy_config_rf_with_headerfile(struct ieee80211_hw *hw,
 	switch (rfpath) {
 	case RF90_PATH_A:
 		return __rtl8821ae_phy_config_with_headerfile(hw,
 			radioa_array_table, radioa_arraylen,
 			_rtl8821ae_config_rf_radio_a);
-		break;
 
 	case RF90_PATH_B:
 	case RF90_PATH_C:
 	case RF90_PATH_D:
 		pr_err("switch case %#x not processed\n", rfpath);
diff --git a/drivers/nfc/st21nfca/core.c b/drivers/nfc/st21nfca/core.c
index 2ce17932a073..6ca0d2f56b18 100644
--- a/drivers/nfc/st21nfca/core.c
+++ b/drivers/nfc/st21nfca/core.c
@@ -792,11 +792,10 @@ static int st21nfca_hci_im_transceive(struct nfc_hci_dev *hdev,
 		return nfc_hci_send_cmd_async(hdev, target->hci_reader_gate,
 					      ST21NFCA_WR_XCHG_DATA, skb->data,
 					      skb->len,
 					      st21nfca_hci_data_exchange_cb,
 					      info);
-		break;
 	default:
 		return 1;
 	}
 }
 
diff --git a/drivers/nfc/trf7970a.c b/drivers/nfc/trf7970a.c
index 3bd97c73f983..c70f62fe321e 100644
--- a/drivers/nfc/trf7970a.c
+++ b/drivers/nfc/trf7970a.c
@@ -1380,11 +1380,10 @@ static int trf7970a_is_iso15693_write_or_lock(u8 cmd)
 	case ISO15693_CMD_WRITE_AFI:
 	case ISO15693_CMD_LOCK_AFI:
 	case ISO15693_CMD_WRITE_DSFID:
 	case ISO15693_CMD_LOCK_DSFID:
 		return 1;
-		break;
 	default:
 		return 0;
 	}
 }
 
diff --git a/drivers/nvdimm/claim.c b/drivers/nvdimm/claim.c
index 5a7c80053c62..2f250874b1a4 100644
--- a/drivers/nvdimm/claim.c
+++ b/drivers/nvdimm/claim.c
@@ -200,11 +200,10 @@ ssize_t nd_namespace_store(struct device *dev,
 		}
 		break;
 	default:
 		len = -EBUSY;
 		goto out_attach;
-		break;
 	}
 
 	if (__nvdimm_namespace_capacity(ndns) < SZ_16M) {
 		dev_dbg(dev, "%s too small to host\n", name);
 		len = -ENXIO;
diff --git a/drivers/pci/controller/pci-v3-semi.c b/drivers/pci/controller/pci-v3-semi.c
index 1f54334f09f7..154a5398633c 100644
--- a/drivers/pci/controller/pci-v3-semi.c
+++ b/drivers/pci/controller/pci-v3-semi.c
@@ -656,11 +656,10 @@ static int v3_get_dma_range_config(struct v3_pci *v3,
 		val |= V3_LB_BASE_ADR_SIZE_2GB;
 		break;
 	default:
 		dev_err(v3->dev, "illegal dma memory chunk size\n");
 		return -EINVAL;
-		break;
 	}
 	val |= V3_PCI_MAP_M_REG_EN | V3_PCI_MAP_M_ENABLE;
 	*pci_map = val;
 
 	dev_dbg(dev,
diff --git a/drivers/pinctrl/samsung/pinctrl-s3c24xx.c b/drivers/pinctrl/samsung/pinctrl-s3c24xx.c
index 5e24838a582f..2223ead5bd72 100644
--- a/drivers/pinctrl/samsung/pinctrl-s3c24xx.c
+++ b/drivers/pinctrl/samsung/pinctrl-s3c24xx.c
@@ -106,23 +106,18 @@ struct s3c24xx_eint_domain_data {
 static int s3c24xx_eint_get_trigger(unsigned int type)
 {
 	switch (type) {
 	case IRQ_TYPE_EDGE_RISING:
 		return EINT_EDGE_RISING;
-		break;
 	case IRQ_TYPE_EDGE_FALLING:
 		return EINT_EDGE_FALLING;
-		break;
 	case IRQ_TYPE_EDGE_BOTH:
 		return EINT_EDGE_BOTH;
-		break;
 	case IRQ_TYPE_LEVEL_HIGH:
 		return EINT_LEVEL_HIGH;
-		break;
 	case IRQ_TYPE_LEVEL_LOW:
 		return EINT_LEVEL_LOW;
-		break;
 	default:
 		return -EINVAL;
 	}
 }
 
diff --git a/drivers/platform/x86/acer-wmi.c b/drivers/platform/x86/acer-wmi.c
index 49f4b73be513..1c2084c74a57 100644
--- a/drivers/platform/x86/acer-wmi.c
+++ b/drivers/platform/x86/acer-wmi.c
@@ -790,11 +790,10 @@ static acpi_status AMW0_set_u32(u32 value, u32 cap)
 		if (value > max_brightness)
 			return AE_BAD_PARAMETER;
 		switch (quirks->brightness) {
 		default:
 			return ec_write(0x83, value);
-			break;
 		}
 	default:
 		return AE_ERROR;
 	}
 
diff --git a/drivers/platform/x86/sony-laptop.c b/drivers/platform/x86/sony-laptop.c
index e5a1b5533408..704813374922 100644
--- a/drivers/platform/x86/sony-laptop.c
+++ b/drivers/platform/x86/sony-laptop.c
@@ -2465,26 +2465,23 @@ static int __sony_nc_gfx_switch_status_get(void)
 	case 0x0146:
 		/* 1: discrete GFX (speed)
 		 * 0: integrated GFX (stamina)
 		 */
 		return result & 0x1 ? SPEED : STAMINA;
-		break;
 	case 0x015B:
 		/* 0: discrete GFX (speed)
 		 * 1: integrated GFX (stamina)
 		 */
 		return result & 0x1 ? STAMINA : SPEED;
-		break;
 	case 0x0128:
 		/* it's a more elaborated bitmask, for now:
 		 * 2: integrated GFX (stamina)
 		 * 0: discrete GFX (speed)
 		 */
 		dprintk("GFX Status: 0x%x\n", result);
 		return result & 0x80 ? AUTO :
 			result & 0x02 ? STAMINA : SPEED;
-		break;
 	}
 	return -EINVAL;
 }
 
 static ssize_t sony_nc_gfx_switch_status_show(struct device *dev,
diff --git a/drivers/platform/x86/wmi.c b/drivers/platform/x86/wmi.c
index d88f388a3450..44e802f9f1b4 100644
--- a/drivers/platform/x86/wmi.c
+++ b/drivers/platform/x86/wmi.c
@@ -1258,17 +1258,14 @@ acpi_wmi_ec_space_handler(u32 function, acpi_physical_address address,
 	}
 
 	switch (result) {
 	case -EINVAL:
 		return AE_BAD_PARAMETER;
-		break;
 	case -ENODEV:
 		return AE_NOT_FOUND;
-		break;
 	case -ETIME:
 		return AE_TIME;
-		break;
 	default:
 		return AE_OK;
 	}
 }
 
diff --git a/drivers/power/supply/wm831x_power.c b/drivers/power/supply/wm831x_power.c
index 18b33f14dfee..4cd2dd870039 100644
--- a/drivers/power/supply/wm831x_power.c
+++ b/drivers/power/supply/wm831x_power.c
@@ -666,11 +666,10 @@ static int wm831x_power_probe(struct platform_device *pdev)
 	default:
 		dev_err(&pdev->dev, "Failed to find USB phy: %d\n", ret);
 		fallthrough;
 	case -EPROBE_DEFER:
 		goto err_bat_irq;
-		break;
 	}
 
 	return ret;
 
 err_bat_irq:
diff --git a/drivers/scsi/aic94xx/aic94xx_task.c b/drivers/scsi/aic94xx/aic94xx_task.c
index f923ed019d4a..ed034192b3c3 100644
--- a/drivers/scsi/aic94xx/aic94xx_task.c
+++ b/drivers/scsi/aic94xx/aic94xx_task.c
@@ -267,11 +267,10 @@ static void asd_task_tasklet_complete(struct asd_ascb *ascb,
 		ts->stat = SAS_NAK_R_ERR;
 		break;
 	case TA_I_T_NEXUS_LOSS:
 		opcode = dl->status_block[0];
 		goto Again;
-		break;
 	case TF_INV_CONN_HANDLE:
 		ts->resp = SAS_TASK_UNDELIVERED;
 		ts->stat = SAS_DEVICE_UNKNOWN;
 		break;
 	case TF_REQUESTED_N_PENDING:
diff --git a/drivers/scsi/be2iscsi/be_mgmt.c b/drivers/scsi/be2iscsi/be_mgmt.c
index 96d6e384b2b2..0d4928567265 100644
--- a/drivers/scsi/be2iscsi/be_mgmt.c
+++ b/drivers/scsi/be2iscsi/be_mgmt.c
@@ -1242,22 +1242,18 @@ beiscsi_adap_family_disp(struct device *dev, struct device_attribute *attr,
 	case BE_DEVICE_ID1:
 	case OC_DEVICE_ID1:
 	case OC_DEVICE_ID2:
 		return snprintf(buf, PAGE_SIZE,
 				"Obsolete/Unsupported BE2 Adapter Family\n");
-		break;
 	case BE_DEVICE_ID2:
 	case OC_DEVICE_ID3:
 		return snprintf(buf, PAGE_SIZE, "BE3-R Adapter Family\n");
-		break;
 	case OC_SKH_ID1:
 		return snprintf(buf, PAGE_SIZE, "Skyhawk-R Adapter Family\n");
-		break;
 	default:
 		return snprintf(buf, PAGE_SIZE,
 				"Unknown Adapter Family: 0x%x\n", dev_id);
-		break;
 	}
 }
 
 /**
  * beiscsi_phys_port()- Display Physical Port Identifier
diff --git a/drivers/scsi/bnx2fc/bnx2fc_hwi.c b/drivers/scsi/bnx2fc/bnx2fc_hwi.c
index 08992095ce7a..b37b0a9ec12d 100644
--- a/drivers/scsi/bnx2fc/bnx2fc_hwi.c
+++ b/drivers/scsi/bnx2fc/bnx2fc_hwi.c
@@ -768,11 +768,10 @@ static void bnx2fc_process_unsol_compl(struct bnx2fc_rport *tgt, u16 wqe)
 				if (rc)
 					goto skip_rec;
 			} else
 				printk(KERN_ERR PFX "SRR in progress\n");
 			goto ret_err_rqe;
-			break;
 		default:
 			break;
 		}
 
 skip_rec:
diff --git a/drivers/scsi/fcoe/fcoe.c b/drivers/scsi/fcoe/fcoe.c
index 0f9274960dc6..a4be6f439c47 100644
--- a/drivers/scsi/fcoe/fcoe.c
+++ b/drivers/scsi/fcoe/fcoe.c
@@ -1892,11 +1892,10 @@ static int fcoe_device_notification(struct notifier_block *notifier,
 			fcoe_interface_remove(fcoe);
 		fcoe_interface_cleanup(fcoe);
 		mutex_unlock(&fcoe_config_mutex);
 		fcoe_ctlr_device_delete(fcoe_ctlr_to_ctlr_dev(ctlr));
 		goto out;
-		break;
 	case NETDEV_FEAT_CHANGE:
 		fcoe_netdev_features_change(lport, netdev);
 		break;
 	default:
 		FCOE_NETDEV_DBG(netdev, "Unknown event %ld "
diff --git a/drivers/scsi/hpsa.c b/drivers/scsi/hpsa.c
index 83ce4f11a589..45136e3a4efc 100644
--- a/drivers/scsi/hpsa.c
+++ b/drivers/scsi/hpsa.c
@@ -7440,11 +7440,10 @@ static int find_PCI_BAR_index(struct pci_dev *pdev, unsigned long pci_bar_addr)
 				break;
 			default:	/* reserved in PCI 2.2 */
 				dev_warn(&pdev->dev,
 				       "base address is invalid\n");
 				return -1;
-				break;
 			}
 		}
 		if (offset == pci_bar_addr - PCI_BASE_ADDRESS_0)
 			return i + 1;
 	}
diff --git a/drivers/scsi/hptiop.c b/drivers/scsi/hptiop.c
index 6a2561f26e38..db4c7a7ff4dd 100644
--- a/drivers/scsi/hptiop.c
+++ b/drivers/scsi/hptiop.c
@@ -756,11 +756,10 @@ static void hptiop_finish_scsi_req(struct hptiop_hba *hba, u32 tag,
 		scsi_set_resid(scp,
 			scsi_bufflen(scp) - le32_to_cpu(req->dataxfer_length));
 		scp->result = SAM_STAT_CHECK_CONDITION;
 		memcpy(scp->sense_buffer, &req->sg_list, SCSI_SENSE_BUFFERSIZE);
 		goto skip_resid;
-		break;
 
 	default:
 		scp->result = DRIVER_INVALID << 24 | DID_ABORT << 16;
 		break;
 	}
diff --git a/drivers/scsi/ipr.c b/drivers/scsi/ipr.c
index b0aa58d117cc..e451102b9a29 100644
--- a/drivers/scsi/ipr.c
+++ b/drivers/scsi/ipr.c
@@ -9485,11 +9485,10 @@ static pci_ers_result_t ipr_pci_error_detected(struct pci_dev *pdev,
 		ipr_pci_frozen(pdev);
 		return PCI_ERS_RESULT_CAN_RECOVER;
 	case pci_channel_io_perm_failure:
 		ipr_pci_perm_failure(pdev);
 		return PCI_ERS_RESULT_DISCONNECT;
-		break;
 	default:
 		break;
 	}
 	return PCI_ERS_RESULT_NEED_RESET;
 }
diff --git a/drivers/scsi/isci/phy.c b/drivers/scsi/isci/phy.c
index 7041e2e3ab48..1b87d9080ebe 100644
--- a/drivers/scsi/isci/phy.c
+++ b/drivers/scsi/isci/phy.c
@@ -751,11 +751,10 @@ enum sci_status sci_phy_event_handler(struct isci_phy *iphy, u32 event_code)
 		       sci_change_state(&iphy->sm, SCI_PHY_STARTING);
 		       break;
 		default:
 			phy_event_warn(iphy, state, event_code);
 			return SCI_FAILURE;
-			break;
 		}
 		return SCI_SUCCESS;
 	case SCI_PHY_SUB_AWAIT_IAF_UF:
 		switch (scu_get_event_code(event_code)) {
 		case SCU_EVENT_SAS_PHY_DETECTED:
@@ -956,11 +955,10 @@ enum sci_status sci_phy_event_handler(struct isci_phy *iphy, u32 event_code)
 			sci_change_state(&iphy->sm, SCI_PHY_STARTING);
 			break;
 		default:
 			phy_event_warn(iphy, state, event_code);
 			return SCI_FAILURE_INVALID_STATE;
-			break;
 		}
 		return SCI_SUCCESS;
 	default:
 		dev_dbg(sciphy_to_dev(iphy), "%s: in wrong state: %s\n",
 			__func__, phy_state_name(state));
diff --git a/drivers/scsi/lpfc/lpfc_debugfs.c b/drivers/scsi/lpfc/lpfc_debugfs.c
index c9a327b13e5c..325081ac6553 100644
--- a/drivers/scsi/lpfc/lpfc_debugfs.c
+++ b/drivers/scsi/lpfc/lpfc_debugfs.c
@@ -3339,11 +3339,10 @@ lpfc_idiag_pcicfg_read(struct file *file, char __user *buf, size_t nbytes,
 		len += scnprintf(pbuffer+len, LPFC_PCI_CFG_SIZE-len,
 				"%03x: %08x\n", where, u32val);
 		break;
 	case LPFC_PCI_CFG_BROWSE: /* browse all */
 		goto pcicfg_browse;
-		break;
 	default:
 		/* illegal count */
 		len = 0;
 		break;
 	}
@@ -4379,11 +4378,11 @@ lpfc_idiag_queacc_write(struct file *file, const char __user *buf,
 					goto pass_check;
 				}
 			}
 		}
 		goto error_out;
-		break;
+
 	case LPFC_IDIAG_CQ:
 		/* MBX complete queue */
 		if (phba->sli4_hba.mbx_cq &&
 		    phba->sli4_hba.mbx_cq->queue_id == queid) {
 			/* Sanity check */
@@ -4431,11 +4430,11 @@ lpfc_idiag_queacc_write(struct file *file, const char __user *buf,
 					goto pass_check;
 				}
 			}
 		}
 		goto error_out;
-		break;
+
 	case LPFC_IDIAG_MQ:
 		/* MBX work queue */
 		if (phba->sli4_hba.mbx_wq &&
 		    phba->sli4_hba.mbx_wq->queue_id == queid) {
 			/* Sanity check */
@@ -4445,11 +4444,11 @@ lpfc_idiag_queacc_write(struct file *file, const char __user *buf,
 				goto error_out;
 			idiag.ptr_private = phba->sli4_hba.mbx_wq;
 			goto pass_check;
 		}
 		goto error_out;
-		break;
+
 	case LPFC_IDIAG_WQ:
 		/* ELS work queue */
 		if (phba->sli4_hba.els_wq &&
 		    phba->sli4_hba.els_wq->queue_id == queid) {
 			/* Sanity check */
@@ -4485,13 +4484,12 @@ lpfc_idiag_queacc_write(struct file *file, const char __user *buf,
 					idiag.ptr_private = qp;
 					goto pass_check;
 				}
 			}
 		}
-
 		goto error_out;
-		break;
+
 	case LPFC_IDIAG_RQ:
 		/* HDR queue */
 		if (phba->sli4_hba.hdr_rq &&
 		    phba->sli4_hba.hdr_rq->queue_id == queid) {
 			/* Sanity check */
@@ -4512,14 +4510,12 @@ lpfc_idiag_queacc_write(struct file *file, const char __user *buf,
 				goto error_out;
 			idiag.ptr_private = phba->sli4_hba.dat_rq;
 			goto pass_check;
 		}
 		goto error_out;
-		break;
 	default:
 		goto error_out;
-		break;
 	}
 
 pass_check:
 
 	if (idiag.cmd.opcode == LPFC_IDIAG_CMD_QUEACC_RD) {
diff --git a/drivers/scsi/lpfc/lpfc_init.c b/drivers/scsi/lpfc/lpfc_init.c
index ca25e54bb782..b6090357e8a5 100644
--- a/drivers/scsi/lpfc/lpfc_init.c
+++ b/drivers/scsi/lpfc/lpfc_init.c
@@ -7194,11 +7194,10 @@ lpfc_init_api_table_setup(struct lpfc_hba *phba, uint8_t dev_grp)
 	default:
 		lpfc_printf_log(phba, KERN_ERR, LOG_TRACE_EVENT,
 				"1431 Invalid HBA PCI-device group: 0x%x\n",
 				dev_grp);
 		return -ENODEV;
-		break;
 	}
 	return 0;
 }
 
 /**
diff --git a/drivers/scsi/lpfc/lpfc_scsi.c b/drivers/scsi/lpfc/lpfc_scsi.c
index 983eeb0e3d07..c3b02dab6e5c 100644
--- a/drivers/scsi/lpfc/lpfc_scsi.c
+++ b/drivers/scsi/lpfc/lpfc_scsi.c
@@ -4282,11 +4282,10 @@ lpfc_scsi_api_table_setup(struct lpfc_hba *phba, uint8_t dev_grp)
 	default:
 		lpfc_printf_log(phba, KERN_ERR, LOG_TRACE_EVENT,
 				"1418 Invalid HBA PCI-device group: 0x%x\n",
 				dev_grp);
 		return -ENODEV;
-		break;
 	}
 	phba->lpfc_rampdown_queue_depth = lpfc_rampdown_queue_depth;
 	phba->lpfc_scsi_cmd_iocb_cmpl = lpfc_scsi_cmd_iocb_cmpl;
 	return 0;
 }
diff --git a/drivers/scsi/lpfc/lpfc_sli.c b/drivers/scsi/lpfc/lpfc_sli.c
index e158cd77d387..0f18f1ba8a28 100644
--- a/drivers/scsi/lpfc/lpfc_sli.c
+++ b/drivers/scsi/lpfc/lpfc_sli.c
@@ -9187,11 +9187,10 @@ lpfc_mbox_api_table_setup(struct lpfc_hba *phba, uint8_t dev_grp)
 	default:
 		lpfc_printf_log(phba, KERN_ERR, LOG_TRACE_EVENT,
 				"1420 Invalid HBA PCI-device group: 0x%x\n",
 				dev_grp);
 		return -ENODEV;
-		break;
 	}
 	return 0;
 }
 
 /**
@@ -10070,11 +10069,10 @@ lpfc_sli4_iocb2wqe(struct lpfc_hba *phba, struct lpfc_iocbq *iocbq,
 	default:
 		lpfc_printf_log(phba, KERN_ERR, LOG_TRACE_EVENT,
 				"2014 Invalid command 0x%x\n",
 				iocbq->iocb.ulpCommand);
 		return IOCB_ERROR;
-		break;
 	}
 
 	if (iocbq->iocb_flag & LPFC_IO_DIF_PASS)
 		bf_set(wqe_dif, &wqe->generic.wqe_com, LPFC_WQE_DIF_PASSTHRU);
 	else if (iocbq->iocb_flag & LPFC_IO_DIF_STRIP)
@@ -10232,11 +10230,10 @@ lpfc_sli_api_table_setup(struct lpfc_hba *phba, uint8_t dev_grp)
 	default:
 		lpfc_printf_log(phba, KERN_ERR, LOG_TRACE_EVENT,
 				"1419 Invalid HBA PCI-device group: 0x%x\n",
 				dev_grp);
 		return -ENODEV;
-		break;
 	}
 	phba->lpfc_get_iocb_from_iocbq = lpfc_get_iocb_from_iocbq;
 	return 0;
 }
 
diff --git a/drivers/scsi/mvumi.c b/drivers/scsi/mvumi.c
index 0354898d7cac..2f7a52bd653a 100644
--- a/drivers/scsi/mvumi.c
+++ b/drivers/scsi/mvumi.c
@@ -2294,11 +2294,10 @@ static int mvumi_cfg_hw_reg(struct mvumi_hba *mhba)
 		regs->int_drbl_int_mask     = 0x3FFFFFFF;
 		regs->int_mu = regs->int_dl_cpu2pciea | regs->int_comaout;
 		break;
 	default:
 		return -1;
-		break;
 	}
 
 	return 0;
 }
 
diff --git a/drivers/scsi/pcmcia/nsp_cs.c b/drivers/scsi/pcmcia/nsp_cs.c
index bc5a623519e7..bb3b3884f968 100644
--- a/drivers/scsi/pcmcia/nsp_cs.c
+++ b/drivers/scsi/pcmcia/nsp_cs.c
@@ -1100,12 +1100,10 @@ static irqreturn_t nspintr(int irq, void *dev_id)
 		nsp_index_write(base, SCSIBUSCTRL, SCSI_ATN);
 		udelay(1);
 		nsp_index_write(base, SCSIBUSCTRL, SCSI_ATN | AUTODIRECTION | ACKENB);
 		return IRQ_HANDLED;
 
-		break;
-
 	case PH_RESELECT:
 		//nsp_dbg(NSP_DEBUG_INTR, "phase reselect");
 		// *sync_neg = SYNC_NOT_YET;
 		if ((phase & BUSMON_PHASE_MASK) != BUSPHASE_MESSAGE_IN) {
 
diff --git a/drivers/scsi/qla2xxx/qla_mbx.c b/drivers/scsi/qla2xxx/qla_mbx.c
index 07afd0d8a8f3..40af7f1524ce 100644
--- a/drivers/scsi/qla2xxx/qla_mbx.c
+++ b/drivers/scsi/qla2xxx/qla_mbx.c
@@ -4028,11 +4028,10 @@ qla24xx_report_id_acquisition(scsi_qla_host_t *vha,
 
 			/* if our portname is higher then initiate N2N login */
 
 			set_bit(N2N_LOGIN_NEEDED, &vha->dpc_flags);
 			return;
-			break;
 		case TOPO_FL:
 			ha->current_topology = ISP_CFG_FL;
 			break;
 		case TOPO_F:
 			ha->current_topology = ISP_CFG_F;
diff --git a/drivers/scsi/st.c b/drivers/scsi/st.c
index e2e5356a997d..43f7624508a9 100644
--- a/drivers/scsi/st.c
+++ b/drivers/scsi/st.c
@@ -2844,11 +2844,10 @@ static int st_int_ioctl(struct scsi_tape *STp, unsigned int cmd_in, unsigned lon
 		fileno = blkno = at_sm = 0;
 		break;
 	case MTNOP:
 		DEBC_printk(STp, "No op on tape.\n");
 		return 0;	/* Should do something ? */
-		break;
 	case MTRETEN:
 		cmd[0] = START_STOP;
 		if (STp->immediate) {
 			cmd[1] = 1;	/* Don't wait for completion */
 			timeout = STp->device->request_queue->rq_timeout;
diff --git a/drivers/scsi/sym53c8xx_2/sym_hipd.c b/drivers/scsi/sym53c8xx_2/sym_hipd.c
index a9fe092a4906..255a2d48d421 100644
--- a/drivers/scsi/sym53c8xx_2/sym_hipd.c
+++ b/drivers/scsi/sym53c8xx_2/sym_hipd.c
@@ -4594,11 +4594,10 @@ static void sym_int_sir(struct sym_hcb *np)
 				sym_print_addr(cp->cmd,
 					"M_REJECT received (%x:%x).\n",
 					scr_to_cpu(np->lastmsg), np->msgout[0]);
 			}
 			goto out_clrack;
-			break;
 		default:
 			goto out_reject;
 		}
 		break;
 	/*
diff --git a/drivers/staging/media/atomisp/pci/sh_css.c b/drivers/staging/media/atomisp/pci/sh_css.c
index ddee04c8248d..eab7a048ca7a 100644
--- a/drivers/staging/media/atomisp/pci/sh_css.c
+++ b/drivers/staging/media/atomisp/pci/sh_css.c
@@ -6284,11 +6284,10 @@ allocate_delay_frames(struct ia_css_pipe *pipe) {
 	case IA_CSS_PIPE_ID_CAPTURE: {
 		struct ia_css_capture_settings *mycs_capture = &pipe->pipe_settings.capture;
 		(void)mycs_capture;
 		return err;
 	}
-	break;
 	case IA_CSS_PIPE_ID_VIDEO: {
 		struct ia_css_video_settings *mycs_video = &pipe->pipe_settings.video;
 
 		ref_info = mycs_video->video_binary.internal_frame_info;
 		/*The ref frame expects
diff --git a/drivers/staging/rts5208/rtsx_scsi.c b/drivers/staging/rts5208/rtsx_scsi.c
index 1deb74112ad4..672248be7bf3 100644
--- a/drivers/staging/rts5208/rtsx_scsi.c
+++ b/drivers/staging/rts5208/rtsx_scsi.c
@@ -569,12 +569,10 @@ static int start_stop_unit(struct scsi_cmnd *srb, struct rtsx_chip *chip)
 	case LOAD_MEDIUM:
 		if (check_card_ready(chip, lun))
 			return TRANSPORT_GOOD;
 		set_sense_type(chip, lun, SENSE_TYPE_MEDIA_NOT_PRESENT);
 		return TRANSPORT_FAILED;
-
-		break;
 	}
 
 	return TRANSPORT_ERROR;
 }
 
diff --git a/drivers/staging/vme/devices/vme_user.c b/drivers/staging/vme/devices/vme_user.c
index fd0ea4dbcb91..7c7d3858e6ca 100644
--- a/drivers/staging/vme/devices/vme_user.c
+++ b/drivers/staging/vme/devices/vme_user.c
@@ -355,12 +355,10 @@ static int vme_user_ioctl(struct inode *inode, struct file *file,
 			 *	to userspace as they are
 			 */
 			return vme_master_set(image[minor].resource,
 				master.enable, master.vme_addr, master.size,
 				master.aspace, master.cycle, master.dwidth);
-
-			break;
 		}
 		break;
 	case SLAVE_MINOR:
 		switch (cmd) {
 		case VME_GET_SLAVE:
@@ -396,12 +394,10 @@ static int vme_user_ioctl(struct inode *inode, struct file *file,
 			 */
 			return vme_slave_set(image[minor].resource,
 				slave.enable, slave.vme_addr, slave.size,
 				image[minor].pci_buf, slave.aspace,
 				slave.cycle);
-
-			break;
 		}
 		break;
 	}
 
 	return -EINVAL;
diff --git a/drivers/tty/nozomi.c b/drivers/tty/nozomi.c
index d42b854cb7df..861e95043191 100644
--- a/drivers/tty/nozomi.c
+++ b/drivers/tty/nozomi.c
@@ -412,15 +412,13 @@ static void read_mem32(u32 *buf, const void __iomem *mem_addr_start,
 	switch (size_bytes) {
 	case 2:	/* 2 bytes */
 		buf16 = (u16 *) buf;
 		*buf16 = __le16_to_cpu(readw(ptr));
 		goto out;
-		break;
 	case 4:	/* 4 bytes */
 		*(buf) = __le32_to_cpu(readl(ptr));
 		goto out;
-		break;
 	}
 
 	while (i < size_bytes) {
 		if (size_bytes - i == 2) {
 			/* Handle 2 bytes in the end */
@@ -458,19 +456,18 @@ static u32 write_mem32(void __iomem *mem_addr_start, const u32 *buf,
 	switch (size_bytes) {
 	case 2:	/* 2 bytes */
 		buf16 = (const u16 *)buf;
 		writew(__cpu_to_le16(*buf16), ptr);
 		return 2;
-		break;
 	case 1: /*
 		 * also needs to write 4 bytes in this case
 		 * so falling through..
 		 */
+		fallthrough;
 	case 4: /* 4 bytes */
 		writel(__cpu_to_le32(*buf), ptr);
 		return 4;
-		break;
 	}
 
 	while (i < size_bytes) {
 		if (size_bytes - i == 2) {
 			/* 2 bytes */
diff --git a/drivers/tty/serial/imx.c b/drivers/tty/serial/imx.c
index 1731d9728865..09703079db7b 100644
--- a/drivers/tty/serial/imx.c
+++ b/drivers/tty/serial/imx.c
@@ -318,31 +318,26 @@ static void imx_uart_writel(struct imx_port *sport, u32 val, u32 offset)
 static u32 imx_uart_readl(struct imx_port *sport, u32 offset)
 {
 	switch (offset) {
 	case UCR1:
 		return sport->ucr1;
-		break;
 	case UCR2:
 		/*
 		 * UCR2_SRST is the only bit in the cached registers that might
 		 * differ from the value that was last written. As it only
 		 * automatically becomes one after being cleared, reread
 		 * conditionally.
 		 */
 		if (!(sport->ucr2 & UCR2_SRST))
 			sport->ucr2 = readl(sport->port.membase + offset);
 		return sport->ucr2;
-		break;
 	case UCR3:
 		return sport->ucr3;
-		break;
 	case UCR4:
 		return sport->ucr4;
-		break;
 	case UFCR:
 		return sport->ufcr;
-		break;
 	default:
 		return readl(sport->port.membase + offset);
 	}
 }
 
diff --git a/drivers/usb/gadget/function/f_hid.c b/drivers/usb/gadget/function/f_hid.c
index 1125f4715830..5204769834d1 100644
--- a/drivers/usb/gadget/function/f_hid.c
+++ b/drivers/usb/gadget/function/f_hid.c
@@ -509,27 +509,23 @@ static int hidg_setup(struct usb_function *f,
 		VDBG(cdev, "get_report\n");
 
 		/* send an empty report */
 		length = min_t(unsigned, length, hidg->report_length);
 		memset(req->buf, 0x0, length);
-
 		goto respond;
-		break;
 
 	case ((USB_DIR_IN | USB_TYPE_CLASS | USB_RECIP_INTERFACE) << 8
 		  | HID_REQ_GET_PROTOCOL):
 		VDBG(cdev, "get_protocol\n");
 		length = min_t(unsigned int, length, 1);
 		((u8 *) req->buf)[0] = hidg->protocol;
 		goto respond;
-		break;
 
 	case ((USB_DIR_OUT | USB_TYPE_CLASS | USB_RECIP_INTERFACE) << 8
 		  | HID_REQ_SET_REPORT):
 		VDBG(cdev, "set_report | wLength=%d\n", ctrl->wLength);
 		goto stall;
-		break;
 
 	case ((USB_DIR_OUT | USB_TYPE_CLASS | USB_RECIP_INTERFACE) << 8
 		  | HID_REQ_SET_PROTOCOL):
 		VDBG(cdev, "set_protocol\n");
 		if (value > HID_REPORT_PROTOCOL)
@@ -542,11 +538,10 @@ static int hidg_setup(struct usb_function *f,
 		if (hidg->bInterfaceSubClass == USB_INTERFACE_SUBCLASS_BOOT) {
 			hidg->protocol = value;
 			goto respond;
 		}
 		goto stall;
-		break;
 
 	case ((USB_DIR_IN | USB_TYPE_STANDARD | USB_RECIP_INTERFACE) << 8
 		  | USB_REQ_GET_DESCRIPTOR):
 		switch (value >> 8) {
 		case HID_DT_HID:
@@ -560,33 +555,29 @@ static int hidg_setup(struct usb_function *f,
 
 			length = min_t(unsigned short, length,
 						   hidg_desc_copy.bLength);
 			memcpy(req->buf, &hidg_desc_copy, length);
 			goto respond;
-			break;
 		}
 		case HID_DT_REPORT:
 			VDBG(cdev, "USB_REQ_GET_DESCRIPTOR: REPORT\n");
 			length = min_t(unsigned short, length,
 						   hidg->report_desc_length);
 			memcpy(req->buf, hidg->report_desc, length);
 			goto respond;
-			break;
 
 		default:
 			VDBG(cdev, "Unknown descriptor request 0x%x\n",
 				 value >> 8);
 			goto stall;
-			break;
 		}
 		break;
 
 	default:
 		VDBG(cdev, "Unknown request 0x%x\n",
 			 ctrl->bRequest);
 		goto stall;
-		break;
 	}
 
 stall:
 	return -EOPNOTSUPP;
 
diff --git a/drivers/usb/host/xhci-mem.c b/drivers/usb/host/xhci-mem.c
index fe405cd38dbc..b46ef45c4d25 100644
--- a/drivers/usb/host/xhci-mem.c
+++ b/drivers/usb/host/xhci-mem.c
@@ -1142,11 +1142,10 @@ int xhci_setup_addressable_virt_dev(struct xhci_hcd *xhci, struct usb_device *ud
 		max_packets = MAX_PACKET(8);
 		break;
 	case USB_SPEED_WIRELESS:
 		xhci_dbg(xhci, "FIXME xHCI doesn't support wireless speeds\n");
 		return -EINVAL;
-		break;
 	default:
 		/* Speed was set earlier, this shouldn't happen. */
 		return -EINVAL;
 	}
 	/* Find the root hub port this device is under */
diff --git a/drivers/usb/misc/iowarrior.c b/drivers/usb/misc/iowarrior.c
index 70ec29681526..efbd317f2f25 100644
--- a/drivers/usb/misc/iowarrior.c
+++ b/drivers/usb/misc/iowarrior.c
@@ -382,11 +382,10 @@ static ssize_t iowarrior_write(struct file *file,
 			goto exit;
 		}
 		retval = usb_set_report(dev->interface, 2, 0, buf, count);
 		kfree(buf);
 		goto exit;
-		break;
 	case USB_DEVICE_ID_CODEMERCS_IOW56:
 	case USB_DEVICE_ID_CODEMERCS_IOW56AM:
 	case USB_DEVICE_ID_CODEMERCS_IOW28:
 	case USB_DEVICE_ID_CODEMERCS_IOW28L:
 	case USB_DEVICE_ID_CODEMERCS_IOW100:
@@ -452,18 +451,16 @@ static ssize_t iowarrior_write(struct file *file,
 		}
 		/* submit was ok */
 		retval = count;
 		usb_free_urb(int_out_urb);
 		goto exit;
-		break;
 	default:
 		/* what do we have here ? An unsupported Product-ID ? */
 		dev_err(&dev->interface->dev, "%s - not supported for product=0x%x\n",
 			__func__, dev->product_id);
 		retval = -EFAULT;
 		goto exit;
-		break;
 	}
 error:
 	usb_free_coherent(dev->udev, dev->report_size, buf,
 			  int_out_urb->transfer_dma);
 error_no_buffer:
diff --git a/drivers/usb/serial/iuu_phoenix.c b/drivers/usb/serial/iuu_phoenix.c
index b4ba79123d9d..f1201d4de297 100644
--- a/drivers/usb/serial/iuu_phoenix.c
+++ b/drivers/usb/serial/iuu_phoenix.c
@@ -848,11 +848,10 @@ static int iuu_uart_baud(struct usb_serial_port *port, u32 baud_base,
 		dataout[DataCount++] = 0x04;
 		break;
 	default:
 		kfree(dataout);
 		return IUU_INVALID_PARAMETER;
-		break;
 	}
 
 	switch (parity & 0xF0) {
 	case IUU_ONE_STOP_BIT:
 		dataout[DataCount - 1] |= IUU_ONE_STOP_BIT;
@@ -862,11 +861,10 @@ static int iuu_uart_baud(struct usb_serial_port *port, u32 baud_base,
 		dataout[DataCount - 1] |= IUU_TWO_STOP_BITS;
 		break;
 	default:
 		kfree(dataout);
 		return IUU_INVALID_PARAMETER;
-		break;
 	}
 
 	status = bulk_immediate(port, dataout, DataCount);
 	if (status != IUU_OPERATION_OK)
 		dev_dbg(&port->dev, "%s - uart_off error\n", __func__);
diff --git a/drivers/usb/storage/freecom.c b/drivers/usb/storage/freecom.c
index 3d5f7d0ff0f1..2b098b55c4cb 100644
--- a/drivers/usb/storage/freecom.c
+++ b/drivers/usb/storage/freecom.c
@@ -429,11 +429,10 @@ static int freecom_transport(struct scsi_cmnd *srb, struct us_data *us)
 		/* should never hit here -- filtered in usb.c */
 		usb_stor_dbg(us, "freecom unimplemented direction: %d\n",
 			     us->srb->sc_data_direction);
 		/* Return fail, SCSI seems to handle this better. */
 		return USB_STOR_TRANSPORT_FAILED;
-		break;
 	}
 
 	return USB_STOR_TRANSPORT_GOOD;
 }
 
diff --git a/drivers/vme/bridges/vme_tsi148.c b/drivers/vme/bridges/vme_tsi148.c
index 50ae26977a02..1227ea937059 100644
--- a/drivers/vme/bridges/vme_tsi148.c
+++ b/drivers/vme/bridges/vme_tsi148.c
@@ -504,11 +504,10 @@ static int tsi148_slave_set(struct vme_slave_resource *image, int enabled,
 		addr |= TSI148_LCSR_ITAT_AS_A64;
 		break;
 	default:
 		dev_err(tsi148_bridge->parent, "Invalid address space\n");
 		return -EINVAL;
-		break;
 	}
 
 	/* Convert 64-bit variables to 2x 32-bit variables */
 	reg_split(vme_base, &vme_base_high, &vme_base_low);
 
@@ -993,11 +992,10 @@ static int tsi148_master_set(struct vme_master_resource *image, int enabled,
 	default:
 		spin_unlock(&image->lock);
 		dev_err(tsi148_bridge->parent, "Invalid address space\n");
 		retval = -EINVAL;
 		goto err_aspace;
-		break;
 	}
 
 	temp_ctl &= ~(3<<4);
 	if (cycle & VME_SUPER)
 		temp_ctl |= TSI148_LCSR_OTAT_SUP;
@@ -1501,11 +1499,10 @@ static int tsi148_dma_set_vme_src_attributes(struct device *dev, __be32 *attr,
 		val |= TSI148_LCSR_DSAT_AMODE_USER4;
 		break;
 	default:
 		dev_err(dev, "Invalid address space\n");
 		return -EINVAL;
-		break;
 	}
 
 	if (cycle & VME_SUPER)
 		val |= TSI148_LCSR_DSAT_SUP;
 	if (cycle & VME_PROG)
@@ -1601,11 +1598,10 @@ static int tsi148_dma_set_vme_dest_attributes(struct device *dev, __be32 *attr,
 		val |= TSI148_LCSR_DDAT_AMODE_USER4;
 		break;
 	default:
 		dev_err(dev, "Invalid address space\n");
 		return -EINVAL;
-		break;
 	}
 
 	if (cycle & VME_SUPER)
 		val |= TSI148_LCSR_DDAT_SUP;
 	if (cycle & VME_PROG)
@@ -1699,11 +1695,10 @@ static int tsi148_dma_list_add(struct vme_dma_list *list,
 		break;
 	default:
 		dev_err(tsi148_bridge->parent, "Invalid source type\n");
 		retval = -EINVAL;
 		goto err_source;
-		break;
 	}
 
 	/* Assume last link - this will be over-written by adding another */
 	entry->descriptor.dnlau = cpu_to_be32(0);
 	entry->descriptor.dnlal = cpu_to_be32(TSI148_LCSR_DNLAL_LLA);
@@ -1736,11 +1731,10 @@ static int tsi148_dma_list_add(struct vme_dma_list *list,
 		break;
 	default:
 		dev_err(tsi148_bridge->parent, "Invalid destination type\n");
 		retval = -EINVAL;
 		goto err_dest;
-		break;
 	}
 
 	/* Fill out count */
 	entry->descriptor.dcnt = cpu_to_be32((u32)count);
 
@@ -1962,11 +1956,10 @@ static int tsi148_lm_set(struct vme_lm_resource *lm, unsigned long long lm_base,
 		break;
 	default:
 		mutex_unlock(&lm->mtx);
 		dev_err(tsi148_bridge->parent, "Invalid address space\n");
 		return -EINVAL;
-		break;
 	}
 
 	if (cycle & VME_SUPER)
 		lm_ctl |= TSI148_LCSR_LMAT_SUPR ;
 	if (cycle & VME_USER)
diff --git a/drivers/vme/vme.c b/drivers/vme/vme.c
index b398293980b6..e1a940e43327 100644
--- a/drivers/vme/vme.c
+++ b/drivers/vme/vme.c
@@ -50,27 +50,22 @@ static struct vme_bridge *find_bridge(struct vme_resource *resource)
 	/* Get list to search */
 	switch (resource->type) {
 	case VME_MASTER:
 		return list_entry(resource->entry, struct vme_master_resource,
 			list)->parent;
-		break;
 	case VME_SLAVE:
 		return list_entry(resource->entry, struct vme_slave_resource,
 			list)->parent;
-		break;
 	case VME_DMA:
 		return list_entry(resource->entry, struct vme_dma_resource,
 			list)->parent;
-		break;
 	case VME_LM:
 		return list_entry(resource->entry, struct vme_lm_resource,
 			list)->parent;
-		break;
 	default:
 		printk(KERN_ERR "Unknown resource type\n");
 		return NULL;
-		break;
 	}
 }
 
 /**
  * vme_free_consistent - Allocate contiguous memory.
@@ -177,26 +172,22 @@ size_t vme_get_size(struct vme_resource *resource)
 			&aspace, &cycle, &dwidth);
 		if (retval)
 			return 0;
 
 		return size;
-		break;
 	case VME_SLAVE:
 		retval = vme_slave_get(resource, &enabled, &base, &size,
 			&buf_base, &aspace, &cycle);
 		if (retval)
 			return 0;
 
 		return size;
-		break;
 	case VME_DMA:
 		return 0;
-		break;
 	default:
 		printk(KERN_ERR "Unknown resource type\n");
 		return 0;
-		break;
 	}
 }
 EXPORT_SYMBOL(vme_get_size);
 
 int vme_check_window(u32 aspace, unsigned long long vme_base,
diff --git a/drivers/watchdog/geodewdt.c b/drivers/watchdog/geodewdt.c
index 83418924e30a..0b699c783d57 100644
--- a/drivers/watchdog/geodewdt.c
+++ b/drivers/watchdog/geodewdt.c
@@ -148,12 +148,10 @@ static long geodewdt_ioctl(struct file *file, unsigned int cmd,
 
 	switch (cmd) {
 	case WDIOC_GETSUPPORT:
 		return copy_to_user(argp, &ident,
 				    sizeof(ident)) ? -EFAULT : 0;
-		break;
-
 	case WDIOC_GETSTATUS:
 	case WDIOC_GETBOOTSTATUS:
 		return put_user(0, p);
 
 	case WDIOC_SETOPTIONS:
diff --git a/fs/efs/inode.c b/fs/efs/inode.c
index 89e73a6f0d36..64f3a54a0f72 100644
--- a/fs/efs/inode.c
+++ b/fs/efs/inode.c
@@ -161,11 +161,10 @@ struct inode *efs_iget(struct super_block *super, unsigned long ino)
 			init_special_inode(inode, inode->i_mode, device);
 			break;
 		default:
 			pr_warn("unsupported inode mode %o\n", inode->i_mode);
 			goto read_inode_error;
-			break;
 	}
 
 	unlock_new_inode(inode);
 	return inode;
         
diff --git a/fs/ocfs2/cluster/tcp.c b/fs/ocfs2/cluster/tcp.c
index 79a231719460..3bd8119bed5e 100644
--- a/fs/ocfs2/cluster/tcp.c
+++ b/fs/ocfs2/cluster/tcp.c
@@ -1196,11 +1196,10 @@ static int o2net_process_message(struct o2net_sock_container *sc,
 			break;
 		default:
 			msglog(hdr, "bad magic\n");
 			ret = -EINVAL;
 			goto out;
-			break;
 	}
 
 	/* find a handler for it */
 	handler_status = 0;
 	nmh = o2net_handler_get(be16_to_cpu(hdr->msg_type),
diff --git a/kernel/bpf/syscall.c b/kernel/bpf/syscall.c
index 1110ecd7d1f3..8f50c9c19f1b 100644
--- a/kernel/bpf/syscall.c
+++ b/kernel/bpf/syscall.c
@@ -2911,11 +2911,10 @@ attach_type_to_prog_type(enum bpf_attach_type attach_type)
 {
 	switch (attach_type) {
 	case BPF_CGROUP_INET_INGRESS:
 	case BPF_CGROUP_INET_EGRESS:
 		return BPF_PROG_TYPE_CGROUP_SKB;
-		break;
 	case BPF_CGROUP_INET_SOCK_CREATE:
 	case BPF_CGROUP_INET_SOCK_RELEASE:
 	case BPF_CGROUP_INET4_POST_BIND:
 	case BPF_CGROUP_INET6_POST_BIND:
 		return BPF_PROG_TYPE_CGROUP_SOCK;
diff --git a/security/integrity/ima/ima_appraise.c b/security/integrity/ima/ima_appraise.c
index 3dd8c2e4314e..f400a6122b3c 100644
--- a/security/integrity/ima/ima_appraise.c
+++ b/security/integrity/ima/ima_appraise.c
@@ -179,11 +179,10 @@ enum hash_algo ima_get_hash_algo(struct evm_ima_xattr_data *xattr_value,
 	case EVM_IMA_XATTR_DIGSIG:
 		sig = (typeof(sig))xattr_value;
 		if (sig->version != 2 || xattr_len <= sizeof(*sig))
 			return ima_hash_algo;
 		return sig->hash_algo;
-		break;
 	case IMA_XATTR_DIGEST_NG:
 		/* first byte contains algorithm id */
 		ret = xattr_value->data[0];
 		if (ret < HASH_ALGO__LAST)
 			return ret;
diff --git a/security/keys/trusted-keys/trusted_tpm1.c b/security/keys/trusted-keys/trusted_tpm1.c
index b9fe02e5f84f..eddc9477d42a 100644
--- a/security/keys/trusted-keys/trusted_tpm1.c
+++ b/security/keys/trusted-keys/trusted_tpm1.c
@@ -899,11 +899,10 @@ static int datablob_parse(char *datablob, struct trusted_key_payload *p,
 			return ret;
 		ret = Opt_update;
 		break;
 	case Opt_err:
 		return -EINVAL;
-		break;
 	}
 	return ret;
 }
 
 static struct trusted_key_options *trusted_options_alloc(void)
diff --git a/security/safesetid/lsm.c b/security/safesetid/lsm.c
index 8a176b6adbe5..1079c6d54784 100644
--- a/security/safesetid/lsm.c
+++ b/security/safesetid/lsm.c
@@ -123,11 +123,10 @@ static int safesetid_security_capable(const struct cred *cred,
 		 * set*uid() (e.g. setting up userns uid mappings).
 		 */
 		pr_warn("Operation requires CAP_SETUID, which is not available to UID %u for operations besides approved set*uid transitions\n",
 			__kuid_val(cred->uid));
 		return -EPERM;
-		break;
 	case CAP_SETGID:
 		/*
 		* If no policy applies to this task, allow the use of CAP_SETGID for
 		* other purposes.
 		*/
@@ -138,15 +137,13 @@ static int safesetid_security_capable(const struct cred *cred,
 		 * set*gid() (e.g. setting up userns gid mappings).
 		 */
 		pr_warn("Operation requires CAP_SETGID, which is not available to GID %u for operations besides approved set*gid transitions\n",
 			__kuid_val(cred->uid));
 		return -EPERM;
-		break;
 	default:
 		/* Error, the only capabilities were checking for is CAP_SETUID/GID */
 		return 0;
-		break;
 	}
 	return 0;
 }
 
 /*
diff --git a/sound/pci/rme32.c b/sound/pci/rme32.c
index 869af8a32c98..4eabece4dcba 100644
--- a/sound/pci/rme32.c
+++ b/sound/pci/rme32.c
@@ -466,11 +466,10 @@ static int snd_rme32_capture_getrate(struct rme32 * rme32, int *is_adat)
 			return 44100;
 		case 7:
 			return 32000;
 		default:
 			return -1;
-			break;
 		} 
 	else
 		switch (n) {	/* supporting the CS8412 */
 		case 0:
 			return -1;
diff --git a/sound/pci/rme9652/hdspm.c b/sound/pci/rme9652/hdspm.c
index 4a1f576dd9cf..3382c069fd3d 100644
--- a/sound/pci/rme9652/hdspm.c
+++ b/sound/pci/rme9652/hdspm.c
@@ -2284,11 +2284,10 @@ static int hdspm_get_wc_sample_rate(struct hdspm *hdspm)
 	switch (hdspm->io_type) {
 	case RayDAT:
 	case AIO:
 		status = hdspm_read(hdspm, HDSPM_RD_STATUS_1);
 		return (status >> 16) & 0xF;
-		break;
 	case AES32:
 		status = hdspm_read(hdspm, HDSPM_statusRegister);
 		return (status >> HDSPM_AES32_wcFreq_bit) & 0xF;
 	default:
 		break;
@@ -2310,11 +2309,10 @@ static int hdspm_get_tco_sample_rate(struct hdspm *hdspm)
 		switch (hdspm->io_type) {
 		case RayDAT:
 		case AIO:
 			status = hdspm_read(hdspm, HDSPM_RD_STATUS_1);
 			return (status >> 20) & 0xF;
-			break;
 		case AES32:
 			status = hdspm_read(hdspm, HDSPM_statusRegister);
 			return (status >> 1) & 0xF;
 		default:
 			break;
@@ -2336,11 +2334,10 @@ static int hdspm_get_sync_in_sample_rate(struct hdspm *hdspm)
 		switch (hdspm->io_type) {
 		case RayDAT:
 		case AIO:
 			status = hdspm_read(hdspm, HDSPM_RD_STATUS_2);
 			return (status >> 12) & 0xF;
-			break;
 		default:
 			break;
 		}
 	}
 
@@ -2356,11 +2353,10 @@ static int hdspm_get_aes_sample_rate(struct hdspm *hdspm, int index)
 
 	switch (hdspm->io_type) {
 	case AES32:
 		timecode = hdspm_read(hdspm, HDSPM_timecodeRegister);
 		return (timecode >> (4*index)) & 0xF;
-		break;
 	default:
 		break;
 	}
 	return 0;
 }
@@ -3843,22 +3839,20 @@ static int hdspm_wc_sync_check(struct hdspm *hdspm)
 				return 2;
 			else
 				return 1;
 		}
 		return 0;
-		break;
 
 	case MADI:
 		status2 = hdspm_read(hdspm, HDSPM_statusRegister2);
 		if (status2 & HDSPM_wcLock) {
 			if (status2 & HDSPM_wcSync)
 				return 2;
 			else
 				return 1;
 		}
 		return 0;
-		break;
 
 	case RayDAT:
 	case AIO:
 		status = hdspm_read(hdspm, HDSPM_statusRegister);
 
@@ -3866,12 +3860,10 @@ static int hdspm_wc_sync_check(struct hdspm *hdspm)
 			return 2;
 		else if (status & 0x1000000)
 			return 1;
 		return 0;
 
-		break;
-
 	case MADIface:
 		break;
 	}
 
 
diff --git a/sound/pci/rme9652/rme9652.c b/sound/pci/rme9652/rme9652.c
index 7ab10028d9fa..012fbec5e6a7 100644
--- a/sound/pci/rme9652/rme9652.c
+++ b/sound/pci/rme9652/rme9652.c
@@ -730,38 +730,31 @@ static inline int rme9652_spdif_sample_rate(struct snd_rme9652 *s)
 	rate_bits = rme9652_read(s, RME9652_status_register) & RME9652_F;
 
 	switch (rme9652_decode_spdif_rate(rate_bits)) {
 	case 0x7:
 		return 32000;
-		break;
 
 	case 0x6:
 		return 44100;
-		break;
 
 	case 0x5:
 		return 48000;
-		break;
 
 	case 0x4:
 		return 88200;
-		break;
 
 	case 0x3:
 		return 96000;
-		break;
 
 	case 0x0:
 		return 64000;
-		break;
 
 	default:
 		dev_err(s->card->dev,
 			"%s: unknown S/PDIF input rate (bits = 0x%x)\n",
 			   s->card_name, rate_bits);
 		return 0;
-		break;
 	}
 }
 
 /*-----------------------------------------------------------------------------
   Control Interface
diff --git a/sound/soc/codecs/wcd-clsh-v2.c b/sound/soc/codecs/wcd-clsh-v2.c
index 1be82113c59a..817d8259758c 100644
--- a/sound/soc/codecs/wcd-clsh-v2.c
+++ b/sound/soc/codecs/wcd-clsh-v2.c
@@ -478,11 +478,10 @@ static int _wcd_clsh_ctrl_set_state(struct wcd_clsh_ctrl *ctrl, int req_state,
 		wcd_clsh_state_hph_l(ctrl, req_state, is_enable, mode);
 		break;
 	case WCD_CLSH_STATE_HPHR:
 		wcd_clsh_state_hph_r(ctrl, req_state, is_enable, mode);
 		break;
-		break;
 	case WCD_CLSH_STATE_LO:
 		wcd_clsh_state_lo(ctrl, req_state, is_enable, mode);
 		break;
 	default:
 		break;
diff --git a/sound/soc/codecs/wl1273.c b/sound/soc/codecs/wl1273.c
index c56b9329240f..d8ced4559bf2 100644
--- a/sound/soc/codecs/wl1273.c
+++ b/sound/soc/codecs/wl1273.c
@@ -309,11 +309,10 @@ static int wl1273_startup(struct snd_pcm_substream *substream,
 			return -EINVAL;
 		}
 		break;
 	default:
 		return -EINVAL;
-		break;
 	}
 
 	return 0;
 }
 
diff --git a/sound/soc/intel/skylake/skl-pcm.c b/sound/soc/intel/skylake/skl-pcm.c
index bbe8d782e0af..b1ca64d2f7ea 100644
--- a/sound/soc/intel/skylake/skl-pcm.c
+++ b/sound/soc/intel/skylake/skl-pcm.c
@@ -500,11 +500,10 @@ static int skl_pcm_trigger(struct snd_pcm_substream *substream, int cmd,
 		 */
 		ret = skl_decoupled_trigger(substream, cmd);
 		if (ret < 0)
 			return ret;
 		return skl_run_pipe(skl, mconfig->pipe);
-		break;
 
 	case SNDRV_PCM_TRIGGER_PAUSE_PUSH:
 	case SNDRV_PCM_TRIGGER_SUSPEND:
 	case SNDRV_PCM_TRIGGER_STOP:
 		/*
diff --git a/sound/soc/ti/davinci-mcasp.c b/sound/soc/ti/davinci-mcasp.c
index a6b72ad53b43..2d85cc4c67fb 100644
--- a/sound/soc/ti/davinci-mcasp.c
+++ b/sound/soc/ti/davinci-mcasp.c
@@ -2383,11 +2383,10 @@ static int davinci_mcasp_probe(struct platform_device *pdev)
 		break;
 	default:
 		dev_err(&pdev->dev, "No DMA controller found (%d)\n", ret);
 	case -EPROBE_DEFER:
 		goto err;
-		break;
 	}
 
 	if (ret) {
 		dev_err(&pdev->dev, "register PCM failed: %d\n", ret);
 		goto err;

_______________________________________________
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel

^ permalink raw reply related	[relevance 15%]

* [PATCH] drm/amdgpu: add missing newline at eof
@ 2020-10-14 21:18 97% trix
  0 siblings, 0 replies; 180+ results
From: trix @ 2020-10-14 21:18 UTC (permalink / raw)
  To: alexander.deucher, christian.koenig, airlied, daniel,
	Hawking.Zhang, Dennis.Li, tao.zhou1, ray.huang, guchun.chen,
	sonny.jiang, xiaojian.du
  Cc: Tom Rix, dri-devel, amd-gfx, linux-kernel

From: Tom Rix <trix@redhat.com>

Representative checkpatch.pl warning

WARNING: adding a line without newline at end of file
 30: FILE: drivers/gpu/drm/amd/pm/swsmu/smu11/vangogh_ppt.h:30:
+#endif

Signed-off-by: Tom Rix <trix@redhat.com>
---
 drivers/gpu/drm/amd/include/asic_reg/gc/gc_9_4_1_sh_mask.h | 2 +-
 drivers/gpu/drm/amd/pm/swsmu/smu11/vangogh_ppt.h           | 2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/gpu/drm/amd/include/asic_reg/gc/gc_9_4_1_sh_mask.h b/drivers/gpu/drm/amd/include/asic_reg/gc/gc_9_4_1_sh_mask.h
index f26246a600c6..4089cfa081f5 100644
--- a/drivers/gpu/drm/amd/include/asic_reg/gc/gc_9_4_1_sh_mask.h
+++ b/drivers/gpu/drm/amd/include/asic_reg/gc/gc_9_4_1_sh_mask.h
@@ -745,4 +745,4 @@
 #define RLC_EDC_CNT2__RLC_SPM_SE7_SCRATCH_RAM_SEC_COUNT_MASK                                                  0x30000000L
 #define RLC_EDC_CNT2__RLC_SPM_SE7_SCRATCH_RAM_DED_COUNT_MASK                                                  0xC0000000L
 
-#endif
\ No newline at end of file
+#endif
diff --git a/drivers/gpu/drm/amd/pm/swsmu/smu11/vangogh_ppt.h b/drivers/gpu/drm/amd/pm/swsmu/smu11/vangogh_ppt.h
index 29929b360db8..d8696e2274c4 100644
--- a/drivers/gpu/drm/amd/pm/swsmu/smu11/vangogh_ppt.h
+++ b/drivers/gpu/drm/amd/pm/swsmu/smu11/vangogh_ppt.h
@@ -27,4 +27,4 @@
 
 extern void vangogh_set_ppt_funcs(struct smu_context *smu);
 
-#endif
\ No newline at end of file
+#endif
-- 
2.18.1

_______________________________________________
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel

^ permalink raw reply related	[relevance 97%]

* [PATCH] drm/gma500: fix double free of gma_connector
@ 2020-10-03 19:39 98% trix
  0 siblings, 0 replies; 180+ results
From: trix @ 2020-10-03 19:39 UTC (permalink / raw)
  To: patrik.r.jakobsson, airlied, daniel, natechancellor,
	ndesaulniers, alan, airlied, yakui.zhao
  Cc: clang-built-linux, linux-kernel, dri-devel, Tom Rix

From: Tom Rix <trix@redhat.com>

clang static analysis reports this problem:

cdv_intel_dp.c:2101:2: warning: Attempt to free released memory
        kfree(gma_connector);
        ^~~~~~~~~~~~~~~~~~~~

In cdv_intel_dp_init() when the call to cdv_intel_edp_panel_vdd_off()
fails, the handler calls cdv_intel_dp_destroy(connector) which does
the first free of gma_connector. So adjust the goto label and skip
the second free.

Fixes: d112a8163f83 ("gma500/cdv: Add eDP support")
Signed-off-by: Tom Rix <trix@redhat.com>
---
 drivers/gpu/drm/gma500/cdv_intel_dp.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/gpu/drm/gma500/cdv_intel_dp.c b/drivers/gpu/drm/gma500/cdv_intel_dp.c
index 720a767118c9..deb4fd13591d 100644
--- a/drivers/gpu/drm/gma500/cdv_intel_dp.c
+++ b/drivers/gpu/drm/gma500/cdv_intel_dp.c
@@ -2083,7 +2083,7 @@ cdv_intel_dp_init(struct drm_device *dev, struct psb_intel_mode_device *mode_dev
 			DRM_INFO("failed to retrieve link info, disabling eDP\n");
 			drm_encoder_cleanup(encoder);
 			cdv_intel_dp_destroy(connector);
-			goto err_priv;
+			goto err_connector;
 		} else {
         		DRM_DEBUG_KMS("DPCD: Rev=%x LN_Rate=%x LN_CNT=%x LN_DOWNSP=%x\n",
 				intel_dp->dpcd[0], intel_dp->dpcd[1], 
-- 
2.18.1

_______________________________________________
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel

^ permalink raw reply related	[relevance 98%]

* [PATCH] drm/nouveau: remove redundant check
@ 2020-08-27 18:37 96% trix
  0 siblings, 0 replies; 180+ results
From: trix @ 2020-08-27 18:37 UTC (permalink / raw)
  To: bskeggs, airlied, daniel; +Cc: nouveau, linux-kernel, dri-devel, Tom Rix

From: Tom Rix <trix@redhat.com>

clang static analysis flags this problem

hw.c:271:12: warning: The left operand of '>=' is a
  garbage value
    if (pv.M1 >= pll_lim.vco1.min_m ...
        ~~~~~ ^

This is mostly not a problem because an early check in
nouveau_hw_fix_bad_vpll()

    	if (nvbios_pll_parse(bios, pll, &pll_lim))
		return;
	nouveau_hw_get_pllvals(dev, pll, &pv);

shadows a similar check in nouveau_hw_get_pllvals()

	ret = nvbios_pll_parse(bios, plltype, &pll_lim);
	if (ret || !(reg1 = pll_lim.reg))
		return -ENOENT;

Since the first check is redundant, remove it and
check the status of nouveau_hw_get_pllvals().

Signed-off-by: Tom Rix <trix@redhat.com>
---
 drivers/gpu/drm/nouveau/dispnv04/hw.c | 4 +---
 1 file changed, 1 insertion(+), 3 deletions(-)

diff --git a/drivers/gpu/drm/nouveau/dispnv04/hw.c b/drivers/gpu/drm/nouveau/dispnv04/hw.c
index b674d68ef28a..b96c5628c33b 100644
--- a/drivers/gpu/drm/nouveau/dispnv04/hw.c
+++ b/drivers/gpu/drm/nouveau/dispnv04/hw.c
@@ -259,14 +259,12 @@ nouveau_hw_fix_bad_vpll(struct drm_device *dev, int head)
 	struct nouveau_drm *drm = nouveau_drm(dev);
 	struct nvif_device *device = &drm->client.device;
 	struct nvkm_clk *clk = nvxx_clk(device);
-	struct nvkm_bios *bios = nvxx_bios(device);
 	struct nvbios_pll pll_lim;
 	struct nvkm_pll_vals pv;
 	enum nvbios_pll_type pll = head ? PLL_VPLL1 : PLL_VPLL0;
 
-	if (nvbios_pll_parse(bios, pll, &pll_lim))
+	if (nouveau_hw_get_pllvals(dev, pll, &pv))
 		return;
-	nouveau_hw_get_pllvals(dev, pll, &pv);
 
 	if (pv.M1 >= pll_lim.vco1.min_m && pv.M1 <= pll_lim.vco1.max_m &&
 	    pv.N1 >= pll_lim.vco1.min_n && pv.N1 <= pll_lim.vco1.max_n &&
-- 
2.18.1

_______________________________________________
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel

^ permalink raw reply related	[relevance 96%]

* [PATCH] drm/i915/display: fix uninitialized variable
@ 2020-08-25 23:20 96% trix
  0 siblings, 0 replies; 180+ results
From: trix @ 2020-08-25 23:20 UTC (permalink / raw)
  To: jani.nikula, joonas.lahtinen, rodrigo.vivi, airlied, daniel,
	jose.souza, matthew.d.roper, anusha.srivatsa,
	pankaj.laxminarayan.bharadiya, wambui.karugax, vivek.kasireddy
  Cc: Tom Rix, intel-gfx, linux-kernel, dri-devel

From: Tom Rix <trix@redhat.com>

clang static analysis flags this error

intel_combo_phy.c:268:7: warning: The left expression of the
  compound assignment is an uninitialized value.
  The computed value will also be garbage
                ret &= check_phy_reg(...
                ~~~ ^

ret has no initial values, in icl_combo_phy_verify_state() ret is
set by the next statment and then updated by similar &= logic.

Because the check_phy_req() are only register reads, reorder the
statements.

Fixes: 239bef676d8e ("drm/i915/display: Implement new combo phy initialization step")
Signed-off-by: Tom Rix <trix@redhat.com>
---
 drivers/gpu/drm/i915/display/intel_combo_phy.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/gpu/drm/i915/display/intel_combo_phy.c b/drivers/gpu/drm/i915/display/intel_combo_phy.c
index 6968de4f3477..7622ef66c987 100644
--- a/drivers/gpu/drm/i915/display/intel_combo_phy.c
+++ b/drivers/gpu/drm/i915/display/intel_combo_phy.c
@@ -264,6 +264,8 @@ static bool icl_combo_phy_verify_state(struct drm_i915_private *dev_priv,
 	if (!icl_combo_phy_enabled(dev_priv, phy))
 		return false;
 
+	ret = cnl_verify_procmon_ref_values(dev_priv, phy);
+
 	if (INTEL_GEN(dev_priv) >= 12) {
 		ret &= check_phy_reg(dev_priv, phy, ICL_PORT_TX_DW8_LN0(phy),
 				     ICL_PORT_TX_DW8_ODCC_CLK_SEL |
@@ -276,8 +278,6 @@ static bool icl_combo_phy_verify_state(struct drm_i915_private *dev_priv,
 				     DCC_MODE_SELECT_CONTINUOSLY);
 	}
 
-	ret = cnl_verify_procmon_ref_values(dev_priv, phy);
-
 	if (phy_is_master(dev_priv, phy)) {
 		ret &= check_phy_reg(dev_priv, phy, ICL_PORT_COMP_DW8(phy),
 				     IREFGEN, IREFGEN);
-- 
2.18.1

_______________________________________________
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel

^ permalink raw reply related	[relevance 96%]

* [PATCH] drm/gma500: fix error check
@ 2020-08-05 20:59 99% trix
  0 siblings, 0 replies; 180+ results
From: trix @ 2020-08-05 20:59 UTC (permalink / raw)
  To: patrik.r.jakobsson, airlied, daniel, airlied, yakui.zhao, alan
  Cc: Tom Rix, linux-kernel, dri-devel

From: Tom Rix <trix@redhat.com>

Reviewing this block of code in cdv_intel_dp_init()

ret = cdv_intel_dp_aux_native_read(gma_encoder, DP_DPCD_REV, ...

cdv_intel_edp_panel_vdd_off(gma_encoder);
if (ret == 0) {
	/* if this fails, presume the device is a ghost */
	DRM_INFO("failed to retrieve link info, disabling eDP\n");
	drm_encoder_cleanup(encoder);
	cdv_intel_dp_destroy(connector);
	goto err_priv;
} else {

The (ret == 0) is not strict enough.
cdv_intel_dp_aux_native_read() returns > 0 on success
otherwise it is failure.

So change to <=

Fixes: d112a8163f83 ("gma500/cdv: Add eDP support")

Signed-off-by: Tom Rix <trix@redhat.com>
---
 drivers/gpu/drm/gma500/cdv_intel_dp.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/gpu/drm/gma500/cdv_intel_dp.c b/drivers/gpu/drm/gma500/cdv_intel_dp.c
index f41cbb753bb4..720a767118c9 100644
--- a/drivers/gpu/drm/gma500/cdv_intel_dp.c
+++ b/drivers/gpu/drm/gma500/cdv_intel_dp.c
@@ -2078,7 +2078,7 @@ cdv_intel_dp_init(struct drm_device *dev, struct psb_intel_mode_device *mode_dev
 					       intel_dp->dpcd,
 					       sizeof(intel_dp->dpcd));
 		cdv_intel_edp_panel_vdd_off(gma_encoder);
-		if (ret == 0) {
+		if (ret <= 0) {
 			/* if this fails, presume the device is a ghost */
 			DRM_INFO("failed to retrieve link info, disabling eDP\n");
 			drm_encoder_cleanup(encoder);
-- 
2.18.1

_______________________________________________
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel

^ permalink raw reply related	[relevance 99%]

* [PATCH] video: fbdev: sis: fix null ptr dereference
@ 2020-08-05 14:52 97% trix
  0 siblings, 0 replies; 180+ results
From: trix @ 2020-08-05 14:52 UTC (permalink / raw)
  To: thomas, b.zolnierkie, akpm; +Cc: Tom Rix, linux-fbdev, linux-kernel, dri-devel

From: Tom Rix <trix@redhat.com>

Clang static analysis reports this representative error

init.c:2501:18: warning: Array access (from variable 'queuedata') results
  in a null pointer dereference
      templ |= ((queuedata[i] & 0xc0) << 3);

This is the problem block of code

   if(ModeNo > 0x13) {
      ...
      if(SiS_Pr->ChipType == SIS_730) {
	 queuedata = &FQBQData730[0];
      } else {
	 queuedata = &FQBQData[0];
      }
   } else {

   }

queuedata is not set in the else block

Reviewing the old code, the arrays FQBQData730 and FQBQData were
used directly.

So hoist the setting of queuedata out of the if-else block.

Fixes: 544393fe584d ("[PATCH] sisfb update")

Signed-off-by: Tom Rix <trix@redhat.com>
---
 drivers/video/fbdev/sis/init.c | 11 +++++------
 1 file changed, 5 insertions(+), 6 deletions(-)

diff --git a/drivers/video/fbdev/sis/init.c b/drivers/video/fbdev/sis/init.c
index dfe3eb769638..fde27feae5d0 100644
--- a/drivers/video/fbdev/sis/init.c
+++ b/drivers/video/fbdev/sis/init.c
@@ -2428,6 +2428,11 @@ SiS_SetCRT1FIFO_630(struct SiS_Private *SiS_Pr, unsigned short ModeNo,
 
    i = 0;
 
+	if (SiS_Pr->ChipType == SIS_730)
+		queuedata = &FQBQData730[0];
+	else
+		queuedata = &FQBQData[0];
+
    if(ModeNo > 0x13) {
 
       /* Get VCLK  */
@@ -2445,12 +2450,6 @@ SiS_SetCRT1FIFO_630(struct SiS_Private *SiS_Pr, unsigned short ModeNo,
       /* Get half colordepth */
       colorth = colortharray[(SiS_Pr->SiS_ModeType - ModeEGA)];
 
-      if(SiS_Pr->ChipType == SIS_730) {
-	 queuedata = &FQBQData730[0];
-      } else {
-	 queuedata = &FQBQData[0];
-      }
-
       do {
 	 templ = SiS_CalcDelay2(SiS_Pr, queuedata[i]) * VCLK * colorth;
 
-- 
2.18.1

_______________________________________________
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel

^ permalink raw reply related	[relevance 97%]

* Re: [RFC PATCH 00/17] Drop uses of pci_read_config_*() return value
  @ 2020-08-02 14:53 98%   ` Tom Rix
  0 siblings, 0 replies; 180+ results
From: Tom Rix @ 2020-08-02 14:53 UTC (permalink / raw)
  To: Borislav Petkov, Saheed O. Bolarinwa
  Cc: Vignesh Raghavendra, linux-pci, linux-fpga, dri-devel, linux-ide,
	linux-mtd, linux-i2c, Miquel Raynal, linux-rdma,
	Richard Weinberger, Joerg Roedel, linux-atm-general, helgaas,
	Jakub Kicinski, linux-kernel-mentees, Wolfgang Grandegger,
	intel-gfx, linux-gpio, Marc Kleine-Budde, skhan, bjorn,
	Kalle Valo, linux-edac, linux-hwmon, netdev, linux-wireless,
	linux-kernel, iommu, linux-crypto, dmaengine, David S. Miller


On 8/1/20 5:56 AM, Borislav Petkov wrote:
> On Sat, Aug 01, 2020 at 01:24:29PM +0200, Saheed O. Bolarinwa wrote:
>> The return value of pci_read_config_*() may not indicate a device error.
>> However, the value read by these functions is more likely to indicate
>> this kind of error. This presents two overlapping ways of reporting
>> errors and complicates error checking.
> So why isn't the *value check done in the pci_read_config_* functions
> instead of touching gazillion callers?
>
> For example, pci_conf{1,2}_read() could check whether the u32 *value it
> just read depending on the access method, whether that value is ~0 and
> return proper PCIBIOS_ error in that case.
>
> The check you're replicating
>
> 	if (val32 == (u32)~0)
>
> everywhere, instead, is just ugly and tests a naked value ~0 which
> doesn't mean anything...
>
I agree, if there is a change, it should be in the pci_read_* functions.

Anything returning void should not fail and likely future users of the proposed change will not do the extra checks.

Tom

_______________________________________________
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel

^ permalink raw reply	[relevance 98%]

* [PATCH] video: fbdev: pvr2fb: initialize variables
@ 2020-07-20 19:18 99% trix
  0 siblings, 0 replies; 180+ results
From: trix @ 2020-07-20 19:18 UTC (permalink / raw)
  To: b.zolnierkie, jhubbard, sam, daniel.vetter, gustavo, arnd, jani.nikula
  Cc: Tom Rix, linux-fbdev, linux-kernel, dri-devel

From: Tom Rix <trix@redhat.com>

clang static analysis reports this repesentative error

pvr2fb.c:1049:2: warning: 1st function call argument
  is an uninitialized value [core.CallAndMessage]
        if (*cable_arg)
        ^~~~~~~~~~~~~~~

Problem is that cable_arg depends on the input loop to
set the cable_arg[0].  If it does not, then some random
value from the stack is used.

A similar problem exists for output_arg.

So initialize cable_arg and output_arg.

Signed-off-by: Tom Rix <trix@redhat.com>
---
 drivers/video/fbdev/pvr2fb.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/drivers/video/fbdev/pvr2fb.c b/drivers/video/fbdev/pvr2fb.c
index 2d9f69b93392..f4add36cb5f4 100644
--- a/drivers/video/fbdev/pvr2fb.c
+++ b/drivers/video/fbdev/pvr2fb.c
@@ -1028,6 +1028,8 @@ static int __init pvr2fb_setup(char *options)
 	if (!options || !*options)
 		return 0;
 
+	cable_arg[0] = output_arg[0] = 0;
+
 	while ((this_opt = strsep(&options, ","))) {
 		if (!*this_opt)
 			continue;
-- 
2.18.1

_______________________________________________
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel

^ permalink raw reply related	[relevance 99%]

* [PATCH] drm/v3d: remove second free in v3d_submit_cl_ioctl
@ 2020-07-20 13:56 99% trix
  0 siblings, 0 replies; 180+ results
From: trix @ 2020-07-20 13:56 UTC (permalink / raw)
  To: eric, airlied, daniel, itoral, navid.emamdoost
  Cc: Tom Rix, linux-kernel, dri-devel

From: Tom Rix <trix@redhat.com>

clang static analysis reports this error

v3d_gem.c:573:4: warning: Attempt to free released
  memory [unix.Malloc]
    kfree(bin);
    ^~~~~~~~~~

Problem is in the block of code

	if (ret) {
		kfree(bin);
		v3d_job_put(&render->base);
		kfree(bin);
		return ret;
	}

Obviously bin is freed twice.
So remove one.

Fixes: 0d352a3a8a1f ("drm/v3d: don't leak bin job if v3d_job_init fails.")
Fixes: 29cd13cfd762 ("drm/v3d: Fix memory leak in v3d_submit_cl_ioctl")

Signed-off-by: Tom Rix <trix@redhat.com>
---
 drivers/gpu/drm/v3d/v3d_gem.c | 1 -
 1 file changed, 1 deletion(-)

diff --git a/drivers/gpu/drm/v3d/v3d_gem.c b/drivers/gpu/drm/v3d/v3d_gem.c
index 915f8bfdb58c..3cfbdb8e6a91 100644
--- a/drivers/gpu/drm/v3d/v3d_gem.c
+++ b/drivers/gpu/drm/v3d/v3d_gem.c
@@ -570,7 +570,6 @@ v3d_submit_cl_ioctl(struct drm_device *dev, void *data,
 		if (ret) {
 			kfree(bin);
 			v3d_job_put(&render->base);
-			kfree(bin);
 			return ret;
 		}
 
-- 
2.18.1

_______________________________________________
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel

^ permalink raw reply related	[relevance 99%]

* [PATCH] drm/bridge: sil_sii8620: initialize return of sii8620_readb
@ 2020-07-12 15:24 99% trix
  0 siblings, 0 replies; 180+ results
From: trix @ 2020-07-12 15:24 UTC (permalink / raw)
  To: a.hajda, narmstrong, Laurent.pinchart, jonas, jernej.skrabec,
	airlied, daniel, architt
  Cc: stable, linux-kernel, dri-devel, Tom Rix

From: Tom Rix <trix@redhat.com>

clang static analysis flags this error

sil-sii8620.c:184:2: warning: Undefined or garbage value
  returned to caller [core.uninitialized.UndefReturn]
        return ret;
        ^~~~~~~~~~

sii8620_readb calls sii8620_read_buf.
sii8620_read_buf can return without setting its output
pararmeter 'ret'.

So initialize ret.

Fixes: ce6e153f414a ("drm/bridge: add Silicon Image SiI8620 driver")

Signed-off-by: Tom Rix <trix@redhat.com>
---
 drivers/gpu/drm/bridge/sil-sii8620.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/gpu/drm/bridge/sil-sii8620.c b/drivers/gpu/drm/bridge/sil-sii8620.c
index 3540e4931383..da933d477e5f 100644
--- a/drivers/gpu/drm/bridge/sil-sii8620.c
+++ b/drivers/gpu/drm/bridge/sil-sii8620.c
@@ -178,7 +178,7 @@ static void sii8620_read_buf(struct sii8620 *ctx, u16 addr, u8 *buf, int len)
 
 static u8 sii8620_readb(struct sii8620 *ctx, u16 addr)
 {
-	u8 ret;
+	u8 ret = 0;
 
 	sii8620_read_buf(ctx, addr, &ret, 1);
 	return ret;
-- 
2.18.1

_______________________________________________
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel

^ permalink raw reply related	[relevance 99%]

* [PATCH] drm/radeon: fix double free
@ 2020-07-06 12:28 90% trix
  0 siblings, 0 replies; 180+ results
From: trix @ 2020-07-06 12:28 UTC (permalink / raw)
  To: alexander.deucher, christian.koenig, airlied, daniel
  Cc: Tom Rix, dri-devel, amd-gfx, linux-kernel

From: Tom Rix <trix@redhat.com>

clang static analysis flags this error

drivers/gpu/drm/radeon/ci_dpm.c:5652:9: warning: Use of memory after it is freed [unix.Malloc]
                kfree(rdev->pm.dpm.ps[i].ps_priv);
                      ^~~~~~~~~~~~~~~~~~~~~~~~~~
drivers/gpu/drm/radeon/ci_dpm.c:5654:2: warning: Attempt to free released memory [unix.Malloc]
        kfree(rdev->pm.dpm.ps);
        ^~~~~~~~~~~~~~~~~~~~~~

problem is reported in ci_dpm_fini, with these code blocks.

	for (i = 0; i < rdev->pm.dpm.num_ps; i++) {
		kfree(rdev->pm.dpm.ps[i].ps_priv);
	}
	kfree(rdev->pm.dpm.ps);

The first free happens in ci_parse_power_table where it cleans up locally
on a failure.  ci_dpm_fini also does a cleanup.

	ret = ci_parse_power_table(rdev);
	if (ret) {
		ci_dpm_fini(rdev);
		return ret;
	}

So remove the cleanup in ci_parse_power_table and
move the num_ps calculation to inside the loop so ci_dpm_fini
will know how many array elements to free.

Fixes: cc8dbbb4f62a ("drm/radeon: add dpm support for CI dGPUs (v2)")

Signed-off-by: Tom Rix <trix@redhat.com>
---
 drivers/gpu/drm/radeon/ci_dpm.c | 7 +++----
 1 file changed, 3 insertions(+), 4 deletions(-)

diff --git a/drivers/gpu/drm/radeon/ci_dpm.c b/drivers/gpu/drm/radeon/ci_dpm.c
index 86ac032275bb..ba20c6f03719 100644
--- a/drivers/gpu/drm/radeon/ci_dpm.c
+++ b/drivers/gpu/drm/radeon/ci_dpm.c
@@ -5563,6 +5563,7 @@ static int ci_parse_power_table(struct radeon_device *rdev)
 	if (!rdev->pm.dpm.ps)
 		return -ENOMEM;
 	power_state_offset = (u8 *)state_array->states;
+	rdev->pm.dpm.num_ps = 0;
 	for (i = 0; i < state_array->ucNumEntries; i++) {
 		u8 *idx;
 		power_state = (union pplib_power_state *)power_state_offset;
@@ -5572,10 +5573,8 @@ static int ci_parse_power_table(struct radeon_device *rdev)
 		if (!rdev->pm.power_state[i].clock_info)
 			return -EINVAL;
 		ps = kzalloc(sizeof(struct ci_ps), GFP_KERNEL);
-		if (ps == NULL) {
-			kfree(rdev->pm.dpm.ps);
+		if (ps == NULL)
 			return -ENOMEM;
-		}
 		rdev->pm.dpm.ps[i].ps_priv = ps;
 		ci_parse_pplib_non_clock_info(rdev, &rdev->pm.dpm.ps[i],
 					      non_clock_info,
@@ -5597,8 +5596,8 @@ static int ci_parse_power_table(struct radeon_device *rdev)
 			k++;
 		}
 		power_state_offset += 2 + power_state->v2.ucNumDPMLevels;
+		rdev->pm.dpm.num_ps = i + 1;
 	}
-	rdev->pm.dpm.num_ps = state_array->ucNumEntries;
 
 	/* fill in the vce power states */
 	for (i = 0; i < RADEON_MAX_VCE_LEVELS; i++) {
-- 
2.18.1

_______________________________________________
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel

^ permalink raw reply related	[relevance 90%]

Results 1-180 of 180 | reverse | options above
-- pct% links below jump to the message on this page, permalinks otherwise --
2020-07-06 12:28 90% [PATCH] drm/radeon: fix double free trix
2020-07-12 15:24 99% [PATCH] drm/bridge: sil_sii8620: initialize return of sii8620_readb trix
2020-07-20 13:56 99% [PATCH] drm/v3d: remove second free in v3d_submit_cl_ioctl trix
2020-07-20 19:18 99% [PATCH] video: fbdev: pvr2fb: initialize variables trix
2020-08-01 11:24     [RFC PATCH 00/17] Drop uses of pci_read_config_*() return value Saheed O. Bolarinwa
2020-08-01 12:56     ` Borislav Petkov
2020-08-02 14:53 98%   ` Tom Rix
2020-08-05 14:52 97% [PATCH] video: fbdev: sis: fix null ptr dereference trix
2020-08-05 20:59 99% [PATCH] drm/gma500: fix error check trix
2020-08-25 23:20 96% [PATCH] drm/i915/display: fix uninitialized variable trix
2020-08-27 18:37 96% [PATCH] drm/nouveau: remove redundant check trix
2020-10-03 19:39 98% [PATCH] drm/gma500: fix double free of gma_connector trix
2020-10-14 21:18 97% [PATCH] drm/amdgpu: add missing newline at eof trix
2020-10-17 16:09 15% [RFC] treewide: cleanup unreachable breaks trix
2020-10-18  5:43     ` Greg KH
2020-10-18 14:04 95%   ` Tom Rix
2020-10-19 19:42       ` Nick Desaulniers
2020-10-19 23:05         ` Jason Gunthorpe
2020-10-20 14:09 90%       ` Tom Rix
2020-10-20 13:55 89%     ` Tom Rix
2020-10-19 14:43 74% [PATCH] drm/amdgpu: remove unneeded break trix
2020-10-19 16:31 82% [PATCH] drm: " trix
2020-10-27 16:42 72% Subject: [RFC] clang tooling cleanups trix
2020-11-10  2:52     ` Joe Perches
2020-11-10 13:12 99%   ` Tom Rix
2020-10-27 19:07 98% [PATCH] drm/amdgpu: remove unneeded semicolon trix
2020-10-27 20:07 97% [PATCH] drm/amd/display: " trix
2020-11-21 16:50 66% [RFC] MAINTAINERS tag for cleanup robot trix
2020-11-21 17:10     ` Joe Perches
2020-11-22 16:33 95%   ` Tom Rix
2020-11-22 18:22         ` Joe Perches
2020-11-23 17:06 98%       ` Tom Rix
     [not found]     ` <20201122032304.GE4327@casper.infradead.org>
2020-11-22 14:46 98%   ` Tom Rix
     [not found]         ` <20201122145635.GG4327@casper.infradead.org>
2020-11-22 16:10 93%       ` Tom Rix
2020-11-27 16:26 99% [PATCH] drm/amdgpu/display: remove trailing semicolon in macro definition trix
2020-11-27 16:28 99% [PATCH] drm/i915: " trix
2020-11-27 19:05 96% [PATCH] omapfb: fbcon: " trix
2020-12-15 14:38 83% [PATCH] drm/amdgpu: remove h from printk format specifier trix
2020-12-15 14:47     ` Christian König
2020-12-15 15:06 99%   ` Tom Rix
2020-12-15 14:41 99% [PATCH] drm/i915: " trix
2020-12-15 18:13     ` Chris Wilson
2020-12-15 19:00 99%   ` Tom Rix
2020-12-15 14:42 96% [PATCH] drm/radeon: " trix
2021-03-22 11:54     [PATCH] amdgpu: avoid incorrect %hu format string Arnd Bergmann
2021-03-22 14:08 99% ` Tom Rix
2021-04-02  9:09     [PATCH RFC 0/3] Adds support to allow the bitstream configuration from pre-allocated dma-buffer Nava kishore Manne
2021-04-02 14:35 99% ` Tom Rix
2021-04-30 17:16 99% [PATCH] drm/amd/pm: initialize variable trix
2021-07-02 19:52 99% [PATCH] drm/amdgpu: initialize amdgpu_ras_query_error_count() error count parameters trix
2021-07-24 20:27 95% [PATCH] drm/nouveau/kms/nv50-: use DRM_NOUVEAU_BACKLIGHT consistently trix
2021-09-30 20:34 99% [PATCH] drm/amdkfd: match the signatures of the real and stub kgd2kfd_probe() trix
2022-01-22 14:35 99% [PATCH] drm/amdkfd: simplify else if to else check of MIGRATION_COPY_DIR trix
2022-01-24 13:52 96% [PATCH] drm/amd/pm: set min, max to 0 if there is no get_dpm_ultimate_freq function trix
2022-01-24 20:18 98% [PATCH v2] drm/amd/pm: return -ENOTSUPP " trix
2022-01-29 14:53 98% [PATCH] drm/amdgpu: initialize reg_access_ctrl trix
2022-02-03 15:23 99% [PATCH] drm/ast: fix using freed memory trix
2022-02-05 15:00 96% [PATCH] drm/amd/pm: fix error handling trix
2022-02-09 14:52 99% [PATCH] drm/amdkfd: fix freeing an unset pointer trix
2022-02-10 17:04 96% [PATCH] drm/amdkfd: fix loop error handling trix
2022-02-14 18:22 98% [PATCH] drm/amdgpu: check return status before using stable_pstate trix
2022-02-17 15:38 89% [PATCH] drm/amdgpu: fix amdgpu_ras_block_late_init error handler trix
2022-02-17 16:41 99% [PATCH] drm/amdkfd: fix typo in setting enum value trix
2022-02-18 17:39 89% [PATCH] drm/amdkfd: rework criu_restore_bos error handling trix
2022-02-18 18:35     ` Felix Kuehling
2022-02-19  2:34 99%   ` Tom Rix
2022-02-21 17:37 99% [PATCH] drm/amdgpu: fix printk format for size_t variable trix
2022-02-21 19:57     ` Luben Tuikov
2022-02-21 20:36 99%   ` Tom Rix
2022-02-21 20:53         ` Luben Tuikov
2022-02-21 21:02 99%       ` Tom Rix
2022-02-26 15:58 97% [PATCH] drm/amdgpu: Fix realloc of ptr trix
2022-02-26 22:21     ` David Laight
2022-02-27 14:36 99%   ` Tom Rix
2022-02-27 15:33 95% [PATCH v2] " trix
2022-03-01 12:43 85% [PATCH] drm/panfrost: cleanup comments trix
2022-03-02  9:09     ` Steven Price
2022-03-02 12:18 99%   ` Tom Rix
2022-03-01 19:29 99% [PATCH] vgaarbiter: fix vgaarbiter doc build break trix
2022-03-02 12:45 85% [PATCH v2] drm/panfrost: cleanup comments trix
2022-03-03 20:19 99% [PATCH] drm/bridge: anx7625: check the return on anx7625_aux_trans trix
2022-03-08 22:57     ` Nick Desaulniers
2022-03-09  1:45 99%   ` Tom Rix
2022-03-04 21:03 85% [PATCH] drm/i915: rework the error handling in *_dpll_params trix
2022-03-13 14:10 95% [PATCH] drm/repaper: combine allocs in repaper_spi_transfer() trix
2022-03-13 15:41     ` Noralf Trønnes
2022-03-13 16:07 99%   ` Tom Rix
2022-04-02 16:27 61% [PATCH] drm/radeon: change si_default_state table from global to static Tom Rix
2022-04-03 15:23     ` Christian König
2022-04-04 12:32 99%   ` Tom Rix
2022-04-04 12:34         ` Christian König
2022-04-04 13:01 99%       ` Tom Rix
2022-04-04 13:32             ` Christian König
2022-04-04 14:22 99%           ` Tom Rix
2022-04-03 14:21 99% [PATCH] drm/amd/display: cleanup extern usage in function definition Tom Rix
2022-04-04 15:22     ` Harry Wentland
2022-04-04 15:43 99%   ` Tom Rix
2022-04-04 22:57 68% [PATCH v2] drm/radeon: change si_default_state table from global to static Tom Rix
2022-04-07 21:46 62% [PATCH] drm/radeon: change cayman_default_state " Tom Rix
2022-04-09 17:11 58% [PATCH] drm/radeon: remove r600_blit_shaders.[c|h] Tom Rix
2022-04-16 17:23 95% [PATCH] drm/i915: change node clearing from memset to initialization Tom Rix
2022-04-16 18:33     ` Joe Perches
2022-04-16 20:48 99%   ` Tom Rix
2022-04-16 21:04         ` Joe Perches
2022-04-16 22:25 99%       ` Tom Rix
2022-04-16 18:47 63% [PATCH] drm/radeon/kms: change evergreen_default_state table from global to static Tom Rix
2022-04-16 22:34 97% [PATCH v2] drm/i915: change node clearing from memset to initialization Tom Rix
2022-04-18 14:18 99% [PATCH] drm/nouveau: change base917c_format from global to static Tom Rix
2022-04-18 15:28 99% [PATCH] drm/nouveau/gr/gf100-: change gf108_gr_fwif " Tom Rix
2022-04-18 19:48 99% [PATCH] drm/amd/display: add virtual_setup_stream_attribute decl to header Tom Rix
2022-04-21 13:15 99% [PATCH] drm/msm: change msm_sched_ops from global to static Tom Rix
2022-04-21 13:30 99% [PATCH] drm/nouveau/gsp: change gv100_gsp " Tom Rix
2022-04-21 14:20 99% [PATCH] drm/qxl: remove qxl_log_level global Tom Rix
2022-04-21 14:43 99% [PATCH] drm/rockchip: cdn-dp: change rk3399_cdn_dp from global to static Tom Rix
2022-04-22 18:51 99% [PATCH] drm/nouveau/kms/gv100: use static for gv100_disp_core_mthd_[base|sor] Tom Rix
2022-04-23 12:56 99% [PATCH] fbcon: change fbcon_*registered_fb variables to static Tom Rix
2022-04-23 13:44 68% [PATCH] drm/radeon: change cik_default_state table from global " Tom Rix
2022-04-23 14:02 99% [PATCH] drm/kmb: remove layer_irqs variable Tom Rix
2022-04-23 20:01 99% [PATCH] drm/radeon: change cac_weights_* to static Tom Rix
2022-04-25 13:00 99% [PATCH] drm/nouveau/disp/gv100: make gv100_disp_wimm static Tom Rix
2022-04-25 13:13 99% [PATCH] drm/nouveau/disp/gv100: make gv100_disp_wndw and gv100_disp_wndw_mthd static Tom Rix
2022-05-21 19:07 99% [PATCH] drm/rockchip: remove vop_writel Tom Rix
2022-05-21 19:59 99% [PATCH] xen: remove setting of 'transp' parameter Tom Rix
2022-05-28 14:18 99% [PATCH] drm/nouveau/fifo/gv100-: set gv100_fifo_runlist storage-class to static Tom Rix
2022-06-26 14:20 96% [PATCH] drm/amd/display: Remove unused globals FORCE_RATE and FORCE_LANE_COUNT Tom Rix
2022-06-26 14:46 99% [PATCH] drm/amd/display: change to_dal_irq_source_dnc32() storage class specifier to static Tom Rix
2022-06-29 20:01 99% [PATCH] drm/vc4: change vc4_dma_range_matches from a global " Tom Rix
2022-07-01 20:32 94% [PATCH] drm/i915/display: clean up comments Tom Rix
2022-07-02 15:39 97% [PATCH] drm/nouveau/bios: set info only when the return is not 0 Tom Rix
2022-07-04 21:32     ` Lyude Paul
2022-07-15 19:09       ` Lyude Paul
2022-07-15 20:24 99%     ` Tom Rix
2022-07-30 13:57 66% [PATCH] drm/vmwgfx: cleanup comments Tom Rix
2022-09-16 21:06     [PATCH 1/2] drm/amd/display: Reduce number of arguments of dml314's CalculateWatermarksAndDRAMSpeedChangeSupport() Nathan Chancellor
2022-09-16 22:04 99% ` Tom Rix
2022-09-17 18:37 32% [PATCH] drm/amd/display: refactor CalculateWriteBackDelay to use vba_vars_st ptr Tom Rix
2022-09-19  2:37 69% [PATCH] drm/amd/display: remove redundant CalculateTWait's Tom Rix
2022-09-19 17:27 80% [PATCH] drm/amd/display: remove redundant CalculateRemoteSurfaceFlipDelay's Tom Rix
2023-01-07 18:48 99% [PATCH] habanalabs: remove redundant memset Tom Rix
2023-01-26 20:49 92% [PATCH] drm/amd/display: reduce else-if to else in dcn32_calculate_dlg_params() Tom Rix
2023-01-27  1:38 93% [PATCH] drm/amd/display: reduce else-if to else in dcn10_blank_pixel_data() Tom Rix
2023-02-08 15:54 98% [PATCH] habanalabs: change unused extern decl of hdev to forward decl of hl_device Tom Rix
2023-02-09 13:40 99% [PATCH] drm/amd/display: set should_disable_otg storage-class-specifier to static Tom Rix
2023-02-13 14:48 99% [PATCH] habanalabs: set hl_capture_*_err " Tom Rix
2023-02-22 15:56 99% [PATCH] drm/msm: return early when allocating fbdev fails Tom Rix
2023-02-24 16:06 99% [PATCH] drm/amdgpu: remove unused variable channel_index Tom Rix
2023-02-24 16:45 98% [PATCH] drm/amdgpu: remove unused variable ring Tom Rix
2023-02-28 22:15 99% [PATCH] drm/nouveau/fifo: set nvkm_engn_cgrp_get storage-class-specifier to static Tom Rix
2023-03-01 14:00 99% [PATCH] drm/amd/pm: set vangogh_set_apu_thermal_limit " Tom Rix
2023-03-02 12:48 99% [PATCH] drm/nouveau/nvfw/acr: set wpr_generic_header_dump " Tom Rix
2023-03-03 13:27 99% [PATCH] drm/nouveau/fifo: set gf100_fifo_nonstall_block_dump " Tom Rix
2023-03-04 15:26 87% [PATCH] drm/amd/display: change several dcn201 variables " Tom Rix
2023-03-04 16:22 82% [PATCH] drm/amd/display: change several dcn20 " Tom Rix
2023-03-05 12:52 89% [PATCH] drm/amd/display: change several dcn30 " Tom Rix
2023-03-08 14:09 98% [PATCH] drm/amd/display: remove unused variable res_pool Tom Rix
2023-03-08 14:10 93% [PATCH] drm/amd/display: remove unused variable available Tom Rix
2023-03-12 11:23 99% [PATCH] drm/nouveau/mc: set ga100_mc_device storage-class-specifier to static Tom Rix
2023-03-14 13:06 99% [PATCH] drm/radeon: remove unused variable rbo Tom Rix
2023-03-16 13:23 93% [PATCH] drm/rockchip: vop2: fix uninitialized variable possible_crtcs Tom Rix
2023-03-18  0:23 99% [PATCH] gpu: drm: bridge: sii9234: remove unused bridge_to_sii9234 function Tom Rix
2023-03-18 13:39 98% [PATCH] drm/kmb: remove unused set_test_mode_src_osc_freq_target_low, hi_bits functions Tom Rix
2023-03-19 14:23 99% [PATCH] drm/gma500: remove unused gma_pipe_event function Tom Rix
2023-03-21 18:24 99% [PATCH] drm/vmwgfx: remove unused vmw_overlay function Tom Rix
2023-03-24 19:54 96% [PATCH] drm/vmwgfx: remove unused mksstat_init_record function Tom Rix
2023-03-25 13:45 97% [PATCH] drm/amd/display: remove unused matching_stream_ptrs variable Tom Rix
2023-03-29 23:14 99% [PATCH] drm/nouveau/svm: remove unused ret variable Tom Rix
2023-03-30 15:20 99% [PATCH] drm/amdkfd: remove unused sq_int_priv variable Tom Rix
2023-03-30 23:43 93% [PATCH] drm/amd/display: remove unused average_render_time_in_us and i variables Tom Rix
2023-03-31  0:10 94% Tom Rix
2023-03-31 16:40 97% [PATCH] drm/amd/pm: remove unused num_of_active_display variable Tom Rix
2023-03-31 17:24 98% [PATCH] drm/qxl: remove unused num_relocs variable Tom Rix
2023-03-31 20:42 98% [PATCH] drm/nouveau/acr: remove unused loc variable Tom Rix
2023-04-04  1:28 99% [PATCH] drm/nouveau/disp: set varaiable gv100_disp_core_mthd_base storage-class-specifier to static Tom Rix
2023-04-04 18:53 99% [PATCH] drm/msm/mdp5: set varaiable msm8x76_config " Tom Rix
2023-04-06 12:51 99% [PATCH] drm/nouveau/gr/tu102: remove unused tu102_gr_load function Tom Rix
2023-04-06 15:12 99% [PATCH] drm/vc4: remove unused render_wait variable Tom Rix
2023-04-06 18:44 99% [PATCH] drm/amd/display: set variable dcn3_14_soc storage-class-specifier to static Tom Rix
2023-04-06 19:58 97% [PATCH] drm/amd/display: set variables aperture_default_system and context0_default_system " Tom Rix
2023-04-08 13:43 86% [PATCH] drm/amd/display: set variables dml*_funcs " Tom Rix
2023-04-08 16:50 99% [PATCH] drm/qxl: remove variable count Tom Rix
2023-04-11 14:08 99% [PATCH] accel/habanalabs: remove variable gaudi_irq_name Tom Rix
2023-04-14 12:03 90% [PATCH] drm/amd/pm: change pmfw_decoded_link_width, speed variables to globals Tom Rix
2023-04-14 12:22 99% [PATCH] phy: mediatek: fix returning garbage Tom Rix
2023-04-14 15:08 99% [PATCH] drm/amd/display: remove unused variable oldest_index Tom Rix
2023-04-15 15:17 99% [PATCH] drm/amd/display: set variable dccg314_init storage-class-specifier to static Tom Rix
2023-04-18 19:20 99% [PATCH] accel/qaic: initialize ret variable to 0 Tom Rix
2023-04-20  2:04 95% [PATCH] drm/amd/display: remove unused variables otg_inst and cmd Tom Rix
2023-04-20 13:21 96% [PATCH] drm/amd/display: return status of abm_feature_support Tom Rix
2023-04-20 13:59 94% [PATCH] drm/amd/display: return status of dmub_srv_get_fw_boot_status Tom Rix
2023-04-24 17:02     ` Hamza Mahfooz
2023-04-24 18:14 99%   ` Tom Rix
2023-04-20 14:29 84% [PATCH] drm/amdgpu: remove unused variable j Tom Rix
2023-04-20 18:07 93% [PATCH] drm/amd/display: remove unused variables dispclk_delay_subtotal and dout Tom Rix
2023-04-23 14:53 90% [PATCH] drm/meson: set variables meson_hdmi_* storage-class-specifier to static Tom Rix
2023-04-26 11:18 98% [PATCH] drm/amd/display: set variable custom_backlight_curve0 " Tom Rix
2023-04-29  1:13 99% [PATCH] agp/uninorth: remove unused variable size Tom Rix
2023-05-01  2:57 94% [PATCH] phy: mediatek: rework the floating point comparisons to fixed point Tom Rix
2023-05-02 14:50 93% [PATCH v2] " Tom Rix
2023-05-17 13:31 99% [PATCH] drm/nouveau/acr/ga102: set variable ga102_gsps storage-class-specifier to static Tom Rix
2023-05-17 13:41 99% [PATCH] drm/mgag200: set variable mgag200_modeset " Tom Rix
2023-05-22 12:30 99% [PATCH] drm/amdgpu: remove unused variable num_xcc Tom Rix
2023-05-22 13:00 99% [PATCH] drm/amdgpu: remove unused variable mmhub_v1_8_mmea_cgtt_clk_cntl_reg Tom Rix
2023-05-23 11:49 95% [PATCH] drm/amd/display: remove unused variables res_create_maximus_funcs and debug_defaults_diags Tom Rix
2023-05-23 12:51 94% [PATCH] drm/i915: simplify switch to if-elseif Tom Rix
2023-05-25 20:07 99% [PATCH] drm/amdkfd: remove unused function get_reserved_sdma_queues_bitmap Tom Rix
2023-05-25 20:35 96% [PATCH] drm/amdgpu: move gfx9_cs_data definition Tom Rix
2023-05-25 21:00 99% [PATCH] drm/radeon: remove unused variable rbo Tom Rix
2023-05-25 21:10 99% [PATCH] drm/nouveau/acr: remove unused variable loc Tom Rix
2023-07-31 13:26     [PATCH -next] drm/amdgpu: Remove a lot of unnecessary ternary operators Ruan Jinjie
2023-07-31 16:22 99% ` Tom Rix

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).