Commit 42c184ad authored by YueHaibing's avatar YueHaibing Committed by Will Deacon

perf: hisi: use devm_platform_ioremap_resource() to simplify code

Use devm_platform_ioremap_resource() to simplify the code a bit.
This is detected by coccinelle.
Signed-off-by: default avatarYueHaibing <yuehaibing@huawei.com>
Signed-off-by: default avatarWill Deacon <will@kernel.org>
parent 54ecb8f7
...@@ -243,8 +243,6 @@ MODULE_DEVICE_TABLE(acpi, hisi_ddrc_pmu_acpi_match); ...@@ -243,8 +243,6 @@ MODULE_DEVICE_TABLE(acpi, hisi_ddrc_pmu_acpi_match);
static int hisi_ddrc_pmu_init_data(struct platform_device *pdev, static int hisi_ddrc_pmu_init_data(struct platform_device *pdev,
struct hisi_pmu *ddrc_pmu) struct hisi_pmu *ddrc_pmu)
{ {
struct resource *res;
/* /*
* Use the SCCL_ID and DDRC channel ID to identify the * Use the SCCL_ID and DDRC channel ID to identify the
* DDRC PMU, while SCCL_ID is in MPIDR[aff2]. * DDRC PMU, while SCCL_ID is in MPIDR[aff2].
...@@ -263,8 +261,7 @@ static int hisi_ddrc_pmu_init_data(struct platform_device *pdev, ...@@ -263,8 +261,7 @@ static int hisi_ddrc_pmu_init_data(struct platform_device *pdev,
/* DDRC PMUs only share the same SCCL */ /* DDRC PMUs only share the same SCCL */
ddrc_pmu->ccl_id = -1; ddrc_pmu->ccl_id = -1;
res = platform_get_resource(pdev, IORESOURCE_MEM, 0); ddrc_pmu->base = devm_platform_ioremap_resource(pdev, 0);
ddrc_pmu->base = devm_ioremap_resource(&pdev->dev, res);
if (IS_ERR(ddrc_pmu->base)) { if (IS_ERR(ddrc_pmu->base)) {
dev_err(&pdev->dev, "ioremap failed for ddrc_pmu resource\n"); dev_err(&pdev->dev, "ioremap failed for ddrc_pmu resource\n");
return PTR_ERR(ddrc_pmu->base); return PTR_ERR(ddrc_pmu->base);
......
...@@ -234,7 +234,6 @@ static int hisi_hha_pmu_init_data(struct platform_device *pdev, ...@@ -234,7 +234,6 @@ static int hisi_hha_pmu_init_data(struct platform_device *pdev,
struct hisi_pmu *hha_pmu) struct hisi_pmu *hha_pmu)
{ {
unsigned long long id; unsigned long long id;
struct resource *res;
acpi_status status; acpi_status status;
status = acpi_evaluate_integer(ACPI_HANDLE(&pdev->dev), status = acpi_evaluate_integer(ACPI_HANDLE(&pdev->dev),
...@@ -256,8 +255,7 @@ static int hisi_hha_pmu_init_data(struct platform_device *pdev, ...@@ -256,8 +255,7 @@ static int hisi_hha_pmu_init_data(struct platform_device *pdev,
/* HHA PMUs only share the same SCCL */ /* HHA PMUs only share the same SCCL */
hha_pmu->ccl_id = -1; hha_pmu->ccl_id = -1;
res = platform_get_resource(pdev, IORESOURCE_MEM, 0); hha_pmu->base = devm_platform_ioremap_resource(pdev, 0);
hha_pmu->base = devm_ioremap_resource(&pdev->dev, res);
if (IS_ERR(hha_pmu->base)) { if (IS_ERR(hha_pmu->base)) {
dev_err(&pdev->dev, "ioremap failed for hha_pmu resource\n"); dev_err(&pdev->dev, "ioremap failed for hha_pmu resource\n");
return PTR_ERR(hha_pmu->base); return PTR_ERR(hha_pmu->base);
......
...@@ -233,7 +233,6 @@ static int hisi_l3c_pmu_init_data(struct platform_device *pdev, ...@@ -233,7 +233,6 @@ static int hisi_l3c_pmu_init_data(struct platform_device *pdev,
struct hisi_pmu *l3c_pmu) struct hisi_pmu *l3c_pmu)
{ {
unsigned long long id; unsigned long long id;
struct resource *res;
acpi_status status; acpi_status status;
status = acpi_evaluate_integer(ACPI_HANDLE(&pdev->dev), status = acpi_evaluate_integer(ACPI_HANDLE(&pdev->dev),
...@@ -259,8 +258,7 @@ static int hisi_l3c_pmu_init_data(struct platform_device *pdev, ...@@ -259,8 +258,7 @@ static int hisi_l3c_pmu_init_data(struct platform_device *pdev,
return -EINVAL; return -EINVAL;
} }
res = platform_get_resource(pdev, IORESOURCE_MEM, 0); l3c_pmu->base = devm_platform_ioremap_resource(pdev, 0);
l3c_pmu->base = devm_ioremap_resource(&pdev->dev, res);
if (IS_ERR(l3c_pmu->base)) { if (IS_ERR(l3c_pmu->base)) {
dev_err(&pdev->dev, "ioremap failed for l3c_pmu resource\n"); dev_err(&pdev->dev, "ioremap failed for l3c_pmu resource\n");
return PTR_ERR(l3c_pmu->base); return PTR_ERR(l3c_pmu->base);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment