mirror of https://gitee.com/openkylin/linux.git
perf: xgene: 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: YueHaibing <yuehaibing@huawei.com> Signed-off-by: Will Deacon <will@kernel.org>
This commit is contained in:
parent
42c184ade4
commit
7fdd7f7c33
|
@ -1282,25 +1282,21 @@ static int acpi_pmu_probe_active_mcb_mcu_l3c(struct xgene_pmu *xgene_pmu,
|
||||||
struct platform_device *pdev)
|
struct platform_device *pdev)
|
||||||
{
|
{
|
||||||
void __iomem *csw_csr, *mcba_csr, *mcbb_csr;
|
void __iomem *csw_csr, *mcba_csr, *mcbb_csr;
|
||||||
struct resource *res;
|
|
||||||
unsigned int reg;
|
unsigned int reg;
|
||||||
|
|
||||||
res = platform_get_resource(pdev, IORESOURCE_MEM, 1);
|
csw_csr = devm_platform_ioremap_resource(pdev, 1);
|
||||||
csw_csr = devm_ioremap_resource(&pdev->dev, res);
|
|
||||||
if (IS_ERR(csw_csr)) {
|
if (IS_ERR(csw_csr)) {
|
||||||
dev_err(&pdev->dev, "ioremap failed for CSW CSR resource\n");
|
dev_err(&pdev->dev, "ioremap failed for CSW CSR resource\n");
|
||||||
return PTR_ERR(csw_csr);
|
return PTR_ERR(csw_csr);
|
||||||
}
|
}
|
||||||
|
|
||||||
res = platform_get_resource(pdev, IORESOURCE_MEM, 2);
|
mcba_csr = devm_platform_ioremap_resource(pdev, 2);
|
||||||
mcba_csr = devm_ioremap_resource(&pdev->dev, res);
|
|
||||||
if (IS_ERR(mcba_csr)) {
|
if (IS_ERR(mcba_csr)) {
|
||||||
dev_err(&pdev->dev, "ioremap failed for MCBA CSR resource\n");
|
dev_err(&pdev->dev, "ioremap failed for MCBA CSR resource\n");
|
||||||
return PTR_ERR(mcba_csr);
|
return PTR_ERR(mcba_csr);
|
||||||
}
|
}
|
||||||
|
|
||||||
res = platform_get_resource(pdev, IORESOURCE_MEM, 3);
|
mcbb_csr = devm_platform_ioremap_resource(pdev, 3);
|
||||||
mcbb_csr = devm_ioremap_resource(&pdev->dev, res);
|
|
||||||
if (IS_ERR(mcbb_csr)) {
|
if (IS_ERR(mcbb_csr)) {
|
||||||
dev_err(&pdev->dev, "ioremap failed for MCBB CSR resource\n");
|
dev_err(&pdev->dev, "ioremap failed for MCBB CSR resource\n");
|
||||||
return PTR_ERR(mcbb_csr);
|
return PTR_ERR(mcbb_csr);
|
||||||
|
@ -1332,13 +1328,11 @@ static int acpi_pmu_v3_probe_active_mcb_mcu_l3c(struct xgene_pmu *xgene_pmu,
|
||||||
struct platform_device *pdev)
|
struct platform_device *pdev)
|
||||||
{
|
{
|
||||||
void __iomem *csw_csr;
|
void __iomem *csw_csr;
|
||||||
struct resource *res;
|
|
||||||
unsigned int reg;
|
unsigned int reg;
|
||||||
u32 mcb0routing;
|
u32 mcb0routing;
|
||||||
u32 mcb1routing;
|
u32 mcb1routing;
|
||||||
|
|
||||||
res = platform_get_resource(pdev, IORESOURCE_MEM, 1);
|
csw_csr = devm_platform_ioremap_resource(pdev, 1);
|
||||||
csw_csr = devm_ioremap_resource(&pdev->dev, res);
|
|
||||||
if (IS_ERR(csw_csr)) {
|
if (IS_ERR(csw_csr)) {
|
||||||
dev_err(&pdev->dev, "ioremap failed for CSW CSR resource\n");
|
dev_err(&pdev->dev, "ioremap failed for CSW CSR resource\n");
|
||||||
return PTR_ERR(csw_csr);
|
return PTR_ERR(csw_csr);
|
||||||
|
|
Loading…
Reference in New Issue