From patchwork Tue Dec 3 05:23:22 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Amit Kucheria X-Patchwork-Id: 180699 Delivered-To: patch@linaro.org Received: by 2002:a92:3001:0:0:0:0:0 with SMTP id x1csp1067879ile; Mon, 2 Dec 2019 21:23:43 -0800 (PST) X-Google-Smtp-Source: APXvYqxiO594Nk+NPfg928rX5ZiRWDiwIZsN3FyNkKUeP9NUEP5lQp9UE15ECiXjbYEsq/9owmiA X-Received: by 2002:a9d:3e43:: with SMTP id h3mr1912893otg.84.1575350623480; Mon, 02 Dec 2019 21:23:43 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1575350623; cv=none; d=google.com; s=arc-20160816; b=TSSdaI+ZIJ+t8dLNnizGtnTax84y0gNUaC7SBQL4QWoRCPXFIU6XhU5PveW5wlkuvH NjkxIFUjBE/5LQAzP2CpujzEjTojDnRWcM/jO4oUrGmTMelWq1L0jYtuWbymGukpffch 2Ctj5yPBTyCsOrO248iEH3NOsC8XuAVCkuyedNEvboqEVAoY1bvFi93tk2dgMgOfHBLU 7P3GHBJ57d22vnE5aW+u2W5SedI6pTVGhZYTISDkaKb8UfXNb3NeD05kypd4CZFYOJaM ykpH3jbaG/6ZDh0P8/DYWNh/+WCACTvzRy3LGkCVNoIXfd4uG6Da+1K15KZLk9qkaGaL uylw== 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=/nB1fYa5n9lqubCyUBVAtESr33YzPH2vKA4mG1o1BMA=; b=qPg4p4z5zInGQPop2ozhAszT5zdbOkW/Cq+93pxz59rp6Gh9IssXw91E872wsI+BFe AJlBgu9HNtcYMeUTG795Zk61y5ImWzFtuREI6C1HKWGjf1IbyhDRGPyU5zmyjgA920Ng aUfz9lrZJdxPWQDDd1RGQeadNAfElZh3KcxgZTa8qJow2KbGh/cvZLZayWg4zbXXiW+a wFlRcv2em3FNOjAPSiyW/N/PeEXT8w+j34hspVf0DpldjM7GcOS4K3DE3sr8kHXwxGzH 6ieIiMw59gWNZ6X+oW1GtczSWbpmqKgAoH+NFZgYBqbeN8td4wx2GUUu+abb5V8gOJAL zBmQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=G4NHZCta; 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 p5si740292oto.116.2019.12.02.21.23.43; Mon, 02 Dec 2019 21:23:43 -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=G4NHZCta; 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 S1726971AbfLCFXm (ORCPT + 27 others); Tue, 3 Dec 2019 00:23:42 -0500 Received: from mail-pj1-f67.google.com ([209.85.216.67]:42719 "EHLO mail-pj1-f67.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726323AbfLCFXl (ORCPT ); Tue, 3 Dec 2019 00:23:41 -0500 Received: by mail-pj1-f67.google.com with SMTP id o11so1019652pjp.9 for ; Mon, 02 Dec 2019 21:23:41 -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=/nB1fYa5n9lqubCyUBVAtESr33YzPH2vKA4mG1o1BMA=; b=G4NHZCtaScI13ud9Mx0Sn8CcLA81Z5aAXTxjKQg/X07I6EdgIJgEm/z74mLnrkqGe7 suhIexigSE/ogvHIMIwb2iucC++fFuyFbohiwt7Qejhb5x65KrM14ZEekYlQGhKZN8iM y7XDyQueLzSEpRW/oAeLCEHVP6l7TtteYWNCOh4jLSmCUHY4If9PoKUV0yYdD3P67sMX RtksZUSxCq8QGbvUebXvCOWXklHuLymyZXQrCh7LtFAtd23QNcxuUaXwi13e2MDmKgGp MX3j5QOP4GTF+Kivk9dtFf5kyEYImstQUdKQQLQ9wfWBuQWThGMZqDLfXi//IVJeMuhy RVig== 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=/nB1fYa5n9lqubCyUBVAtESr33YzPH2vKA4mG1o1BMA=; b=jjt5YfXLhs9xnafxoK0eXYNT3h1CVQuOQ2yphQ4NsjzhLqGVWgTGcZjYfqePJ5FXDj 3itUC9HBxw1HlS4g/OAjwrqRNPxCBFTRqGksqghZaaW18tn99ytl4MANq4N0PpQe/SlY qDZ0/DXPgLhYMqBZkoo1Hx2wQbbDKha/yCbpn1HR6sXfz9IK1HENiiA/i+MeVOtaiivw Lbwafo6ZQ3+oZ9Mck/8Fn5dXhYepSGXLcvsYrhe/ffUrF9h35yFD15OQv+9FSiIWrjgL nF/gEp60vSCrmuPkqip5DFYhW/gkcRksB/BAfrnA7Hfg+mqT4se1Tmu/k70NvpN/6hM2 tgQQ== X-Gm-Message-State: APjAAAUNmfaEpqCQhRwpMSTpIs9ysoFtwb2yLtr075xPdP0ZZC5+oLbp aAjOIYeQln73AFXU2Ev+XSBRHixwjj5a5Q== X-Received: by 2002:a17:90a:db43:: with SMTP id u3mr3587202pjx.56.1575350620471; Mon, 02 Dec 2019 21:23:40 -0800 (PST) Received: from localhost ([14.96.109.134]) by smtp.gmail.com with ESMTPSA id o67sm1453975pga.62.2019.12.02.21.23.39 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Mon, 02 Dec 2019 21:23:39 -0800 (PST) From: Amit Kucheria To: linux-kernel@vger.kernel.org, linux-arm-msm@vger.kernel.org, bjorn.andersson@linaro.org, swboyd@chromium.org, sivaa@codeaurora.org, Andy Gross Cc: Daniel Lezcano , Amit Kucheria , linux-pm@vger.kernel.org Subject: [PATCH v2 1/9] drivers: thermal: tsens: De-constify struct tsens_features Date: Tue, 3 Dec 2019 10:53:22 +0530 Message-Id: <4ea61a3f0c1b58e139eb20493a5d757d1eddb878.1575349416.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 struct tsens_features is currently initialized as part of platform data at compile-time and not modifiable. We now have some usecases in feature detection across IP versions where it is more flexible to update the features after probing registers. Remove const qualifier from tsens_features and the encapsulating tsens_plat_data. Signed-off-by: Amit Kucheria --- drivers/thermal/qcom/tsens-8960.c | 2 +- drivers/thermal/qcom/tsens-v0_1.c | 6 +++--- drivers/thermal/qcom/tsens-v1.c | 6 +++--- drivers/thermal/qcom/tsens-v2.c | 6 +++--- drivers/thermal/qcom/tsens.h | 12 ++++++------ 5 files changed, 16 insertions(+), 16 deletions(-) -- 2.17.1 diff --git a/drivers/thermal/qcom/tsens-8960.c b/drivers/thermal/qcom/tsens-8960.c index fb77acb8d13b9..a383a57cfbbcb 100644 --- a/drivers/thermal/qcom/tsens-8960.c +++ b/drivers/thermal/qcom/tsens-8960.c @@ -279,7 +279,7 @@ static const struct tsens_ops ops_8960 = { .resume = resume_8960, }; -const struct tsens_plat_data data_8960 = { +struct tsens_plat_data data_8960 = { .num_sensors = 11, .ops = &ops_8960, }; diff --git a/drivers/thermal/qcom/tsens-v0_1.c b/drivers/thermal/qcom/tsens-v0_1.c index 4b8dd6de02ce4..959a9371d205c 100644 --- a/drivers/thermal/qcom/tsens-v0_1.c +++ b/drivers/thermal/qcom/tsens-v0_1.c @@ -327,7 +327,7 @@ static int calibrate_8974(struct tsens_priv *priv) /* v0.1: 8916, 8974 */ -static const struct tsens_features tsens_v0_1_feat = { +static struct tsens_features tsens_v0_1_feat = { .ver_major = VER_0_1, .crit_int = 0, .adc = 1, @@ -377,7 +377,7 @@ static const struct tsens_ops ops_8916 = { .get_temp = get_temp_common, }; -const struct tsens_plat_data data_8916 = { +struct tsens_plat_data data_8916 = { .num_sensors = 5, .ops = &ops_8916, .hw_ids = (unsigned int []){0, 1, 2, 4, 5 }, @@ -392,7 +392,7 @@ static const struct tsens_ops ops_8974 = { .get_temp = get_temp_common, }; -const struct tsens_plat_data data_8974 = { +struct tsens_plat_data data_8974 = { .num_sensors = 11, .ops = &ops_8974, .feat = &tsens_v0_1_feat, diff --git a/drivers/thermal/qcom/tsens-v1.c b/drivers/thermal/qcom/tsens-v1.c index bd2ddb684a45d..b682a4df00810 100644 --- a/drivers/thermal/qcom/tsens-v1.c +++ b/drivers/thermal/qcom/tsens-v1.c @@ -299,7 +299,7 @@ static int calibrate_8976(struct tsens_priv *priv) /* v1.x: msm8956,8976,qcs404,405 */ -static const struct tsens_features tsens_v1_feat = { +static struct tsens_features tsens_v1_feat = { .ver_major = VER_1_X, .crit_int = 0, .adc = 1, @@ -368,7 +368,7 @@ static const struct tsens_ops ops_generic_v1 = { .get_temp = get_temp_tsens_valid, }; -const struct tsens_plat_data data_tsens_v1 = { +struct tsens_plat_data data_tsens_v1 = { .ops = &ops_generic_v1, .feat = &tsens_v1_feat, .fields = tsens_v1_regfields, @@ -381,7 +381,7 @@ static const struct tsens_ops ops_8976 = { }; /* Valid for both MSM8956 and MSM8976. Sensor ID 3 is unused. */ -const struct tsens_plat_data data_8976 = { +struct tsens_plat_data data_8976 = { .num_sensors = 11, .ops = &ops_8976, .hw_ids = (unsigned int[]){0, 1, 2, 4, 5, 6, 7, 8, 9, 10}, diff --git a/drivers/thermal/qcom/tsens-v2.c b/drivers/thermal/qcom/tsens-v2.c index a4d15e1abfddd..f1c8ec62e69f9 100644 --- a/drivers/thermal/qcom/tsens-v2.c +++ b/drivers/thermal/qcom/tsens-v2.c @@ -27,7 +27,7 @@ /* v2.x: 8996, 8998, sdm845 */ -static const struct tsens_features tsens_v2_feat = { +static struct tsens_features tsens_v2_feat = { .ver_major = VER_2_X, .crit_int = 1, .adc = 0, @@ -81,14 +81,14 @@ static const struct tsens_ops ops_generic_v2 = { .get_temp = get_temp_tsens_valid, }; -const struct tsens_plat_data data_tsens_v2 = { +struct tsens_plat_data data_tsens_v2 = { .ops = &ops_generic_v2, .feat = &tsens_v2_feat, .fields = tsens_v2_regfields, }; /* Kept around for backward compatibility with old msm8996.dtsi */ -const struct tsens_plat_data data_8996 = { +struct tsens_plat_data data_8996 = { .num_sensors = 13, .ops = &ops_generic_v2, .feat = &tsens_v2_feat, diff --git a/drivers/thermal/qcom/tsens.h b/drivers/thermal/qcom/tsens.h index e24a865fbc34c..be364bf1d5a63 100644 --- a/drivers/thermal/qcom/tsens.h +++ b/drivers/thermal/qcom/tsens.h @@ -440,7 +440,7 @@ struct tsens_plat_data { const u32 num_sensors; const struct tsens_ops *ops; unsigned int *hw_ids; - const struct tsens_features *feat; + struct tsens_features *feat; const struct reg_field *fields; }; @@ -481,7 +481,7 @@ struct tsens_priv { struct regmap_field *rf[MAX_REGFIELDS]; struct tsens_context ctx; - const struct tsens_features *feat; + struct tsens_features *feat; const struct reg_field *fields; const struct tsens_ops *ops; @@ -502,15 +502,15 @@ int tsens_set_trips(void *_sensor, int low, int high); irqreturn_t tsens_irq_thread(int irq, void *data); /* TSENS target */ -extern const struct tsens_plat_data data_8960; +extern struct tsens_plat_data data_8960; /* TSENS v0.1 targets */ -extern const struct tsens_plat_data data_8916, data_8974; +extern struct tsens_plat_data data_8916, data_8974; /* TSENS v1 targets */ -extern const struct tsens_plat_data data_tsens_v1, data_8976; +extern struct tsens_plat_data data_tsens_v1, data_8976; /* TSENS v2 targets */ -extern const struct tsens_plat_data data_8996, data_tsens_v2; +extern struct tsens_plat_data data_8996, data_tsens_v2; #endif /* __QCOM_TSENS_H__ */ From patchwork Tue Dec 3 05:23:23 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Amit Kucheria X-Patchwork-Id: 180700 Delivered-To: patch@linaro.org Received: by 2002:a92:3001:0:0:0:0:0 with SMTP id x1csp1067936ile; Mon, 2 Dec 2019 21:23:49 -0800 (PST) X-Google-Smtp-Source: APXvYqyV5tQcj+j9lVSNooOBbqmyev7GxqzdoifuMnNAu5sJBadf5a68cCBqZG4E8hHSWyP0Wzvr X-Received: by 2002:aca:1103:: with SMTP id 3mr2291794oir.171.1575350628993; Mon, 02 Dec 2019 21:23:48 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1575350628; cv=none; d=google.com; s=arc-20160816; b=ovnjTjzMKTmjN5Opo6qYu+VwUq9VhnwSq22iAbe0fD2r0qdE0Y5I64I5jX09Hk7NkM 2mNA419t7HbwXR1atLtqQt39RhXtSNh7cr+wQ+6gcCaKBiTb7oRiNPF4j2N140CtYrLd 2BiP1rphnnxEktkdgmeUYWNJZoWBtfZT1AW8xUV92zCRgUIf7vkmWBC9avwd1ZiTybxE P5QStU08uYP+xAtsPNLp6z9kpLIDTRTklH2nhA/3/Az0uimsGU8OJrojwb2PYzpAfqdC yzAxjIu8ZWZ7D54b0OVVmTUamUPrZ/qhbsFr9r/h328ExfMU81FANp31H1ohRcj5LL3L Uj/A== 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=3jEZWcL7GDtf1dkrmxImtelr/uLTAn26FhaUYUisOhw=; b=IhfT2FknOo+ZBjv53Ov2fptgiMU1Z2pTb468iDIUckseWGtA5ySesQHUJ6jlRt0cFD mFVxbZTaCLUr1AZeO6pCInFXeUoOvvtGz44STHpWKi7Hx4doEForj+ulTw1+hCG5Du7O sXIFtiZHtT7R/fRbe7tPCYJwLfQJFC848IxuMdcRcGSiRGAYDijnf+I7RrCJ5FHXj8g4 rICXKTZJuwb0lE/sEqk4u2fwRE0zJq9hCS99k5yUyltlQb0l9eKrYYqrL7ZEZMD8QpD/ sd+Ba7HiOUD18XIj/5AozmfRGEj0UO2tKrTwxDk/DTw+u0mj/fs4LIe4ELPS6zYo5n+N 1rsg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=ANH+ejgm; 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 x2si688908otk.66.2019.12.02.21.23.48; Mon, 02 Dec 2019 21:23:48 -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=ANH+ejgm; 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 S1727048AbfLCFXq (ORCPT + 27 others); Tue, 3 Dec 2019 00:23:46 -0500 Received: from mail-pf1-f195.google.com ([209.85.210.195]:43558 "EHLO mail-pf1-f195.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726987AbfLCFXp (ORCPT ); Tue, 3 Dec 2019 00:23:45 -0500 Received: by mail-pf1-f195.google.com with SMTP id h14so1231438pfe.10 for ; Mon, 02 Dec 2019 21:23:45 -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=3jEZWcL7GDtf1dkrmxImtelr/uLTAn26FhaUYUisOhw=; b=ANH+ejgmPfpj3NzV3qtaOVx1ksjtj4W69naT7IoMuV1TjeGCfzrZrda08QEo0VfJoW PQDnpU2Ta8Q+V8e77eF2OsPDDY4DlStmUCh1zqAAMVnCeuoIArFe9a2yjeboqGUBPg/c 1HG/HR+5jBsN8dyNCCq6daMvLh6b742dkK37EaponwduxnD0dYXqzAkF7PxRgz8pabV7 0OwuJ17wONmLe4ZNQhmjFDTsMFm0lblFyZ3mqQGfnWwoUVJiyB7KHZjmeh59ZMYjR/Y9 GXgXTFND0z5uh33fnzPx/WHvA0x2QbmlI1AP07kvsL2HnohhzXA5Vs9iIHmIPuoCHaSc J4ug== 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=3jEZWcL7GDtf1dkrmxImtelr/uLTAn26FhaUYUisOhw=; b=L/lvLXIDq6MU/OqPqPmEv+e6mm9DDLkeagjrnWz0lW9SF5oxNewOKdQuJzbJYjJDgs 3lIDoBGuQEjM73gwEBcC2+WWInH1QJkQYoJexvZOeB9Xf3GapKxeJuun444Um796/PBh iQ8YI/iy+mpcCQYYEK/5QdeTkVNFT7uVSv51WAfhciRclBStYNVlaKJDVCl27GnWvOQc zdTQ/fK0kCtVu19k12B7n7Jrn9X5X2mKvL+yzEK48fnrRAMYFqWozBPEWx7roHCrTG8i wb9WTMdPD6/vy6IvQgYQH6EHTuCUMc21iZO+JxReL/06eR37Z15PDot5L5KEq+ahTtYR +E1w== X-Gm-Message-State: APjAAAUSE00OEYUqPei0O+dd5PI9mxHpELLBeS6u4fpafHMqRGP9VTHg 5JBq9LzuOJmpacG4ewbXrWdw4qUy1FxByw== X-Received: by 2002:aa7:86ce:: with SMTP id h14mr2901081pfo.248.1575350624411; Mon, 02 Dec 2019 21:23:44 -0800 (PST) Received: from localhost ([14.96.109.134]) by smtp.gmail.com with ESMTPSA id p16sm1509689pgm.8.2019.12.02.21.23.43 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Mon, 02 Dec 2019 21:23:43 -0800 (PST) From: Amit Kucheria To: linux-kernel@vger.kernel.org, linux-arm-msm@vger.kernel.org, bjorn.andersson@linaro.org, swboyd@chromium.org, sivaa@codeaurora.org, Andy Gross Cc: Daniel Lezcano , Amit Kucheria , linux-pm@vger.kernel.org Subject: [PATCH v2 2/9] drivers: thermal: tsens: Pass around struct tsens_sensor as a constant Date: Tue, 3 Dec 2019 10:53:23 +0530 Message-Id: <1d24d634859bebd57e346c3ec4c726a01b7644ba.1575349416.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 All the sensor data is initialised at init time. Lock it down by passing it to functions as a constant. Signed-off-by: Amit Kucheria --- drivers/thermal/qcom/tsens-8960.c | 2 +- drivers/thermal/qcom/tsens-common.c | 14 +++++++------- drivers/thermal/qcom/tsens.h | 6 +++--- 3 files changed, 11 insertions(+), 11 deletions(-) -- 2.17.1 diff --git a/drivers/thermal/qcom/tsens-8960.c b/drivers/thermal/qcom/tsens-8960.c index a383a57cfbbcb..2a28a5af209ec 100644 --- a/drivers/thermal/qcom/tsens-8960.c +++ b/drivers/thermal/qcom/tsens-8960.c @@ -245,7 +245,7 @@ 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_sensor *s, int *temp) +static int get_temp_8960(const struct tsens_sensor *s, int *temp) { int ret; u32 code, trdy; diff --git a/drivers/thermal/qcom/tsens-common.c b/drivers/thermal/qcom/tsens-common.c index c8d57ee0a5bb2..c2df30a08b9e4 100644 --- a/drivers/thermal/qcom/tsens-common.c +++ b/drivers/thermal/qcom/tsens-common.c @@ -128,7 +128,7 @@ static inline int code_to_degc(u32 adc_code, const struct tsens_sensor *s) * Return: Temperature in milliCelsius on success, a negative errno will * be returned in error cases */ -static int tsens_hw_to_mC(struct tsens_sensor *s, int field) +static int tsens_hw_to_mC(const struct tsens_sensor *s, int field) { struct tsens_priv *priv = s->priv; u32 resolution; @@ -160,7 +160,7 @@ static int tsens_hw_to_mC(struct tsens_sensor *s, int field) * * Return: ADC code or temperature in deciCelsius. */ -static int tsens_mC_to_hw(struct tsens_sensor *s, int temp) +static int tsens_mC_to_hw(const struct tsens_sensor *s, int temp) { struct tsens_priv *priv = s->priv; @@ -275,7 +275,7 @@ static int tsens_threshold_violated(struct tsens_priv *priv, u32 hw_id, } static int tsens_read_irq_state(struct tsens_priv *priv, u32 hw_id, - struct tsens_sensor *s, struct tsens_irq_data *d) + const struct tsens_sensor *s, struct tsens_irq_data *d) { int ret; @@ -346,10 +346,10 @@ irqreturn_t tsens_irq_thread(int irq, void *data) for (i = 0; i < priv->num_sensors; i++) { bool trigger = false; - struct tsens_sensor *s = &priv->sensor[i]; + const struct tsens_sensor *s = &priv->sensor[i]; u32 hw_id = s->hw_id; - if (IS_ERR(priv->sensor[i].tzd)) + if (IS_ERR(s->tzd)) continue; if (!tsens_threshold_violated(priv, hw_id, &d)) continue; @@ -457,7 +457,7 @@ void tsens_disable_irq(struct tsens_priv *priv) regmap_field_write(priv->rf[INT_EN], 0); } -int get_temp_tsens_valid(struct tsens_sensor *s, int *temp) +int get_temp_tsens_valid(const struct tsens_sensor *s, int *temp) { struct tsens_priv *priv = s->priv; int hw_id = s->hw_id; @@ -486,7 +486,7 @@ int get_temp_tsens_valid(struct tsens_sensor *s, int *temp) return 0; } -int get_temp_common(struct tsens_sensor *s, int *temp) +int get_temp_common(const struct tsens_sensor *s, int *temp) { struct tsens_priv *priv = s->priv; int hw_id = s->hw_id; diff --git a/drivers/thermal/qcom/tsens.h b/drivers/thermal/qcom/tsens.h index be364bf1d5a63..70dc34c805377 100644 --- a/drivers/thermal/qcom/tsens.h +++ b/drivers/thermal/qcom/tsens.h @@ -67,7 +67,7 @@ struct tsens_ops { /* mandatory callbacks */ int (*init)(struct tsens_priv *priv); int (*calibrate)(struct tsens_priv *priv); - int (*get_temp)(struct tsens_sensor *s, int *temp); + int (*get_temp)(const struct tsens_sensor *s, int *temp); /* optional callbacks */ int (*enable)(struct tsens_priv *priv, int i); void (*disable)(struct tsens_priv *priv); @@ -494,8 +494,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_sensor *s, int *temp); -int get_temp_common(struct tsens_sensor *s, int *temp); +int get_temp_tsens_valid(const struct tsens_sensor *s, int *temp); +int get_temp_common(const struct tsens_sensor *s, int *temp); int tsens_enable_irq(struct tsens_priv *priv); void tsens_disable_irq(struct tsens_priv *priv); int tsens_set_trips(void *_sensor, int low, int high);