From patchwork Tue Aug 28 13:38:38 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Amit Kucheria X-Patchwork-Id: 145327 Delivered-To: patch@linaro.org Received: by 2002:a2e:1648:0:0:0:0:0 with SMTP id 8-v6csp1204594ljw; Tue, 28 Aug 2018 06:39:58 -0700 (PDT) X-Google-Smtp-Source: ANB0VdaKUIkPyoEgQ+xtB7PRdTWHIZ/OdN7SjpnVAry/+NOzILaIUsEmsVePPORKTqkcMUGyWyE8 X-Received: by 2002:a62:d94:: with SMTP id 20-v6mr1672897pfn.202.1535463598613; Tue, 28 Aug 2018 06:39:58 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1535463598; cv=none; d=google.com; s=arc-20160816; b=NXSXRlsBj6q7WPPgd7boMBeIldKFDQjSF17+zG/5//YhpNeCYL8mkoB0LnyGEBn3lM /hI+jb4PwWTX0NfkBPq/UIjxK7zLiSAf4tEC8majR6oOUO/Y1mYLg6+8m+YFy2yhAIw9 wZ0XVLKWEY2/WjBeLLKOJ105kLylG60QSAvyoIqW/zFSH6X4KnNKjw0+l9QW7oPtH842 ZSHvxbJgtMY0syQOONpHT0NW1wjxzC4v4Er/v1xEMC2kjY8JFj/A14RZUz5pee8qJea7 W4ht0ABRP0QUqIvACXPu1mX6jSq1TgQr7ed6G6sxSnflDXFUiawKL8s8IRI7JHMXC1pf zLAg== 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 :arc-authentication-results; bh=6G1iNig0jk2gQ+OjSL4nzNGU4I6h5Na2kNfcgaBgtf0=; b=OKL4NljM1U4Jj7QtzEZPIw/XuwDY9fFefOzb7sdgBvx8gAyjbRFiJwsr+aLXGbMFpo gm9hPpysBJCEO/jc8Saa9t6PWYzQKGdc4WNFpQyvMZDf5T9Sae7HlyUeaLxUV9eX2YzT Imuvd2cxcKe5O0J6/ipBAu3o66LipvR4MvLW26Ga2aSBzZCsxCGUat+vmeg712bghKvk O/H8zkCXak2eNJVliK+F/OQFM3sxw8h2dXZvDmzPeGol1r4Bv5Zhi/jYkuNnc7ef20iF 4gFO27PAKvC+prQvaY3jWe9x4KXakFlmgZagMA7qNLoPCkIVnM1QRnjUX9ZUgRgOpmFG g4QA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=Eb4c7RWQ; 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 g9-v6si1151575pli.494.2018.08.28.06.39.58; Tue, 28 Aug 2018 06:39:58 -0700 (PDT) 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=Eb4c7RWQ; 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 S1728248AbeH1Rbj (ORCPT + 32 others); Tue, 28 Aug 2018 13:31:39 -0400 Received: from mail-ed1-f65.google.com ([209.85.208.65]:35567 "EHLO mail-ed1-f65.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728224AbeH1Rbi (ORCPT ); Tue, 28 Aug 2018 13:31:38 -0400 Received: by mail-ed1-f65.google.com with SMTP id y20-v6so1409948edq.2 for ; Tue, 28 Aug 2018 06:39:55 -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=6G1iNig0jk2gQ+OjSL4nzNGU4I6h5Na2kNfcgaBgtf0=; b=Eb4c7RWQ0HDnwb0imz+jUBeT9ObIiZTeMJ/D6aRlYTsxAZyAsK0Jo7s2HZjtXRZLXA hNI4zmcpMsp8YgL9M7Drnulj/ZuldFOZdMm3zH7/A8X/i6Jo0OTRTtD4cR52SePyZkAQ ULCfs5OpjNm3HJeg9JQfnP0ntsDl/l8vpBS5E= 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=6G1iNig0jk2gQ+OjSL4nzNGU4I6h5Na2kNfcgaBgtf0=; b=nuRn+XTRWrKuabVcPfBQMWNbF2eoSqFKdSaypTI36+T73p5+IcZlpnNQHXYU42htzE tfdVjligr3Hw9kHUd5nYkegZK3KANNI5BxZoxoCfTuiF8pO7NBq8CIwqMuSR7SsW2FXZ iocP2jt6YzJB+6cSyHzVaVeee9kcwBMvrA2mRev61t0hLR4XIT0dOzMstemxuLUNPlpA w15jSCG8/DUG+5Ez25NAEdtvEmq9GKpFlKp9g676FlfFjvVBepsFhxAYG8XzcZAdwAuI DAqAVwwOE3yp/Il2YF2dHldGXbXAJzDEARfJW/E2nu1rxPb9PvBYn93lRVkQZkTILclG IEYw== X-Gm-Message-State: APzg51BBsqjSuvsu53GdFPP+EgztFRvR9pGsbiFXNBJmv6TJ3ovaUE+u ezYsKRW08TmV8SsfRZEBWHA6TyfMSNU= X-Received: by 2002:a50:9943:: with SMTP id l3-v6mr2570012edb.198.1535463594773; Tue, 28 Aug 2018 06:39:54 -0700 (PDT) Received: from localhost ([49.248.200.109]) by smtp.gmail.com with ESMTPSA id b39-v6sm598635edb.82.2018.08.28.06.39.52 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Tue, 28 Aug 2018 06:39:54 -0700 (PDT) From: Amit Kucheria To: linux-kernel@vger.kernel.org Cc: rnayak@codeaurora.org, linux-arm-msm@vger.kernel.org, bjorn.andersson@linaro.org, edubezval@gmail.com, smohanad@codeaurora.org, andy.gross@linaro.org, dianders@chromium.org, mka@chromium.org, Zhang Rui , Daniel Lezcano , linux-pm@vger.kernel.org Subject: [PATCH v2 09/11] thermal: tsens: Get rid of 'id' field Date: Tue, 28 Aug 2018 19:08:38 +0530 Message-Id: <6c23d113e19a9ddf9dc9def18943eaf7f5ad4d79.1535462942.git.amit.kucheria@linaro.org> 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 The hw_id field in 'struct tsens_sensor' can do the job of tracking unique ids for each sensor connected to each tsens device instance. It also allows hw_ids to be overridden (e.g. 8916) in cases where some sensors in a sequence are disabled on a particular platform. Use the hw_id field instead of the id field consistently across the tsens code. While we're at it, document the fields of struct tsens_sensor. Signed-off-by: Amit Kucheria Reviewed-by: Matthias Kaehlcke --- drivers/thermal/qcom/tsens.c | 5 ++--- drivers/thermal/qcom/tsens.h | 10 +++++++++- 2 files changed, 11 insertions(+), 4 deletions(-) -- 2.17.1 diff --git a/drivers/thermal/qcom/tsens.c b/drivers/thermal/qcom/tsens.c index 9a8e8f7b4ae1..fb728ec5d77f 100644 --- a/drivers/thermal/qcom/tsens.c +++ b/drivers/thermal/qcom/tsens.c @@ -17,7 +17,7 @@ static int tsens_get_temp(void *data, int *temp) const struct tsens_sensor *s = data; struct tsens_device *tmdev = s->tmdev; - return tmdev->ops->get_temp(tmdev, s->id, temp); + return tmdev->ops->get_temp(tmdev, s->hw_id, temp); } static int tsens_get_trend(void *p, int trip, enum thermal_trend *trend) @@ -26,7 +26,7 @@ static int tsens_get_trend(void *p, int trip, enum thermal_trend *trend) struct tsens_device *tmdev = s->tmdev; if (tmdev->ops->get_trend) - return tmdev->ops->get_trend(tmdev, s->id, trend); + return tmdev->ops->get_trend(tmdev, s->hw_id, trend); return -ENOTSUPP; } @@ -83,7 +83,6 @@ static int tsens_register(struct tsens_device *tmdev) for (i = 0; i < tmdev->num_sensors; i++) { tmdev->sensor[i].tmdev = tmdev; - tmdev->sensor[i].id = i; tzd = devm_thermal_zone_of_sensor_register(tmdev->dev, i, &tmdev->sensor[i], &tsens_of_ops); diff --git a/drivers/thermal/qcom/tsens.h b/drivers/thermal/qcom/tsens.h index b9c4bcf255fa..2a3174dfc1a9 100644 --- a/drivers/thermal/qcom/tsens.h +++ b/drivers/thermal/qcom/tsens.h @@ -14,11 +14,19 @@ struct tsens_device; +/** + * struct tsens_sensor - sensor-specific data + * @tmdev: tsens device instance this sensor is connected to + * @tzd: thermal zone corresponding to this sensor + * @offset: offset from calibration data to convert ADC data to degrees + * @hw_id: unique sensor ID for each sensor connected to tsens device instance + * @slope: slope from calibration data to convert ADC data to degrees + * @status: 8960-specific status register addresses + */ struct tsens_sensor { struct tsens_device *tmdev; struct thermal_zone_device *tzd; int offset; - int id; int hw_id; int slope; u32 status;