Skip to contentSkip to conversation

drm/amdgpu: use string choice helpers

PATCH In review R Sundar 2 participants 2 messages Apr 27, 2025 – Apr 28, 2025

Subsystems (2)
lore
Share & tools
lore

R Sundar

author
#0 lore raw

PATCH 1/1 drm/amdgpu: use string choice helpers

Use string choice helpers for better readability.

---

Reported in linux repository.

cocci warnings: (new ones prefixed by >>)

Quoted 1 line
Quoted 1 line

drivers/gpu/drm/amd/amdgpu/amdgpu_vpe.c:311:49-70: opportunity for str_true_false(vpe -> collaborate_mode)

vim +311 drivers/gpu/drm/amd/amdgpu/amdgpu_vpe.c

for linux-next:

 drivers/gpu/drm/amd/amdgpu/amdgpu_vpe.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/gpu/drm/amd/amdgpu/amdgpu_vpe.c +1 -1
index 121ee17b522b..442d137e0fed 100644
@@ -317,7 +317,7 @@ static int vpe_early_init(struct amdgpu_ip_block *ip_block)
 	vpe_set_ring_funcs(adev);
 	vpe_set_regs(vpe);
 
-	dev_info(adev->dev, "VPE: collaborate mode %s", vpe->collaborate_mode ? "true" : "false");
+	dev_info(adev->dev, "VPE: collaborate mode %s", str_true_false(vpe->collaborate_mode));
 
 	return 0;
 }
Signature · 1 line
2.34.1
#1 lore raw
Quoted 26 lines · R Sundar

Use string choice helpers for better readability.

---

Reported in linux repository.

cocci warnings: (new ones prefixed by >>)

Quoted 1 line
Quoted 1 line

drivers/gpu/drm/amd/amdgpu/amdgpu_vpe.c:311:49-70: opportunity for str_true_false(vpe -> collaborate_mode)

vim +311 drivers/gpu/drm/amd/amdgpu/amdgpu_vpe.c

for linux-next:

 drivers/gpu/drm/amd/amdgpu/amdgpu_vpe.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/gpu/drm/amd/amdgpu/amdgpu_vpe.c +0 -0
index 121ee17b522b..442d137e0fed 100644

drivers/gpu/drm/amd/amdgpu/amdgpu_vpe.c static int vpe_early_init(struct amdgpu_ip_block *ip_block) · line 320

Quoted 5 lines
drivers/gpu/drm/amd/amdgpu/amdgpu_vpe.c +1 -1
@@ -317,7 +317,7 @@ static int vpe_early_init(struct amdgpu_ip_block *ip_block)
        vpe_set_ring_funcs(adev);
        vpe_set_regs(vpe);
 
-       dev_info(adev->dev, "VPE: collaborate mode %s", vpe->collaborate_mode ? "true" : "false");
+       dev_info(adev->dev, "VPE: collaborate mode %s", str_true_false(vpe->collaborate_mode));

I'm not opposed to this change if there is a general initiative to convert everyone over to using this for some useful reason, but I personally don't think it helps readability at all. If anything it makes it worse in my opinion.

Alex

Quoted 6 lines
drivers/gpu/drm/amd/amdgpu/amdgpu_vpe.c +0 -1
        return 0;
 }
--

2.34.1