Skip to contentSkip to conversation

hw/cxl: Fix local variable shadowing of cap_hdrs

PATCH Applied Jonathan Cameron via 4 participants 8 messages Sep 25, 2023 – Oct 4, 2023

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 hw/cxl: Fix local variable shadowing of cap_hdrs

Rename the version not burried in the macro to cap_h.

---

I had another instance of this in a series I'll post later today. Cleaned that up the same way.

 hw/cxl/cxl-device-utils.c | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)
hw/cxl/cxl-device-utils.c +4 -4
index 517f06d869..bd68328032 100644
@@ -283,13 +283,13 @@ static void memdev_reg_init_common(CXLDeviceState *cxl_dstate) { }
 
 void cxl_device_register_init_common(CXLDeviceState *cxl_dstate)
 {
-    uint64_t *cap_hdrs = cxl_dstate->caps_reg_state64;
+    uint64_t *cap_h = cxl_dstate->caps_reg_state64;
     const int cap_count = 3;
 
     /* CXL Device Capabilities Array Register */
-    ARRAY_FIELD_DP64(cap_hdrs, CXL_DEV_CAP_ARRAY, CAP_ID, 0);
-    ARRAY_FIELD_DP64(cap_hdrs, CXL_DEV_CAP_ARRAY, CAP_VERSION, 1);
-    ARRAY_FIELD_DP64(cap_hdrs, CXL_DEV_CAP_ARRAY, CAP_COUNT, cap_count);
+    ARRAY_FIELD_DP64(cap_h, CXL_DEV_CAP_ARRAY, CAP_ID, 0);
+    ARRAY_FIELD_DP64(cap_h, CXL_DEV_CAP_ARRAY, CAP_VERSION, 1);
+    ARRAY_FIELD_DP64(cap_h, CXL_DEV_CAP_ARRAY, CAP_COUNT, cap_count);
 
     cxl_device_cap_init(cxl_dstate, DEVICE_STATUS, 1, 2);
     device_reg_init_common(cxl_dstate);
Signature · 1 line
2.39.2
#1 lore raw
Quoted 1 line · Jonathan Cameron

Rename the version not burried in the macro to cap_h.

The change looks good to me. Just one minor thing. why "version" get involved here?

Fan

Quoted 35 lines

---

I had another instance of this in a series I'll post later today. Cleaned that up the same way.

 hw/cxl/cxl-device-utils.c | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)
hw/cxl/cxl-device-utils.c +4 -4
index 517f06d869..bd68328032 100644
@@ -283,13 +283,13 @@ static void memdev_reg_init_common(CXLDeviceState *cxl_dstate) { }
 
 void cxl_device_register_init_common(CXLDeviceState *cxl_dstate)
 {
-    uint64_t *cap_hdrs = cxl_dstate->caps_reg_state64;
+    uint64_t *cap_h = cxl_dstate->caps_reg_state64;
     const int cap_count = 3;
 
     /* CXL Device Capabilities Array Register */
-    ARRAY_FIELD_DP64(cap_hdrs, CXL_DEV_CAP_ARRAY, CAP_ID, 0);
-    ARRAY_FIELD_DP64(cap_hdrs, CXL_DEV_CAP_ARRAY, CAP_VERSION, 1);
-    ARRAY_FIELD_DP64(cap_hdrs, CXL_DEV_CAP_ARRAY, CAP_COUNT, cap_count);
+    ARRAY_FIELD_DP64(cap_h, CXL_DEV_CAP_ARRAY, CAP_ID, 0);
+    ARRAY_FIELD_DP64(cap_h, CXL_DEV_CAP_ARRAY, CAP_VERSION, 1);
+    ARRAY_FIELD_DP64(cap_h, CXL_DEV_CAP_ARRAY, CAP_COUNT, cap_count);
 
     cxl_device_cap_init(cxl_dstate, DEVICE_STATUS, 1, 2);
     device_reg_init_common(cxl_dstate);
Signature · 1 line
2.39.2
#2 lore raw
Quoted 6 lines · On Wed, 27 Sep 2023 19:13:35 +0000 Fan Ni <[email protected]> wrote:
Quoted 1 line · Jonathan Cameron

Rename the version not burried in the macro to cap_h.

The change looks good to me. Just one minor thing. why "version" get involved here?

Used in the sense of two copies of something with slightly differences given if it were straight code without a macro, we'd have just have used the copy being changed here for all of the calls. With hindsight, not the best word to choose given the many other meanings!

Jonathan

Quoted 36 lines

Fan

Quoted 35 lines

---

I had another instance of this in a series I'll post later today. Cleaned that up the same way.

 hw/cxl/cxl-device-utils.c | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)
hw/cxl/cxl-device-utils.c +4 -4
index 517f06d869..bd68328032 100644
@@ -283,13 +283,13 @@ static void memdev_reg_init_common(CXLDeviceState *cxl_dstate) { }
 
 void cxl_device_register_init_common(CXLDeviceState *cxl_dstate)
 {
-    uint64_t *cap_hdrs = cxl_dstate->caps_reg_state64;
+    uint64_t *cap_h = cxl_dstate->caps_reg_state64;
     const int cap_count = 3;
 
     /* CXL Device Capabilities Array Register */
-    ARRAY_FIELD_DP64(cap_hdrs, CXL_DEV_CAP_ARRAY, CAP_ID, 0);
-    ARRAY_FIELD_DP64(cap_hdrs, CXL_DEV_CAP_ARRAY, CAP_VERSION, 1);
-    ARRAY_FIELD_DP64(cap_hdrs, CXL_DEV_CAP_ARRAY, CAP_COUNT, cap_count);
+    ARRAY_FIELD_DP64(cap_h, CXL_DEV_CAP_ARRAY, CAP_ID, 0);
+    ARRAY_FIELD_DP64(cap_h, CXL_DEV_CAP_ARRAY, CAP_VERSION, 1);
+    ARRAY_FIELD_DP64(cap_h, CXL_DEV_CAP_ARRAY, CAP_COUNT, cap_count);
 
     cxl_device_cap_init(cxl_dstate, DEVICE_STATUS, 1, 2);
     device_reg_init_common(cxl_dstate);
Signature · 1 line
2.39.2
#3 lore raw
Quoted 6 lines · Jonathan Cameron
Quoted 3 lines · On Wed, 27 Sep 2023 19:13:35 +0000 Fan Ni <[email protected]> wrote:
Quoted 1 line · Jonathan Cameron

Rename the version not burried in the macro to cap_h.

Quoted 8 lines
Quoted 3 lines

The change looks good to me. Just one minor thing. why "version" get involved here?

Used in the sense of two copies of something with slightly differences given if it were straight code without a macro, we'd have just have used the copy being changed here for all of the calls. With hindsight, not the best word to choose given the many other meanings!

Fan, good enough to get your R-by?

Reviewed-by on v1 1/1
#5 lore raw
In reply to Jonathan Cameron via
Quoted 4 lines · Jonathan Cameron

Rename the version not burried in the macro to cap_h.

---

pls merge with the rest of local shadowing things.

Quoted 30 lines

I had another instance of this in a series I'll post later today. Cleaned that up the same way.

 hw/cxl/cxl-device-utils.c | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)
hw/cxl/cxl-device-utils.c +4 -4
index 517f06d869..bd68328032 100644
@@ -283,13 +283,13 @@ static void memdev_reg_init_common(CXLDeviceState *cxl_dstate) { }
 
 void cxl_device_register_init_common(CXLDeviceState *cxl_dstate)
 {
-    uint64_t *cap_hdrs = cxl_dstate->caps_reg_state64;
+    uint64_t *cap_h = cxl_dstate->caps_reg_state64;
     const int cap_count = 3;
 
     /* CXL Device Capabilities Array Register */
-    ARRAY_FIELD_DP64(cap_hdrs, CXL_DEV_CAP_ARRAY, CAP_ID, 0);
-    ARRAY_FIELD_DP64(cap_hdrs, CXL_DEV_CAP_ARRAY, CAP_VERSION, 1);
-    ARRAY_FIELD_DP64(cap_hdrs, CXL_DEV_CAP_ARRAY, CAP_COUNT, cap_count);
+    ARRAY_FIELD_DP64(cap_h, CXL_DEV_CAP_ARRAY, CAP_ID, 0);
+    ARRAY_FIELD_DP64(cap_h, CXL_DEV_CAP_ARRAY, CAP_VERSION, 1);
+    ARRAY_FIELD_DP64(cap_h, CXL_DEV_CAP_ARRAY, CAP_COUNT, cap_count);
 
     cxl_device_cap_init(cxl_dstate, DEVICE_STATUS, 1, 2);
     device_reg_init_common(cxl_dstate);
Signature · 1 line
2.39.2
#4 lore raw
In reply to Markus Armbruster
Quoted 12 lines · Markus Armbruster
Quoted 10 lines · Jonathan Cameron
Quoted 6 lines · On Wed, 27 Sep 2023 19:13:35 +0000 Fan Ni <[email protected]> wrote:
Quoted 1 line · Jonathan Cameron

Rename the version not burried in the macro to cap_h.

The change looks good to me. Just one minor thing. why "version" get involved here?

Quoted 7 lines
Quoted 4 lines

Used in the sense of two copies of something with slightly differences given if it were straight code without a macro, we'd have just have used the copy being changed here for all of the calls. With hindsight, not the best word to choose given the many other meanings!

Fan, good enough to get your R-by?

Yes.

Fan

Reviewed-by on v1 1/1
#6 lore raw
In reply to Jonathan Cameron via
Quoted 36 lines · Jonathan Cameron

Rename the version not burried in the macro to cap_h.

---

I had another instance of this in a series I'll post later today. Cleaned that up the same way.

 hw/cxl/cxl-device-utils.c | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)
hw/cxl/cxl-device-utils.c +4 -4
index 517f06d869..bd68328032 100644
@@ -283,13 +283,13 @@ static void memdev_reg_init_common(CXLDeviceState *cxl_dstate) { }
 
 void cxl_device_register_init_common(CXLDeviceState *cxl_dstate)
 {
-    uint64_t *cap_hdrs = cxl_dstate->caps_reg_state64;
+    uint64_t *cap_h = cxl_dstate->caps_reg_state64;
     const int cap_count = 3;
 
     /* CXL Device Capabilities Array Register */
-    ARRAY_FIELD_DP64(cap_hdrs, CXL_DEV_CAP_ARRAY, CAP_ID, 0);
-    ARRAY_FIELD_DP64(cap_hdrs, CXL_DEV_CAP_ARRAY, CAP_VERSION, 1);
-    ARRAY_FIELD_DP64(cap_hdrs, CXL_DEV_CAP_ARRAY, CAP_COUNT, cap_count);
+    ARRAY_FIELD_DP64(cap_h, CXL_DEV_CAP_ARRAY, CAP_ID, 0);
+    ARRAY_FIELD_DP64(cap_h, CXL_DEV_CAP_ARRAY, CAP_VERSION, 1);
+    ARRAY_FIELD_DP64(cap_h, CXL_DEV_CAP_ARRAY, CAP_COUNT, cap_count);
 
     cxl_device_cap_init(cxl_dstate, DEVICE_STATUS, 1, 2);
     device_reg_init_common(cxl_dstate);
Signature · 1 line
2.39.2