Received: by 2002:ac0:a5a7:0:0:0:0:0 with SMTP id m36-v6csp1316475imm; Wed, 25 Jul 2018 15:57:18 -0700 (PDT) X-Google-Smtp-Source: AAOMgpfav4gJbj7WvUFKYIDY+a4Wp45wjlWQucR2rMJYcDq09emrdInWcBmlzJn0vi8IQi/BN7BR X-Received: by 2002:a63:a619:: with SMTP id t25-v6mr21768461pge.288.1532559438857; Wed, 25 Jul 2018 15:57:18 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1532559438; cv=none; d=google.com; s=arc-20160816; b=jhn1HxTpyRO/V1yJ6J94Xwdce1ENydtR4TbTidA6oMqhwFeqYqNzwNfI85alq0RrBa at83vQdU+BrSuWdiHeBm/NPgE5MK3mgfFNfoqg0jbJTsIf5QdkvGVH6sFkHcGMmDSwYy 5mKurBcmLPqhwCQFmaKkG44X3CAhZY9yWnyLKR31Qb4McXYOp91GRrWVSOcbECBmHere yeltMEshE1y7RO6VeeHRuD7800frVkrJl9kmGMsv27bDW3Brk5U2770uXzuXGJbG5HNk iPJz/p75bZN2K4PdaM1nTfTRL8SaWV+nX3Ix+wp2ajjFgT16XbwX+ROTEn3XhZk36P1H A5ew== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:user-agent:in-reply-to :content-disposition:mime-version:references:message-id:subject:cc :to:from:date:dkim-signature:arc-authentication-results; bh=wDKjzkPhtv3Vsj1tPZsn2Uyr1PgRiq2fnKr5O1DV66M=; b=bTKJZ0QTnTmoDQhVYSTABsiTbiHYvWiwUg6YYUPEQI4CXN6yLSqDlOlGwig+fQLK6p AVTK0fUfI6vugAckLgaVBaCy1VG/A3jcsxHVg2koWjUpYyx6S62nl5EkU6tR3TOs9Ivk Ds99ZYuXXhUYiwL2z1TGjGokZ9TrlNfB5TjkpgIK3MPw1r8YK/2Stf5KzYUo1D7fyJtA qBMiHXW2fkoPKvroXudUNVqjlb2eT5VUb/zTgCZr7E5bpN2PBmcNIsOx/9IDaQQNympj /sXmIXgqTqMJiyHTk0miCReE2nl4UH5WFowHU06aiDdKCrmIHlMDW0CzTipZL6AOIu3d uEMg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@chromium.org header.s=google header.b=MmbLcFJS; 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=chromium.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id k14-v6si14788323pga.149.2018.07.25.15.57.03; Wed, 25 Jul 2018 15:57:18 -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=@chromium.org header.s=google header.b=MmbLcFJS; 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=chromium.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1731729AbeGZAJ5 (ORCPT + 99 others); Wed, 25 Jul 2018 20:09:57 -0400 Received: from mail-pg1-f193.google.com ([209.85.215.193]:46648 "EHLO mail-pg1-f193.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1731534AbeGZAJ5 (ORCPT ); Wed, 25 Jul 2018 20:09:57 -0400 Received: by mail-pg1-f193.google.com with SMTP id p23-v6so6220749pgv.13 for ; Wed, 25 Jul 2018 15:56:06 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=chromium.org; s=google; h=date:from:to:cc:subject:message-id:references:mime-version :content-disposition:in-reply-to:user-agent; bh=wDKjzkPhtv3Vsj1tPZsn2Uyr1PgRiq2fnKr5O1DV66M=; b=MmbLcFJSKLSqZI//VZ4SvYyInO3YjTdNHivqBdZ+uvrRfbhsCJ7xXPr2EzBTSq7Pij /WviGG4HQKB9fbfZZUREjgXy9uAtaBfprSQQ05puWZKaW4/l9oYHAmOoOkWUnUWUS4HA B5uR1xJtrnmlC0i3Qa4rA0IuEItBQZmti1Q0I= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:from:to:cc:subject:message-id:references :mime-version:content-disposition:in-reply-to:user-agent; bh=wDKjzkPhtv3Vsj1tPZsn2Uyr1PgRiq2fnKr5O1DV66M=; b=fB8WL150UR0VklHkiuGkowVSgLb5lPcHWGkiiwiFJ+kLGfSs8+oxzi6eLgYoHQrRsI BBQfraM6YPNeCEITIzN2NFCsN+vyVxjdcmHmHX6L2lJeYw4tRihS1oIh+qerb1mMq3iX 8eqoo6tEtufrgFn31Zv17hQSyZccqCbLXOScVAqyvpO1+hLekX6O6p0Wa7ENFe2h86Rm KJMo2zKX5DjKlKiBOTp/bBQ+/AQcj5z3sbjwtAFf8EUH9AojRgHonqwXq/0YEV81Wa+3 RWWrj5fqLvmi8MiHK+GK+Mr80SRsNXRx/PBNgZMoAgBkaNczSmKBtssVNpw3YwPj/iBa 4n6g== X-Gm-Message-State: AOUpUlHwxvgXjFyfSCddzb2bHaMn9dEpqla5KGhvuuouCYyxBL22G+ox T0vulo1Ap92vSpPbDoF0bGABvw== X-Received: by 2002:a62:d41a:: with SMTP id a26-v6mr403437pfh.142.1532559366620; Wed, 25 Jul 2018 15:56:06 -0700 (PDT) Received: from localhost ([2620:0:1000:1501:8e2d:4727:1211:622]) by smtp.gmail.com with ESMTPSA id 65-v6sm23091463pfq.81.2018.07.25.15.56.06 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Wed, 25 Jul 2018 15:56:06 -0700 (PDT) Date: Wed, 25 Jul 2018 15:56:05 -0700 From: Matthias Kaehlcke To: Amit Kucheria Cc: linux-kernel@vger.kernel.org, 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, Zhang Rui , linux-pm@vger.kernel.org Subject: Re: [PATCH v1 2/3] thermal: tsens: switch from of_iomap() to devm_ioremap_resource() Message-ID: <20180725225605.GS129942@google.com> References: <4dd9f01c2b5d6988c5329062c25ae61747b42a32.1531898088.git.amit.kucheria@linaro.org> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline In-Reply-To: <4dd9f01c2b5d6988c5329062c25ae61747b42a32.1531898088.git.amit.kucheria@linaro.org> User-Agent: Mutt/1.9.2 (2017-12-15) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Wed, Jul 18, 2018 at 12:55:02PM +0530, Amit Kucheria wrote: > 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; > } Reviewed-by: Matthias Kaehlcke