drm/amd/display: Use swap() where appropriate
Subsystems (6)
PATCH 1/3 drm/amd/display: Use swap() where appropriate
From: Ville Syrjälä <[email protected]>
Mostly a cocci-job, but it flat out refused to remove the declaration in drivers/gpu/drm/amd/display/dc/core/dc.c so had to do that part manually.
@swap@
identifier TEMP;
expression A,B;
@@
- TEMP = A;
- A = B;
- B = TEMP;
+ swap(A, B);
@@
type T;
identifier swap.TEMP;
@@
(
- T TEMP;
|
- T TEMP = {...};
)
... when != TEMP
--- drivers/gpu/drm/amd/display/dc/bios/bios_parser.c | 7 ++----- drivers/gpu/drm/amd/display/dc/bios/bios_parser2.c | 8 ++------ drivers/gpu/drm/amd/display/dc/core/dc.c | 6 +----- 3 files changed, 5 insertions(+), 16 deletions(-)
drivers/gpu/drm/amd/display/dc/bios/bios_parser.c +2 -5
@@ -2543,7 +2543,6 @@ static enum bp_result construct_integrated_info(/* Sort voltage table from low to high*/ if (result ==BP_RESULT_OK ) { -struct clock_voltage_caps temp = {0 ,0 };uint32_t i;uint32_t j;
@@ -2553,10 +2552,8 @@ static enum bp_result construct_integrated_info( 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; +swap (info->disp_clk_voltage[j -1 ], + info->disp_clk_voltage[j]); } } }
drivers/gpu/drm/amd/display/dc/bios/bios_parser2.c +2 -6
@@ -1613,8 +1613,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;
@@ -1644,10 +1642,8 @@ static enum bp_result construct_integrated_info( 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; +swap (info->disp_clk_voltage[j -1 ], + info->disp_clk_voltage[j]); } } }
drivers/gpu/drm/amd/display/dc/core/dc.c +1 -5
@@ -901,15 +901,11 @@ static void program_timing_sync(/* set first pipe with plane as master */ for (j =0 ; j < group_size; j++) { -struct pipe_ctx *temp; -if (pipe_set[j]->plane_state) {if (j ==0 )break ; - temp = pipe_set[0 ]; - pipe_set[0 ] = pipe_set[j]; - pipe_set[j] = temp; +swap (pipe_set[0 ], pipe_set[j]);break ; } }
Signature · 6 lines
2.21.0 _______________________________________________ dri-devel mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/dri-devel
A message that is not in the archive (sent off-list or not yet received): 20191010131159.17346-1-ville.syrjala-VuQAYsv1563Yd54FQh9/[email protected]
PATCH 2/3 drm/amdgpu/powerplay: Use swap() where appropriate
From: Ville Syrjälä <[email protected]>
@swap@
identifier TEMP;
expression A,B;
@@
- TEMP = A;
- A = B;
- B = TEMP;
+ swap(A, B);
@@
type T;
identifier swap.TEMP;
@@
(
- T TEMP;
|
- T TEMP = {...};
)
... when != TEMP
--- drivers/gpu/drm/amd/powerplay/hwmgr/smu7_hwmgr.c | 6 ++---- drivers/gpu/drm/amd/powerplay/hwmgr/vega10_hwmgr.c | 6 ++---- 2 files changed, 4 insertions(+), 8 deletions(-)
drivers/gpu/drm/amd/powerplay/hwmgr/smu7_hwmgr.c +2 -4
@@ -1994,7 +1994,6 @@ static int smu7_sort_lookup_table(struct pp_hwmgr *hwmgr, struct phm_ppt_v1_voltage_lookup_table *lookup_table) {uint32_t table_size, i, j; -struct phm_ppt_v1_voltage_lookup_record tmp_voltage_lookup_record; table_size = lookup_table->count; PP_ASSERT_WITH_CODE(0 != lookup_table->count,
@@ -2005,9 +2004,8 @@ static int smu7_sort_lookup_table(struct pp_hwmgr *hwmgr,for (j = i +1 ; j >0 ; j--) {if (lookup_table->entries[j].us_vdd < lookup_table->entries[j -1 ].us_vdd) { - tmp_voltage_lookup_record = lookup_table->entries[j -1 ]; - lookup_table->entries[j -1 ] = lookup_table->entries[j]; - lookup_table->entries[j] = tmp_voltage_lookup_record; +swap (lookup_table->entries[j -1 ], + lookup_table->entries[j]); } } }
drivers/gpu/drm/amd/powerplay/hwmgr/vega10_hwmgr.c +2 -4
@@ -712,7 +712,6 @@ static int vega10_sort_lookup_table(struct pp_hwmgr *hwmgr, struct phm_ppt_v1_voltage_lookup_table *lookup_table) {uint32_t table_size, i, j; -struct phm_ppt_v1_voltage_lookup_record tmp_voltage_lookup_record;PP_ASSERT_WITH_CODE (lookup_table && lookup_table->count,"Lookup table is empty" , return -EINVAL );
@@ -724,9 +723,8 @@ static int vega10_sort_lookup_table(struct pp_hwmgr *hwmgr,for (j = i +1 ; j >0 ; j--) {if (lookup_table->entries[j].us_vdd < lookup_table->entries[j -1 ].us_vdd) { - tmp_voltage_lookup_record = lookup_table->entries[j -1 ]; - lookup_table->entries[j -1 ] = lookup_table->entries[j]; - lookup_table->entries[j] = tmp_voltage_lookup_record; +swap (lookup_table->entries[j -1 ], + lookup_table->entries[j]); } } }
Signature · 6 lines
2.21.0 _______________________________________________ amd-gfx mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/amd-gfx
Re: [PATCH 2/3] drm/amdgpu/powerplay: Use swap() where appropriate
Quoted 23 lines · Ville Syrjala
From: Ville Syrjälä <[email protected]>
@swap@
identifier TEMP;
expression A,B;
@@
- TEMP = A;
- A = B;
- B = TEMP;
+swap(A, B);@@
type T;
identifier swap.TEMP;
@@
(
- T TEMP;
|
- T TEMP = {...};
)
... when != TEMP
Quoted 7 lines
Cc Rex Zhu <[email protected]>Cc Evan Quan <[email protected]>Cc Alex Deucher <[email protected]>Cc "Christian König" <[email protected]>Cc "David (ChunMing) Zhou" <[email protected]>Signed-off-by Ville Syrjälä <[email protected]>
Reviewed and applied. Thanks!
Alex
Quoted 56 lines
--- drivers/gpu/drm/amd/powerplay/hwmgr/smu7_hwmgr.c | 6 ++---- drivers/gpu/drm/amd/powerplay/hwmgr/vega10_hwmgr.c | 6 ++---- 2 files changed, 4 insertions(+), 8 deletions(-)drivers/gpu/drm/amd/powerplay/hwmgr/smu7_hwmgr.c +2
-4@@ -1994,7 +1994,6 @@ static int smu7_sort_lookup_table(struct pp_hwmgr *hwmgr, struct phm_ppt_v1_voltage_lookup_table *lookup_table) {uint32_t table_size, i, j; -struct phm_ppt_v1_voltage_lookup_record tmp_voltage_lookup_record; table_size = lookup_table->count; PP_ASSERT_WITH_CODE(0 != lookup_table->count,@@ -2005,9 +2004,8 @@ static int smu7_sort_lookup_table(struct pp_hwmgr *hwmgr,for (j = i +1 ; j >0 ; j--) {if (lookup_table->entries[j].us_vdd < lookup_table->entries[j -1 ].us_vdd) { - tmp_voltage_lookup_record = lookup_table->entries[j -1 ]; - lookup_table->entries[j -1 ] = lookup_table->entries[j]; - lookup_table->entries[j] = tmp_voltage_lookup_record; +swap (lookup_table->entries[j -1 ], + lookup_table->entries[j]); } } }drivers/gpu/drm/amd/powerplay/hwmgr/vega10_hwmgr.c +2
-5@@ -712,7 +712,6 @@ static int vega10_sort_lookup_table(struct pp_hwmgr *hwmgr, struct phm_ppt_v1_voltage_lookup_table *lookup_table) {uint32_t table_size, i, j; -struct phm_ppt_v1_voltage_lookup_record tmp_voltage_lookup_record;PP_ASSERT_WITH_CODE (lookup_table && lookup_table->count,"Lookup table is empty" , return -EINVAL );@@ -724,9 +723,8 @@ static int vega10_sort_lookup_table(struct pp_hwmgr *hwmgr,for (j = i +1 ; j >0 ; j--) {if (lookup_table->entries[j].us_vdd < lookup_table->entries[j -1 ].us_vdd) { - tmp_voltage_lookup_record = lookup_table->entries[j -1 ]; - lookup_table->entries[j -1 ] = lookup_table->entries[j]; - lookup_table->entries[j] = tmp_voltage_lookup_record; +swap (lookup_table->entries[j -1 ], + lookup_table->entries[j]); } } } --2.21.0
Quoted 4 lines
_______________________________________________
amd-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/amd-gfx
_______________________________________________
dri-devel mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/dri-devel
Kazlauskas, Nicholas
Reviewed-by Nicholas KazlauskasQuoted 26 lines · Ville Syrjala
From: Ville Syrjälä <[email protected]>
Mostly a cocci-job, but it flat out refused to remove the declaration in
drivers/gpu/drm/amd/display/dc/core/dc.cso had to do that part manually.@swap@
identifier TEMP;
expression A,B;
@@
- TEMP = A;
- A = B;
- B = TEMP;
+swap(A, B);@@
type T;
identifier swap.TEMP;
@@
(
- T TEMP;
|
- T TEMP = {...};
)
... when != TEMP
Quoted 7 lines
Cc Harry Wentland <[email protected]>Cc Leo Li <[email protected]>Cc Alex Deucher <[email protected]>Cc "Christian König" <[email protected]>Cc "David (ChunMing) Zhou" <[email protected]>Signed-off-by Ville Syrjälä <[email protected]>
Thanks!
Nicholas Kazlauskas
Quoted 69 lines
--- drivers/gpu/drm/amd/display/dc/bios/bios_parser.c | 7 ++----- drivers/gpu/drm/amd/display/dc/bios/bios_parser2.c | 8 ++------ drivers/gpu/drm/amd/display/dc/core/dc.c | 6 +----- 3 files changed, 5 insertions(+), 16 deletions(-)drivers/gpu/drm/amd/display/dc/bios/bios_parser.c +2
-5@@ -2543,7 +2543,6 @@ static enum bp_result construct_integrated_info(/* Sort voltage table from low to high*/ if (result ==BP_RESULT_OK ) { -struct clock_voltage_caps temp = {0 ,0 };uint32_t i;uint32_t j;@@ -2553,10 +2552,8 @@ static enum bp_result construct_integrated_info( 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; +swap (info->disp_clk_voltage[j -1 ], + info->disp_clk_voltage[j]); } } }drivers/gpu/drm/amd/display/dc/bios/bios_parser2.c +2
-6@@ -1613,8 +1613,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;@@ -1644,10 +1642,8 @@ static enum bp_result construct_integrated_info( 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; +swap (info->disp_clk_voltage[j -1 ], + info->disp_clk_voltage[j]); } } }drivers/gpu/drm/amd/display/dc/core/dc.c +0
-2@@ -901,15 +901,11 @@ static void program_timing_sync(/* set first pipe with plane as master */ for (j =0 ; j < group_size; j++) { -struct pipe_ctx *temp; -if (pipe_set[j]->plane_state) {
drivers/gpu/drm/amd/display/dc/core/dc.c static void program_timing_sync( · line 911
Quoted 10 lines
drivers/gpu/drm/amd/display/dc/core/dc.c +1
-3if (j ==0 )break ; - temp = pipe_set[0 ]; - pipe_set[0 ] = pipe_set[j]; - pipe_set[j] = temp; +swap (pipe_set[0 ], pipe_set[j]);break ; } }
_______________________________________________
amd-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/amd-gfx
Alex Deucher
AppliedApplied. Thanks!
Alex
Quoted 113 lines · Nicholas
Quoted 26 lines · Ville Syrjala
From: Ville Syrjälä <[email protected]>
Mostly a cocci-job, but it flat out refused to remove the declaration in
drivers/gpu/drm/amd/display/dc/core/dc.cso had to do that part manually.@swap@
identifier TEMP;
expression A,B;
@@
- TEMP = A;
- A = B;
- B = TEMP;
+swap(A, B);@@
type T;
identifier swap.TEMP;
@@
(
- T TEMP;
|
- T TEMP = {...};
)
... when != TEMPQuoted 7 lines
Cc Harry Wentland <[email protected]>Cc Leo Li <[email protected]>Cc Alex Deucher <[email protected]>Cc "Christian König" <[email protected]>Cc "David (ChunMing) Zhou" <[email protected]>Signed-off-by Ville Syrjälä <[email protected]>Reviewed-by Nicholas Kazlauskas <[email protected]>Thanks!
Nicholas Kazlauskas
Quoted 71 lines
--- drivers/gpu/drm/amd/display/dc/bios/bios_parser.c | 7 ++----- drivers/gpu/drm/amd/display/dc/bios/bios_parser2.c | 8 ++------ drivers/gpu/drm/amd/display/dc/core/dc.c | 6 +----- 3 files changed, 5 insertions(+), 16 deletions(-)drivers/gpu/drm/amd/display/dc/bios/bios_parser.c +2
-5@@ -2543,7 +2543,6 @@ static enum bp_result construct_integrated_info(/* Sort voltage table from low to high*/ if (result ==BP_RESULT_OK ) { -struct clock_voltage_caps temp = {0 ,0 };uint32_t i;uint32_t j;@@ -2553,10 +2552,8 @@ static enum bp_result construct_integrated_info( 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; +swap (info->disp_clk_voltage[j -1 ], + info->disp_clk_voltage[j]); } } }drivers/gpu/drm/amd/display/dc/bios/bios_parser2.c +2
-6@@ -1613,8 +1613,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;@@ -1644,10 +1642,8 @@ static enum bp_result construct_integrated_info( 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; +swap (info->disp_clk_voltage[j -1 ], + info->disp_clk_voltage[j]); } } }drivers/gpu/drm/amd/display/dc/core/dc.c +0
-2@@ -901,15 +901,11 @@ static void program_timing_sync(/* set first pipe with plane as master */ for (j =0 ; j < group_size; j++) { -struct pipe_ctx *temp; -if (pipe_set[j]->plane_state) {if (j ==0 )break ;
Quoted 13 lines
drivers/gpu/drm/amd/display/dc/core/dc.c static void program_timing_sync( · line 911
Quoted 8 lines
drivers/gpu/drm/amd/display/dc/core/dc.c +1
-3- temp = pipe_set[0 ]; - pipe_set[0 ] = pipe_set[j]; - pipe_set[j] = temp; +swap (pipe_set[0 ], pipe_set[j]);break ; } }_______________________________________________
amd-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/amd-gfx
_______________________________________________
dri-devel mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/dri-devel
PATCH 3/3 drm/atmel-hlcdc: Use swap() where appropriate
In reply to Ville SyrjalaFrom: Ville Syrjälä <[email protected]>
@swap@
identifier TEMP;
expression A,B;
@@
- TEMP = A;
- A = B;
- B = TEMP;
+ swap(A, B);
@@
type T;
identifier swap.TEMP;
@@
(
- T TEMP;
|
- T TEMP = {...};
)
... when != TEMP
--- drivers/gpu/drm/atmel-hlcdc/atmel_hlcdc_plane.c | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-)
drivers/gpu/drm/atmel-hlcdc/atmel_hlcdc_plane.c +1 -4
@@ -601,7 +601,6 @@ static int atmel_hlcdc_plane_atomic_check(struct drm_plane *p,struct drm_framebuffer *fb = state->base.fb;const struct drm_display_mode *mode;struct drm_crtc_state *crtc_state; -unsigned int tmp;int ret;int i;
@@ -694,9 +693,7 @@ static int atmel_hlcdc_plane_atomic_check(struct drm_plane *p,* Swap width and size in case of 90 or 270 degrees rotation */ if (drm_rotation_90_or_270 (state->base.rotation)) { - tmp = state->src_w; - state->src_w = state->src_h; - state->src_h = tmp; +swap (state->src_w, state->src_h); } if (!desc->layout.size &&
Signature · 6 lines
2.21.0 _______________________________________________ dri-devel mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/dri-devel
Re: [PATCH 3/3] drm/atmel-hlcdc: Use swap() where appropriate
Quoted 22 lines · On Thu, 10 Oct 2019 16:11:59 +0300 Ville Syrjala…
From: Ville Syrjälä <[email protected]>
@swap@
identifier TEMP;
expression A,B;
@@
- TEMP = A;
- A = B;
- B = TEMP;
+swap(A, B);@@
type T;
identifier swap.TEMP;
@@
(
- T TEMP;
|
- T TEMP = {...};
)
... when != TEMP
Quoted 3 lines
Cc Sam Ravnborg <[email protected]>Cc Boris Brezillon <[email protected]>Signed-off-by Ville Syrjälä <[email protected]>
Quoted 17 lines
--- drivers/gpu/drm/atmel-hlcdc/atmel_hlcdc_plane.c | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-)drivers/gpu/drm/atmel-hlcdc/atmel_hlcdc_plane.c +0
-1@@ -601,7 +601,6 @@ static int atmel_hlcdc_plane_atomic_check(struct drm_plane *p,struct drm_framebuffer *fb = state->base.fb;const struct drm_display_mode *mode;struct drm_crtc_state *crtc_state; -unsigned int tmp;int ret;int i;
drivers/gpu/drm/atmel-hlcdc/atmel_hlcdc_plane.c static int atmel_hlcdc_plane_atomic_check(struct drm_plane *p, · line 699
Quoted 10 lines
drivers/gpu/drm/atmel-hlcdc/atmel_hlcdc_plane.c +1
-3@@ -694,9 +693,7 @@ static int atmel_hlcdc_plane_atomic_check(struct drm_plane *p,* Swap width and size in case of 90 or 270 degrees rotation */ if (drm_rotation_90_or_270 (state->base.rotation)) { - tmp = state->src_w; - state->src_w = state->src_h; - state->src_h = tmp; +swap (state->src_w, state->src_h); } if (!desc->layout.size &&
_______________________________________________
dri-devel mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/dri-devel
Re: [PATCH 3/3] drm/atmel-hlcdc: Use swap() where appropriate
Quoted 25 lines · Boris Brezillon
Quoted 22 lines · On Thu, 10 Oct 2019 16:11:59 +0300 Ville Syrjala…
From: Ville Syrjälä <[email protected]>
@swap@
identifier TEMP;
expression A,B;
@@
- TEMP = A;
- A = B;
- B = TEMP;
+swap(A, B);@@
type T;
identifier swap.TEMP;
@@
(
- T TEMP;
|
- T TEMP = {...};
)
... when != TEMP
Quoted 5 lines
Quoted 3 lines
Cc Sam Ravnborg <[email protected]>Cc Boris Brezillon <[email protected]>Signed-off-by Ville Syrjälä <[email protected]>Reviewed-by Boris Brezillon <[email protected]>
Ta. Pushed to drm-misc-next.
Quoted 28 lines
Quoted 28 lines
--- drivers/gpu/drm/atmel-hlcdc/atmel_hlcdc_plane.c | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-)drivers/gpu/drm/atmel-hlcdc/atmel_hlcdc_plane.c +1
-4@@ -601,7 +601,6 @@ static int atmel_hlcdc_plane_atomic_check(struct drm_plane *p,struct drm_framebuffer *fb = state->base.fb;const struct drm_display_mode *mode;struct drm_crtc_state *crtc_state; -unsigned int tmp;int ret;int i;@@ -694,9 +693,7 @@ static int atmel_hlcdc_plane_atomic_check(struct drm_plane *p,* Swap width and size in case of 90 or 270 degrees rotation */ if (drm_rotation_90_or_270 (state->base.rotation)) { - tmp = state->src_w; - state->src_w = state->src_h; - state->src_h = tmp; +swap (state->src_w, state->src_h); } if (!desc->layout.size &&
Signature · 6 lines
Ville Syrjälä Intel _______________________________________________ dri-devel mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/dri-devel