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: 157749 Delivered-To: patch@linaro.org Received: by 2002:a02:48:0:0:0:0:0 with SMTP id 69csp611667jaa; Thu, 7 Feb 2019 04:58:18 -0800 (PST) X-Google-Smtp-Source: AHgI3IYdBoW/0VR3HUz8Sj3SG7rYIc1wlz8Ueakun+CDUYIQKQDc0lRX79UdZPz67EENhPeOv6TM X-Received: by 2002:a17:902:32c3:: with SMTP id z61mr16292506plb.114.1549544298418; Thu, 07 Feb 2019 04:58:18 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1549544298; cv=none; d=google.com; s=arc-20160816; b=yu3Rgegs2tlTm8FZcR+RZ1fPDFe/E0HyejeU0ZRpk3gjCS/keUGhMwg2uff199wDHo AKnp/5Otm6Ntg7puKP6RmxZexuQScJdCAEJovldoU5uZb8C7BN9mRoRSpuyIXFsywJbR HE7crL4zdEHxP0j93m6Gz+3zD9/XjYjp4MKpmFrq/qmnL4LwtAQ6SFM3khMco9MM4Tyh kW8lpwCgPmfanL5OjxyWX4PJV3oxV/Z7e+fb6lrVgFOEQDMsXgRhManmltL3Y0wEJ5BF M3M3FbG5GtFgql+jcpv8LAMBBqb21Ty/DOzTsS8hE5b585LlovDlrzfVc+7AA8wBf19m 5+Gg== 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=DhOH74k9WLUHZ9bc4R59OvEiqm0NxoNRQ6D2mdU8GNA=; b=TAttd5DlWscPa8H5XXm/djJygOKDBoeI3VruniX1X5DZ/zvd0+1ANjQcCECt769l5H FoanPzsHdbRHs923o6gcNIHhx0Jcmf0VeNzQI3UcyrdfmImz3PfXYw8LyTRYTCnQymN0 XBSQ9bHEHZ+F/2THYWHhkC75lscIeiALPQVZdbY/v6XS8KL1W6jTW/w7RpjE3LtGXr/W v44LTS4pgkVXzp3QI+ribXrZCUZIJZhruZnBIGjGBX9ZU+JAXE6LG6EvJ3wFTWst5OFD i5arM+XU3g5CBc7Zxs9UveENzzuaDQfOXGu03WckMzyl3NjjLV1esvw1Mr+4np29zKeC 5tcQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b="JgfGa/xD"; 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 y29si8740000pgk.376.2019.02.07.04.58.18; Thu, 07 Feb 2019 04:58:18 -0800 (PST) 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="JgfGa/xD"; 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 S1727632AbfBGM6Q (ORCPT + 31 others); Thu, 7 Feb 2019 07:58:16 -0500 Received: from mail-pf1-f194.google.com ([209.85.210.194]:43114 "EHLO mail-pf1-f194.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727621AbfBGM6O (ORCPT ); Thu, 7 Feb 2019 07:58:14 -0500 Received: by mail-pf1-f194.google.com with SMTP id w73so4723567pfk.10 for ; Thu, 07 Feb 2019 04:58:14 -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=pql5bO+EURdZdqHavZ0BTmfJbp4FO3VfiV5mAN/vUJGx4VGlnBmjwbQBcU7mOTG4GX Ods7dYGwuxdiK8eRn/hOaPJPPSCXRCc+cJaH/o7oW7P+MRpPq0vwwtQxRX0udP9Ac81v AojDJB1fs7vbUQFfEDXsyvI5Qxh8I0xx+CmWlqhbR3Dd5AQbes5RC/F+UDk2zBvlqyOJ N+OJjgGzEiUtbBsY0N5id281Mq7VK7xfhfcfwScHxaXL4D4npT+j6t7x0rldJtGiy3B3 3crsjZc1HJ2Wh045pD9dqxzY5gf6AYg09uhx63yZP5Rsm8ifJ1Z/pUvje+BQNXuhI5tE tjcQ== X-Gm-Message-State: AHQUAuZ3MWznjT3AmFPPZgkT4n6GGVpYYOirE5v+Y/tnZ7lWv5nTNIGs BP+JDszyvWqdlgM8Oh4Uom/wQU1U/KE= 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-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@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 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]);