hw/cxl: Fix local variable shadowing of cap_hdrs
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
@@ -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
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
Signed-off-by Jonathan Cameron <[email protected]>---
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@@ -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
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
Signed-off-by Jonathan Cameron <[email protected]>---
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@@ -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
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?
Quoted 4 lines · Jonathan Cameron
Rename the version not burried in the macro to
cap_h.Signed-off-by Jonathan Cameron <[email protected]>---
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@@ -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
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
Quoted 36 lines · Jonathan Cameron
Rename the version not burried in the macro to
cap_h.Signed-off-by Jonathan Cameron <[email protected]>---
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@@ -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
Markus Armbruster
AppliedQuoted 3 lines · Jonathan Cameron
Rename the version not burried in the macro to
cap_h.Signed-off-by Jonathan Cameron <[email protected]>
Queued, thanks!