Skip to contentSkip to conversation

drm/amd/display: use swap() in update_phy_id_mapping()

PATCH Applied Jiapeng Chong 2 participants 2 messages Dec 12, 2024

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

PATCH 1/1 drm/amd/display: use swap() in update_phy_id_mapping()

Use existing swap() function rather than duplicating its implementation.

./drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm_crc.c:185:47-48: WARNING opportunity for swap(). ./drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm_crc.c:125:53-54: WARNING opportunity for swap().

---
 .../gpu/drm/amd/display/amdgpu_dm/amdgpu_dm_crc.c  | 14 ++++----------
 1 file changed, 4 insertions(+), 10 deletions(-)
drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm_crc.c +4 -10
index 309c7999faa6..6fdc306a4a86 100644
@@ -120,11 +120,8 @@ static void update_phy_id_mapping(struct amdgpu_device *adev)
 	for (idx = connector_cnt; idx > 1 ; idx--) {
 		for (idx_2 = 0; idx_2 < (idx - 1); idx_2++) {
 			if (sort_connector[idx_2]->dc_link->link_enc_hw_inst >
-				sort_connector[idx_2 + 1]->dc_link->link_enc_hw_inst) {
-				aconnector = sort_connector[idx_2];
-				sort_connector[idx_2] = sort_connector[idx_2 + 1];
-				sort_connector[idx_2 + 1] = aconnector;
-			}
+			    sort_connector[idx_2 + 1]->dc_link->link_enc_hw_inst)
+				swap(sort_connector[idx_2], sort_connector[idx_2 + 1]);
 		}
 	}
 
@@ -180,11 +177,8 @@ static void update_phy_id_mapping(struct amdgpu_device *adev)
 						}
 					}
 
-					if (swap) {
-						aconnector = sort_connector[j];
-						sort_connector[j] = sort_connector[j + 1];
-						sort_connector[j + 1] = aconnector;
-					}
+					if (swap)
+						swap(sort_connector[j], sort_connector[j + 1]);
 				}
 			}
 
Signature · 1 line
2.32.0.3.g01195cf9f
Applied
#1 lore raw

Applied. Thanks!

Quoted 48 lines · Jiapeng Chong

Use existing swap() function rather than duplicating its implementation.

./drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm_crc.c:185:47-48: WARNING opportunity for swap(). ./drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm_crc.c:125:53-54: WARNING opportunity for swap().

---
 .../gpu/drm/amd/display/amdgpu_dm/amdgpu_dm_crc.c  | 14 ++++----------
 1 file changed, 4 insertions(+), 10 deletions(-)
drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm_crc.c +4 -11
index 309c7999faa6..6fdc306a4a86 100644
@@ -120,11 +120,8 @@ static void update_phy_id_mapping(struct amdgpu_device *adev)
        for (idx = connector_cnt; idx > 1 ; idx--) {
                for (idx_2 = 0; idx_2 < (idx - 1); idx_2++) {
                        if (sort_connector[idx_2]->dc_link->link_enc_hw_inst >
-                               sort_connector[idx_2 + 1]->dc_link->link_enc_hw_inst) {
-                               aconnector = sort_connector[idx_2];
-                               sort_connector[idx_2] = sort_connector[idx_2 + 1];
-                               sort_connector[idx_2 + 1] = aconnector;
-                       }
+                           sort_connector[idx_2 + 1]->dc_link->link_enc_hw_inst)
+                               swap(sort_connector[idx_2], sort_connector[idx_2 + 1]);
                }
        }
 
@@ -180,11 +177,8 @@ static void update_phy_id_mapping(struct amdgpu_device *adev)
                                                }
                                        }
 
-                                       if (swap) {
-                                               aconnector = sort_connector[j];
-                                               sort_connector[j] = sort_connector[j + 1];
-                                               sort_connector[j + 1] = aconnector;
-                                       }
+                                       if (swap)
+                                               swap(sort_connector[j], sort_connector[j + 1]);
                                }
                        }
 
--

2.32.0.3.g01195cf9f