Received: by 2002:ac0:a5a7:0:0:0:0:0 with SMTP id m36-v6csp282796imm; Thu, 26 Jul 2018 03:34:56 -0700 (PDT) X-Google-Smtp-Source: AAOMgpeEjB3g3xu27KeUFLjU0TSgLiHyGknY1+YL+p8YNAlzejfZHoSQ3XJvDISvorsSNbG18Sat X-Received: by 2002:a17:902:bd93:: with SMTP id q19-v6mr1429711pls.238.1532601296879; Thu, 26 Jul 2018 03:34:56 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1532601296; cv=none; d=google.com; s=arc-20160816; b=Uc+hYhLMPFaZuChiYhknUViNDZE13zwqdO5xe185JiwTe1ayrdLOQvWKqGCetXhS4X b2CvMWSS7gj8TzFsDsHQJOWTWnKidfd2ZIWizYbbgB07JsNHMaIQC0qcI6W9JfmFJREd /EIhBY7TrwMQ/z2oElwHKosC8wzMZSUe/+wg3p4e0y/lIhr2oSWS8fDmxq6e5GuTUQ8j 9784fZudVA/gY1r+V3UnA02H2Eakq3dvIMYAEpsaeU0cRIyDGkCEs8WFD6xVY2PX6w9s 5QPJKJ4hR6Cr3aZ2txRJJi7oIDSctWANFTvh9EkuEEiADrY8bZ+a7pywSanxLTu0MBYr IBhA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:references:in-reply-to:references :in-reply-to:message-id:date:subject:cc:to:from:dkim-signature :arc-authentication-results; bh=7pdKkXszJl0Y74TWXh6gdA8KIIImBRTHTJ1Z9RN0dvg=; b=J1MesA6M0dgbdYhG0IOeYZ8LFIP7WFrrdt2iJ/e0oJoCL3CO+IOiK5MKGT21zfqfdD 46wpbAXqGqlqlwgZnBtqPMZx9PCoEdo0mIG3krF2jm/QXO7Ti3y9t5gUNyy0s4aMvidl CpdjOckpFzEtYpxZO7UY32qlRi5W0LbvWaCAGDN2+V/m9jrguGiHGQ4kQK4b4dJ7Bq// iPeP9XQB5E7q95vZeB5HmPKvH0L27WfXs3Q1SgKTkuHUl7kzE3fPu1/rJla4jDB+ibsY E3U1GVF0LhZ8sesSf2bw0C2oboOcr6tDNr+G0y0qhMkNQKfRp2Wv2ITHoeJOpIejWzn7 csJA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b="Fhi4Ct/b"; 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=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id 24-v6si1032177pgx.314.2018.07.26.03.34.42; Thu, 26 Jul 2018 03:34:56 -0700 (PDT) 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=@linaro.org header.s=google header.b="Fhi4Ct/b"; 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=NONE dis=NONE) header.from=linaro.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1729392AbeGZLt4 (ORCPT + 99 others); Thu, 26 Jul 2018 07:49:56 -0400 Received: from mail-wr1-f68.google.com ([209.85.221.68]:36503 "EHLO mail-wr1-f68.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1729369AbeGZLt4 (ORCPT ); Thu, 26 Jul 2018 07:49:56 -0400 Received: by mail-wr1-f68.google.com with SMTP id h9-v6so1201193wro.3 for ; Thu, 26 Jul 2018 03:33:43 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :in-reply-to:references; bh=7pdKkXszJl0Y74TWXh6gdA8KIIImBRTHTJ1Z9RN0dvg=; b=Fhi4Ct/bj4yBxlkbsu/bgpQOl38iLOTF6THsInYunPXq3OR8wghp/qpuILwTIc/7ls usASnw3IVoVeBZvGIfqRJLAc6KRMJULsxnKne8r9HGPv6PvX5gib4c8KhjQ8uDGMFqIF XMmk78yAf6eBbPx1OfM+Vgww16XG9Bm5jluFo= 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:in-reply-to:references; bh=7pdKkXszJl0Y74TWXh6gdA8KIIImBRTHTJ1Z9RN0dvg=; b=MCnBBA4DeTxmOfUVH4kuY7fPuB0y8Q6Kvnbt5zNe/xdmcevlA6kjMX4CSRKnPMlWjJ /i83QeKgbHM/qPzLBO6lh2PZb+SwHk9De9qCKcEA/lfMTZ1AsrGQmYJlycwOLGQuckhB f0yAjH6bvDrDrQaFzrwUL1lwt+/uXwUZwmWbiypcqqiDkvT0ZSx+ryOkJoTdAizhPBsb diacSG9o5xFUh7ObwMqNRkazgxDNaZDOG587L8nyHtstq030aLRFPi5FD6JiU4J7Hyk8 eeRF6FdIKTNA64gpQEL+qb6j7xJJi51CJn6m9+M+mkjSsaa/I/0ydjp17QBg+GMgWHmw l7qA== X-Gm-Message-State: AOUpUlENMZZGUUpivUoG3di/hvLkJAEmPopOspFQqwHPd2yMoCmHCEAT /shWQiI1cqP0FV8jyQS0XTxouoh3R94= X-Received: by 2002:a5d:6841:: with SMTP id o1-v6mr1124857wrw.159.1532601222160; Thu, 26 Jul 2018 03:33:42 -0700 (PDT) Received: from localhost ([49.248.197.57]) by smtp.gmail.com with ESMTPSA id b6-v6sm1520458wru.66.2018.07.26.03.33.40 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Thu, 26 Jul 2018 03:33:41 -0700 (PDT) From: Amit Kucheria To: linux-kernel@vger.kernel.org Cc: rnayak@codeaurora.org, linux-arm-msm@vger.kernel.org, bjorn.andersson@linaro.org, edubezval@gmail.com, smohanad@codeaurora.org, andy.gross@linaro.org, dianders@chromium.org, mka@chromium.org, Zhang Rui , linux-pm@vger.kernel.org Subject: [PATCH v2 2/3] thermal: tsens: switch from of_iomap() to devm_ioremap_resource() Date: Thu, 26 Jul 2018 16:03:09 +0530 Message-Id: X-Mailer: git-send-email 2.17.GIT In-Reply-To: References: In-Reply-To: References: Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org devm_ioremap_resources() automatically requests resources (so that the I/O region shows up in /proc/iomem) and devm_ wrappers do better error handling and unmapping of the I/O region when needed. Signed-off-by: Amit Kucheria Reviewed-by: Matthias Kaehlcke --- drivers/thermal/qcom/tsens-common.c | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/drivers/thermal/qcom/tsens-common.c b/drivers/thermal/qcom/tsens-common.c index 25e7f247b027..6207d8d92351 100644 --- a/drivers/thermal/qcom/tsens-common.c +++ b/drivers/thermal/qcom/tsens-common.c @@ -127,13 +127,11 @@ static const struct regmap_config tsens_config = { int __init init_common(struct tsens_device *tmdev) { void __iomem *base; + struct resource *res; struct platform_device *op = of_find_device_by_node(tmdev->dev->of_node); if (!op) return -EINVAL; - base = of_iomap(tmdev->dev->of_node, 0); - if (!base) - return -EINVAL; /* The driver only uses the TM register address space for now */ if (op->num_resources > 1) { @@ -143,11 +141,14 @@ int __init init_common(struct tsens_device *tmdev) tmdev->tm_offset = 0x1000; } + res = platform_get_resource(op, IORESOURCE_MEM, 0); + base = devm_ioremap_resource(&op->dev, res); + if (IS_ERR(base)) + return PTR_ERR(base); + tmdev->map = devm_regmap_init_mmio(tmdev->dev, base, &tsens_config); - if (IS_ERR(tmdev->map)) { - iounmap(base); + if (IS_ERR(tmdev->map)) return PTR_ERR(tmdev->map); - } return 0; } -- 2.17.GIT