Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

drm/amd/display: use swap() in is_config_schedulable()

Use existing swap() function rather than duplicating its implementation.

./drivers/gpu/drm/amd/display/dc/dml2/dml21/src/dml2_pmo/dml2_pmo_dcn4_fams2.c:1171:103-104: WARNING opportunity for swap().
./drivers/gpu/drm/amd/display/dc/dml2/dml21/src/dml2_pmo/dml2_pmo_dcn4_fams2.c:1231:99-100: WARNING opportunity for swap().

Reported-by: Abaci Robot <abaci@linux.alibaba.com>
Closes: https://bugzilla.openanolis.cn/show_bug.cgi?id=9400
Signed-off-by: Jiapeng Chong <jiapeng.chong@linux.alibaba.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>

authored by

Jiapeng Chong and committed by
Alex Deucher
e97db6d9 68936346

+4 -7
+4 -7
drivers/gpu/drm/amd/display/dc/dml2/dml21/src/dml2_pmo/dml2_pmo_dcn4_fams2.c
··· 1163 1163 schedulable = true; 1164 1164 1165 1165 /* sort disallow times from greatest to least */ 1166 - unsigned int temp; 1167 1166 for (i = 0; i < s->pmo_dcn4.num_timing_groups; i++) { 1168 1167 bool swapped = false; 1169 1168 ··· 1171 1172 double jp1_disallow_us = s->pmo_dcn4.group_common_fams2_meta[s->pmo_dcn4.sorted_group_gtl_disallow_index[j + 1]].disallow_time_us; 1172 1173 if (j_disallow_us < jp1_disallow_us) { 1173 1174 /* swap as A < B */ 1174 - temp = s->pmo_dcn4.sorted_group_gtl_disallow_index[j]; 1175 - s->pmo_dcn4.sorted_group_gtl_disallow_index[j] = s->pmo_dcn4.sorted_group_gtl_disallow_index[j + 1]; 1176 - s->pmo_dcn4.sorted_group_gtl_disallow_index[j + 1] = temp; 1175 + swap(s->pmo_dcn4.sorted_group_gtl_disallow_index[j], 1176 + s->pmo_dcn4.sorted_group_gtl_disallow_index[j+1]); 1177 1177 swapped = true; 1178 1178 } 1179 1179 } ··· 1230 1232 double jp1_period_us = s->pmo_dcn4.group_common_fams2_meta[s->pmo_dcn4.sorted_group_gtl_period_index[j + 1]].period_us; 1231 1233 if (j_period_us < jp1_period_us) { 1232 1234 /* swap as A < B */ 1233 - temp = s->pmo_dcn4.sorted_group_gtl_period_index[j]; 1234 - s->pmo_dcn4.sorted_group_gtl_period_index[j] = s->pmo_dcn4.sorted_group_gtl_period_index[j + 1]; 1235 - s->pmo_dcn4.sorted_group_gtl_period_index[j + 1] = temp; 1235 + swap(s->pmo_dcn4.sorted_group_gtl_period_index[j], 1236 + s->pmo_dcn4.sorted_group_gtl_period_index[j+1]); 1236 1237 swapped = true; 1237 1238 } 1238 1239 }