Received: by 2002:ac0:a5a7:0:0:0:0:0 with SMTP id m36-v6csp1986842imm; Thu, 9 Aug 2018 05:34:51 -0700 (PDT) X-Google-Smtp-Source: AA+uWPwF+OF+ozHendaivZkD86rwox/oBm2bwQYB7LchDoVHZm0Iv+IZBLSnjCdZ0FLA11EYYsCr X-Received: by 2002:a63:a502:: with SMTP id n2-v6mr2026858pgf.263.1533818091424; Thu, 09 Aug 2018 05:34:51 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1533818091; cv=none; d=google.com; s=arc-20160816; b=wPXmjXdxyWlWaKQdga6ggvEyaawlTLLIHeIzgKS+VNIHi+jBlqxuJB4R2XBQs3Bmdr AnTrodPR9InwXRCVeJKikaVWrACbXFNWAITuUC9PshluROmInutGu5dfrbnaGUb++T5S o0T9bR1Psdl6eg/fDgpmdlgSnIRGHYcd89tySP7qpJ9lfHYPPTKgp7pJKihwKmUvIOUi Z+k6Bv3WERm1WbVRJiySyeXY8xLfIBQLCIXGRe+TN4URngBbQgOYtF19CvZdjRUj5Jxb yzczGf6zILWEa2dDGYmOOp/dMCO9JFTUmkiVXHFsz5aVsFnKywwaiLjkRIu0h4EHFSQx xj6g== 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=Gct4lOuxYFWJ5iMbse3TfLVgnZuyuNabzMoHh2gRRuQ=; b=m6ppxjn5Bm7axWwXT7lUSvPMajm52JzYWhvSoWfGXVLqYNp+E7FtQwyCgfuRD8/J1n gGDROhGAmhDC8sLl8kxfm+6tb7Dzb1mAN9Tf8o/awccXDq8rvB6zXFOZvZQ5TM4BO0JA kzLeuyUAi0dSyMqFi4/c788JtThS0YAamQMGQEOnnfJ3kLtXHFr741ZisedeFOukYrbA VMkMEhLRD99ovLQmu5Xv+oXpBB6iW7VDWuc3U54+6coVDBHjj/xlKt/Sikz1AgAHeBOo uyCWojQ6vDqsvbpAh/mfIkW/fRKetCgqXVO9bTivYOVxmNJJNrhIzJjQ23MWiFTM2tIP /LDw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=SngJGovQ; 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 k11-v6si5334693pls.17.2018.08.09.05.34.36; Thu, 09 Aug 2018 05:34:51 -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=SngJGovQ; 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 S1732284AbeHIO6H (ORCPT + 99 others); Thu, 9 Aug 2018 10:58:07 -0400 Received: from mail-pg1-f196.google.com ([209.85.215.196]:41995 "EHLO mail-pg1-f196.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1732269AbeHIO6G (ORCPT ); Thu, 9 Aug 2018 10:58:06 -0400 Received: by mail-pg1-f196.google.com with SMTP id y4-v6so2689204pgp.9 for ; Thu, 09 Aug 2018 05:33:25 -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=Gct4lOuxYFWJ5iMbse3TfLVgnZuyuNabzMoHh2gRRuQ=; b=SngJGovQLy8KurtU6+ZIVcvxJ39PFS30jXQoqitXwU65m9c/yrARDeWfwwpnl7Z5HE VrcAh/dNNHLxiz2mdxOhTNKnpCLLEcaGcZDeBsF/IgizgMBqqKFf1ncFtwT3Sh1GDZmL 7knOvcTABQXmO1PSnC7s7LI8MbJWsFwaSG6Ps= 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=Gct4lOuxYFWJ5iMbse3TfLVgnZuyuNabzMoHh2gRRuQ=; b=R+aZGNglOi2aRTPFSoy1iCJu0/zxinjotxNV+Djzl2QOb5f4NKJpvHDhZh+kWIBaZn uQ2YjSVljypP3jaPKcfNWm++2IwNvnEsWfjlC1afpawoysNk9JDtM0r4syZSbXf4HTfB QjfGglVfHLm6kCBwxQEE7n4Jy+O9uVwICReO7o8VewEdjGjLBgBdw76Ly7qUPvFgSEIt 85AqM1ZWkMxMU9I36HO14YzhGjNHIFVCvgQnQZghDnqHLih+aOFiXLSTlxVmni2v9byv TNy9GyFq7Vs9V9RT8K6PumC0pDa3PIJ+Qkxcdj3tExzIHb0JHVAfMeo7pDpWENYd7pBU Nqyg== X-Gm-Message-State: AOUpUlEhCZ9Czo+63QQRhRdHOz3+fSYvWPfhyW1MVwivycOM4j5xPG82 5g/hkIweuOoXNQqpwqBT75IbfGdouEI= X-Received: by 2002:a62:5e45:: with SMTP id s66-v6mr2216120pfb.129.1533818004405; Thu, 09 Aug 2018 05:33:24 -0700 (PDT) Received: from localhost ([45.113.251.134]) by smtp.gmail.com with ESMTPSA id n9-v6sm12201171pfg.21.2018.08.09.05.33.23 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Thu, 09 Aug 2018 05:33:23 -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 , linux-pm@vger.kernel.org Subject: [PATCH v1 08/10] thermal: tsens: Get rid of 'id' field Date: Thu, 9 Aug 2018 18:02:40 +0530 Message-Id: <3810cbe6b499d265d7e3fb97c408cb80a12d5850.1533815718.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 --- drivers/thermal/qcom/tsens.c | 5 ++--- drivers/thermal/qcom/tsens.h | 10 +++++++++- 2 files changed, 11 insertions(+), 4 deletions(-) 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; -- 2.17.1