Received: by 2002:ac0:a5a7:0:0:0:0:0 with SMTP id m36-v6csp212395imm; Wed, 18 Jul 2018 00:26:43 -0700 (PDT) X-Google-Smtp-Source: AAOMgpfHu8dvC4y8l0xCjpfJxQLpabVZURu0HCopYk+IHZzF+tD0x4d6xZqyevfRkS0WsPZL5Ndz X-Received: by 2002:a63:ac57:: with SMTP id z23-v6mr4558620pgn.74.1531898803411; Wed, 18 Jul 2018 00:26:43 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1531898803; cv=none; d=google.com; s=arc-20160816; b=oAtsRS6JDzegSP2vADBK5uRmUoklNa9PpClMuRdkeg+VqU0f2RYe3Fw7Es4TbMsGM5 jrVFHc9JKdCYKKuKblND6BmX/CcmKyIJICA4maFQVx006npS+TLBj7UiPfledOpqrkc5 2RSxqgC7N7X6caaB0kPg3rnNEKG8ZjIC6Vsmh8PJHOy4/zvjtSX2Cweb5/kgYkhvOJz2 +Qb3lu8/nmszxLtovXaZlgx+kcfZdUFtWx4jPxs7lyLyVs1QRSkE1ZjRpdrkVCA9djTZ fVq2WhpjN15x3ByzuRih4ymc2alWkICjHESUfJ+Jv4P8d8T45a0uSnBBTWC+c8tr+jMw OOoA== 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=VD2olbd9oQC1RGmU9iprACti8KCCG3wIJjoyBgZ3IoM=; b=xurYN2KHO74EZUrbPSB3lIYWR99jKJXIKi3M4Rb+KgkYEU6ZIy8iqK9aFf/cswPyb4 y2fl2JNxDIW26iRKXjYIW4MNcP6HiuYA0utgEXH/dpfpcEPG95VTq2SS0AKmEj8e5YhR DCn6iuyB3AtJZfuz4gPUt/kVGzFjszx6KvvI44V6TOfaw0lMZC6RzJP0ELVO8CWf41rj 3WKCoTzx7rE3lBsuxxLzGez7fsmsskzVz0vq9ZDLukd59MrNT7zg0IOrLBW5z+58V1m9 0NSiPJFts5jRY/Z9MBznMZ8NU9LMLvjjMjzJBt8W2VmkAc5hdFx0uLInOxetjt4nIcl2 hzUw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b="M/Jo+vXV"; 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 n5-v6si2532682plk.352.2018.07.18.00.26.28; Wed, 18 Jul 2018 00:26:43 -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="M/Jo+vXV"; 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 S1729706AbeGRICD (ORCPT + 99 others); Wed, 18 Jul 2018 04:02:03 -0400 Received: from mail-wr1-f68.google.com ([209.85.221.68]:46235 "EHLO mail-wr1-f68.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1729594AbeGRICC (ORCPT ); Wed, 18 Jul 2018 04:02:02 -0400 Received: by mail-wr1-f68.google.com with SMTP id s11-v6so3515186wra.13 for ; Wed, 18 Jul 2018 00:25:35 -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=VD2olbd9oQC1RGmU9iprACti8KCCG3wIJjoyBgZ3IoM=; b=M/Jo+vXV92GYMmp5IIJxWZp+PRsISVnNpXChlCaibp28Aj1WOgJc8ctyjRUcPy3qfy cSzhNz2CADP5c2t0MD6Iu1UWRNQIosmYqZnCdQWS4NBzRbV8cnsQjilvW/Vry1CwdHMY EIGhDWO2GSxqxyyj/UYxbngSBIs2Jz4Ccuxo0= 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=VD2olbd9oQC1RGmU9iprACti8KCCG3wIJjoyBgZ3IoM=; b=BBeEaSyoN8+BW2DclaHqXV2onujfnNIoYrWoJfbo0V3T4yyVAlTfZJuUOEy0KD5I5O gXLV6I9WP8EPN8flgt77iKUmUk5ANS68eqwr70EnqsGj0MGOUSNuIeyH0HaHS78BfrWF J+JXJ7MFYVNxNc8T6v4hniB4sRuDKxmzvxxwEahMfHKFvrA8FDEKewHeEJiELVuWfawJ UFtnC3+yiAzXEG5BA+3imkbMKqI9NpzT9vdnTIMoWV04J9WBPZPiOAQBLFo091xSqY9s xsZNDFaIvvKCzrBnDfUQ/bWYmKhGFz6fhY4Tk10hGhFJcHLrdAVL9I/tj4+Z9YC/HGlC WRLg== X-Gm-Message-State: AOUpUlGuf8QZHET/O1TD4FVkaNQUOrZhd4urTIgc53AGc1kireu/qWWT py3fyLvdBN7QlSDOT56nNz8oCySubX0= X-Received: by 2002:adf:88e3:: with SMTP id g32-v6mr3270446wrg.62.1531898734754; Wed, 18 Jul 2018 00:25:34 -0700 (PDT) Received: from localhost ([49.248.170.255]) by smtp.gmail.com with ESMTPSA id q11-v6sm7220033wrp.58.2018.07.18.00.25.32 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 18 Jul 2018 00:25:34 -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 v1 2/3] thermal: tsens: switch from of_iomap() to devm_ioremap_resource() Date: Wed, 18 Jul 2018 12:55:02 +0530 Message-Id: <4dd9f01c2b5d6988c5329062c25ae61747b42a32.1531898088.git.amit.kucheria@linaro.org> X-Mailer: git-send-email 2.7.4 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 --- 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 25e7f24..6207d8d 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.7.4