cxl/core/regs: Rework cxl_map_pmu_regs() to use map->dev for devm
authorRobert Richter <rrichter@amd.com>
Wed, 18 Oct 2023 17:17:13 +0000 (19:17 +0200)
committerDan Williams <dan.j.williams@intel.com>
Sat, 28 Oct 2023 03:13:39 +0000 (20:13 -0700)
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>
Reviewed-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
Link: https://lore.kernel.org/r/20231018171713.1883517-21-rrichter@amd.com
Signed-off-by: Dan Williams <dan.j.williams@intel.com>
drivers/cxl/core/regs.c
drivers/cxl/cxl.h
drivers/cxl/pci.c

index cac28a656cb86c8b1a5bc7f43f4335a22b0571b7..372786f809555f66509186c3e3476af2fad0d7f8 100644 (file)
@@ -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;
index 3b09286d9d526b8a081ffc5d9ecaa4c6451046fa..378fc96ff7ff603d10a316f69ee2dcf77ae74a10 100644 (file)
@@ -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);
index 037792e941f2c8a992548c1b838023d91e8a3e9a..fa94bc61af25b58c0d0c880520188c6cc4c22d1c 100644 (file)
@@ -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;