From patchwork Thu Aug 9 12:32:36 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Amit Kucheria X-Patchwork-Id: 143832 Delivered-To: patch@linaro.org Received: by 2002:a2e:9754:0:0:0:0:0 with SMTP id f20-v6csp2038500ljj; Thu, 9 Aug 2018 05:33:13 -0700 (PDT) X-Google-Smtp-Source: AA+uWPyIghhijZ0dTSRa/ZG33qRyveuNxYg4b9+sUYVbyoQAWdktypHNzZUNSnOFz+FMhby0NFC0 X-Received: by 2002:a17:902:158b:: with SMTP id m11-v6mr1976467pla.102.1533817993066; Thu, 09 Aug 2018 05:33:13 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1533817993; cv=none; d=google.com; s=arc-20160816; b=FLnHBX3MumfBmRhnnYzD2aO/N87ji8QYiLzKY1sL/bWcxOy92QPh9rjr82QjThc+Yp jkZTGBxtPOl2vEy7tWWptT6IoFmMpq5TlZJM64J7YzmupYE5O9kTTeHcwkWH2q1UYe9k dQtfmwoj/6GCJWFARwb/kXFbM51f2VAp3EXsxM/SDuQ7uB/+xI6UZzM+BzA8DxZW5AlW 0OVdRyzgMLAZzJE/B9iPozkb+kbeoR47fpusCEsb0QKI8wZKH22KzcsyQpuJvHYdPdFi Eo696/b2xpmBkWksg6tca3DW9jPHMdSKcRe3MLV1GCnjkumImMuMTZLgb2v2Et07l4io gUEw== 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=LajXdiR+UMjFusLCr0IrH9cyGv2mk15+PoiKf/4cna4=; b=mcM1iui1EbaI9AvGZKqAjPrVvhrLbaYGcr2+M9/q34j3MfUSQXgiP6LjcYlCHFDjeY kNtBJuu8BBrXn3iloY66rM/UpRFCg3f1Kdq0pSDjCPCl+5iHxbDfLTvbn2hBt0fs3xBy /24W9/JcM8Ut48dtHVmDLBQKfuFDZYlH1iQwhc0H3oqWzzkNt8WLc7XUcsI/sCsz9/M8 ApXw1KNN6uVEMRXlIcUAaHDVbLn8Fw4WP22mRh5r8CggWJ38cRGJDmLdrog9EfRlpo+X gsJR7P8w2Bnx93+jxZJ8ZKGIjHHXie5OjnGRYArqJeEIkdqWcHvN93/VDO/csaQda9qN 1lRw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=dp3z1FdW; 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 w15-v6si5541686ply.501.2018.08.09.05.33.12; Thu, 09 Aug 2018 05:33:13 -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=dp3z1FdW; 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 S1732139AbeHIO5w (ORCPT + 10 others); Thu, 9 Aug 2018 10:57:52 -0400 Received: from mail-pg1-f195.google.com ([209.85.215.195]:38419 "EHLO mail-pg1-f195.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1732136AbeHIO5w (ORCPT ); Thu, 9 Aug 2018 10:57:52 -0400 Received: by mail-pg1-f195.google.com with SMTP id k3-v6so2695761pgq.5 for ; Thu, 09 Aug 2018 05:33:10 -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=LajXdiR+UMjFusLCr0IrH9cyGv2mk15+PoiKf/4cna4=; b=dp3z1FdWV+2UM/p9OwFhQgpvGV9I72sQcZflwuQf1PLFveTjtGNRmQRLkaqTvrlLZG Kle5slvSSIksbdlO2jCJIJLCf4OoH1XLPjsxpBKiEldKEGwFKXEMyc6k80Hlm2OGIiVv UK43GFrevkBifNAgnt2y+h3hEQ09q4Lde6deg= 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=LajXdiR+UMjFusLCr0IrH9cyGv2mk15+PoiKf/4cna4=; b=ttaG0G6gPdtCgViC1Bqp/pV202YbHZh32seux0x20GhyPSrxDKoiEZgzh/HyQJm9ne sTI8VePeBxvL/pNO+M59kAi0YFJMHWmqDxZwXlCOSCINaVZvYXIylEndGCb7+I+ngUzd Dmsfqe0KIY24q7gZ+rPnek1JXKkUs3HZ0kL22Np9udb8kI2LWOOhAvfKppuXgdk16TbG RaUDfjMNyo8cLNxayB+lVUTfeSSzTCv2No42gC3va3I2UdXCe25PLNcaGV96a7KzxQoO tDV21Hw8wv5X7n8GkRccSbtoaVECHWxjBqgR1nedHn1czdoNkRRwgF0N8kBHuYygLiKn GlQQ== X-Gm-Message-State: AOUpUlFGF6Epcc9IdUTMLES4Yo3IvCLokEOPUOnsbYW3rt4dq+dQo/Br ZBsy9q+g8QjVW4SVPWX/eM3Rng== X-Received: by 2002:a63:5660:: with SMTP id g32-v6mr2029301pgm.227.1533817990565; Thu, 09 Aug 2018 05:33:10 -0700 (PDT) Received: from localhost ([45.113.251.134]) by smtp.gmail.com with ESMTPSA id i28-v6sm11592220pfk.108.2018.08.09.05.33.09 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Thu, 09 Aug 2018 05:33:09 -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 04/10] thermal: tsens: Get rid of dead code Date: Thu, 9 Aug 2018 18:02:36 +0530 Message-Id: <0f945a83190de17df94a1bfcab48e6a86805cc9b.1533815718.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 hw_id is dynamically allocated but not used anywhere. Get rid of dead code. Signed-off-by: Amit Kucheria --- drivers/thermal/qcom/tsens.c | 5 ----- 1 file changed, 5 deletions(-) -- 2.17.1 Reviewed-by: Matthias Kaehlcke diff --git a/drivers/thermal/qcom/tsens.c b/drivers/thermal/qcom/tsens.c index 90bb431cf740..9a8e8f7b4ae1 100644 --- a/drivers/thermal/qcom/tsens.c +++ b/drivers/thermal/qcom/tsens.c @@ -80,11 +80,6 @@ static int tsens_register(struct tsens_device *tmdev) { int i; struct thermal_zone_device *tzd; - u32 *hw_id, n = tmdev->num_sensors; - - hw_id = devm_kcalloc(tmdev->dev, n, sizeof(u32), GFP_KERNEL); - if (!hw_id) - return -ENOMEM; for (i = 0; i < tmdev->num_sensors; i++) { tmdev->sensor[i].tmdev = tmdev; From patchwork Thu Aug 9 12:32:39 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Amit Kucheria X-Patchwork-Id: 143835 Delivered-To: patch@linaro.org Received: by 2002:a2e:9754:0:0:0:0:0 with SMTP id f20-v6csp2038691ljj; Thu, 9 Aug 2018 05:33:23 -0700 (PDT) X-Google-Smtp-Source: AA+uWPytXCPVcmTVv39N5mdPuPJN63kOSFp1Pf1vgMvewflWaH5SCHJYhkWgmyKRLOo50HkFO/96 X-Received: by 2002:a17:902:74c2:: with SMTP id f2-v6mr1914949plt.260.1533818003367; Thu, 09 Aug 2018 05:33:23 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1533818003; cv=none; d=google.com; s=arc-20160816; b=qJCrAJgoKluwU/PTDUUGG6dJGwkQSjB7k34xuxJ+VX6LMMpbKBTDt0U6FbLJyKwxfU IwEPGuHpO3X6cZ0evqehGQMOSm0d7m+8rW5vql/FHMCmcvDZ9+yg6awDW9U9ptKBK8cV qpvEKJ0Bqc8je4iMwWapLXZ+qWWDi0NH3LWlC9yWzsMs818qtQMlphkxKfGHPpKHnhHt 7GIFHCqIaCFzM1/h8eXEcNtnQgsT8XW4Nx/l7TEkQf2WCa7iGmYKglT63v5h0lxa1nuV pUpxg6UZlDCSzVUeiBtkqF5wpqy9QlY6kb22GnB+P48q7s1bNtCIzZDni2y1MZQp5IWf y3aQ== 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=njW6jAZWOPdw7KJ/kbY+W+hKS572y0dkgyYwoknGJBU=; b=ssFzQhXAqL5/8wCjTh2YuAtHH9A+saw4YW2/AAQBY/1JastivMfURvk+yW+lCeUC2w gVyIWURDlbJZe4P6CMZ1v/gLJDJcIwDT67hrcU2PYDbLzHxTXYcFHTvI78r563Jl3uBy Gmc0bEiJDqU0jIQXo0UNOhXW5BKkzyCP7JABmKSxPIZh6OiRJoycBXGc9C+hYlm5u9bU SYG/EDwF+L5lyal+GTVumQV690hr91P4ispiiG5k0u97D7w6/SyuScp/qy6si8084Iz4 YWuT3lrJySvN2XSbg08+S3eA/EVTb0m3zcBZJhJKtkU8x+KhLmueHxWfj7X+PZZDk/7t OL7Q== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=kBj3KSKq; 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 a5-v6si5465648plh.312.2018.08.09.05.33.22; Thu, 09 Aug 2018 05:33:23 -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=kBj3KSKq; 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 S1732170AbeHIO6D (ORCPT + 10 others); Thu, 9 Aug 2018 10:58:03 -0400 Received: from mail-pf1-f195.google.com ([209.85.210.195]:42362 "EHLO mail-pf1-f195.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1731130AbeHIO6C (ORCPT ); Thu, 9 Aug 2018 10:58:02 -0400 Received: by mail-pf1-f195.google.com with SMTP id l9-v6so2780883pff.9 for ; Thu, 09 Aug 2018 05:33:21 -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=njW6jAZWOPdw7KJ/kbY+W+hKS572y0dkgyYwoknGJBU=; b=kBj3KSKqdrGbKlEZB8ILVyoVK8wPo4sqH0Ttz37olDY7oM8X97IojsYz+ogQTBqhZ4 pv3pbYSRO5b8h6DWWzDe4oFYlcmpQ+YOlq1IK0PKsTs9YjjkOXnFlOi2IFJw0m6Ha8Am w2Z2T16cRauQxtQDRoQjCYmPqzYfWEY+OX/0o= 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=njW6jAZWOPdw7KJ/kbY+W+hKS572y0dkgyYwoknGJBU=; b=HbKpfPWdgGdUPiLW+4fYF6t2FOwaA42G1lOANiH5Qj4wrRAKmkQmIELofxJ9/I/gN5 HqAihxuk59HjmZ6G3ArS4cLf8px+opvDcXAWFQLnVyxjTqMiVLSI0sL/CWiTXRmjFeNL wf3qzrvApB4XmaeNSwFftkhtg/ofQjaKZ4Hx6N1YBs0fATXpx9FMkS297ZIVW2bZejo8 Z9td4AaXFXup74htZxqAfYPWBiob3TLDAc0yswH7Pu0Ejv4E5wTg7/DCK+29mdlZrKgX mfyVYIp/ABRNnVH+1lEV1TOaNvpTd+7QLyJRU14diYMvu3tULnE+D1M/jvsgmYopdxSX ts0g== X-Gm-Message-State: AOUpUlFD02hAkrq7bw3gqhBmvi9kUE8MeWJJAIM0BwHYtxejyjbJ84Do N9B13slD6Dk5PicyFI15qfVucw== X-Received: by 2002:a62:1449:: with SMTP id 70-v6mr2234037pfu.222.1533818001059; Thu, 09 Aug 2018 05:33:21 -0700 (PDT) Received: from localhost ([45.113.251.134]) by smtp.gmail.com with ESMTPSA id w192-v6sm7818876pfd.74.2018.08.09.05.33.19 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Thu, 09 Aug 2018 05:33:20 -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 07/10] thermal: tsens: Check if the IP is correctly enabled by firmware Date: Thu, 9 Aug 2018 18:02:39 +0530 Message-Id: <985ed415774fdac9ac21afad4b4b74f30f6c5068.1533815718.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 The SROT registers are initialised by the secure firmware at boot. We don't have write access to the registers. Check if the block is enabled before continuing. Signed-off-by: Amit Kucheria --- drivers/thermal/qcom/tsens-common.c | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) -- 2.17.1 diff --git a/drivers/thermal/qcom/tsens-common.c b/drivers/thermal/qcom/tsens-common.c index 0b8a793f15f4..d250b757d1f0 100644 --- a/drivers/thermal/qcom/tsens-common.c +++ b/drivers/thermal/qcom/tsens-common.c @@ -12,6 +12,11 @@ #include #include "tsens.h" +/* SROT */ +#define CTRL_OFFSET 0x4 +#define TSENS_EN BIT(0) + +/* TM */ #define STATUS_OFFSET 0x30 #define SN_ADDR_OFFSET 0x4 #define SN_ST_TEMP_MASK 0x3ff @@ -119,6 +124,8 @@ int __init init_common(struct tsens_device *tmdev) { void __iomem *tm_base, *srot_base; struct resource *res; + u32 code; + int ret; struct platform_device *op = of_find_device_by_node(tmdev->dev->of_node); if (!op) @@ -151,5 +158,15 @@ int __init init_common(struct tsens_device *tmdev) if (IS_ERR(tmdev->tm_map)) return PTR_ERR(tmdev->tm_map); + if (tmdev->srot_map) { + ret = regmap_read(tmdev->srot_map, CTRL_OFFSET, &code); + if (ret) + return ret; + if (!(code & TSENS_EN)) { + dev_err(tmdev->dev, "tsens device is not enabled\n"); + return -ENODEV; + } + } + return 0; } From patchwork Thu Aug 9 12:32:40 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Amit Kucheria X-Patchwork-Id: 143836 Delivered-To: patch@linaro.org Received: by 2002:a2e:9754:0:0:0:0:0 with SMTP id f20-v6csp2038777ljj; Thu, 9 Aug 2018 05:33:26 -0700 (PDT) X-Google-Smtp-Source: AA+uWPxQsHsaKTLqYaKyBhaMcGUG6917ko+Jn+vpJSFxadykGxtDBpgaE0MrgOI1tKt7grxq6TkV X-Received: by 2002:a65:6086:: with SMTP id t6-v6mr2042770pgu.424.1533818006682; Thu, 09 Aug 2018 05:33:26 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1533818006; cv=none; d=google.com; s=arc-20160816; b=gn7IgpCrOcsdOeZKC8xSDhMiGZzI+4OZpQHyTuUfYSOe+J4tDx4etWK2whQXJ/k4hx Xx5n2Ag44A118hjzGy3Qvr8GmE6MFeti4vCrqxQmD0lbmG3F5mGmwy7NXd9AYyX2vJRG KlRAaiqpR+GzcMN3yq5tZi3pfYfBUv8GyO4RVuIxXV6+jf36Y/AIHtrAVuKicz5Xtnwc oCDVVHQGlGAByHwOY9amTWTWLIboCAOgzDL1U+TajogY3M3Xsl/39dTrkK7VBEo+3n6O fV+Zogv96ZfNQtY72YsEgVIS++pI6N0x21USby+8J1zsEcgIod+5bHkhDTdKVcYsplC/ 2C+g== 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=wVyq1qdiaQxAsMgk2zdQ8WPed2Y4BPyFbWYYrzK404EcxI6G63t8cvRs/nxrK0a67G 78iRwoARtaQs/PyVnIV5urNIxYcvPK1qbAi3DRLO0dkKfk5XJpuBcsiJUoN9cIAcdnHa 5LIJ8mkFSsFTnvRLg08TeBTwKsY6PXuuugQXUgish6Dy6LSKtUyNMKTsfWpMVkp3qvbM PD+sQd7WFGCAcwkWpsMWcbMYZmdpI0LvisnahVV5lK1D7IQjfSMN57wTIIQ8xnmk/EGb TJkx1wBQ3rZL/eM6+oJWQ/e3QCiEYhwPr3+QBYM3gpr7qWvSvjCjtUzXD2pQtO/LWHHy Gf+Q== 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-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 o12-v6si5902794pgn.556.2018.08.09.05.33.26; Thu, 09 Aug 2018 05:33:26 -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=SngJGovQ; 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 S1732270AbeHIO6G (ORCPT + 10 others); Thu, 9 Aug 2018 10:58:06 -0400 Received: from mail-pg1-f195.google.com ([209.85.215.195]:34568 "EHLO mail-pg1-f195.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1731065AbeHIO6G (ORCPT ); Thu, 9 Aug 2018 10:58:06 -0400 Received: by mail-pg1-f195.google.com with SMTP id y5-v6so2703265pgv.1 for ; Thu, 09 Aug 2018 05:33:24 -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=q/nL89MY7c999RIhfyL8vNXv0xOd+Lm1FBn63J8ED33sqJp9qxdCNaIOf67Q+ejhkA aU2q1Hsc62laR3Iogwo2xcDHFdmWNebQLJd10uS9YEFXtc1MYVV+EZVlf0ANs6XmaoOv oOBuLMfvoRwCfyQ6azh435j9SEHmM4cjI3/RxQIEJQ4Q0F6DzOMF/14TnPjiWPPY1RBU gPuENKCY83AwlDkGl/OpGfUdzveRr4WXsTnv+VxElkRiTRr8OcpWPDcFTCoGcGrrVyO0 ApXdsK8rCQrAODx50wsFvfl6rtxe76/PMsLT5yMblTWCWh8BGH/rp7sceMX/TzijWQaU Z+lw== X-Gm-Message-State: AOUpUlHarx2Ii3XQ7KEhTOIpKGwP1g7jLwxOU1bnKhw+6phm1jCrjZnf cAjyGoMi7RlDTNp/qS4QI+Ijpg== 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-pm-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-pm@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(-) -- 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;