diff options
author | Andy Shevchenko <andriy.shevchenko@linux.intel.com> | 2019-10-21 12:24:43 +0300 |
---|---|---|
committer | Andy Shevchenko <andriy.shevchenko@linux.intel.com> | 2019-10-27 02:10:57 +0300 |
commit | ba367730ffe90706e3aaacd6aa4da763f4599bdc (patch) | |
tree | 9b2fe7769536e030efdcc80687d64c48373b4389 /drivers/platform/x86 | |
parent | 16c6c057175cbdcdc6c1251bbce90264a5380240 (diff) | |
download | linux-ba367730ffe90706e3aaacd6aa4da763f4599bdc.tar.bz2 |
platform/x86: intel_punit_ipc: use devm_platform_ioremap_resource() to simplify code
Use devm_platform_ioremap_resource() to simplify the code a bit.
Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Diffstat (limited to 'drivers/platform/x86')
-rw-r--r-- | drivers/platform/x86/intel_punit_ipc.c | 43 |
1 files changed, 14 insertions, 29 deletions
diff --git a/drivers/platform/x86/intel_punit_ipc.c b/drivers/platform/x86/intel_punit_ipc.c index fa97834fdb78..fe49a97d64ef 100644 --- a/drivers/platform/x86/intel_punit_ipc.c +++ b/drivers/platform/x86/intel_punit_ipc.c @@ -224,7 +224,6 @@ static irqreturn_t intel_punit_ioc(int irq, void *dev_id) static int intel_punit_get_bars(struct platform_device *pdev) { - struct resource *res; void __iomem *addr; /* @@ -232,14 +231,12 @@ static int intel_punit_get_bars(struct platform_device *pdev) * - BIOS_IPC BASE_DATA * - BIOS_IPC BASE_IFACE */ - res = platform_get_resource(pdev, IORESOURCE_MEM, 0); - addr = devm_ioremap_resource(&pdev->dev, res); + addr = devm_platform_ioremap_resource(pdev, 0); if (IS_ERR(addr)) return PTR_ERR(addr); punit_ipcdev->base[BIOS_IPC][BASE_DATA] = addr; - res = platform_get_resource(pdev, IORESOURCE_MEM, 1); - addr = devm_ioremap_resource(&pdev->dev, res); + addr = devm_platform_ioremap_resource(pdev, 1); if (IS_ERR(addr)) return PTR_ERR(addr); punit_ipcdev->base[BIOS_IPC][BASE_IFACE] = addr; @@ -251,33 +248,21 @@ static int intel_punit_get_bars(struct platform_device *pdev) * - GTDRIVER_IPC BASE_DATA * - GTDRIVER_IPC BASE_IFACE */ - res = platform_get_resource(pdev, IORESOURCE_MEM, 2); - if (res) { - addr = devm_ioremap_resource(&pdev->dev, res); - if (!IS_ERR(addr)) - punit_ipcdev->base[ISPDRIVER_IPC][BASE_DATA] = addr; - } + addr = devm_platform_ioremap_resource(pdev, 2); + if (!IS_ERR(addr)) + punit_ipcdev->base[ISPDRIVER_IPC][BASE_DATA] = addr; - res = platform_get_resource(pdev, IORESOURCE_MEM, 3); - if (res) { - addr = devm_ioremap_resource(&pdev->dev, res); - if (!IS_ERR(addr)) - punit_ipcdev->base[ISPDRIVER_IPC][BASE_IFACE] = addr; - } + addr = devm_platform_ioremap_resource(pdev, 3); + if (!IS_ERR(addr)) + punit_ipcdev->base[ISPDRIVER_IPC][BASE_IFACE] = addr; - res = platform_get_resource(pdev, IORESOURCE_MEM, 4); - if (res) { - addr = devm_ioremap_resource(&pdev->dev, res); - if (!IS_ERR(addr)) - punit_ipcdev->base[GTDRIVER_IPC][BASE_DATA] = addr; - } + addr = devm_platform_ioremap_resource(pdev, 4); + if (!IS_ERR(addr)) + punit_ipcdev->base[GTDRIVER_IPC][BASE_DATA] = addr; - res = platform_get_resource(pdev, IORESOURCE_MEM, 5); - if (res) { - addr = devm_ioremap_resource(&pdev->dev, res); - if (!IS_ERR(addr)) - punit_ipcdev->base[GTDRIVER_IPC][BASE_IFACE] = addr; - } + addr = devm_platform_ioremap_resource(pdev, 5); + if (!IS_ERR(addr)) + punit_ipcdev->base[GTDRIVER_IPC][BASE_IFACE] = addr; return 0; } |