drm/amd/display: use swap() helper macro in bios_parser
Subsystems (3)
PATCH 1/1 drm/amd/display: use swap() helper macro in bios_parser
Use swap() helper macro instead of open coded swap instructions. The change also facilitates code cleanup and realignment for improved readability. Issue identified using swap.cocci Coccinelle semantic patch script.
Signed-off-by Deepak R Varma <[email protected]>
--- drivers/gpu/drm/amd/display/dc/bios/bios_parser2.c | 11 ++--------- 1 file changed, 2 insertions(+), 9 deletions(-)
drivers/gpu/drm/amd/display/dc/bios/bios_parser2.c +2 -9
@@ -2929,7 +2929,6 @@ static enum bp_result construct_integrated_info(struct atom_common_table_header *header;struct atom_data_revision revision; -struct clock_voltage_caps temp = {0 ,0 };uint32_t i;uint32_t j;
@@ -3032,14 +3031,8 @@ static enum bp_result construct_integrated_info(for (i =1 ; i <NUMBER_OF_DISP_CLK_VOLTAGE ; ++i) {for (j = i; j >0 ; --j) {if (info->disp_clk_voltage[j].max_supported_clk < - info->disp_clk_voltage[j-1 ].max_supported_clk - ) { -/* swap j and j - 1*/ - temp = info->disp_clk_voltage[j-1 ]; - info->disp_clk_voltage[j-1 ] = - info->disp_clk_voltage[j]; - info->disp_clk_voltage[j] = temp; - } + info->disp_clk_voltage[j-1 ].max_supported_clk) +swap (info->disp_clk_voltage[j-1 ], info->disp_clk_voltage[j]); } }
Signature · 1 line
2.34.1
Alex Deucher
AppliedApplied. Thanks!
Quoted 45 lines · Deepak R Varma
Use
swap()helper macro instead of open coded swap instructions. The change also facilitates code cleanup and realignment for improved readability. Issue identified usingswap.cocciCoccinelle semantic patch script.Signed-off-by Deepak R Varma <[email protected]>--- drivers/gpu/drm/amd/display/dc/bios/bios_parser2.c | 11 ++--------- 1 file changed, 2 insertions(+), 9 deletions(-)drivers/gpu/drm/amd/display/dc/bios/bios_parser2.c +2
-10@@ -2929,7 +2929,6 @@ static enum bp_result construct_integrated_info(struct atom_common_table_header *header;struct atom_data_revision revision; -struct clock_voltage_caps temp = {0 ,0 };uint32_t i;uint32_t j;@@ -3032,14 +3031,8 @@ static enum bp_result construct_integrated_info(for (i =1 ; i <NUMBER_OF_DISP_CLK_VOLTAGE ; ++i) {for (j = i; j >0 ; --j) {if (info->disp_clk_voltage[j].max_supported_clk < - info->disp_clk_voltage[j-1 ].max_supported_clk - ) { -/* swap j and j - 1*/ - temp = info->disp_clk_voltage[j-1 ]; - info->disp_clk_voltage[j-1 ] = - info->disp_clk_voltage[j]; - info->disp_clk_voltage[j] = temp; - } + info->disp_clk_voltage[j-1 ].max_supported_clk) +swap (info->disp_clk_voltage[j-1 ], info->disp_clk_voltage[j]); } } --2.34.1