Received: by 2002:ac0:946b:0:0:0:0:0 with SMTP id j40csp2754018imj; Mon, 18 Feb 2019 11:33:25 -0800 (PST) X-Google-Smtp-Source: AHgI3Ia9yrOU+I0rDESQhnXC0xMdBs/k1MMv7hMXEAUd8AIVjNGw8m9zM08384uy4ppdHofxL4a2 X-Received: by 2002:a65:64c8:: with SMTP id t8mr20161365pgv.31.1550518405152; Mon, 18 Feb 2019 11:33:25 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1550518405; cv=none; d=google.com; s=arc-20160816; b=NCqZsoqTaoBxERGA3ECLUo1k9K1EuJSfLkQZk0Bg2aI0Ug8EXI7pkrb+kZDbInj8oZ olKO+xlBhgCJUNuOKMS0uMpa807PmfTVP3FdAcCSKAj44JVIqYfAcBkGtz4swMxQONYT 13CiGMCgpmjvc/3XTNTeiwlMm10lMmVPsrsSYgHz+Xdi5SYLiBrwe21RFRj+vBI+vgci cFnl75wUJ0XFVEF7M+qunHNa+BqQTa5DjPttZ7TMJPUFve1mwy4pnSU4vsx035Su15LH uiVc7Vwx1zu5I2A7eDKOttiuoi+Mg/76kiwDvceQ+S292GZJZ9IpfLWK8vn7uCuEBesb uhiA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=DeiicEMgTNNDXmv9VFBWv0NLs52ELmzeLlmAN97MkhY=; b=t/pIWfVZQ5sOVXuJFi22f57G3lkgRvmbUeKUyNSGjIsNYkrO5AUyABFlDny1a55Agu Jmy7Mpz1xijiab+ZYrq/yS1Y1pGNqEIskSundRunkBmMycMIZMVQmqZvUya4KwWu/8YM 7JjCeAyT7E1YnFcaeEIYCfHRB2ryz7vfPndGHxdOMDXcyVNT8UpIKEGiTQbt5pHwb8dn NvqSPoH0Sru/fUeEDjh2qQd3V4RFGy21Lp7lX1qthamQhRDipV+ZcZVLY8fXHFqZqW5X 4bJQFz6VAHTjaraC7Lmgbendj+escIOp0VXgB5G3fQPIjPY5JRRX6a6UwlgDjE93t9B0 Syww== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=fjNKfqqj; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id 67si14159296pgc.312.2019.02.18.11.33.05; Mon, 18 Feb 2019 11:33:25 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=fjNKfqqj; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728644AbfBRTMK (ORCPT + 99 others); Mon, 18 Feb 2019 14:12:10 -0500 Received: from mail-pg1-f182.google.com ([209.85.215.182]:33508 "EHLO mail-pg1-f182.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728465AbfBRTMI (ORCPT ); Mon, 18 Feb 2019 14:12:08 -0500 Received: by mail-pg1-f182.google.com with SMTP id h11so6560018pgl.0; Mon, 18 Feb 2019 11:12:07 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=DeiicEMgTNNDXmv9VFBWv0NLs52ELmzeLlmAN97MkhY=; b=fjNKfqqj/FzICc/YOAr9PB8rRoEk/c1KFLlRAYyd62uhV7u4JKnM6mBSDycEwGM87W UArXN2i5yxjtcVv5zC+oOWPlOLxg+jwWo1tVGfKwGu0SzN0aX9N2fGISr+Q8txd27F7G c/JRi/+UUf2q2pngdbZ7JHpmX4AiS2RzEVwnxyDmwxMwPxvKE3qdmbrfjVVSFFxfZpR+ HjAVwBJTMrycS05qvNvIlc2m4H7fvrQlo4hhjpLMsZjgXTRH1p7/lOrwCS6oTxSKZU2G Foon8YlAqo+VnET5x+0WMU8iETmv4cbqcGIXv1xPnIJpjiXpyg0DDZUIU0Jc/nqSu/qL AcEw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=DeiicEMgTNNDXmv9VFBWv0NLs52ELmzeLlmAN97MkhY=; b=kjlAD6m/sVNONl8FVWTjv5LaZjxpyG+DLK2NPJDh2l56ejmjr6rdj37KTNGurE3hzV dO+SHtIssno1fuAVscs8b7OtTdz3xSaSebQyCvgQB09t07ZectKcKPGxjK8CKidZyRpj mREmI7tu9ZMwzyYgZbU3A9a393XHz8TX8m/AJx+s3isu2myz0S9OySoi9R4t3vqxiNLi AAAgmCHZvwF2rTu9SaDUdBlvp6UbCqvDirJs73KiD0+V1Sr8xSrqvm3kJG3DewVypyx9 td154uyV4h3PnRUMJsUyVLwKafIDEvWyH5f+FjPA293Mk6ceYTygx1MFR5GQIPa94d1H ZT5w== X-Gm-Message-State: AHQUAuZxR1+G027/nlVAC9jK8H/3RKUkvFso2YG+Dy0XFLszq/FTZgyl TMmars6EAUAglmECQTbGrI4EQe7J X-Received: by 2002:a63:6ec2:: with SMTP id j185mr23988244pgc.341.1550517126518; Mon, 18 Feb 2019 11:12:06 -0800 (PST) Received: from squirtle.lan (c-24-22-235-96.hsd1.wa.comcast.net. [24.22.235.96]) by smtp.gmail.com with ESMTPSA id t12sm33189727pgq.68.2019.02.18.11.12.05 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Mon, 18 Feb 2019 11:12:05 -0800 (PST) From: Andrey Smirnov To: linux-pm@vger.kernel.org Cc: Andrey Smirnov , Chris Healy , Lucas Stach , Zhang Rui , Eduardo Valentin , Daniel Lezcano , linux-imx@nxp.com, linux-kernel@vger.kernel.org Subject: [PATCH 05/12] thermal: qoriq: Convert driver to use devm_ioremap() Date: Mon, 18 Feb 2019 11:11:34 -0800 Message-Id: <20190218191141.3729-6-andrew.smirnov@gmail.com> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20190218191141.3729-1-andrew.smirnov@gmail.com> References: <20190218191141.3729-1-andrew.smirnov@gmail.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Convert driver to use devm_ioremap() to simplify memory deallocation and error handling code. No functional change intended. Signed-off-by: Andrey Smirnov Cc: Chris Healy Cc: Lucas Stach Cc: Zhang Rui Cc: Eduardo Valentin Cc: Daniel Lezcano Cc: linux-imx@nxp.com Cc: linux-pm@vger.kernel.org Cc: linux-kernel@vger.kernel.org --- drivers/thermal/qoriq_thermal.c | 19 ++++++++++--------- 1 file changed, 10 insertions(+), 9 deletions(-) diff --git a/drivers/thermal/qoriq_thermal.c b/drivers/thermal/qoriq_thermal.c index 9bae001e8264..472594fca03b 100644 --- a/drivers/thermal/qoriq_thermal.c +++ b/drivers/thermal/qoriq_thermal.c @@ -188,6 +188,7 @@ static int qoriq_tmu_probe(struct platform_device *pdev) struct qoriq_tmu_data *data; struct device_node *np = pdev->dev.of_node; struct device *dev = &pdev->dev; + struct resource *io; u32 site; data = devm_kzalloc(dev, sizeof(struct qoriq_tmu_data), @@ -203,7 +204,13 @@ static int qoriq_tmu_probe(struct platform_device *pdev) return -ENODEV; } - data->regs = of_iomap(np, 0); + io = platform_get_resource(pdev, IORESOURCE_MEM, 0); + if (!io) { + dev_err(dev, "Failed to get memory region\n"); + return -ENODEV; + } + + data->regs = devm_ioremap(dev, io->start, resource_size(io)); if (!data->regs) { dev_err(dev, "Failed to get memory region\n"); return -ENODEV; @@ -213,7 +220,7 @@ static int qoriq_tmu_probe(struct platform_device *pdev) ret = qoriq_tmu_calibration(dev, data); /* TMU calibration */ if (ret < 0) - goto err_tmu; + return ret; data->tz = devm_thermal_zone_of_sensor_register(dev, data->sensor_id, @@ -222,7 +229,7 @@ static int qoriq_tmu_probe(struct platform_device *pdev) ret = PTR_ERR(data->tz); dev_err(dev, "Failed to register thermal zone device %d\n", ret); - goto err_tmu; + return ret; } platform_set_drvdata(pdev, data); @@ -232,11 +239,6 @@ static int qoriq_tmu_probe(struct platform_device *pdev) tmu_write(data, site | TMR_ME | TMR_ALPF, &data->regs->tmr); return 0; - -err_tmu: - iounmap(data->regs); - - return ret; } static int qoriq_tmu_remove(struct platform_device *pdev) @@ -246,7 +248,6 @@ static int qoriq_tmu_remove(struct platform_device *pdev) /* Disable monitoring */ tmu_write(data, TMR_DISABLE, &data->regs->tmr); - iounmap(data->regs); platform_set_drvdata(pdev, NULL); return 0; -- 2.20.1