Skip to contentSkip to conversation

drm/amdkfd: Do not use internal implementation of tolower()

PATCH In review Andy Shevchenko 2 participants 2 messages Oct 21

Subsystems (3)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 drm/amdkfd: Do not use internal implementation of tolower()

ctype.h provides tolower() macro specifically for the cases that might be architecture-optimised. Using __tolower(), which is internal implementation, needs a good justification, as this driver is the only user of that and there is no evidence it's required.

Note, currently it's no difference as the macro always defined to the internal implementation, but it might change in the future.

---
 drivers/gpu/drm/amd/amdkfd/kfd_topology.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/gpu/drm/amd/amdkfd/kfd_topology.c +1 -1
index 35b3abe57b80..1ef4d26a0ac6 100644
@@ -2091,7 +2091,7 @@ int kfd_topology_add_device(struct kfd_node *gpu)
 	 * needed for the topology
 	 */
 	for (i = 0; i < KFD_TOPOLOGY_PUBLIC_NAME_SIZE-1; i++) {
-		dev->node_props.name[i] = __tolower(asic_name[i]);
+		dev->node_props.name[i] = tolower(asic_name[i]);
 		if (asic_name[i] == '\0')
 			break;
 	}
Signature · 1 line
2.50.1
maintainer Reviewed-by on v1 1/1
#1 lore raw
Quoted 10 lines · Andy Shevchenko

ctype.h provides tolower() macro specifically for the cases that might be architecture-optimised. Using __tolower(), which is internal implementation, needs a good justification, as this driver is the only user of that and there is no evidence it's required.

Note, currently it's no difference as the macro always defined to the internal implementation, but it might change in the future.

Thanks. I'm applying the patch to amd-staging-drm-next.

Quoted 17 lines
---
  drivers/gpu/drm/amd/amdkfd/kfd_topology.c | 2 +-
  1 file changed, 1 insertion(+), 1 deletion(-)
drivers/gpu/drm/amd/amdkfd/kfd_topology.c +1 -1
index 35b3abe57b80..1ef4d26a0ac6 100644
@@ -2091,7 +2091,7 @@ int kfd_topology_add_device(struct kfd_node *gpu)
  	 * needed for the topology
  	 */
  	for (i = 0; i < KFD_TOPOLOGY_PUBLIC_NAME_SIZE-1; i++) {
-		dev->node_props.name[i] = __tolower(asic_name[i]);
+		dev->node_props.name[i] = tolower(asic_name[i]);
  		if (asic_name[i] == '\0')
  			break;
  	}