drm/amd/display: More efficient data output in four functions
Subsystems (3)
cover drm/amd/display: More efficient data output in four functions
From: Markus Elfring <[email protected]>
Date: Fri, 5 Jun 2026 13:00:03 +0200
A few update suggestions were taken into account
from static source code analysis.
Markus Elfring (3):
Simplify data output in psr_capability_show()
Simplify data output in ips_status_show()
Use seq_putc() in three functions
.../drm/amd/display/amdgpu_dm/amdgpu_dm_debugfs.c | 13 ++++++------- 1 file changed, 6 insertions(+), 7 deletions(-)
Signature · 1 line
2.54.0
PATCH 1/3 drm/amd/display: Simplify data output in psr_capability_show()
From: Markus Elfring <[email protected]>
Date: Fri, 5 Jun 2026 11:39:13 +0200
Move the specification for a line break from a seq_puts() call to a seq_printf() call.
The source code was transformed by using the Coccinelle software.
--- drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm_debugfs.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm_debugfs.c +2 -2
@@ -1076,9 +1076,9 @@ static int psr_capability_show(struct seq_file *m, void *data)seq_printf (m,"Sink support: %s" ,str_yes_no (link->dpcd_caps.psr_info.psr_version !=0 ));if (link->dpcd_caps.psr_info.psr_version)seq_printf (m," [0x%02x]" , link->dpcd_caps.psr_info.psr_version); -seq_puts (m,"\n" ); -seq_printf (m,"Driver support: %s" ,str_yes_no (link->psr_settings.psr_feature_enabled)); +seq_printf (m,"\nDriver support: %s" , +str_yes_no (link->psr_settings.psr_feature_enabled));if (link->psr_settings.psr_version)seq_printf (m," [0x%02x]" , link->psr_settings.psr_version);seq_puts (m,"\n" );
Signature · 1 line
2.54.0
Re: [PATCH 1/3] drm/amd/display: Simplify data output in psr_capability_show()
Quoted 19 lines · Markus Elfring
From: Markus Elfring <[email protected]>
Date: Fri, 5 Jun 2026 11:39:13 +0200Move the specification for a line break from a
seq_puts()call to aseq_printf()call.The source code was transformed by using the Coccinelle software.
Signed-off-by Markus Elfring <[email protected]>--- drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm_debugfs.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm_debugfs.c +0
-0
drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm_debugfs.c static int psr_capability_show(struct seq_file *m, void *data) · line 1079
Quoted 4 lines
drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm_debugfs.c +0
-1@@ -1076,9 +1076,9 @@ static int psr_capability_show(struct seq_file *m, void *data)seq_printf (m,"Sink support: %s" ,str_yes_no (link->dpcd_caps.psr_info.psr_version !=0 ));if (link->dpcd_caps.psr_info.psr_version)seq_printf (m," [0x%02x]" , link->dpcd_caps.psr_info.psr_version); -seq_puts (m,"\n" );
Why not just convert this to seq_putc() and drop the rest? It seems more logical from a code structure perspective.
Alex
Quoted 10 lines
drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm_debugfs.c +2
-2-seq_printf (m,"Driver support: %s" ,str_yes_no (link->psr_settings.psr_feature_enabled)); +seq_printf (m,"\nDriver support: %s" , +str_yes_no (link->psr_settings.psr_feature_enabled));if (link->psr_settings.psr_version)seq_printf (m," [0x%02x]" , link->psr_settings.psr_version);seq_puts (m,"\n" ); --2.54.0
Re: [PATCH 1/3] drm/amd/display: Simplify data output in psr_capability_show()
Quoted 10 lines
Quoted 10 lines
Move the specification for a line break from a
seq_puts()call to aseq_printf()call.The source code was transformed by using the Coccinelle software.
Signed-off-by Markus Elfring <[email protected]>--- drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm_debugfs.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
Quoted 12 lines
drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm_debugfs.c static int psr_capability_show(struct seq_file *m, void *data) · line 1079
Quoted 9 lines
drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm_debugfs.c +0
-1@@ -1076,9 +1076,9 @@ static int psr_capability_show(struct seq_file *m, void *data)seq_printf (m,"Sink support: %s" ,str_yes_no (link->dpcd_caps.psr_info.psr_version !=0 ));if (link->dpcd_caps.psr_info.psr_version)seq_printf (m," [0x%02x]" , link->dpcd_caps.psr_info.psr_version); -seq_puts (m,"\n" );Why not just convert this to
seq_putc()and drop the rest? It seems more logical from a code structure perspective.
I obviously propose to omit a function call at this source code place
because an intended line break output can be achieved also with the subsequent function call.
Do you insist to preserve a similar statement here?
Quoted 7 lines
drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm_debugfs.c static int psr_capability_show(struct seq_file *m, void *data) · line 1084
Quoted 7 lines
drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm_debugfs.c +2
-1-seq_printf (m,"Driver support: %s" ,str_yes_no (link->psr_settings.psr_feature_enabled)); +seq_printf (m,"\nDriver support: %s" , +str_yes_no (link->psr_settings.psr_feature_enabled));if (link->psr_settings.psr_version)seq_printf (m," [0x%02x]" , link->psr_settings.psr_version);seq_puts (m,"\n" );
Regards,
Markus
Re: [PATCH 1/3] drm/amd/display: Simplify data output in psr_capability_show()
Quoted 24 lines · Markus Elfring
Quoted 11 lines
Quoted 11 lines
Move the specification for a line break from a
seq_puts()call to aseq_printf()call.The source code was transformed by using the Coccinelle software.
Signed-off-by Markus Elfring <[email protected]>--- drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm_debugfs.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)Quoted 12 lines
drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm_debugfs.c static int psr_capability_show(struct seq_file *m, void *data) · line 1079
Quoted 9 lines
drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm_debugfs.c +0
-1@@ -1076,9 +1076,9 @@ static int psr_capability_show(struct seq_file *m, void *data)seq_printf (m,"Sink support: %s" ,str_yes_no (link->dpcd_caps.psr_info.psr_version !=0 ));if (link->dpcd_caps.psr_info.psr_version)seq_printf (m," [0x%02x]" , link->dpcd_caps.psr_info.psr_version); -seq_puts (m,"\n" );Why not just convert this to
seq_putc()and drop the rest? It seems more logical from a code structure perspective.
Quoted 4 lines
I obviously propose to omit a function call at this source code place
because an intended line break output can be achieved also with the subsequent function call.Do you insist to preserve a similar statement here?
I think the code reads more cleanly that way, but it's not a big deal either way.
Alex
Quoted 12 lines
Quoted 9 lines
drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm_debugfs.c static int psr_capability_show(struct seq_file *m, void *data) · line 1084
Quoted 9 lines
drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm_debugfs.c +2
-1-seq_printf (m,"Driver support: %s" ,str_yes_no (link->psr_settings.psr_feature_enabled)); +seq_printf (m,"\nDriver support: %s" , +str_yes_no (link->psr_settings.psr_feature_enabled));if (link->psr_settings.psr_version)seq_printf (m," [0x%02x]" , link->psr_settings.psr_version);seq_puts (m,"\n" );Regards,
Markus
PATCH 2/3 drm/amd/display: Simplify data output in ips_status_show()
In reply to Markus ElfringFrom: Markus Elfring <[email protected]>
Date: Fri, 5 Jun 2026 12:40:31 +0200
Move the specification for a line break from a seq_puts() call to a previous seq_printf() call.
This issue was detected by using the Coccinelle software.
--- drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm_debugfs.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-)
drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm_debugfs.c +1 -2
@@ -2705,11 +2705,10 @@ static int ips_status_show(struct seq_file *m, void *unused) rcg_count = ips_fw->rcg_exit_count; ips1_count = ips_fw->ips1_exit_count; ips2_count = ips_fw->ips2_exit_count; -seq_printf (m,"exit counts: rcg=%u ips1=%u ips2=%u" , +seq_printf (m,"exit counts: rcg=%u ips1=%u ips2=%u\n" , rcg_count, ips1_count, ips2_count); -seq_puts (m,"\n" ); }return 0 ; }
Signature · 1 line
2.54.0
PATCH 3/3 drm/amd/display: Use seq_putc() in three functions
In reply to Markus ElfringFrom: Markus Elfring <[email protected]>
Date: Fri, 5 Jun 2026 12:44:01 +0200
Single characters should occasionally be put into a sequence. Thus use the corresponding function “seq_putc”.
The source code was transformed by using the Coccinelle software.
--- drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm_debugfs.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-)
drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm_debugfs.c +3 -3
@@ -606,7 +606,7 @@ static int dp_lttpr_status_show(struct seq_file *m, void *unused)break ; } -seq_puts (m,"\n" ); +seq_putc (m,'\n' );return 0 ; }
@@ -1081,7 +1081,7 @@ static int psr_capability_show(struct seq_file *m, void *data) str_yes_no(link->psr_settings.psr_feature_enabled));if (link->psr_settings.psr_version)seq_printf (m," [0x%02x]" , link->psr_settings.psr_version); -seq_puts (m,"\n" ); +seq_putc (m,'\n' );return 0 ; }
@@ -1266,7 +1266,7 @@ static int hdcp_sink_capability_show(struct seq_file *m, void *data)if (!hdcp_cap && !hdcp2_cap)seq_printf (m,"%s " ,"None" ); -seq_puts (m,"\n" ); +seq_putc (m,'\n' );return 0 ; }
Signature · 1 line
2.54.0
Alex Deucher
AppliedRe: [PATCH 3/3] drm/amd/display: Use seq_putc() in three functions
Applied patches 2 and 3. Thanks!
Alex
Quoted 48 lines · Markus Elfring
From: Markus Elfring <[email protected]>
Date: Fri, 5 Jun 2026 12:44:01 +0200Single characters should occasionally be put into a sequence. Thus use the corresponding function “seq_putc”.
The source code was transformed by using the Coccinelle software.
Signed-off-by Markus Elfring <[email protected]>--- drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm_debugfs.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-)drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm_debugfs.c +3
-4@@ -606,7 +606,7 @@ static int dp_lttpr_status_show(struct seq_file *m, void *unused)break ; } -seq_puts (m,"\n" ); +seq_putc (m,'\n' );return 0 ; }@@ -1081,7 +1081,7 @@ static int psr_capability_show(struct seq_file *m, void *data) str_yes_no(link->psr_settings.psr_feature_enabled));if (link->psr_settings.psr_version)seq_printf (m," [0x%02x]" , link->psr_settings.psr_version); -seq_puts (m,"\n" ); +seq_putc (m,'\n' );return 0 ; }@@ -1266,7 +1266,7 @@ static int hdcp_sink_capability_show(struct seq_file *m, void *data)if (!hdcp_cap && !hdcp2_cap)seq_printf (m,"%s " ,"None" ); -seq_puts (m,"\n" ); +seq_putc (m,'\n' );return 0 ; } --2.54.0
Quoted 5 lines · On 2026. június 5., péntek 13:30:13 közép-európai nyári idő Markus Elfring…
From: Markus Elfring <[email protected]>
Date: Fri, 5 Jun 2026 13:00:03 +0200A few update suggestions were taken into account
from static source code analysis.
The series looks good to me. Thank you!
Quoted 8 lines
Markus Elfring (3):
Simplify data output inpsr_capability_show()
Simplify data output inips_status_show()
Useseq_putc()in three functions.../drm/amd/display/amdgpu_dm/amdgpu_dm_debugfs.c | 13 ++++++------- 1 file changed, 6 insertions(+), 7 deletions(-)