* [PATCH 1/3] drm/amd/display: Use swap() where appropriate
@ 2019-10-10 13:11 Ville Syrjala
2019-10-10 13:11 ` [PATCH 3/3] drm/atmel-hlcdc: " Ville Syrjala
[not found] ` <20191010131159.17346-1-ville.syrjala-VuQAYsv1563Yd54FQh9/CA@public.gmane.org>
0 siblings, 2 replies; 8+ messages in thread
From: Ville Syrjala @ 2019-10-10 13:11 UTC (permalink / raw)
To: dri-devel; +Cc: Leo Li, amd-gfx, Alex Deucher, Christian König
From: Ville Syrjälä <ville.syrjala@linux.intel.com>
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
Cc: Harry Wentland <harry.wentland@amd.com>
Cc: Leo Li <sunpeng.li@amd.com>
Cc: Alex Deucher <alexander.deucher@amd.com>
Cc: "Christian König" <christian.koenig@amd.com>
Cc: "David (ChunMing) Zhou" <David1.Zhou@amd.com>
Cc: amd-gfx@lists.freedesktop.org
Signed-off-by: Ville Syrjälä <ville.syrjala@linux.intel.com>
---
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(-)
diff --git a/drivers/gpu/drm/amd/display/dc/bios/bios_parser.c b/drivers/gpu/drm/amd/display/dc/bios/bios_parser.c
index 221e0f56389f..823843cd2613 100644
--- a/drivers/gpu/drm/amd/display/dc/bios/bios_parser.c
+++ b/drivers/gpu/drm/amd/display/dc/bios/bios_parser.c
@@ -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]);
}
}
}
diff --git a/drivers/gpu/drm/amd/display/dc/bios/bios_parser2.c b/drivers/gpu/drm/amd/display/dc/bios/bios_parser2.c
index dff65c0fe82f..7873abea4112 100644
--- a/drivers/gpu/drm/amd/display/dc/bios/bios_parser2.c
+++ b/drivers/gpu/drm/amd/display/dc/bios/bios_parser2.c
@@ -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]);
}
}
}
diff --git a/drivers/gpu/drm/amd/display/dc/core/dc.c b/drivers/gpu/drm/amd/display/dc/core/dc.c
index 5d1adeda4d90..fb6a7288caf4 100644
--- a/drivers/gpu/drm/amd/display/dc/core/dc.c
+++ b/drivers/gpu/drm/amd/display/dc/core/dc.c
@@ -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;
}
}
--
2.21.0
_______________________________________________
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel
^ permalink raw reply related [flat|nested] 8+ messages in thread
* [PATCH 2/3] drm/amdgpu/powerplay: Use swap() where appropriate
[not found] ` <20191010131159.17346-1-ville.syrjala-VuQAYsv1563Yd54FQh9/CA@public.gmane.org>
@ 2019-10-10 13:11 ` Ville Syrjala
2019-10-10 14:27 ` Alex Deucher
2019-10-10 13:47 ` [PATCH 1/3] drm/amd/display: " Kazlauskas, Nicholas
1 sibling, 1 reply; 8+ messages in thread
From: Ville Syrjala @ 2019-10-10 13:11 UTC (permalink / raw)
To: dri-devel-PD4FTy7X32lNgt0PjOBp9y5qC8QIuHrW
Cc: David (ChunMing) Zhou, amd-gfx-PD4FTy7X32lNgt0PjOBp9y5qC8QIuHrW,
Alex Deucher, Evan Quan, Rex Zhu, Christian König
From: Ville Syrjälä <ville.syrjala@linux.intel.com>
@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
Cc: Rex Zhu <rex.zhu@amd.com>
Cc: Evan Quan <evan.quan@amd.com>
Cc: Alex Deucher <alexander.deucher@amd.com>
Cc: "Christian König" <christian.koenig@amd.com>
Cc: "David (ChunMing) Zhou" <David1.Zhou@amd.com>
Cc: amd-gfx@lists.freedesktop.org
Signed-off-by: Ville Syrjälä <ville.syrjala@linux.intel.com>
---
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(-)
diff --git a/drivers/gpu/drm/amd/powerplay/hwmgr/smu7_hwmgr.c b/drivers/gpu/drm/amd/powerplay/hwmgr/smu7_hwmgr.c
index 34f95e0e3ea4..1fe992835a76 100644
--- a/drivers/gpu/drm/amd/powerplay/hwmgr/smu7_hwmgr.c
+++ b/drivers/gpu/drm/amd/powerplay/hwmgr/smu7_hwmgr.c
@@ -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]);
}
}
}
diff --git a/drivers/gpu/drm/amd/powerplay/hwmgr/vega10_hwmgr.c b/drivers/gpu/drm/amd/powerplay/hwmgr/vega10_hwmgr.c
index d08493b67b67..f5dcba44f74a 100644
--- a/drivers/gpu/drm/amd/powerplay/hwmgr/vega10_hwmgr.c
+++ b/drivers/gpu/drm/amd/powerplay/hwmgr/vega10_hwmgr.c
@@ -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
_______________________________________________
amd-gfx mailing list
amd-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/amd-gfx
^ permalink raw reply related [flat|nested] 8+ messages in thread
* [PATCH 3/3] drm/atmel-hlcdc: Use swap() where appropriate
2019-10-10 13:11 [PATCH 1/3] drm/amd/display: Use swap() where appropriate Ville Syrjala
@ 2019-10-10 13:11 ` Ville Syrjala
2019-10-10 13:24 ` Boris Brezillon
[not found] ` <20191010131159.17346-1-ville.syrjala-VuQAYsv1563Yd54FQh9/CA@public.gmane.org>
1 sibling, 1 reply; 8+ messages in thread
From: Ville Syrjala @ 2019-10-10 13:11 UTC (permalink / raw)
To: dri-devel; +Cc: Sam Ravnborg, Boris Brezillon
From: Ville Syrjälä <ville.syrjala@linux.intel.com>
@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
Cc: Sam Ravnborg <sam@ravnborg.org>
Cc: Boris Brezillon <bbrezillon@kernel.org>
Signed-off-by: Ville Syrjälä <ville.syrjala@linux.intel.com>
---
drivers/gpu/drm/atmel-hlcdc/atmel_hlcdc_plane.c | 5 +----
1 file changed, 1 insertion(+), 4 deletions(-)
diff --git a/drivers/gpu/drm/atmel-hlcdc/atmel_hlcdc_plane.c b/drivers/gpu/drm/atmel-hlcdc/atmel_hlcdc_plane.c
index 89f5a756fa37..034f202dfe8f 100644
--- a/drivers/gpu/drm/atmel-hlcdc/atmel_hlcdc_plane.c
+++ b/drivers/gpu/drm/atmel-hlcdc/atmel_hlcdc_plane.c
@@ -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 &&
--
2.21.0
_______________________________________________
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel
^ permalink raw reply related [flat|nested] 8+ messages in thread
* Re: [PATCH 3/3] drm/atmel-hlcdc: Use swap() where appropriate
2019-10-10 13:11 ` [PATCH 3/3] drm/atmel-hlcdc: " Ville Syrjala
@ 2019-10-10 13:24 ` Boris Brezillon
2019-10-11 16:07 ` Ville Syrjälä
0 siblings, 1 reply; 8+ messages in thread
From: Boris Brezillon @ 2019-10-10 13:24 UTC (permalink / raw)
To: Ville Syrjala; +Cc: Sam Ravnborg, dri-devel, Boris Brezillon
On Thu, 10 Oct 2019 16:11:59 +0300
Ville Syrjala <ville.syrjala@linux.intel.com> wrote:
> From: Ville Syrjälä <ville.syrjala@linux.intel.com>
>
> @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
>
> Cc: Sam Ravnborg <sam@ravnborg.org>
> Cc: Boris Brezillon <bbrezillon@kernel.org>
> Signed-off-by: Ville Syrjälä <ville.syrjala@linux.intel.com>
Reviewed-by: Boris Brezillon <boris.brezillon@collabora.com>
> ---
> drivers/gpu/drm/atmel-hlcdc/atmel_hlcdc_plane.c | 5 +----
> 1 file changed, 1 insertion(+), 4 deletions(-)
>
> diff --git a/drivers/gpu/drm/atmel-hlcdc/atmel_hlcdc_plane.c b/drivers/gpu/drm/atmel-hlcdc/atmel_hlcdc_plane.c
> index 89f5a756fa37..034f202dfe8f 100644
> --- a/drivers/gpu/drm/atmel-hlcdc/atmel_hlcdc_plane.c
> +++ b/drivers/gpu/drm/atmel-hlcdc/atmel_hlcdc_plane.c
> @@ -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 &&
_______________________________________________
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: [PATCH 1/3] drm/amd/display: Use swap() where appropriate
[not found] ` <20191010131159.17346-1-ville.syrjala-VuQAYsv1563Yd54FQh9/CA@public.gmane.org>
2019-10-10 13:11 ` [PATCH 2/3] drm/amdgpu/powerplay: " Ville Syrjala
@ 2019-10-10 13:47 ` Kazlauskas, Nicholas
2019-10-10 14:24 ` Alex Deucher
1 sibling, 1 reply; 8+ messages in thread
From: Kazlauskas, Nicholas @ 2019-10-10 13:47 UTC (permalink / raw)
To: Ville Syrjala, dri-devel-PD4FTy7X32lNgt0PjOBp9y5qC8QIuHrW
Cc: Li, Sun peng (Leo),
Deucher, Alexander, Koenig, Christian,
amd-gfx-PD4FTy7X32lNgt0PjOBp9y5qC8QIuHrW
On 2019-10-10 9:11 a.m., Ville Syrjala wrote:
> From: Ville Syrjälä <ville.syrjala@linux.intel.com>
>
> 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
>
> Cc: Harry Wentland <harry.wentland@amd.com>
> Cc: Leo Li <sunpeng.li@amd.com>
> Cc: Alex Deucher <alexander.deucher@amd.com>
> Cc: "Christian König" <christian.koenig@amd.com>
> Cc: "David (ChunMing) Zhou" <David1.Zhou@amd.com>
> Cc: amd-gfx@lists.freedesktop.org
> Signed-off-by: Ville Syrjälä <ville.syrjala@linux.intel.com>
Reviewed-by: Nicholas Kazlauskas <nicholas.kazlauskas@amd.com>
Thanks!
Nicholas Kazlauskas
> ---
> 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(-)
>
> diff --git a/drivers/gpu/drm/amd/display/dc/bios/bios_parser.c b/drivers/gpu/drm/amd/display/dc/bios/bios_parser.c
> index 221e0f56389f..823843cd2613 100644
> --- a/drivers/gpu/drm/amd/display/dc/bios/bios_parser.c
> +++ b/drivers/gpu/drm/amd/display/dc/bios/bios_parser.c
> @@ -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]);
> }
> }
> }
> diff --git a/drivers/gpu/drm/amd/display/dc/bios/bios_parser2.c b/drivers/gpu/drm/amd/display/dc/bios/bios_parser2.c
> index dff65c0fe82f..7873abea4112 100644
> --- a/drivers/gpu/drm/amd/display/dc/bios/bios_parser2.c
> +++ b/drivers/gpu/drm/amd/display/dc/bios/bios_parser2.c
> @@ -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]);
> }
> }
> }
> diff --git a/drivers/gpu/drm/amd/display/dc/core/dc.c b/drivers/gpu/drm/amd/display/dc/core/dc.c
> index 5d1adeda4d90..fb6a7288caf4 100644
> --- a/drivers/gpu/drm/amd/display/dc/core/dc.c
> +++ b/drivers/gpu/drm/amd/display/dc/core/dc.c
> @@ -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;
> }
> }
>
_______________________________________________
amd-gfx mailing list
amd-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/amd-gfx
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: [PATCH 1/3] drm/amd/display: Use swap() where appropriate
2019-10-10 13:47 ` [PATCH 1/3] drm/amd/display: " Kazlauskas, Nicholas
@ 2019-10-10 14:24 ` Alex Deucher
0 siblings, 0 replies; 8+ messages in thread
From: Alex Deucher @ 2019-10-10 14:24 UTC (permalink / raw)
To: Kazlauskas, Nicholas
Cc: Li, Sun peng (Leo),
amd-gfx, dri-devel, Deucher, Alexander, Koenig, Christian
Applied. Thanks!
Alex
On Thu, Oct 10, 2019 at 9:48 AM Kazlauskas, Nicholas
<Nicholas.Kazlauskas@amd.com> wrote:
>
> On 2019-10-10 9:11 a.m., Ville Syrjala wrote:
> > From: Ville Syrjälä <ville.syrjala@linux.intel.com>
> >
> > 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
> >
> > Cc: Harry Wentland <harry.wentland@amd.com>
> > Cc: Leo Li <sunpeng.li@amd.com>
> > Cc: Alex Deucher <alexander.deucher@amd.com>
> > Cc: "Christian König" <christian.koenig@amd.com>
> > Cc: "David (ChunMing) Zhou" <David1.Zhou@amd.com>
> > Cc: amd-gfx@lists.freedesktop.org
> > Signed-off-by: Ville Syrjälä <ville.syrjala@linux.intel.com>
>
> Reviewed-by: Nicholas Kazlauskas <nicholas.kazlauskas@amd.com>
>
> Thanks!
>
> Nicholas Kazlauskas
>
> > ---
> > 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(-)
> >
> > diff --git a/drivers/gpu/drm/amd/display/dc/bios/bios_parser.c b/drivers/gpu/drm/amd/display/dc/bios/bios_parser.c
> > index 221e0f56389f..823843cd2613 100644
> > --- a/drivers/gpu/drm/amd/display/dc/bios/bios_parser.c
> > +++ b/drivers/gpu/drm/amd/display/dc/bios/bios_parser.c
> > @@ -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]);
> > }
> > }
> > }
> > diff --git a/drivers/gpu/drm/amd/display/dc/bios/bios_parser2.c b/drivers/gpu/drm/amd/display/dc/bios/bios_parser2.c
> > index dff65c0fe82f..7873abea4112 100644
> > --- a/drivers/gpu/drm/amd/display/dc/bios/bios_parser2.c
> > +++ b/drivers/gpu/drm/amd/display/dc/bios/bios_parser2.c
> > @@ -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]);
> > }
> > }
> > }
> > diff --git a/drivers/gpu/drm/amd/display/dc/core/dc.c b/drivers/gpu/drm/amd/display/dc/core/dc.c
> > index 5d1adeda4d90..fb6a7288caf4 100644
> > --- a/drivers/gpu/drm/amd/display/dc/core/dc.c
> > +++ b/drivers/gpu/drm/amd/display/dc/core/dc.c
> > @@ -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;
> > }
> > }
> >
>
> _______________________________________________
> amd-gfx mailing list
> amd-gfx@lists.freedesktop.org
> https://lists.freedesktop.org/mailman/listinfo/amd-gfx
_______________________________________________
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: [PATCH 2/3] drm/amdgpu/powerplay: Use swap() where appropriate
2019-10-10 13:11 ` [PATCH 2/3] drm/amdgpu/powerplay: " Ville Syrjala
@ 2019-10-10 14:27 ` Alex Deucher
0 siblings, 0 replies; 8+ messages in thread
From: Alex Deucher @ 2019-10-10 14:27 UTC (permalink / raw)
To: Ville Syrjala
Cc: amd-gfx list, Maling list - DRI developers, Alex Deucher,
Evan Quan, Rex Zhu, Christian König
On Thu, Oct 10, 2019 at 9:12 AM Ville Syrjala
<ville.syrjala@linux.intel.com> wrote:
>
> From: Ville Syrjälä <ville.syrjala@linux.intel.com>
>
> @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
>
> Cc: Rex Zhu <rex.zhu@amd.com>
> Cc: Evan Quan <evan.quan@amd.com>
> Cc: Alex Deucher <alexander.deucher@amd.com>
> Cc: "Christian König" <christian.koenig@amd.com>
> Cc: "David (ChunMing) Zhou" <David1.Zhou@amd.com>
> Cc: amd-gfx@lists.freedesktop.org
> Signed-off-by: Ville Syrjälä <ville.syrjala@linux.intel.com>
Reviewed and applied. Thanks!
Alex
> ---
> 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(-)
>
> diff --git a/drivers/gpu/drm/amd/powerplay/hwmgr/smu7_hwmgr.c b/drivers/gpu/drm/amd/powerplay/hwmgr/smu7_hwmgr.c
> index 34f95e0e3ea4..1fe992835a76 100644
> --- a/drivers/gpu/drm/amd/powerplay/hwmgr/smu7_hwmgr.c
> +++ b/drivers/gpu/drm/amd/powerplay/hwmgr/smu7_hwmgr.c
> @@ -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]);
> }
> }
> }
> diff --git a/drivers/gpu/drm/amd/powerplay/hwmgr/vega10_hwmgr.c b/drivers/gpu/drm/amd/powerplay/hwmgr/vega10_hwmgr.c
> index d08493b67b67..f5dcba44f74a 100644
> --- a/drivers/gpu/drm/amd/powerplay/hwmgr/vega10_hwmgr.c
> +++ b/drivers/gpu/drm/amd/powerplay/hwmgr/vega10_hwmgr.c
> @@ -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
>
> _______________________________________________
> amd-gfx mailing list
> amd-gfx@lists.freedesktop.org
> https://lists.freedesktop.org/mailman/listinfo/amd-gfx
_______________________________________________
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: [PATCH 3/3] drm/atmel-hlcdc: Use swap() where appropriate
2019-10-10 13:24 ` Boris Brezillon
@ 2019-10-11 16:07 ` Ville Syrjälä
0 siblings, 0 replies; 8+ messages in thread
From: Ville Syrjälä @ 2019-10-11 16:07 UTC (permalink / raw)
To: Boris Brezillon; +Cc: Sam Ravnborg, dri-devel, Boris Brezillon
On Thu, Oct 10, 2019 at 03:24:28PM +0200, Boris Brezillon wrote:
> On Thu, 10 Oct 2019 16:11:59 +0300
> Ville Syrjala <ville.syrjala@linux.intel.com> wrote:
>
> > From: Ville Syrjälä <ville.syrjala@linux.intel.com>
> >
> > @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
> >
> > Cc: Sam Ravnborg <sam@ravnborg.org>
> > Cc: Boris Brezillon <bbrezillon@kernel.org>
> > Signed-off-by: Ville Syrjälä <ville.syrjala@linux.intel.com>
>
> Reviewed-by: Boris Brezillon <boris.brezillon@collabora.com>
Ta. Pushed to drm-misc-next.
>
> > ---
> > drivers/gpu/drm/atmel-hlcdc/atmel_hlcdc_plane.c | 5 +----
> > 1 file changed, 1 insertion(+), 4 deletions(-)
> >
> > diff --git a/drivers/gpu/drm/atmel-hlcdc/atmel_hlcdc_plane.c b/drivers/gpu/drm/atmel-hlcdc/atmel_hlcdc_plane.c
> > index 89f5a756fa37..034f202dfe8f 100644
> > --- a/drivers/gpu/drm/atmel-hlcdc/atmel_hlcdc_plane.c
> > +++ b/drivers/gpu/drm/atmel-hlcdc/atmel_hlcdc_plane.c
> > @@ -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 &&
--
Ville Syrjälä
Intel
_______________________________________________
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel
^ permalink raw reply [flat|nested] 8+ messages in thread
end of thread, other threads:[~2019-10-11 16:07 UTC | newest]
Thread overview: 8+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-10-10 13:11 [PATCH 1/3] drm/amd/display: Use swap() where appropriate Ville Syrjala
2019-10-10 13:11 ` [PATCH 3/3] drm/atmel-hlcdc: " Ville Syrjala
2019-10-10 13:24 ` Boris Brezillon
2019-10-11 16:07 ` Ville Syrjälä
[not found] ` <20191010131159.17346-1-ville.syrjala-VuQAYsv1563Yd54FQh9/CA@public.gmane.org>
2019-10-10 13:11 ` [PATCH 2/3] drm/amdgpu/powerplay: " Ville Syrjala
2019-10-10 14:27 ` Alex Deucher
2019-10-10 13:47 ` [PATCH 1/3] drm/amd/display: " Kazlauskas, Nicholas
2019-10-10 14:24 ` Alex Deucher
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.