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: 10861681 X-Patchwork-Delegate: eduardo.valentin@ti.com Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 076BE6C2 for ; Wed, 20 Mar 2019 13:19:17 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id E9E7727CAF for ; Wed, 20 Mar 2019 13:19:16 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id DE62029A37; Wed, 20 Mar 2019 13:19:16 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-6.5 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,MAILING_LIST_MULTI,RCVD_IN_DNSWL_HI, RCVD_IN_SORBS_WEB autolearn=unavailable version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 892F527CAF for ; Wed, 20 Mar 2019 13:19:16 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728221AbfCTNTP (ORCPT ); Wed, 20 Mar 2019 09:19:15 -0400 Received: from mail-pf1-f195.google.com ([209.85.210.195]:46008 "EHLO mail-pf1-f195.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728234AbfCTNTN (ORCPT ); Wed, 20 Mar 2019 09:19:13 -0400 Received: by mail-pf1-f195.google.com with SMTP id v21so1902003pfm.12 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=LPMIWA09XG7lE5zCSJ0hol91r2kZC2D2ESxEW0yq3MW1KsJpF0TkpN8fk1wBSIqWiD mCpXjNQdRTnDyXFH4XA5Z18sgXR7Snoy7FcIahhm7DhY4+SPsHa11BZGNELXe/HcIWNQ 6IoLSePCI33tTcuo884n5VVR7pbmIcfb+c3SQay0Eg+ofhcS875gbAdM6F4v3vImcLar 9OX+w8MGI5mbPkIaHVGp59SfEGXpqFFZTrkcBn9Ujg3VEr4d0eFl+jOz/+KHnge7Fukz vstdMoFRWPjPslm7elIkt+9I7Z15D2Z1kr1D1XK+CJk6Jq3Uup49rkiANiImL+VcTcR7 64Cw== X-Gm-Message-State: APjAAAVxiXXWQDRPUih2IMo4JxvVWMfyxih03W8hazSrzpzez7DepzLj fhSYH1rU5VwqaeS3741wBHc2Zw== X-Google-Smtp-Source: APXvYqywZpAUoBP9jdZORIidvhkdZPQC+2FNPWJqQUrlb0yIEt8T1SUNNH9vbw6KWkNnuYvLx5IKmg== 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-pm-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-pm@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP 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(-) 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]);