diff mbox series

[v4,3/6] cxl: Convert qos_class() to use 'struct cxl_root *' directly

Message ID 170441750038.3632067.659502106120894365.stgit@djiang5-mobl3
State New, archived
Headers show
Series find_cxl_root() related cleanups | expand

Commit Message

Dave Jiang Jan. 5, 2024, 1:18 a.m. UTC
->qos_class() is expected to take a 'struct cxl_root *' instead of a
'struct cxl_port *'. Convert to directly accepting a 'struct cxl_root *'
to ensure that the root port device is passed in.

Signed-off-by: Dave Jiang <dave.jiang@intel.com>
---
 drivers/cxl/acpi.c      |    6 ++----
 drivers/cxl/core/cdat.c |    2 +-
 drivers/cxl/cxl.h       |   12 ++++++------
 3 files changed, 9 insertions(+), 11 deletions(-)

Comments

Dan Williams Jan. 5, 2024, 4:30 a.m. UTC | #1
Dave Jiang wrote:
> ->qos_class() is expected to take a 'struct cxl_root *' instead of a
> 'struct cxl_port *'. Convert to directly accepting a 'struct cxl_root *'
> to ensure that the root port device is passed in.

Ah, disregard my comment on the last patch, you came to the same
conclusion. I just think it belongs with the rest of the find_cxl_root()
type conversion patch.
diff mbox series

Patch

diff --git a/drivers/cxl/acpi.c b/drivers/cxl/acpi.c
index afc712264d1c..dcf2b39e1048 100644
--- a/drivers/cxl/acpi.c
+++ b/drivers/cxl/acpi.c
@@ -295,14 +295,12 @@  cxl_acpi_evaluate_qtg_dsm(acpi_handle handle, struct access_coordinate *coord,
 	return rc;
 }
 
-static int cxl_acpi_qos_class(struct cxl_port *root_port,
+static int cxl_acpi_qos_class(struct cxl_root *cxl_root,
 			      struct access_coordinate *coord, int entries,
 			      int *qos_class)
 {
+	struct device *dev = cxl_root->port.uport_dev;
 	acpi_handle handle;
-	struct device *dev;
-
-	dev = root_port->uport_dev;
 
 	if (!dev_is_platform(dev))
 		return -ENODEV;
diff --git a/drivers/cxl/core/cdat.c b/drivers/cxl/core/cdat.c
index f9bc386f3043..0df5379cf02f 100644
--- a/drivers/cxl/core/cdat.c
+++ b/drivers/cxl/core/cdat.c
@@ -191,7 +191,7 @@  static int cxl_port_perf_data_calculate(struct cxl_port *port,
 						    dent->coord.write_bandwidth);
 
 		dent->entries = 1;
-		rc = cxl_root->ops->qos_class(&cxl_root->port, &dent->coord, 1,
+		rc = cxl_root->ops->qos_class(cxl_root, &dent->coord, 1,
 					      &qos_class);
 		if (rc != 1)
 			continue;
diff --git a/drivers/cxl/cxl.h b/drivers/cxl/cxl.h
index 70d5e6363399..3a5004aab97a 100644
--- a/drivers/cxl/cxl.h
+++ b/drivers/cxl/cxl.h
@@ -617,12 +617,6 @@  struct cxl_port {
 	long pci_latency;
 };
 
-struct cxl_root_ops {
-	int (*qos_class)(struct cxl_port *root_port,
-			 struct access_coordinate *coord, int entries,
-			 int *qos_class);
-};
-
 /**
  * struct cxl_root - logical collection of root cxl_port items
  *
@@ -640,6 +634,12 @@  to_cxl_root(const struct cxl_port *port)
 	return container_of(port, struct cxl_root, port);
 }
 
+struct cxl_root_ops {
+	int (*qos_class)(struct cxl_root *cxl_root,
+			 struct access_coordinate *coord, int entries,
+			 int *qos_class);
+};
+
 static inline struct cxl_dport *
 cxl_find_dport_by_dev(struct cxl_port *port, const struct device *dport_dev)
 {