[PATCH v5 08/14] cxl/port: Replace put_cxl_root() by a cleanup helper

Robert Richter posted 14 patches 9 months, 2 weeks ago
There is a newer version of this series
[PATCH v5 08/14] cxl/port: Replace put_cxl_root() by a cleanup helper
Posted by Robert Richter 9 months, 2 weeks ago
Function put_cxl_root() is only used by its cleanup helper. Remove the
function entirely and only use the helper.

Signed-off-by: Robert Richter <rrichter@amd.com>
---
 drivers/cxl/core/port.c | 9 ---------
 drivers/cxl/cxl.h       | 4 ++--
 2 files changed, 2 insertions(+), 11 deletions(-)

diff --git a/drivers/cxl/core/port.c b/drivers/cxl/core/port.c
index c9087515d743..e325f08aaf32 100644
--- a/drivers/cxl/core/port.c
+++ b/drivers/cxl/core/port.c
@@ -1037,15 +1037,6 @@ struct cxl_root *find_cxl_root(struct cxl_port *port)
 }
 EXPORT_SYMBOL_NS_GPL(find_cxl_root, "CXL");
 
-void put_cxl_root(struct cxl_root *cxl_root)
-{
-	if (!cxl_root)
-		return;
-
-	put_device(&cxl_root->port.dev);
-}
-EXPORT_SYMBOL_NS_GPL(put_cxl_root, "CXL");
-
 static struct cxl_dport *find_dport(struct cxl_port *port, int id)
 {
 	struct cxl_dport *dport;
diff --git a/drivers/cxl/cxl.h b/drivers/cxl/cxl.h
index 960efcc60476..ea06850ecaea 100644
--- a/drivers/cxl/cxl.h
+++ b/drivers/cxl/cxl.h
@@ -737,10 +737,10 @@ struct cxl_port *devm_cxl_add_port(struct device *host,
 struct cxl_root *devm_cxl_add_root(struct device *host,
 				   const struct cxl_root_ops *ops);
 struct cxl_root *find_cxl_root(struct cxl_port *port);
-void put_cxl_root(struct cxl_root *cxl_root);
-DEFINE_FREE(put_cxl_root, struct cxl_root *, if (_T) put_cxl_root(_T))
 
+DEFINE_FREE(put_cxl_root, struct cxl_root *, if (_T) put_device(&_T->port.dev))
 DEFINE_FREE(put_cxl_port, struct cxl_port *, if (!IS_ERR_OR_NULL(_T)) put_device(&_T->dev))
+
 int devm_cxl_enumerate_ports(struct cxl_memdev *cxlmd);
 void cxl_bus_rescan(void);
 void cxl_bus_drain(void);
-- 
2.39.5
Re: [PATCH v5 08/14] cxl/port: Replace put_cxl_root() by a cleanup helper
Posted by Jonathan Cameron 9 months, 2 weeks ago
On Mon, 28 Apr 2025 23:43:11 +0200
Robert Richter <rrichter@amd.com> wrote:

> Function put_cxl_root() is only used by its cleanup helper. Remove the
> function entirely and only use the helper.
> 
> Signed-off-by: Robert Richter <rrichter@amd.com>
Oops. I had a bonus space, but missed the cancel button
Reviewed-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
Re: [PATCH v5 08/14] cxl/port: Replace put_cxl_root() by a cleanup helper
Posted by Jonathan Cameron 9 months, 2 weeks ago
On Mon, 28 Apr 2025 23:43:11 +0200
Robert Richter <rrichter@amd.com> wrote:

> Function put_cxl_root() is only used by its cleanup helper. Remove the
> function entirely and only use the helper.
> 
> Signed-off-by: Robert Richter <rrichter@amd.com>
Reviewed-by: Jonathan Cameron < Jonathan.Cameron@huawei.com>
Re: [PATCH v5 08/14] cxl/port: Replace put_cxl_root() by a cleanup helper
Posted by Dave Jiang 9 months, 2 weeks ago

On 4/28/25 2:43 PM, Robert Richter wrote:
> Function put_cxl_root() is only used by its cleanup helper. Remove the
> function entirely and only use the helper.
> 
> Signed-off-by: Robert Richter <rrichter@amd.com>

Reviewed-by: Dave Jiang <dave.jiang@intel.com>
> ---
>  drivers/cxl/core/port.c | 9 ---------
>  drivers/cxl/cxl.h       | 4 ++--
>  2 files changed, 2 insertions(+), 11 deletions(-)
> 
> diff --git a/drivers/cxl/core/port.c b/drivers/cxl/core/port.c
> index c9087515d743..e325f08aaf32 100644
> --- a/drivers/cxl/core/port.c
> +++ b/drivers/cxl/core/port.c
> @@ -1037,15 +1037,6 @@ struct cxl_root *find_cxl_root(struct cxl_port *port)
>  }
>  EXPORT_SYMBOL_NS_GPL(find_cxl_root, "CXL");
>  
> -void put_cxl_root(struct cxl_root *cxl_root)
> -{
> -	if (!cxl_root)
> -		return;
> -
> -	put_device(&cxl_root->port.dev);
> -}
> -EXPORT_SYMBOL_NS_GPL(put_cxl_root, "CXL");
> -
>  static struct cxl_dport *find_dport(struct cxl_port *port, int id)
>  {
>  	struct cxl_dport *dport;
> diff --git a/drivers/cxl/cxl.h b/drivers/cxl/cxl.h
> index 960efcc60476..ea06850ecaea 100644
> --- a/drivers/cxl/cxl.h
> +++ b/drivers/cxl/cxl.h
> @@ -737,10 +737,10 @@ struct cxl_port *devm_cxl_add_port(struct device *host,
>  struct cxl_root *devm_cxl_add_root(struct device *host,
>  				   const struct cxl_root_ops *ops);
>  struct cxl_root *find_cxl_root(struct cxl_port *port);
> -void put_cxl_root(struct cxl_root *cxl_root);
> -DEFINE_FREE(put_cxl_root, struct cxl_root *, if (_T) put_cxl_root(_T))
>  
> +DEFINE_FREE(put_cxl_root, struct cxl_root *, if (_T) put_device(&_T->port.dev))
>  DEFINE_FREE(put_cxl_port, struct cxl_port *, if (!IS_ERR_OR_NULL(_T)) put_device(&_T->dev))
> +
>  int devm_cxl_enumerate_ports(struct cxl_memdev *cxlmd);
>  void cxl_bus_rescan(void);
>  void cxl_bus_drain(void);
Re: [PATCH v5 08/14] cxl/port: Replace put_cxl_root() by a cleanup helper
Posted by Gregory Price 9 months, 2 weeks ago
On Mon, Apr 28, 2025 at 11:43:11PM +0200, Robert Richter wrote:
> Function put_cxl_root() is only used by its cleanup helper. Remove the
> function entirely and only use the helper.
> 
> Signed-off-by: Robert Richter <rrichter@amd.com>

Reviewed-by: Gregory Price <gourry@gourry.net>
Re: [PATCH v5 08/14] cxl/port: Replace put_cxl_root() by a cleanup helper
Posted by Fabio M. De Francesco 9 months, 1 week ago
On Monday, April 28, 2025 11:43:11 PM Central European Summer Time Robert Richter wrote:
> Function put_cxl_root() is only used by its cleanup helper. Remove the
> function entirely and only use the helper.
> 
> Signed-off-by: Robert Richter <rrichter@amd.com>

Reviewed-by: Fabio M. De Francesco <fabio.m.de.francesco@linux.intel.com>

> ---
>  drivers/cxl/core/port.c | 9 ---------
>  drivers/cxl/cxl.h       | 4 ++--
>  2 files changed, 2 insertions(+), 11 deletions(-)
> 
> diff --git a/drivers/cxl/core/port.c b/drivers/cxl/core/port.c
> index c9087515d743..e325f08aaf32 100644
> --- a/drivers/cxl/core/port.c
> +++ b/drivers/cxl/core/port.c
> @@ -1037,15 +1037,6 @@ struct cxl_root *find_cxl_root(struct cxl_port *port)
>  }
>  EXPORT_SYMBOL_NS_GPL(find_cxl_root, "CXL");
>  
> -void put_cxl_root(struct cxl_root *cxl_root)
> -{
> -	if (!cxl_root)
> -		return;
> -
> -	put_device(&cxl_root->port.dev);
> -}
> -EXPORT_SYMBOL_NS_GPL(put_cxl_root, "CXL");
> -
>  static struct cxl_dport *find_dport(struct cxl_port *port, int id)
>  {
>  	struct cxl_dport *dport;
> diff --git a/drivers/cxl/cxl.h b/drivers/cxl/cxl.h
> index 960efcc60476..ea06850ecaea 100644
> --- a/drivers/cxl/cxl.h
> +++ b/drivers/cxl/cxl.h
> @@ -737,10 +737,10 @@ struct cxl_port *devm_cxl_add_port(struct device *host,
>  struct cxl_root *devm_cxl_add_root(struct device *host,
>  				   const struct cxl_root_ops *ops);
>  struct cxl_root *find_cxl_root(struct cxl_port *port);
> -void put_cxl_root(struct cxl_root *cxl_root);
> -DEFINE_FREE(put_cxl_root, struct cxl_root *, if (_T) put_cxl_root(_T))
>  
> +DEFINE_FREE(put_cxl_root, struct cxl_root *, if (_T) put_device(&_T->port.dev))
>  DEFINE_FREE(put_cxl_port, struct cxl_port *, if (!IS_ERR_OR_NULL(_T)) put_device(&_T->dev))
> +
>  int devm_cxl_enumerate_ports(struct cxl_memdev *cxlmd);
>  void cxl_bus_rescan(void);
>  void cxl_bus_drain(void);
>