From patchwork Wed Mar 20 13:17:51 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Amit Kucheria X-Patchwork-Id: 160678 Delivered-To: patch@linaro.org Received: by 2002:a02:c6d8:0:0:0:0:0 with SMTP id r24csp282623jan; Wed, 20 Mar 2019 06:19:16 -0700 (PDT) X-Google-Smtp-Source: APXvYqzgywcn6r7H5tnxidJgSxJjcLKWkzy3IQx6ON5Y/jP5EuMlmyDQRMDunrROA9+gFtAV2DkW X-Received: by 2002:a17:902:b617:: with SMTP id b23mr30403933pls.200.1553087955960; Wed, 20 Mar 2019 06:19:15 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1553087955; cv=none; d=google.com; s=arc-20160816; b=Dk97YcSx4ENyslQ37ngHVWPvR8q7oIesvnSvpQsCjAx7oKBuNToVVgNU9nuBZpjkwo KfuwUdjMsOXeabPV+25A23tVSMnCWoiTqaqONhIjMAcc+H9u7VEmkWbYv63nCYxyZnXo o/ijIHHfqNtBRJCq2+gz+e9VIf6H6XdqbKKQ7kxyMQRa2cwKjvyDBfxdbkAYUdZMUzbp pVnLbPIxbJMe6wIplsQWwcZkcvUZZQjXn64L5elCX9FwhOuqUsENQ9aESISWo6y8oizH CgZV2RXsvjbFURpGEHwhG/zcx0Qt+QMLjO2Nerz1UylRqIHc0kKMt9h2UntKpUB6eUSR sWyA== 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; bh=VhHcZVSBRtsAuReEPdrQAjR3KZZmXdu2lzzS3zScaAA=; b=EX1gWAHxtZN5J6F1Mu75JdeaViNtwoV2xPBSJerCTuaPdYpOcc3cIiiUPo9l9Oylhg H1XU/bIxldlgM/HLu+6OYeqf7MTTV1B+YPjN+e8Pd+xml5cnVzZi0m1VH061YZkdhf+y LPfvAdCLZTmbQVEbubTg4ROQVq6ZXpwPXorNH5yJUSvOL6DulWc58rhwFAoSLODrmYQ+ 3XDvSUrr3DH1o1PbYPGqqJHBSGQhCqJEOgmwSaz96aJ1wW80jfPDcy38sgshkqqADsMp hF8u5iU7bTU+BIDUiHqUfEu+zzaic/kXnJQKQzxDn57l8a0P29VmDZFi85QAENLfQUyJ 3LOg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=aZkY1Ivl; spf=pass (google.com: best guess record for domain of linux-arm-msm-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-arm-msm-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 s36si1927823pld.342.2019.03.20.06.19.15; Wed, 20 Mar 2019 06:19:15 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-arm-msm-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=aZkY1Ivl; spf=pass (google.com: best guess record for domain of linux-arm-msm-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-arm-msm-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 S1728236AbfCTNTN (ORCPT + 15 others); Wed, 20 Mar 2019 09:19:13 -0400 Received: from mail-pf1-f194.google.com ([209.85.210.194]:36068 "EHLO mail-pf1-f194.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728221AbfCTNTN (ORCPT ); Wed, 20 Mar 2019 09:19:13 -0400 Received: by mail-pf1-f194.google.com with SMTP id p10so1934368pff.3 for ; Wed, 20 Mar 2019 06:19:13 -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=VhHcZVSBRtsAuReEPdrQAjR3KZZmXdu2lzzS3zScaAA=; b=aZkY1Ivl6KfG4R9fP3oGBO6uKKN5O5mzkyWOFX8mhBiOLBVRHy6aoXtn3F+odCHGzr trUXiN0hFog5QI7l/LxUCAfNUo3ui3/KgdFZKDoEvN3Og93iweybpi2+1mqMw5AYSYS5 HyqkDVVIZq2V/s9PStYPNZBudk/dZCgiaZjLJZBGFo1M2YzRKEGFpRbMq1Ik+36QjNIt 5NObXQoneODcBinX2/koefYT6hSuDUyFLrB94ZuHy/MgvdrM7q5LpLDtXvdYVmv9Z3Cc K3y3/kcRJIYRTfaQjDk3mxCcPKf1R2A3M7XpyIDXWgCbb8duuUNf4pfJrv+LDYb8chrL sFSg== 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=VhHcZVSBRtsAuReEPdrQAjR3KZZmXdu2lzzS3zScaAA=; b=I7P9ltFjVc6vOPvRZQWeYPUVojb6cvh3RRzs8m5GgK6DRIuNLOdQf81/Imf4Wd3ApD oMhxAxikPxhW6LgdGSy+sxoxAxZGBfCnlUll7fx4O2jdvgJS76zZWbq92aiqTmqhCvkQ w4my6vYqYiZLOfqIxeSlYsu0Guxrfj2/a5ucQ8DGDTi9TOZ5E2X/FVctwNRg+EH844AS YnwYK+3TGQ+pf8dx8YCmzc+lmyZ98FQgll6LSSq/BORlVORjnLF7WuOoB5oEGpeKNgXU 4UWWEKTWG87pF/qWzI+UNN0c5dWMcDkvigFK6/RBXBtaAJAaA0P2VUpTiM9MBcLgCvL8 2/og== X-Gm-Message-State: APjAAAVX5mnv6h5AH1Bhg1vkEznOHHzxGdnYxWoxeKBnuOx8o/GRKuQa Yar9KxH5xHVOAYcck2O4CeoiRg== X-Received: by 2002:a17:902:b687:: with SMTP id c7mr7997450pls.270.1553087952682; Wed, 20 Mar 2019 06:19:12 -0700 (PDT) Received: from localhost ([114.143.122.221]) by smtp.gmail.com with ESMTPSA id z77sm4975215pfi.155.2019.03.20.06.19.11 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Wed, 20 Mar 2019 06:19:12 -0700 (PDT) From: Amit Kucheria To: linux-kernel@vger.kernel.org, linux-arm-msm@vger.kernel.org, bjorn.andersson@linaro.org, edubezval@gmail.com, andy.gross@linaro.org, Daniel Lezcano , David Brown , Zhang Rui Cc: linux-pm@vger.kernel.org Subject: [PATCHv3 11/23] drivers: thermal: tsens: Save reference to the device pointer and use it Date: Wed, 20 Mar 2019 18:47:51 +0530 Message-Id: <8d368c678b3985cc58a0c314ee14756921d33746.1553086065.git.amit.kucheria@linaro.org> X-Mailer: git-send-email 2.17.1 In-Reply-To: References: In-Reply-To: References: Sender: linux-arm-msm-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-arm-msm@vger.kernel.org Code cleanup making it easier to read Signed-off-by: Amit Kucheria --- drivers/thermal/qcom/tsens-common.c | 15 ++++++++------- 1 file changed, 8 insertions(+), 7 deletions(-) -- 2.17.1 diff --git a/drivers/thermal/qcom/tsens-common.c b/drivers/thermal/qcom/tsens-common.c index 0f9deec2517a..9d7a6c328ae0 100644 --- a/drivers/thermal/qcom/tsens-common.c +++ b/drivers/thermal/qcom/tsens-common.c @@ -119,6 +119,7 @@ static const struct regmap_config tsens_srot_config = { int __init init_common(struct tsens_priv *priv) { void __iomem *tm_base, *srot_base; + struct device *dev = priv->dev; struct resource *res; u32 enabled; int ret, i, j; @@ -137,7 +138,7 @@ int __init init_common(struct tsens_priv *priv) goto err_put_device; } - priv->srot_map = devm_regmap_init_mmio(priv->dev, srot_base, + priv->srot_map = devm_regmap_init_mmio(dev, srot_base, &tsens_srot_config); if (IS_ERR(priv->srot_map)) { ret = PTR_ERR(priv->srot_map); @@ -155,13 +156,13 @@ int __init init_common(struct tsens_priv *priv) goto err_put_device; } - priv->tm_map = devm_regmap_init_mmio(priv->dev, tm_base, &tsens_config); + priv->tm_map = devm_regmap_init_mmio(dev, tm_base, &tsens_config); if (IS_ERR(priv->tm_map)) { ret = PTR_ERR(priv->tm_map); goto err_put_device; } - priv->rf[TSENS_EN] = devm_regmap_field_alloc(priv->dev, priv->srot_map, + priv->rf[TSENS_EN] = devm_regmap_field_alloc(dev, priv->srot_map, priv->fields[TSENS_EN]); if (IS_ERR(priv->rf[TSENS_EN])) { ret = PTR_ERR(priv->rf[TSENS_EN]); @@ -171,12 +172,12 @@ int __init init_common(struct tsens_priv *priv) if (ret) goto err_put_device; if (!enabled) { - dev_err(priv->dev, "tsens device is not enabled\n"); + dev_err(dev, "tsens device is not enabled\n"); ret = -ENODEV; goto err_put_device; } - priv->rf[SENSOR_EN] = devm_regmap_field_alloc(priv->dev, priv->srot_map, + priv->rf[SENSOR_EN] = devm_regmap_field_alloc(dev, priv->srot_map, priv->fields[SENSOR_EN]); if (IS_ERR(priv->rf[SENSOR_EN])) { ret = PTR_ERR(priv->rf[SENSOR_EN]); @@ -184,7 +185,7 @@ int __init init_common(struct tsens_priv *priv) } /* now alloc regmap_fields in tm_map */ for (i = 0, j = LAST_TEMP_0; i < priv->num_sensors; i++, j++) { - priv->rf[j] = devm_regmap_field_alloc(priv->dev, priv->tm_map, + priv->rf[j] = devm_regmap_field_alloc(dev, priv->tm_map, priv->fields[j]); if (IS_ERR(priv->rf[j])) { ret = PTR_ERR(priv->rf[j]); @@ -192,7 +193,7 @@ int __init init_common(struct tsens_priv *priv) } } for (i = 0, j = VALID_0; i < priv->num_sensors; i++, j++) { - priv->rf[j] = devm_regmap_field_alloc(priv->dev, priv->tm_map, + priv->rf[j] = devm_regmap_field_alloc(dev, priv->tm_map, priv->fields[j]); if (IS_ERR(priv->rf[j])) { ret = PTR_ERR(priv->rf[j]);