Skip to contentSkip to conversation

acpi,hmat: Use ACCESS_COORDINATE_CPU when appropriate

PATCH In review Huang Ying 3 participants 3 messages Jun 6, 2024 ACPI

lore
Share & tools
lore

Huang Ying

author
#0 lore raw

PATCH 1/1 acpi,hmat: Use ACCESS_COORDINATE_CPU when appropriate

To improve the readability of the code via replacing the magic number "1" with ACCESS_COORDINATE_CPU when appropriate. No functionality change.

Cc Jonathan Cameron <[email protected]>
Cc Dave Jiang <[email protected]>
Cc Dan Williams <[email protected]>
Cc Bharata B Rao <[email protected]>
Cc Alistair Popple <[email protected]>
Cc Aneesh Kumar K.V <[email protected]>
---
 drivers/acpi/numa/hmat.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)
drivers/acpi/numa/hmat.c +3 -3
index 2c8ccc91ebe6..febd9e51350b 100644
@@ -408,7 +408,7 @@ static __init void hmat_update_target(unsigned int tgt_pxm, unsigned int init_px
 	if (target && target->processor_pxm == init_pxm) {
 		hmat_update_target_access(target, type, value,
 					  ACCESS_COORDINATE_LOCAL);
-		/* If the node has a CPU, update access 1 */
+		/* If the node has a CPU, update access ACCESS_COORDINATE_CPU */
 		if (node_state(pxm_to_node(init_pxm), N_CPU))
 			hmat_update_target_access(target, type, value,
 						  ACCESS_COORDINATE_CPU);
@@ -948,7 +948,7 @@ static int hmat_set_default_dram_perf(void)
 		target = find_mem_target(pxm);
 		if (!target)
 			continue;
-		attrs = &target->coord[1];
+		attrs = &target->coord[ACCESS_COORDINATE_CPU];
 		rc = mt_set_default_dram_perf(nid, attrs, "ACPI HMAT");
 		if (rc)
 			return rc;
@@ -975,7 +975,7 @@ static int hmat_calculate_adistance(struct notifier_block *self,
 	hmat_update_target_attrs(target, p_nodes, ACCESS_COORDINATE_CPU);
 	mutex_unlock(&target_lock);
 
-	perf = &target->coord[1];
+	perf = &target->coord[ACCESS_COORDINATE_CPU];
 
 	if (mt_perf_to_adistance(perf, adist))
 		return NOTIFY_OK;
Signature · 1 line
2.39.2
Reviewed-by on v1 1/1
#1 lore raw
Quoted 11 lines · On Thu, 6 Jun 2024 10:28:45 +0800 Huang Ying <[email protected]> wrote:

To improve the readability of the code via replacing the magic number "1" with ACCESS_COORDINATE_CPU when appropriate. No functionality change.

Cc Jonathan Cameron <[email protected]>
Cc Dave Jiang <[email protected]>
Cc Dan Williams <[email protected]>
Cc Bharata B Rao <[email protected]>
Cc Alistair Popple <[email protected]>
Cc Aneesh Kumar K.V <[email protected]>

Good to clean this up. Thanks!

Quoted 35 lines
---
 drivers/acpi/numa/hmat.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)
drivers/acpi/numa/hmat.c +3 -3
index 2c8ccc91ebe6..febd9e51350b 100644
@@ -408,7 +408,7 @@ static __init void hmat_update_target(unsigned int tgt_pxm, unsigned int init_px
 	if (target && target->processor_pxm == init_pxm) {
 		hmat_update_target_access(target, type, value,
 					  ACCESS_COORDINATE_LOCAL);
-		/* If the node has a CPU, update access 1 */
+		/* If the node has a CPU, update access ACCESS_COORDINATE_CPU */
 		if (node_state(pxm_to_node(init_pxm), N_CPU))
 			hmat_update_target_access(target, type, value,
 						  ACCESS_COORDINATE_CPU);
@@ -948,7 +948,7 @@ static int hmat_set_default_dram_perf(void)
 		target = find_mem_target(pxm);
 		if (!target)
 			continue;
-		attrs = &target->coord[1];
+		attrs = &target->coord[ACCESS_COORDINATE_CPU];
 		rc = mt_set_default_dram_perf(nid, attrs, "ACPI HMAT");
 		if (rc)
 			return rc;
@@ -975,7 +975,7 @@ static int hmat_calculate_adistance(struct notifier_block *self,
 	hmat_update_target_attrs(target, p_nodes, ACCESS_COORDINATE_CPU);
 	mutex_unlock(&target_lock);
 
-	perf = &target->coord[1];
+	perf = &target->coord[ACCESS_COORDINATE_CPU];
 
 	if (mt_perf_to_adistance(perf, adist))
 		return NOTIFY_OK;
Reviewed-by on v1 1/1
#2 lore raw
In reply to Huang Ying
Quoted 11 lines · Huang Ying

To improve the readability of the code via replacing the magic number "1" with ACCESS_COORDINATE_CPU when appropriate. No functionality change.

Cc Jonathan Cameron <[email protected]>
Cc Dave Jiang <[email protected]>
Cc Dan Williams <[email protected]>
Cc Bharata B Rao <[email protected]>
Cc Alistair Popple <[email protected]>
Cc Aneesh Kumar K.V <[email protected]>

Thanks for this. Looks like I missed a few.

Quoted 35 lines
---
 drivers/acpi/numa/hmat.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)
drivers/acpi/numa/hmat.c +3 -3
index 2c8ccc91ebe6..febd9e51350b 100644
@@ -408,7 +408,7 @@ static __init void hmat_update_target(unsigned int tgt_pxm, unsigned int init_px
 	if (target && target->processor_pxm == init_pxm) {
 		hmat_update_target_access(target, type, value,
 					  ACCESS_COORDINATE_LOCAL);
-		/* If the node has a CPU, update access 1 */
+		/* If the node has a CPU, update access ACCESS_COORDINATE_CPU */
 		if (node_state(pxm_to_node(init_pxm), N_CPU))
 			hmat_update_target_access(target, type, value,
 						  ACCESS_COORDINATE_CPU);
@@ -948,7 +948,7 @@ static int hmat_set_default_dram_perf(void)
 		target = find_mem_target(pxm);
 		if (!target)
 			continue;
-		attrs = &target->coord[1];
+		attrs = &target->coord[ACCESS_COORDINATE_CPU];
 		rc = mt_set_default_dram_perf(nid, attrs, "ACPI HMAT");
 		if (rc)
 			return rc;
@@ -975,7 +975,7 @@ static int hmat_calculate_adistance(struct notifier_block *self,
 	hmat_update_target_attrs(target, p_nodes, ACCESS_COORDINATE_CPU);
 	mutex_unlock(&target_lock);
 
-	perf = &target->coord[1];
+	perf = &target->coord[ACCESS_COORDINATE_CPU];
 
 	if (mt_perf_to_adistance(perf, adist))
 		return NOTIFY_OK;