Skip to content

Commit e8db070

Browse files
Robert Richterdjbw
authored andcommitted
cxl/core/regs: Rework cxl_map_pmu_regs() to use map->dev for devm
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>
1 parent d3970f0 commit e8db070

File tree

3 files changed

+4
-6
lines changed

3 files changed

+4
-6
lines changed

drivers/cxl/core/regs.c

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -386,10 +386,9 @@ int cxl_count_regblock(struct pci_dev *pdev, enum cxl_regloc_type type)
386386
}
387387
EXPORT_SYMBOL_NS_GPL(cxl_count_regblock, CXL);
388388

389-
int cxl_map_pmu_regs(struct pci_dev *pdev, struct cxl_pmu_regs *regs,
390-
struct cxl_register_map *map)
389+
int cxl_map_pmu_regs(struct cxl_register_map *map, struct cxl_pmu_regs *regs)
391390
{
392-
struct device *dev = &pdev->dev;
391+
struct device *dev = map->host;
393392
resource_size_t phys_addr;
394393

395394
phys_addr = map->resource;

drivers/cxl/cxl.h

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -286,8 +286,7 @@ int cxl_map_component_regs(const struct cxl_register_map *map,
286286
unsigned long map_mask);
287287
int cxl_map_device_regs(const struct cxl_register_map *map,
288288
struct cxl_device_regs *regs);
289-
int cxl_map_pmu_regs(struct pci_dev *pdev, struct cxl_pmu_regs *regs,
290-
struct cxl_register_map *map);
289+
int cxl_map_pmu_regs(struct cxl_register_map *map, struct cxl_pmu_regs *regs);
291290

292291
enum cxl_regloc_type;
293292
int cxl_count_regblock(struct pci_dev *pdev, enum cxl_regloc_type type);

drivers/cxl/pci.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -898,7 +898,7 @@ static int cxl_pci_probe(struct pci_dev *pdev, const struct pci_device_id *id)
898898
break;
899899
}
900900

901-
rc = cxl_map_pmu_regs(pdev, &pmu_regs, &map);
901+
rc = cxl_map_pmu_regs(&map, &pmu_regs);
902902
if (rc) {
903903
dev_dbg(&pdev->dev, "Could not map PMU regs\n");
904904
break;

0 commit comments

Comments
 (0)