From patchwork Wed Oct 16 07:34:00 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Amit Kucheria X-Patchwork-Id: 176426 Delivered-To: patch@linaro.org Received: by 2002:a92:7e96:0:0:0:0:0 with SMTP id q22csp6992508ill; Wed, 16 Oct 2019 00:34:29 -0700 (PDT) X-Google-Smtp-Source: APXvYqwo+ghJlMVkT8tpFH3SX+iol0pqkyXfR9WQS1SzyRDxpxTthZSXE6T9573QL7gx4CGZmxbo X-Received: by 2002:aa7:d955:: with SMTP id l21mr37634226eds.179.1571211269035; Wed, 16 Oct 2019 00:34:29 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1571211269; cv=none; d=google.com; s=arc-20160816; b=Cdsk1CRfyF6Kn6lfroCCDNL/yaigPZUXi2BLU4wvKIMH1CFcGqSzti/NNMd9lgxmVU rhdEt/LcvvcxI/0jzJ6lX1+aMVFjP8DlSteTxSuMaRezmv5dIZqeWDfYKCcm3vd6zTE5 wli9eIcjgI/1jHRC2VkBEQpbRPL0wSLqc+kczrCsEtnO9jSNop4eWUuUILwkm/jPqN6e +1eZwfnRJeOJ1Molo0vsAz7a6P+FuEa0xvSswL1ru9oPRp/7gtfRnH9+YSsPPRvkQxnA hoQ3fdsnnNCs8cI7wqR+IfnwcEK3rS2+KZGURTkma0345CEZ9IClPad0nkAZqTtP/lLo H/lQ== 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=rO1z1JlGDHGdy6zVD5fls33iWqIXWjt9KmTfIa3Qj2w=; b=Jy8oWmLQojSuHHGJ1esY+Nel3bl4s8FSXKdX7GFppj1AHSUl1a4NJMlRbLsgBIUzWy 1BPRn8XzGMKlmrYn8JPWbRU6E62fRSB5XkJOiZQ9x1g6WyRKyyNHNSYDHs4DO9X+x/vT Ktch7qM3+cL/Xzd3Nb2Aq627qEJnETximjKTyCiVFKNqQy01nfUFpT8ZyNi/je2jyNMK LilhQgXzKNUeN3lT6qBJ9j4Laca3HIKnjMS8RpDB4YyDbGNz4H1YnQTuTTUAGD7qW6VY emzLVEVbOmFr2U6UShRVvXV0ujfIkPOlFDTivA6kTBmaG8HK5Q4bftlE7NoSjg2CXNLR pL2w== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=LzUjZmEp; spf=pass (google.com: best guess record for domain of linux-pm-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-pm-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 h43si15559069ede.142.2019.10.16.00.34.28; Wed, 16 Oct 2019 00:34:29 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-pm-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=LzUjZmEp; spf=pass (google.com: best guess record for domain of linux-pm-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-pm-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 S1732041AbfJPHe2 (ORCPT + 10 others); Wed, 16 Oct 2019 03:34:28 -0400 Received: from mail-pg1-f193.google.com ([209.85.215.193]:36258 "EHLO mail-pg1-f193.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1732033AbfJPHe1 (ORCPT ); Wed, 16 Oct 2019 03:34:27 -0400 Received: by mail-pg1-f193.google.com with SMTP id 23so13769970pgk.3 for ; Wed, 16 Oct 2019 00:34:27 -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=rO1z1JlGDHGdy6zVD5fls33iWqIXWjt9KmTfIa3Qj2w=; b=LzUjZmEpb4CTUq2TAze15TIpVNPb2PZBWKXXlGpSIhPM3RX/9Bu0Wrgugkkp90yLqT BfxN2xeveGkUuIU73q0mnw3Ech8CAmdOtynmdYGHsKBNCZQRoSab+Z4w3Gfh2eSAyaQC TsPy3rAJw8IgC92PZ8CkB+/FOioFXftl/mIa2RJBB5bjE/q0lBMg5IzZj8XVlUldPZj+ vV5+m5AToJemzw9OeoNCDDzdt9jdjFLwQMU7Q8XoXDHp53b96yxNQrAL7o8hpq6AHNAY HCo0S3C1mYgINkInHdzjMVtXnqV54cj7y0Jgaq/CxJINOepTF3rOji2yuv5X6SQJ8UdG ApyQ== 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=rO1z1JlGDHGdy6zVD5fls33iWqIXWjt9KmTfIa3Qj2w=; b=tqt8Kb0m33AsFv+0dXm4nkh97P1ctqOGbuUvMua0mugzuO6t8rZqavGb7RyyORCVaJ sfreELqwj79rW6nvoCq74hanU5Vwrj0Z0iDZ0f3MDRmKipRejyd7V7/o1A3EV7kxYjCj khLfdBIhNRj/mX9FYweLOrLUC1x3Xgi+wQQhdXV4bfqdiIyTcTEuICOKpqFi7MwQSacd MJphPrS7FNsd+r/5zm7pSVLlMEoPWxSCJzmZT4ssldWRbuuix9aGntvfV07P/8h9x8sk Th/x/TrxxVa+MHWVcRjW8XeKCVPM02HRW8IRFnkLhOM6+k+zZ9JCV1cnOHxSsQ0kKHYP jmKw== X-Gm-Message-State: APjAAAXXNI1AfjvKJjmJhgfGCHfY5Y6JLCTDbkg3WRMsziWyuEZfuT4Y peag8i1dp+LAcDhY1DrKfqUSTA== X-Received: by 2002:a63:8541:: with SMTP id u62mr41548173pgd.377.1571211266665; Wed, 16 Oct 2019 00:34:26 -0700 (PDT) Received: from localhost ([49.248.175.127]) by smtp.gmail.com with ESMTPSA id s141sm30601856pfs.13.2019.10.16.00.34.25 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Wed, 16 Oct 2019 00:34:26 -0700 (PDT) From: Amit Kucheria To: linux-kernel@vger.kernel.org, linux-arm-msm@vger.kernel.org, bjorn.andersson@linaro.org, edubezval@gmail.com, agross@kernel.org, masneyb@onstation.org, swboyd@chromium.org, Amit Kucheria , Daniel Lezcano , Mark Rutland , Rob Herring , Zhang Rui Cc: linux-pm@vger.kernel.org Subject: [PATCH 01/15] drivers: thermal: tsens: Get rid of id field in tsens_sensor Date: Wed, 16 Oct 2019 13:04:00 +0530 Message-Id: <30206cd47d303d2dcaef87f4e3c7173481a0bddd.1571210269.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 There are two fields - id and hw_id - to track what sensor an action was to performed on. This was because the sensors connected to a TSENS IP might not be contiguous i.e. 1, 2, 4, 5 with 3 being skipped. This causes confusion in the code which uses hw_id sometimes and id other times (tsens_get_temp, tsens_get_trend). Switch to only using the hw_id field to track the physical ID of the sensor. When we iterate through all the sensors connected to an IP block, we use an index i to loop through the list of sensors, and then return the actual hw_id that is registered on that index. Signed-off-by: Amit Kucheria Reviewed-by: Stephen Boyd Reviewed-by: Daniel Lezcano --- drivers/thermal/qcom/tsens-8960.c | 4 ++-- drivers/thermal/qcom/tsens-common.c | 16 +++++++++------- drivers/thermal/qcom/tsens.c | 11 +++++------ drivers/thermal/qcom/tsens.h | 10 ++++------ 4 files changed, 20 insertions(+), 21 deletions(-) -- 2.17.1 diff --git a/drivers/thermal/qcom/tsens-8960.c b/drivers/thermal/qcom/tsens-8960.c index e46a4e3f25c4..fb77acb8d13b 100644 --- a/drivers/thermal/qcom/tsens-8960.c +++ b/drivers/thermal/qcom/tsens-8960.c @@ -245,11 +245,11 @@ static inline int code_to_mdegC(u32 adc_code, const struct tsens_sensor *s) return adc_code * slope + offset; } -static int get_temp_8960(struct tsens_priv *priv, int id, int *temp) +static int get_temp_8960(struct tsens_sensor *s, int *temp) { int ret; u32 code, trdy; - const struct tsens_sensor *s = &priv->sensor[id]; + struct tsens_priv *priv = s->priv; unsigned long timeout; timeout = jiffies + usecs_to_jiffies(TIMEOUT_US); diff --git a/drivers/thermal/qcom/tsens-common.c b/drivers/thermal/qcom/tsens-common.c index 528df8801254..c037bdf92c66 100644 --- a/drivers/thermal/qcom/tsens-common.c +++ b/drivers/thermal/qcom/tsens-common.c @@ -83,11 +83,12 @@ static inline int code_to_degc(u32 adc_code, const struct tsens_sensor *s) return degc; } -int get_temp_tsens_valid(struct tsens_priv *priv, int i, int *temp) +int get_temp_tsens_valid(struct tsens_sensor *s, int *temp) { - struct tsens_sensor *s = &priv->sensor[i]; - u32 temp_idx = LAST_TEMP_0 + s->hw_id; - u32 valid_idx = VALID_0 + s->hw_id; + struct tsens_priv *priv = s->priv; + int hw_id = s->hw_id; + u32 temp_idx = LAST_TEMP_0 + hw_id; + u32 valid_idx = VALID_0 + hw_id; u32 last_temp = 0, valid, mask; int ret; @@ -123,12 +124,13 @@ int get_temp_tsens_valid(struct tsens_priv *priv, int i, int *temp) return 0; } -int get_temp_common(struct tsens_priv *priv, int i, int *temp) +int get_temp_common(struct tsens_sensor *s, int *temp) { - struct tsens_sensor *s = &priv->sensor[i]; + struct tsens_priv *priv = s->priv; + int hw_id = s->hw_id; int last_temp = 0, ret; - ret = regmap_field_read(priv->rf[LAST_TEMP_0 + s->hw_id], &last_temp); + ret = regmap_field_read(priv->rf[LAST_TEMP_0 + hw_id], &last_temp); if (ret) return ret; diff --git a/drivers/thermal/qcom/tsens.c b/drivers/thermal/qcom/tsens.c index 0627d8615c30..6ed687a6e53c 100644 --- a/drivers/thermal/qcom/tsens.c +++ b/drivers/thermal/qcom/tsens.c @@ -14,19 +14,19 @@ static int tsens_get_temp(void *data, int *temp) { - const struct tsens_sensor *s = data; + struct tsens_sensor *s = data; struct tsens_priv *priv = s->priv; - return priv->ops->get_temp(priv, s->id, temp); + return priv->ops->get_temp(s, temp); } static int tsens_get_trend(void *data, int trip, enum thermal_trend *trend) { - const struct tsens_sensor *s = data; + struct tsens_sensor *s = data; struct tsens_priv *priv = s->priv; if (priv->ops->get_trend) - return priv->ops->get_trend(priv, s->id, trend); + return priv->ops->get_trend(s, trend); return -ENOTSUPP; } @@ -86,8 +86,7 @@ static int tsens_register(struct tsens_priv *priv) for (i = 0; i < priv->num_sensors; i++) { priv->sensor[i].priv = priv; - priv->sensor[i].id = i; - tzd = devm_thermal_zone_of_sensor_register(priv->dev, i, + tzd = devm_thermal_zone_of_sensor_register(priv->dev, priv->sensor[i].hw_id, &priv->sensor[i], &tsens_of_ops); if (IS_ERR(tzd)) diff --git a/drivers/thermal/qcom/tsens.h b/drivers/thermal/qcom/tsens.h index b89083b61c38..84e5447c5686 100644 --- a/drivers/thermal/qcom/tsens.h +++ b/drivers/thermal/qcom/tsens.h @@ -32,7 +32,6 @@ enum tsens_ver { * @priv: tsens device instance that this sensor is connected to * @tzd: pointer to the thermal zone that this sensor is in * @offset: offset of temperature adjustment curve - * @id: Sensor ID * @hw_id: HW ID can be used in case of platform-specific IDs * @slope: slope of temperature adjustment curve * @status: 8960-specific variable to track 8960 and 8660 status register offset @@ -41,7 +40,6 @@ struct tsens_sensor { struct tsens_priv *priv; struct thermal_zone_device *tzd; int offset; - unsigned int id; unsigned int hw_id; int slope; u32 status; @@ -62,13 +60,13 @@ struct tsens_ops { /* mandatory callbacks */ int (*init)(struct tsens_priv *priv); int (*calibrate)(struct tsens_priv *priv); - int (*get_temp)(struct tsens_priv *priv, int i, int *temp); + int (*get_temp)(struct tsens_sensor *s, int *temp); /* optional callbacks */ int (*enable)(struct tsens_priv *priv, int i); void (*disable)(struct tsens_priv *priv); int (*suspend)(struct tsens_priv *priv); int (*resume)(struct tsens_priv *priv); - int (*get_trend)(struct tsens_priv *priv, int i, enum thermal_trend *trend); + int (*get_trend)(struct tsens_sensor *s, enum thermal_trend *trend); }; #define REG_FIELD_FOR_EACH_SENSOR11(_name, _offset, _startbit, _stopbit) \ @@ -314,8 +312,8 @@ struct tsens_priv { char *qfprom_read(struct device *dev, const char *cname); void compute_intercept_slope(struct tsens_priv *priv, u32 *pt1, u32 *pt2, u32 mode); int init_common(struct tsens_priv *priv); -int get_temp_tsens_valid(struct tsens_priv *priv, int i, int *temp); -int get_temp_common(struct tsens_priv *priv, int i, int *temp); +int get_temp_tsens_valid(struct tsens_sensor *s, int *temp); +int get_temp_common(struct tsens_sensor *s, int *temp); /* TSENS target */ extern const struct tsens_plat_data data_8960; From patchwork Wed Oct 16 07:34:01 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Amit Kucheria X-Patchwork-Id: 176427 Delivered-To: patch@linaro.org Received: by 2002:a92:7e96:0:0:0:0:0 with SMTP id q22csp6992641ill; Wed, 16 Oct 2019 00:34:37 -0700 (PDT) X-Google-Smtp-Source: APXvYqyMhllFNk3XVsv5O0Hjna9MYoisa8mSaEBEOSMd+dZtEEj0Ff9CH589KhYDkW8xn9zu1m2O X-Received: by 2002:a17:906:1d02:: with SMTP id n2mr37985341ejh.303.1571211277064; Wed, 16 Oct 2019 00:34:37 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1571211277; cv=none; d=google.com; s=arc-20160816; b=TEkWi0vZG4awGOx5WKGHcfa6LbUtPh6jySgLHUtvdHaQwkXBmU+/qmPSr8irEgZyvS 6U0PWM5muFNH0AH/KhbvdDnVFZspPf3f58HXZn7L9GyymkBV9qMJaE8nnajp2DQ+XKhy eNzUia76DZsBMBeS4ywzKrrNxcqQoD53goeUzq/tXkvpft0XoTretXMFrKOgvc+gzVJH LOpMfJd52g4/SYxZcRa2ZMkjsk6R1Ry1m0/RFUWD/4yPAcieyB1DL8J8/91l4/SHle9/ 3D6zA/fbeEIZHcwqyBZRxcA2iT14SozpULKaQXwOT4U9DC3fwtgEXNep/aPr/dEt80cz ldMw== 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=BcKGfqptsJMIyqg8m+kdv7mwKKvvYfua8/fbCWYYrS8=; b=JaGoowrMcZ7vZDnJsoBjpYURT7ml55lj/Axup1bZFILRjstjWKIzOaqcBN7kPh5fUg UfoLGigW1RaXBjK8Ca5Lsie8zF05OObmcSoGvtcMU4qlNS680el5m+wNcgT7fBNc6PPi d3kKkJomTJmfFbAHSP43oaijkPfG0ZRkqCk2749nltpzuIVCgwkNfujZGBXI2vtC7NK/ xE/B0zfiwKm3N3XLMswx79U2woWOE7y4Q3UEAZk7LyWaEh6oJLgzWo7EYHPWuSRi3nVS vkxZyVxPFgVaCD7skPIvDHZeLK16argZXaem5Djr9IO0oBfXVf5i1xtr1XXye4qPuhXC yEXQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=zr8Jj6FL; spf=pass (google.com: best guess record for domain of linux-pm-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-pm-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 b25si15461161ejb.49.2019.10.16.00.34.36; Wed, 16 Oct 2019 00:34:37 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-pm-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=zr8Jj6FL; spf=pass (google.com: best guess record for domain of linux-pm-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-pm-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 S1732347AbfJPHeb (ORCPT + 10 others); Wed, 16 Oct 2019 03:34:31 -0400 Received: from mail-pf1-f195.google.com ([209.85.210.195]:34158 "EHLO mail-pf1-f195.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1732309AbfJPHeb (ORCPT ); Wed, 16 Oct 2019 03:34:31 -0400 Received: by mail-pf1-f195.google.com with SMTP id b128so14177122pfa.1 for ; Wed, 16 Oct 2019 00:34:30 -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=BcKGfqptsJMIyqg8m+kdv7mwKKvvYfua8/fbCWYYrS8=; b=zr8Jj6FLnbAxHmN67Iiq1ZcLMchv+Ks/Xp8pWezcbvbe+OApPGXcik/g3TNk3LpCdn WqiMviPLfH4XpdhwwAjIO0HcaT+jzOcX1q19E/1nhHn4RLP03eszEg5BwAv95ODScHzl JZmDR3UbqSJzvqzT8KUI1AEZZgg+FUOEvnXpRfbq1Z+6/U7JBZLYCt1cwitQd0wmLkEA AKngyASWhgcLKrJNFfYpZfi9yZSyBTJX6NCr2Xyk6ck1mmcSjHH1UqHvZ3Cubx0wclSo /yJy0+zURpm9IagVQz5jHEmUPlKj0gbgX2093XrBsL3LVGxRTuvRHwsgexb+USPuV9WW fdwg== 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=BcKGfqptsJMIyqg8m+kdv7mwKKvvYfua8/fbCWYYrS8=; b=UoYIqY/6kT84SwpGaregCN/TpEqGjJb6Vd2tKh+f/wVnYJHUT9Pq4twY/vtwxdglpi 2TBzRb58i9AlDhBfIfxBqKYnZbtqjkqTZM9VxTDn5nC1U0E6dgL9VRwflgdfyaJG6kcU mInppNFMgtVS+frzW3Q1dJo+649Kny8RNoyh6mO7MjDOKsjOKxv14ueTAjXtiswewIfm 2KZqAKaCIrD2lojmKOMZl1fDhlxy7lx6UKlKwPliGeOtv07VKhEq8P6ZFtTG2Yqsb7DE Z91ZSOL6C6+czEQpKpm4rkVcXhlblCYS/wgtUB2GscHYvmBSLU3nq/cGfZVaPRoYIVLG AMkA== X-Gm-Message-State: APjAAAUmBZwVwMoyrB5wzT3dk1bG6AyBbZmkoXYHpl4Y5914BkUwsgt6 HuvVstktBXcSWaJnEZn7Ti72iQ== X-Received: by 2002:a63:1423:: with SMTP id u35mr5608555pgl.122.1571211270181; Wed, 16 Oct 2019 00:34:30 -0700 (PDT) Received: from localhost ([49.248.175.127]) by smtp.gmail.com with ESMTPSA id h186sm31611631pfb.63.2019.10.16.00.34.29 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Wed, 16 Oct 2019 00:34:29 -0700 (PDT) From: Amit Kucheria To: linux-kernel@vger.kernel.org, linux-arm-msm@vger.kernel.org, bjorn.andersson@linaro.org, edubezval@gmail.com, agross@kernel.org, masneyb@onstation.org, swboyd@chromium.org, Amit Kucheria , Daniel Lezcano , Mark Rutland , Rob Herring , Zhang Rui Cc: linux-pm@vger.kernel.org Subject: [PATCH 02/15] drivers: thermal: tsens: Simplify code flow in tsens_probe Date: Wed, 16 Oct 2019 13:04:01 +0530 Message-Id: <184422dcc1c12553e71a58c62e01425fd7d1172a.1571210269.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 Move platform_set_drvdata up to avoid an extra 'if (ret)' check after the call to tsens_register. Signed-off-by: Amit Kucheria Reviewed-by: Stephen Boyd Reviewed-by: Daniel Lezcano --- drivers/thermal/qcom/tsens.c | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) -- 2.17.1 diff --git a/drivers/thermal/qcom/tsens.c b/drivers/thermal/qcom/tsens.c index 6ed687a6e53c..542a7f8c3d96 100644 --- a/drivers/thermal/qcom/tsens.c +++ b/drivers/thermal/qcom/tsens.c @@ -149,6 +149,8 @@ static int tsens_probe(struct platform_device *pdev) priv->feat = data->feat; priv->fields = data->fields; + platform_set_drvdata(pdev, priv); + if (!priv->ops || !priv->ops->init || !priv->ops->get_temp) return -EINVAL; @@ -167,11 +169,7 @@ static int tsens_probe(struct platform_device *pdev) } } - ret = tsens_register(priv); - - platform_set_drvdata(pdev, priv); - - return ret; + return tsens_register(priv); } static int tsens_remove(struct platform_device *pdev) From patchwork Wed Oct 16 07:34:02 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Amit Kucheria X-Patchwork-Id: 176428 Delivered-To: patch@linaro.org Received: by 2002:a92:7e96:0:0:0:0:0 with SMTP id q22csp6992666ill; Wed, 16 Oct 2019 00:34:38 -0700 (PDT) X-Google-Smtp-Source: APXvYqy09HI7tIu/0IC0fL2yBvz51pJ6Sf1LhiC6CGXShpt7mU6FJhDV6Aic/gVobW+xHoUNc9Ju X-Received: by 2002:a17:906:7e17:: with SMTP id e23mr31278919ejr.205.1571211278173; Wed, 16 Oct 2019 00:34:38 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1571211278; cv=none; d=google.com; s=arc-20160816; b=cRw4fFsl25Gay1WzTxPixgqa+E3u1f2strLnb/FYrp5Z9OZCgzFDfupr4C/6qcOSd5 DdJIKns7XwY4zOqIuE+7IyRujLfhsclezgvndvNl2fTvBHlr/hV9A1Ozeb+jdg/JTd2S S1q4h89kClJQWIjX7zqIMrRBXnB4lTL6UPd6LIox6JjqsfnhmXF+tul2Ly3Ibk9S3l1v G4TFKDeNuVD+lNqWy7yXVyrttYI5JVPtlFfWjk0TrhJ11fgkdOPhtAIprvqU2ZLeEy12 M2xcFg4EX0gL1tJQ/vDsmxvE083yuqKa6cAhS+K0XTfnPIwhybx7aoiQeudEXmjspnRJ YhVg== 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=4RhmNFrAjG8zCFd7O6KRoEzlzkP2xNrQ5XZHUG6WYMo=; b=G2iZMxc+qO9WGku2UoCIoW2eq8b+YgZKruKWjqFcvhyiF93zDq830BLC5LsLTFrAM5 5S8p45rEfbdzc9oVkDQnYh+Ml/WCj+uTpWfvHXzlWMwUkzHqDqwRHi/riSF7YG+zZwkw D11yd8y/zYP2pXvntHY4eprzPwNxAIt/j0bmGUqMbnI8JMGwHoJjGJjrDGwXuVx5yCBM wmCEq3xsIQRqeQdCgT4aYPxgXzznQVRSf3Tns+TyXm14QP4wi2bwnRDEKNA3KniCsQWI l1VfXTYpPzAIN1du0wuM90XBAPLoN4OZHIKnmGSIQoJFbPn2jaFNW4JYec/2R4WB5p2z OL1A== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=dCFBysYD; spf=pass (google.com: best guess record for domain of linux-pm-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-pm-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 b25si15461161ejb.49.2019.10.16.00.34.38; Wed, 16 Oct 2019 00:34:38 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-pm-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=dCFBysYD; spf=pass (google.com: best guess record for domain of linux-pm-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-pm-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 S1732040AbfJPHeg (ORCPT + 10 others); Wed, 16 Oct 2019 03:34:36 -0400 Received: from mail-pg1-f193.google.com ([209.85.215.193]:44512 "EHLO mail-pg1-f193.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1732511AbfJPHee (ORCPT ); Wed, 16 Oct 2019 03:34:34 -0400 Received: by mail-pg1-f193.google.com with SMTP id e10so9765570pgd.11 for ; Wed, 16 Oct 2019 00:34:34 -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=4RhmNFrAjG8zCFd7O6KRoEzlzkP2xNrQ5XZHUG6WYMo=; b=dCFBysYDMtrZWkaWVSQ6gElCAcOUUOzQjnnzXReacAYDRsxxrF6pcSz2vUYJL2wuyb 9lXXXGhU0BnfZrvH5fd1wExIx5HcCvOX5JGZ4kjGJX9YY0aRYxUxKBGfxDgVQI1iHugg lu39ANrG4dMc9P1lRSw56+WhLI5wNhtgGm/2prvVjbTjP8NW7NpOg2A2eiawKKhwC72x iajf+VznJ8/MDK2d63PJKKAkokdpE93pXoonLw+cvsX8gg/1dsGHv38NR4OHfVYqamx5 vmy/y4e2rRfHTyjaN3x5ShfIykPkVL6Q8F5fsnR9ZtSAbcm+cpihcfVCxzl7SqvXiBri 25Qg== 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=4RhmNFrAjG8zCFd7O6KRoEzlzkP2xNrQ5XZHUG6WYMo=; b=D7HDh3fgYq5TOzjF+NI/TYOvV4iBeMChoIHS+YUebRATY9O4vgUGuFM5Rqs9KQ1OYZ kO6ac5tpND9m50Xn/Qkl5vIfxRC6r2bSEWWgFHniNflBlBmVn01vPcz0iKjWuj4uWS5G zj/myKtW5Z6Sj8VDkM3tfd1Dr7TRCuqI8Feh6ZUrN53B1D5BmR+iSg1MVVJtwjTolBNa 3kpQS0Ttp5I0YY7l5+kIl/2H8aWaTA4pqTvN0wzINzgC8vCPvkICkOcgqaULZbM14hgJ pNDzwpAatnzVHu5WaNo4FIVTxJ2vubH/HYLELnmF+VwJF90Jt5kDqMPPBg9tL93xEfsI 4wog== X-Gm-Message-State: APjAAAWoL7xEDe+QRUmaQSjBwAGxlqBdEewS9hntULmUll4j5PnafeAM DQ6F8gyGhGrXVZ1+fmmEv4dIpA== X-Received: by 2002:a63:1e04:: with SMTP id e4mr22427676pge.4.1571211273858; Wed, 16 Oct 2019 00:34:33 -0700 (PDT) Received: from localhost ([49.248.175.127]) by smtp.gmail.com with ESMTPSA id k124sm12361970pga.83.2019.10.16.00.34.32 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Wed, 16 Oct 2019 00:34:33 -0700 (PDT) From: Amit Kucheria To: linux-kernel@vger.kernel.org, linux-arm-msm@vger.kernel.org, bjorn.andersson@linaro.org, edubezval@gmail.com, agross@kernel.org, masneyb@onstation.org, swboyd@chromium.org, Amit Kucheria , Daniel Lezcano , Mark Rutland , Rob Herring , Zhang Rui Cc: linux-pm@vger.kernel.org Subject: [PATCH 03/15] drivers: thermal: tsens: Add __func__ identifier to debug statements Date: Wed, 16 Oct 2019 13:04:02 +0530 Message-Id: <18717de35f31098d3ebc12564c2767b6d54d37d8.1571210269.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 Printing the function name when enabling debugging makes logs easier to read. Signed-off-by: Amit Kucheria Reviewed-by: Stephen Boyd Reviewed-by: Daniel Lezcano --- drivers/thermal/qcom/tsens-common.c | 8 ++++---- drivers/thermal/qcom/tsens.c | 6 +++--- 2 files changed, 7 insertions(+), 7 deletions(-) -- 2.17.1 diff --git a/drivers/thermal/qcom/tsens-common.c b/drivers/thermal/qcom/tsens-common.c index c037bdf92c66..7437bfe196e5 100644 --- a/drivers/thermal/qcom/tsens-common.c +++ b/drivers/thermal/qcom/tsens-common.c @@ -42,8 +42,8 @@ void compute_intercept_slope(struct tsens_priv *priv, u32 *p1, for (i = 0; i < priv->num_sensors; i++) { dev_dbg(priv->dev, - "sensor%d - data_point1:%#x data_point2:%#x\n", - i, p1[i], p2[i]); + "%s: sensor%d - data_point1:%#x data_point2:%#x\n", + __func__, i, p1[i], p2[i]); priv->sensor[i].slope = SLOPE_DEFAULT; if (mode == TWO_PT_CALIB) { @@ -60,7 +60,7 @@ void compute_intercept_slope(struct tsens_priv *priv, u32 *p1, priv->sensor[i].offset = (p1[i] * SLOPE_FACTOR) - (CAL_DEGC_PT1 * priv->sensor[i].slope); - dev_dbg(priv->dev, "offset:%d\n", priv->sensor[i].offset); + dev_dbg(priv->dev, "%s: offset:%d\n", __func__, priv->sensor[i].offset); } } @@ -209,7 +209,7 @@ int __init init_common(struct tsens_priv *priv) if (ret) goto err_put_device; if (!enabled) { - dev_err(dev, "tsens device is not enabled\n"); + dev_err(dev, "%s: device not enabled\n", __func__); ret = -ENODEV; goto err_put_device; } diff --git a/drivers/thermal/qcom/tsens.c b/drivers/thermal/qcom/tsens.c index 542a7f8c3d96..06c6bbd69a1a 100644 --- a/drivers/thermal/qcom/tsens.c +++ b/drivers/thermal/qcom/tsens.c @@ -127,7 +127,7 @@ static int tsens_probe(struct platform_device *pdev) of_property_read_u32(np, "#qcom,sensors", &num_sensors); if (num_sensors <= 0) { - dev_err(dev, "invalid number of sensors\n"); + dev_err(dev, "%s: invalid number of sensors\n", __func__); return -EINVAL; } @@ -156,7 +156,7 @@ static int tsens_probe(struct platform_device *pdev) ret = priv->ops->init(priv); if (ret < 0) { - dev_err(dev, "tsens init failed\n"); + dev_err(dev, "%s: init failed\n", __func__); return ret; } @@ -164,7 +164,7 @@ static int tsens_probe(struct platform_device *pdev) ret = priv->ops->calibrate(priv); if (ret < 0) { if (ret != -EPROBE_DEFER) - dev_err(dev, "tsens calibration failed\n"); + dev_err(dev, "%s: calibration failed\n", __func__); return ret; } }