Received: by 2002:ac0:a5a7:0:0:0:0:0 with SMTP id m36-v6csp708218imm; Thu, 26 Jul 2018 10:34:08 -0700 (PDT) X-Google-Smtp-Source: AAOMgpc6TEpmhIg7d67cbMuOLEhlYA7UTXzd5P+/GcYpe+FgNVAa3F7LbuvIwcSewU7Io37QJY4K X-Received: by 2002:a65:4304:: with SMTP id j4-v6mr2876362pgq.109.1532626448522; Thu, 26 Jul 2018 10:34:08 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1532626448; cv=none; d=google.com; s=arc-20160816; b=NahxWPcS+e5Ifvz5qBn1SzeB9hwj+3AwlxeEIPbeYRhdLrDhJGuYCK3VdO1PjCs7fU CO85kr20LGJGcq3U3FtNndRMMzgF2XvwrtfGfstfVStyhF2cs27izuu2nEWC7n74WGLk 1N6uhjQ2thEZcAH+R0pTY/Z9BDpKsSMW3+CsFweJS/3M4AUqqHu2CQ3HvvZJBoVdO7nj 8ZUfBlQ3o7jIr60kRPUsqr8bGLTez1SIS4Bpm9r4DqiXPXQH9JX44ndr8+kjmrJJoCC/ WgLW1nHE9fFXO2o2YHJyxzgTqD0Vcyc0lZ90Z1h0dFgDOmypxioN9QIGVbI7MqcoVmLQ Sehg== 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=w3LoNJ+r1fC1V0bdjbtCifoz+jvERHZVfX8KApM66Ls=; b=K2kq5u7sr8IfejMFuXxfGZo9AU7552jQcg8bWafjnXD7uk5Ks0zJ7iAfcq3RehbDsb PUb5IDeOxBxmHEwe/qhU7YAYDme/YJwzzyK6ajYY3vMe4Dzka+Bn2nMiTTFXRyKtD5dy zU2V8qXjuj1aThjBqawk13nK3KIxV9r5rmUo31PFW6kHxZTI/5Qh7ZA8BmJKSbgughfG Yk6mp0ZNFWG8rPQZwtvaKRDT2yKcbbYze2LtPHlE/DgnWc3uj3Z/ZuYKJzkrhvDRC5R7 QFj/39oFcFXLcOpEOxIZwTJTvnb37Iv12wbjLxsLn2n6kg0QBd++356G+C2pziJPXrwa exmA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=dnuBbxQa; 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 b39-v6si1713495pla.26.2018.07.26.10.33.53; Thu, 26 Jul 2018 10:34:08 -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=dnuBbxQa; 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 S1732179AbeGZRv1 (ORCPT + 99 others); Thu, 26 Jul 2018 13:51:27 -0400 Received: from mail-pg1-f194.google.com ([209.85.215.194]:44833 "EHLO mail-pg1-f194.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1731801AbeGZRv1 (ORCPT ); Thu, 26 Jul 2018 13:51:27 -0400 Received: by mail-pg1-f194.google.com with SMTP id r1-v6so1486415pgp.11 for ; Thu, 26 Jul 2018 09:33:51 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=date:from:to:cc:subject:message-id:references:mime-version :content-disposition:in-reply-to:user-agent; bh=w3LoNJ+r1fC1V0bdjbtCifoz+jvERHZVfX8KApM66Ls=; b=dnuBbxQap7ggM++8ixmYveXsi7IkxOCvE7ESQRjswZ5oIgxpYwHIdtO6dwfuOTupJv hpz7EsX7OEkEpnCUpkY3fxez++MTLJWAVaMv8dMwdMYg0cY0t5JqpE8Ar4YT9mGUWg8m YHXR6PxmReAU36xaSf986qT1URVeFzJbG0R2c= 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=w3LoNJ+r1fC1V0bdjbtCifoz+jvERHZVfX8KApM66Ls=; b=PldziPV3MDwLJ82nhfE6ELbUH0/GpvF32KLJeda8a0UAJD7YDGm9a64iDcDT8sOuEY qGjbh+IjxVz5Sh8CfnBwlDi8GtuQbScUQpTFga4H5ag89u5HIwR20kdc7/GlzSlFj1Bc RxFkNNN3STbe4YlBE3fxK2ghJJoDYyE6b5imkvAM6Lf7TkEoIOJrnoHnT7vRIgiLtR0u AYD4RdIZudnj8d/JnB3/xGhC4MLrCJXRtdCkF7txJbvmJlJ+Kvmwzlqml/xGN20pLzTj EPeKBKu4heTfE1WTVgzBZzYeo668JPoqyyENm5ssQ4Ythl2HUtdFcbxAEeG5WiC/rx91 Cgag== X-Gm-Message-State: AOUpUlFpQ/hhhYLZRveRXa7O2B+FvoYk5OeStvLx+K6Cyz6s4JrXl+Iw mgaWLkJdgQz1cl/dKHYExrE0Hw== X-Received: by 2002:a65:658d:: with SMTP id u13-v6mr2668415pgv.20.1532622831507; Thu, 26 Jul 2018 09:33:51 -0700 (PDT) Received: from tuxbook-pro (104-188-17-28.lightspeed.sndgca.sbcglobal.net. [104.188.17.28]) by smtp.gmail.com with ESMTPSA id u11-v6sm5138952pfd.117.2018.07.26.09.33.50 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Thu, 26 Jul 2018 09:33:50 -0700 (PDT) Date: Thu, 26 Jul 2018 09:36:59 -0700 From: Bjorn Andersson To: Amit Kucheria Cc: linux-kernel@vger.kernel.org, rnayak@codeaurora.org, linux-arm-msm@vger.kernel.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: Re: [PATCH v2 2/3] thermal: tsens: switch from of_iomap() to devm_ioremap_resource() Message-ID: <20180726163659.GB5450@tuxbook-pro> References: MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.10.0 (2018-05-17) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Thu 26 Jul 03:33 PDT 2018, 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 > Reviewed-by: Matthias Kaehlcke Reviewed-by: Bjorn Andersson Regards, Bjorn > --- > 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 >