Linux CXL
 help / color / mirror / Atom feed
* [PATCH] cxl: update var names for interleave ways conversion macros
@ 2022-10-11 21:43 Dave Jiang
  2022-10-12  1:15 ` Alison Schofield
  2022-10-12  1:18 ` Alison Schofield
  0 siblings, 2 replies; 6+ messages in thread
From: Dave Jiang @ 2022-10-11 21:43 UTC (permalink / raw)
  To: linux-cxl; +Cc: dan.j.williams, ira.weiny, vishal.l.verma, alison.schofield

Change var names for interleave ways macros to clearly indicate which
variable is encoded and which is the actual ways value.

iw == interleave ways
eniw == encoded interleave ways

Signed-off-by: Dave Jiang <dave.jiang@intel.com>
---
 drivers/cxl/cxl.h |   22 +++++++++++-----------
 1 file changed, 11 insertions(+), 11 deletions(-)

diff --git a/drivers/cxl/cxl.h b/drivers/cxl/cxl.h
index 7a4f740d710c..c0d826084465 100644
--- a/drivers/cxl/cxl.h
+++ b/drivers/cxl/cxl.h
@@ -78,14 +78,14 @@ static inline int cxl_to_granularity(u16 enig, unsigned int *ig)
 }
 
 /* Encode defined in CXL ECN "3, 6, 12 and 16-way memory Interleaving" */
-static inline int cxl_to_ways(u8 eniw, unsigned int *val)
+static inline int cxl_to_ways(u8 eniw, unsigned int *iw)
 {
 	switch (eniw) {
 	case 0 ... 4:
-		*val = 1 << eniw;
+		*iw = 1 << eniw;
 		break;
 	case 8 ... 10:
-		*val = 3 << (eniw - 8);
+		*iw = 3 << (eniw - 8);
 		break;
 	default:
 		return -EINVAL;
@@ -102,20 +102,20 @@ static inline int granularity_to_cxl(int ig, u16 *enig)
 	return 0;
 }
 
-static inline int ways_to_cxl(unsigned int ways, u8 *iw)
+static inline int ways_to_cxl(unsigned int iw, u8 *eniw)
 {
-	if (ways > 16)
+	if (iw > 16)
 		return -EINVAL;
-	if (is_power_of_2(ways)) {
-		*iw = ilog2(ways);
+	if (is_power_of_2(iw)) {
+		*eniw = ilog2(iw);
 		return 0;
 	}
-	if (ways % 3)
+	if (iw % 3)
 		return -EINVAL;
-	ways /= 3;
-	if (!is_power_of_2(ways))
+	iw /= 3;
+	if (!is_power_of_2(iw))
 		return -EINVAL;
-	*iw = ilog2(ways) + 8;
+	*eniw = ilog2(iw) + 8;
 	return 0;
 }
 



^ permalink raw reply related	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2022-10-12 15:47 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2022-10-11 21:43 [PATCH] cxl: update var names for interleave ways conversion macros Dave Jiang
2022-10-12  1:15 ` Alison Schofield
2022-10-12 15:47   ` Dave Jiang
2022-10-12  1:18 ` Alison Schofield
2022-10-12 12:45   ` Jonathan Cameron
2022-10-12 15:47   ` Dave Jiang

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox