From patchwork Thu Feb 7 10:49:29 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Amit Kucheria X-Patchwork-Id: 10801113 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 1FFAE13A4 for ; Thu, 7 Feb 2019 12:58:23 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 109FC2D41B for ; Thu, 7 Feb 2019 12:58:23 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 03FB22D421; Thu, 7 Feb 2019 12:58:23 +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=-8.0 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,MAILING_LIST_MULTI,RCVD_IN_DNSWL_HI 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 9B7F62D424 for ; Thu, 7 Feb 2019 12:58:22 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727171AbfBGM6Q (ORCPT ); Thu, 7 Feb 2019 07:58:16 -0500 Received: from mail-pg1-f196.google.com ([209.85.215.196]:34185 "EHLO mail-pg1-f196.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727601AbfBGM6O (ORCPT ); Thu, 7 Feb 2019 07:58:14 -0500 Received: by mail-pg1-f196.google.com with SMTP id d9so4473329pgl.1 for ; Thu, 07 Feb 2019 04:58:13 -0800 (PST) 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=DhOH74k9WLUHZ9bc4R59OvEiqm0NxoNRQ6D2mdU8GNA=; b=JgfGa/xDJVcgKShX9fKv+jO2xMqrHtpemIF+1QKP5uUtW9DNeAmGjtKpaXnY8h7Gd2 XyRvEzzkoOir8QfBtzkae+3N99K9yaAiVK0tvCQXWITsyR8D1pEVR0+vkB7tUy5xaE9R Z2064Fx9zf4hSE1lJQfjX3mdjKebq6rMlt+Lw7luRP7ZBCrgaL7OKdnGIMhdu/dqITst mAJT/5mVBQqp/Hz7qiBR8AYD0HWZmcdVa/08A1s4UbhdXmndIpZUYeoUu5a5pUm1014p iS5oY5FiZ2/abEGljYNDhOthiwMkZHucZ9YKsk5xyifCcvV/R46r9N3Q95AMaHlNmQ4n GvIA== 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=DhOH74k9WLUHZ9bc4R59OvEiqm0NxoNRQ6D2mdU8GNA=; b=E+IV5y9uquxyWvs7B0I5ol6GNzXCrcruavDWjPXLoHmHvtX2tVGEmV4i/AvfiZby8X azl9BWpf7KC1WmohPYM/9ZkfB9HwSsvonQpuS2oxmQ6JAhExbaQwbR5okTjTsE2/S6vB uN4e4PZXcQb9dznq/askSv8O1NAZ5PzLL+6PDBeLMpuPQf1/+g2KPovXUxLnpGoXjtr7 GQUOtcfvUPwXcXMlBSi0PJ+JCNYeHAO5Fxz4y2+czxQi8Pe9Um5pSFeTyxExl/+4uUj+ FmPbi8fdH3ISogZM9k8z6Od7DqVaUJm/JZSYZb2TRqI3fVOlP8CV1t9/gXS1Dq/fJgYN bX2A== X-Gm-Message-State: AHQUAuZtuj0dFIdE5o71sU3ZeJ7yw+SuQEh0/6h0DFHJuUnumLQ3Vjzz qrOs/4jXpI5WXIHb9YpAtxwjYQ== X-Google-Smtp-Source: AHgI3IZswpqS9BXtUweo8Lkv6VlZIszZgPd+6TsZmd2//eWCNgcvdobBXOYuA2P6V3/P1g6pe9HmiQ== X-Received: by 2002:a63:2ac9:: with SMTP id q192mr14686638pgq.58.1549544293499; Thu, 07 Feb 2019 04:58:13 -0800 (PST) Received: from localhost ([2402:3a80:c80:4138:75dd:3900:1d90:762f]) by smtp.gmail.com with ESMTPSA id i8sm22019348pfj.18.2019.02.07.04.58.12 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Thu, 07 Feb 2019 04:58:13 -0800 (PST) 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: [PATCH v1 11/24] drivers: thermal: tsens: Save reference to the device pointer and use it Date: Thu, 7 Feb 2019 16:19:29 +0530 Message-Id: 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 a82e4c928a78..aae3d71d7eed 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; @@ -135,7 +136,7 @@ int __init init_common(struct tsens_priv *priv) if (IS_ERR(srot_base)) return PTR_ERR(srot_base); - 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)) return PTR_ERR(priv->srot_map); @@ -150,11 +151,11 @@ int __init init_common(struct tsens_priv *priv) if (IS_ERR(tm_base)) return PTR_ERR(tm_base); - 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)) return PTR_ERR(priv->tm_map); - 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])) return PTR_ERR(priv->rf[TSENS_EN]); @@ -162,24 +163,24 @@ int __init init_common(struct tsens_priv *priv) if (ret) return ret; if (!enabled) { - dev_err(priv->dev, "tsens device is not enabled\n"); + dev_err(dev, "tsens device is not enabled\n"); return -ENODEV; } - 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])) return PTR_ERR(priv->rf[SENSOR_EN]); /* 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])) return PTR_ERR(priv->rf[j]); } 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])) return PTR_ERR(priv->rf[j]);