Message ID | 170476243490.115624.648453218819673314.stgit@djiang5-mobl3 |
---|---|
State | New, archived |
Headers | show |
Series | None | expand |
Dave Jiang wrote: > Remove the local vars that points to the 'struct cxl_port' withint 'struct s/withint/within/ > cxl_root' and refer to the port directly. > > Suggested-by: Robert Richter <rrichter@amd.com> > Signed-off-by: Dave Jiang <dave.jiang@intel.com> > --- > drivers/cxl/core/cdat.c | 13 +++++-------- > drivers/cxl/port.c | 5 +---- > 2 files changed, 6 insertions(+), 12 deletions(-) This one looks ok.
On Mon, 08 Jan 2024 18:07:14 -0700 Dave Jiang <dave.jiang@intel.com> wrote: > Remove the local vars that points to the 'struct cxl_port' withint 'struct > cxl_root' and refer to the port directly. > > Suggested-by: Robert Richter <rrichter@amd.com> > Signed-off-by: Dave Jiang <dave.jiang@intel.com> A comment on existing code inline. Otherwise LGTM Reviewed-by: Jonathan Cameron <Jonathan.Cameron@huawei.com> > --- > drivers/cxl/core/cdat.c | 13 +++++-------- > drivers/cxl/port.c | 5 +---- > 2 files changed, 6 insertions(+), 12 deletions(-) > > diff --git a/drivers/cxl/core/cdat.c b/drivers/cxl/core/cdat.c > index f7ba7bd2e459..140935511bab 100644 > --- a/drivers/cxl/core/cdat.c > +++ b/drivers/cxl/core/cdat.c > @@ -290,7 +290,7 @@ static int match_cxlrd_qos_class(struct device *dev, void *data) > return 0; > } > > -static void cxl_qos_match(struct cxl_port *root_port, > +static void cxl_qos_match(struct cxl_root *cxl_root, > struct list_head *work_list, > struct list_head *discard_list) > { > @@ -302,7 +302,7 @@ static void cxl_qos_match(struct cxl_port *root_port, > if (dpa_perf->qos_class == CXL_QOS_CLASS_INVALID) > return; > > - rc = device_for_each_child(&root_port->dev, > + rc = device_for_each_child(&cxl_root->port.dev, > (void *)&dpa_perf->qos_class, Whilst we are here: Why is the (void *) needed or useful? > match_cxlrd_qos_class); > if (!rc) >
On 1/9/24 08:29, Jonathan Cameron wrote: > On Mon, 08 Jan 2024 18:07:14 -0700 > Dave Jiang <dave.jiang@intel.com> wrote: > >> Remove the local vars that points to the 'struct cxl_port' withint 'struct >> cxl_root' and refer to the port directly. >> >> Suggested-by: Robert Richter <rrichter@amd.com> >> Signed-off-by: Dave Jiang <dave.jiang@intel.com> > A comment on existing code inline. Otherwise LGTM > > Reviewed-by: Jonathan Cameron <Jonathan.Cameron@huawei.com> > >> --- >> drivers/cxl/core/cdat.c | 13 +++++-------- >> drivers/cxl/port.c | 5 +---- >> 2 files changed, 6 insertions(+), 12 deletions(-) >> >> diff --git a/drivers/cxl/core/cdat.c b/drivers/cxl/core/cdat.c >> index f7ba7bd2e459..140935511bab 100644 >> --- a/drivers/cxl/core/cdat.c >> +++ b/drivers/cxl/core/cdat.c >> @@ -290,7 +290,7 @@ static int match_cxlrd_qos_class(struct device *dev, void *data) >> return 0; >> } >> >> -static void cxl_qos_match(struct cxl_port *root_port, >> +static void cxl_qos_match(struct cxl_root *cxl_root, >> struct list_head *work_list, >> struct list_head *discard_list) >> { >> @@ -302,7 +302,7 @@ static void cxl_qos_match(struct cxl_port *root_port, >> if (dpa_perf->qos_class == CXL_QOS_CLASS_INVALID) >> return; >> >> - rc = device_for_each_child(&root_port->dev, >> + rc = device_for_each_child(&cxl_root->port.dev, >> (void *)&dpa_perf->qos_class, > > Whilst we are here: Why is the (void *) needed or useful? It's not. We can remove it. > >> match_cxlrd_qos_class); >> if (!rc) > >> > >
diff --git a/drivers/cxl/core/cdat.c b/drivers/cxl/core/cdat.c index f7ba7bd2e459..140935511bab 100644 --- a/drivers/cxl/core/cdat.c +++ b/drivers/cxl/core/cdat.c @@ -290,7 +290,7 @@ static int match_cxlrd_qos_class(struct device *dev, void *data) return 0; } -static void cxl_qos_match(struct cxl_port *root_port, +static void cxl_qos_match(struct cxl_root *cxl_root, struct list_head *work_list, struct list_head *discard_list) { @@ -302,7 +302,7 @@ static void cxl_qos_match(struct cxl_port *root_port, if (dpa_perf->qos_class == CXL_QOS_CLASS_INVALID) return; - rc = device_for_each_child(&root_port->dev, + rc = device_for_each_child(&cxl_root->port.dev, (void *)&dpa_perf->qos_class, match_cxlrd_qos_class); if (!rc) @@ -348,20 +348,17 @@ static int cxl_qos_class_verify(struct cxl_memdev *cxlmd) struct cxl_memdev_state *mds = to_cxl_memdev_state(cxlds); LIST_HEAD(__discard); struct list_head *discard __free(dpa_perf) = &__discard; - struct cxl_port *root_port; int rc; struct cxl_root *cxl_root __free(put_cxl_root) = find_cxl_root(cxlmd->endpoint); - root_port = &cxl_root->port; - /* Check that the QTG IDs are all sane between end device and root decoders */ - cxl_qos_match(root_port, &mds->ram_perf_list, discard); - cxl_qos_match(root_port, &mds->pmem_perf_list, discard); + cxl_qos_match(cxl_root, &mds->ram_perf_list, discard); + cxl_qos_match(cxl_root, &mds->pmem_perf_list, discard); /* Check to make sure that the device's host bridge is under a root decoder */ - rc = device_for_each_child(&root_port->dev, + rc = device_for_each_child(&cxl_root->port.dev, (void *)cxlmd->endpoint->host_bridge, match_cxlrd_hb); if (!rc) { diff --git a/drivers/cxl/port.c b/drivers/cxl/port.c index 97c21566677a..c054e7b13bdd 100644 --- a/drivers/cxl/port.c +++ b/drivers/cxl/port.c @@ -95,7 +95,6 @@ static int cxl_endpoint_port_probe(struct cxl_port *port) struct cxl_memdev *cxlmd = to_cxl_memdev(port->uport_dev); struct cxl_dev_state *cxlds = cxlmd->cxlds; struct cxl_hdm *cxlhdm; - struct cxl_port *root; int rc; rc = cxl_dvsec_rr_decode(cxlds->dev, cxlds->cxl_dvsec, &info); @@ -132,13 +131,11 @@ static int cxl_endpoint_port_probe(struct cxl_port *port) */ struct cxl_root *cxl_root __free(put_cxl_root) = find_cxl_root(port); - root = &cxl_root->port; - /* * Now that all endpoint decoders are successfully enumerated, try to * assemble regions from committed decoders */ - device_for_each_child(&port->dev, root, discover_region); + device_for_each_child(&port->dev, &cxl_root->port, discover_region); return 0; }
Remove the local vars that points to the 'struct cxl_port' withint 'struct cxl_root' and refer to the port directly. Suggested-by: Robert Richter <rrichter@amd.com> Signed-off-by: Dave Jiang <dave.jiang@intel.com> --- drivers/cxl/core/cdat.c | 13 +++++-------- drivers/cxl/port.c | 5 +---- 2 files changed, 6 insertions(+), 12 deletions(-)