thermal/drivers/tegra: Use devm_platform_ioremap_resource_byname

Use the devm_platform_ioremap_resource_byname() helper instead of
calling platform_get_resource_byname() and devm_ioremap_resource()
separately.

Signed-off-by: dingsenjie <dingsenjie@yulong.com>
Signed-off-by: Daniel Lezcano <daniel.lezcano@linaro.org>
Link: https://lore.kernel.org/r/20210414063943.96244-1-dingsenjie@163.com
This commit is contained in:
dingsenjie 2021-04-14 14:39:43 +08:00 коммит произвёл Daniel Lezcano
Родитель beaa41029f
Коммит fc88f7ad76
1 изменённых файлов: 3 добавлений и 10 удалений

Просмотреть файл

@ -2118,7 +2118,6 @@ static int tegra_soctherm_probe(struct platform_device *pdev)
struct tegra_soctherm *tegra; struct tegra_soctherm *tegra;
struct thermal_zone_device *z; struct thermal_zone_device *z;
struct tsensor_shared_calib shared_calib; struct tsensor_shared_calib shared_calib;
struct resource *res;
struct tegra_soctherm_soc *soc; struct tegra_soctherm_soc *soc;
unsigned int i; unsigned int i;
int err; int err;
@ -2140,26 +2139,20 @@ static int tegra_soctherm_probe(struct platform_device *pdev)
tegra->soc = soc; tegra->soc = soc;
res = platform_get_resource_byname(pdev, IORESOURCE_MEM, tegra->regs = devm_platform_ioremap_resource_byname(pdev, "soctherm-reg");
"soctherm-reg");
tegra->regs = devm_ioremap_resource(&pdev->dev, res);
if (IS_ERR(tegra->regs)) { if (IS_ERR(tegra->regs)) {
dev_err(&pdev->dev, "can't get soctherm registers"); dev_err(&pdev->dev, "can't get soctherm registers");
return PTR_ERR(tegra->regs); return PTR_ERR(tegra->regs);
} }
if (!tegra->soc->use_ccroc) { if (!tegra->soc->use_ccroc) {
res = platform_get_resource_byname(pdev, IORESOURCE_MEM, tegra->clk_regs = devm_platform_ioremap_resource_byname(pdev, "car-reg");
"car-reg");
tegra->clk_regs = devm_ioremap_resource(&pdev->dev, res);
if (IS_ERR(tegra->clk_regs)) { if (IS_ERR(tegra->clk_regs)) {
dev_err(&pdev->dev, "can't get car clk registers"); dev_err(&pdev->dev, "can't get car clk registers");
return PTR_ERR(tegra->clk_regs); return PTR_ERR(tegra->clk_regs);
} }
} else { } else {
res = platform_get_resource_byname(pdev, IORESOURCE_MEM, tegra->ccroc_regs = devm_platform_ioremap_resource_byname(pdev, "ccroc-reg");
"ccroc-reg");
tegra->ccroc_regs = devm_ioremap_resource(&pdev->dev, res);
if (IS_ERR(tegra->ccroc_regs)) { if (IS_ERR(tegra->ccroc_regs)) {
dev_err(&pdev->dev, "can't get ccroc registers"); dev_err(&pdev->dev, "can't get ccroc registers");
return PTR_ERR(tegra->ccroc_regs); return PTR_ERR(tegra->ccroc_regs);