Skip to content

Commit 46791d1

Browse files
seehearfeelalexdeucher
authored andcommitted
drm/amd: Fix set but not used warnings
There are many set but not used warnings under drivers/gpu/drm/amd when compiling with the latest upstream mainline GCC: drivers/gpu/drm/amd/amdgpu/amdgpu_gart.c:305:18: warning: variable ‘p’ set but not used [-Wunused-but-set-variable=] drivers/gpu/drm/amd/amdgpu/amdgpu_vcn.h:103:26: warning: variable ‘internal_reg_offset’ set but not used [-Wunused-but-set-variable=] ... drivers/gpu/drm/amd/amdgpu/amdgpu_vcn.h:164:26: warning: variable ‘internal_reg_offset’ set but not used [-Wunused-but-set-variable=] ... drivers/gpu/drm/amd/amdgpu/../display/dc/dc_dmub_srv.c:445:13: warning: variable ‘pipe_idx’ set but not used [-Wunused-but-set-variable=] drivers/gpu/drm/amd/amdgpu/../display/dc/dc_dmub_srv.c:875:21: warning: variable ‘pipe_idx’ set but not used [-Wunused-but-set-variable=] Remove the variables actually not used or add __maybe_unused attribute for the variables actually used to fix them, compile tested only. Signed-off-by: Tiezhu Yang <yangtiezhu@loongson.cn> Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
1 parent 7169e70 commit 46791d1

3 files changed

Lines changed: 8 additions & 11 deletions

File tree

drivers/gpu/drm/amd/amdgpu/amdgpu_gart.c

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -302,7 +302,6 @@ void amdgpu_gart_unbind(struct amdgpu_device *adev, uint64_t offset,
302302
int pages)
303303
{
304304
unsigned t;
305-
unsigned p;
306305
int i, j;
307306
u64 page_base;
308307
/* Starting from VEGA10, system bit must be 0 to mean invalid. */
@@ -316,8 +315,7 @@ void amdgpu_gart_unbind(struct amdgpu_device *adev, uint64_t offset,
316315
return;
317316

318317
t = offset / AMDGPU_GPU_PAGE_SIZE;
319-
p = t / AMDGPU_GPU_PAGES_IN_CPU_PAGE;
320-
for (i = 0; i < pages; i++, p++) {
318+
for (i = 0; i < pages; i++) {
321319
page_base = adev->dummy_page_addr;
322320
if (!adev->gart.ptr)
323321
continue;

drivers/gpu/drm/amd/amdgpu/amdgpu_vcn.h

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -100,7 +100,8 @@
100100

101101
#define SOC15_DPG_MODE_OFFSET(ip, inst_idx, reg) \
102102
({ \
103-
uint32_t internal_reg_offset, addr; \
103+
/* To avoid a -Wunused-but-set-variable warning. */ \
104+
uint32_t internal_reg_offset __maybe_unused, addr; \
104105
bool video_range, video1_range, aon_range, aon1_range; \
105106
\
106107
addr = (adev->reg_offset[ip##_HWIP][inst_idx][reg##_BASE_IDX] + reg); \
@@ -161,7 +162,8 @@
161162

162163
#define SOC24_DPG_MODE_OFFSET(ip, inst_idx, reg) \
163164
({ \
164-
uint32_t internal_reg_offset, addr; \
165+
/* To avoid a -Wunused-but-set-variable warning. */ \
166+
uint32_t internal_reg_offset __maybe_unused, addr; \
165167
bool video_range, video1_range, aon_range, aon1_range; \
166168
\
167169
addr = (adev->reg_offset[ip##_HWIP][inst_idx][reg##_BASE_IDX] + reg); \

drivers/gpu/drm/amd/display/dc/dc_dmub_srv.c

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -442,7 +442,6 @@ bool dc_dmub_srv_p_state_delegate(struct dc *dc, bool should_manage_pstate, stru
442442
int i = 0, k = 0;
443443
int ramp_up_num_steps = 1; // TODO: Ramp is currently disabled. Reenable it.
444444
uint8_t visual_confirm_enabled;
445-
int pipe_idx = 0;
446445
struct dc_stream_status *stream_status = NULL;
447446

448447
if (dc == NULL)
@@ -457,7 +456,7 @@ bool dc_dmub_srv_p_state_delegate(struct dc *dc, bool should_manage_pstate, stru
457456
cmd.fw_assisted_mclk_switch.config_data.visual_confirm_enabled = visual_confirm_enabled;
458457

459458
if (should_manage_pstate) {
460-
for (i = 0, pipe_idx = 0; i < dc->res_pool->pipe_count; i++) {
459+
for (i = 0; i < dc->res_pool->pipe_count; i++) {
461460
struct pipe_ctx *pipe = &context->res_ctx.pipe_ctx[i];
462461

463462
if (!pipe->stream)
@@ -472,7 +471,6 @@ bool dc_dmub_srv_p_state_delegate(struct dc *dc, bool should_manage_pstate, stru
472471
cmd.fw_assisted_mclk_switch.config_data.vactive_stretch_margin_us = dc->debug.fpo_vactive_margin_us;
473472
break;
474473
}
475-
pipe_idx++;
476474
}
477475
}
478476

@@ -872,7 +870,7 @@ void dc_dmub_setup_subvp_dmub_command(struct dc *dc,
872870
bool enable)
873871
{
874872
uint8_t cmd_pipe_index = 0;
875-
uint32_t i, pipe_idx;
873+
uint32_t i;
876874
uint8_t subvp_count = 0;
877875
union dmub_rb_cmd cmd;
878876
struct pipe_ctx *subvp_pipes[2];
@@ -899,7 +897,7 @@ void dc_dmub_setup_subvp_dmub_command(struct dc *dc,
899897

900898
if (enable) {
901899
// For each pipe that is a "main" SUBVP pipe, fill in pipe data for DMUB SUBVP cmd
902-
for (i = 0, pipe_idx = 0; i < dc->res_pool->pipe_count; i++) {
900+
for (i = 0; i < dc->res_pool->pipe_count; i++) {
903901
struct pipe_ctx *pipe = &context->res_ctx.pipe_ctx[i];
904902
pipe_mall_type = dc_state_get_pipe_subvp_type(context, pipe);
905903

@@ -922,7 +920,6 @@ void dc_dmub_setup_subvp_dmub_command(struct dc *dc,
922920
populate_subvp_cmd_vblank_pipe_info(dc, context, &cmd, pipe, cmd_pipe_index++);
923921

924922
}
925-
pipe_idx++;
926923
}
927924
if (subvp_count == 2) {
928925
update_subvp_prefetch_end_to_mall_start(dc, context, &cmd, subvp_pipes);

0 commit comments

Comments
 (0)