[PATCH 09/10] thermal/drivers/qcom/tsens: Drop __init from ops init callbacks

From: Lee Jones

Date: Thu Dec 03 2026 - 14:57:01 EST


The TSENS ops init callbacks (init_common and the per-SoC init helpers)
are annotated with __init even though they are stored in const struct
tsens_ops tables and invoked from non-__init tsens_probe(). When built
into the kernel, deferred probe or driver rebind after free_initmem()
jumps into freed init text.

Remove __init from all nine init callbacks.

Fixes: 9066073c6c27 ("thermal: qcom: tsens: Add a skeletal TSENS drivers")
Closes: https://sashiko.dev/#/bug/linux-efcbd818-b857-4c2b-831f-3fe62a3050ee
Cc: stable@xxxxxxxxxxxxxxx
Signed-off-by: Lee Jones <lee@xxxxxxxxxx>
---
drivers/thermal/qcom/tsens-v0_1.c | 8 ++++----
drivers/thermal/qcom/tsens-v1.c | 6 +++---
drivers/thermal/qcom/tsens-v2.c | 2 +-
drivers/thermal/qcom/tsens.c | 2 +-
4 files changed, 9 insertions(+), 9 deletions(-)

diff --git a/drivers/thermal/qcom/tsens-v0_1.c b/drivers/thermal/qcom/tsens-v0_1.c
index 468da9e513e2..bcd3c0bf49dd 100644
--- a/drivers/thermal/qcom/tsens-v0_1.c
+++ b/drivers/thermal/qcom/tsens-v0_1.c
@@ -207,7 +207,7 @@ static int calibrate_8974(struct tsens_priv *priv)
return 0;
}

-static int __init init_8226(struct tsens_priv *priv)
+static int init_8226(struct tsens_priv *priv)
{
static const u32 slopes[] = { 2901, 2846, 3038, 2955, 2901, 2846 };

@@ -217,7 +217,7 @@ static int __init init_8226(struct tsens_priv *priv)
return init_common(priv);
}

-static int __init init_8909(struct tsens_priv *priv)
+static int init_8909(struct tsens_priv *priv)
{
static const int p1_offsets[] = { 0, -10, 0, -9, -8 };
static const int p2_offsets[] = { 0, -6, 0, -9, -10 };
@@ -233,7 +233,7 @@ static int __init init_8909(struct tsens_priv *priv)
return init_common(priv);
}

-static int __init init_8939(struct tsens_priv *priv)
+static int init_8939(struct tsens_priv *priv)
{
static const u32 slopes[] = {
2911, 2789, 2906, 2763, 2922, 2867, 2833, 2838, 2840,
@@ -245,7 +245,7 @@ static int __init init_8939(struct tsens_priv *priv)
return init_common(priv);
}

-static int __init init_9607(struct tsens_priv *priv)
+static int init_9607(struct tsens_priv *priv)
{
static const int p1_offsets[] = { 1, -4, 4, -3, -4 };
static const int p2_offsets[] = { 1, -2, 8, -5, -4 };
diff --git a/drivers/thermal/qcom/tsens-v1.c b/drivers/thermal/qcom/tsens-v1.c
index a43ccc4bda86..14c6c6c2c0d6 100644
--- a/drivers/thermal/qcom/tsens-v1.c
+++ b/drivers/thermal/qcom/tsens-v1.c
@@ -148,7 +148,7 @@ static const struct reg_field tsens_v1_regfields[MAX_REGFIELDS] = {
[TRDY] = REG_FIELD(TM_TRDY_OFF, 0, 0),
};

-static int __init init_8952(struct tsens_priv *priv)
+static int init_8952(struct tsens_priv *priv)
{
static const int p1_offsets[] = { 2, -4, 4, 1, 2, -1, 0, 3, 2, 0, -3 };
static const int p2_offsets[] = { -1, -4, 5, 1, 3, -1, -1, 4, 4, 0, -2 };
@@ -161,7 +161,7 @@ static int __init init_8952(struct tsens_priv *priv)
return init_common(priv);
}

-static int __init init_8956(struct tsens_priv *priv)
+static int init_8956(struct tsens_priv *priv)
{
static const u32 slopes[] = {
3313, 3275, 3320, 3246, 3279, 3257, 3234, 3269, 3255, 3239, 3286,
@@ -173,7 +173,7 @@ static int __init init_8956(struct tsens_priv *priv)
return init_common(priv);
}

-static int __init init_tsens_v1_no_rpm(struct tsens_priv *priv)
+static int init_tsens_v1_no_rpm(struct tsens_priv *priv)
{
int i, ret;
u32 mask = 0;
diff --git a/drivers/thermal/qcom/tsens-v2.c b/drivers/thermal/qcom/tsens-v2.c
index 843dd29fad2e..22284973bb61 100644
--- a/drivers/thermal/qcom/tsens-v2.c
+++ b/drivers/thermal/qcom/tsens-v2.c
@@ -220,7 +220,7 @@ static int tsens_v2_calibration(struct tsens_priv *priv)
return 0;
}

-static int __init init_tsens_v2_no_rpm(struct tsens_priv *priv)
+static int init_tsens_v2_no_rpm(struct tsens_priv *priv)
{
struct device *dev = priv->dev;
int i, ret;
diff --git a/drivers/thermal/qcom/tsens.c b/drivers/thermal/qcom/tsens.c
index ff7c573c6a21..6ea0581e9161 100644
--- a/drivers/thermal/qcom/tsens.c
+++ b/drivers/thermal/qcom/tsens.c
@@ -929,7 +929,7 @@ static const struct regmap_config tsens_srot_config = {
.reg_stride = 4,
};

-int __init init_common(struct tsens_priv *priv)
+int init_common(struct tsens_priv *priv)
{
void __iomem *tm_base, *srot_base;
struct device *dev = priv->dev;
--
2.56.1.911.g883d8bcb20-goog