diff mbox series

[v11,20/20] cxl/core/regs: Rework cxl_map_pmu_regs() to use map->dev for devm

Message ID 20230927154339.1600738-21-rrichter@amd.com
State Superseded
Headers show
Series cxl/pci: Add support for RCH RAS error handling | expand

Commit Message

Robert Richter Sept. 27, 2023, 3:43 p.m. UTC
struct cxl_register_map carries a @dev parameter for devm operations.
Simplify the function interface to use that instead of a separate @dev
argument.

Signed-off-by: Terry Bowman <terry.bowman@amd.com>
Signed-off-by: Robert Richter <rrichter@amd.com>
---
 drivers/cxl/core/regs.c | 5 ++---
 drivers/cxl/cxl.h       | 3 +--
 drivers/cxl/pci.c       | 2 +-
 3 files changed, 4 insertions(+), 6 deletions(-)

Comments

Jonathan Cameron Oct. 2, 2023, 3:01 p.m. UTC | #1
On Wed, 27 Sep 2023 17:43:39 +0200
Robert Richter <rrichter@amd.com> wrote:

> struct cxl_register_map carries a @dev parameter for devm operations.
> Simplify the function interface to use that instead of a separate @dev
> argument.
> 
> Signed-off-by: Terry Bowman <terry.bowman@amd.com>
> Signed-off-by: Robert Richter <rrichter@amd.com>
Seems reasonable.

Reviewed-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>

> ---
>  drivers/cxl/core/regs.c | 5 ++---
>  drivers/cxl/cxl.h       | 3 +--
>  drivers/cxl/pci.c       | 2 +-
>  3 files changed, 4 insertions(+), 6 deletions(-)
> 
> diff --git a/drivers/cxl/core/regs.c b/drivers/cxl/core/regs.c
> index 7b56f6f28ab1..b668be617fd7 100644
> --- a/drivers/cxl/core/regs.c
> +++ b/drivers/cxl/core/regs.c
> @@ -386,10 +386,9 @@ int cxl_count_regblock(struct pci_dev *pdev, enum cxl_regloc_type type)
>  }
>  EXPORT_SYMBOL_NS_GPL(cxl_count_regblock, CXL);
>  
> -int cxl_map_pmu_regs(struct pci_dev *pdev, struct cxl_pmu_regs *regs,
> -		     struct cxl_register_map *map)
> +int cxl_map_pmu_regs(struct cxl_register_map *map, struct cxl_pmu_regs *regs)
>  {
> -	struct device *dev = &pdev->dev;
> +	struct device *dev = map->host;
>  	resource_size_t phys_addr;
>  
>  	phys_addr = map->resource;
> diff --git a/drivers/cxl/cxl.h b/drivers/cxl/cxl.h
> index 7c2c195592d6..ed90ca8ed79e 100644
> --- a/drivers/cxl/cxl.h
> +++ b/drivers/cxl/cxl.h
> @@ -286,8 +286,7 @@ int cxl_map_component_regs(const struct cxl_register_map *map,
>  			   unsigned long map_mask);
>  int cxl_map_device_regs(const struct cxl_register_map *map,
>  			struct cxl_device_regs *regs);
> -int cxl_map_pmu_regs(struct pci_dev *pdev, struct cxl_pmu_regs *regs,
> -		     struct cxl_register_map *map);
> +int cxl_map_pmu_regs(struct cxl_register_map *map, struct cxl_pmu_regs *regs);
>  
>  enum cxl_regloc_type;
>  int cxl_count_regblock(struct pci_dev *pdev, enum cxl_regloc_type type);
> diff --git a/drivers/cxl/pci.c b/drivers/cxl/pci.c
> index 037792e941f2..fa94bc61af25 100644
> --- a/drivers/cxl/pci.c
> +++ b/drivers/cxl/pci.c
> @@ -898,7 +898,7 @@ static int cxl_pci_probe(struct pci_dev *pdev, const struct pci_device_id *id)
>  			break;
>  		}
>  
> -		rc = cxl_map_pmu_regs(pdev, &pmu_regs, &map);
> +		rc = cxl_map_pmu_regs(&map, &pmu_regs);
>  		if (rc) {
>  			dev_dbg(&pdev->dev, "Could not map PMU regs\n");
>  			break;
diff mbox series

Patch

diff --git a/drivers/cxl/core/regs.c b/drivers/cxl/core/regs.c
index 7b56f6f28ab1..b668be617fd7 100644
--- a/drivers/cxl/core/regs.c
+++ b/drivers/cxl/core/regs.c
@@ -386,10 +386,9 @@  int cxl_count_regblock(struct pci_dev *pdev, enum cxl_regloc_type type)
 }
 EXPORT_SYMBOL_NS_GPL(cxl_count_regblock, CXL);
 
-int cxl_map_pmu_regs(struct pci_dev *pdev, struct cxl_pmu_regs *regs,
-		     struct cxl_register_map *map)
+int cxl_map_pmu_regs(struct cxl_register_map *map, struct cxl_pmu_regs *regs)
 {
-	struct device *dev = &pdev->dev;
+	struct device *dev = map->host;
 	resource_size_t phys_addr;
 
 	phys_addr = map->resource;
diff --git a/drivers/cxl/cxl.h b/drivers/cxl/cxl.h
index 7c2c195592d6..ed90ca8ed79e 100644
--- a/drivers/cxl/cxl.h
+++ b/drivers/cxl/cxl.h
@@ -286,8 +286,7 @@  int cxl_map_component_regs(const struct cxl_register_map *map,
 			   unsigned long map_mask);
 int cxl_map_device_regs(const struct cxl_register_map *map,
 			struct cxl_device_regs *regs);
-int cxl_map_pmu_regs(struct pci_dev *pdev, struct cxl_pmu_regs *regs,
-		     struct cxl_register_map *map);
+int cxl_map_pmu_regs(struct cxl_register_map *map, struct cxl_pmu_regs *regs);
 
 enum cxl_regloc_type;
 int cxl_count_regblock(struct pci_dev *pdev, enum cxl_regloc_type type);
diff --git a/drivers/cxl/pci.c b/drivers/cxl/pci.c
index 037792e941f2..fa94bc61af25 100644
--- a/drivers/cxl/pci.c
+++ b/drivers/cxl/pci.c
@@ -898,7 +898,7 @@  static int cxl_pci_probe(struct pci_dev *pdev, const struct pci_device_id *id)
 			break;
 		}
 
-		rc = cxl_map_pmu_regs(pdev, &pmu_regs, &map);
+		rc = cxl_map_pmu_regs(&map, &pmu_regs);
 		if (rc) {
 			dev_dbg(&pdev->dev, "Could not map PMU regs\n");
 			break;