@@ -263,6 +263,6 @@ static const struct tsens_ops ops_8960 = {
};
const struct tsens_plat_data data_8960 = {
- .num_sensors = 11,
+ .num_sensors = MAX_NUM_SENSORS[VER_0_1],
.ops = &ops_8960,
};
@@ -324,7 +324,7 @@ static const struct tsens_features tsens_v0_1_feat = {
.crit_int = 0,
.adc = 1,
.srot_split = 1,
- .max_sensors = 11,
+ .max_sensors = MAX_NUM_SENSORS[VER_0_1],
};
static const struct reg_field tsens_v0_1_regfields[MAX_REGFIELDS] = {
@@ -374,7 +374,7 @@ static const struct tsens_ops ops_8974 = {
};
const struct tsens_plat_data data_8974 = {
- .num_sensors = 11,
+ .num_sensors = MAX_NUM_SENSORS[VER_0_1],
.ops = &ops_8974,
.feat = &tsens_v0_1_feat,
.fields = tsens_v0_1_regfields,
@@ -149,7 +149,7 @@ static const struct tsens_features tsens_v1_feat = {
.crit_int = 0,
.adc = 1,
.srot_split = 1,
- .max_sensors = 11,
+ .max_sensors = MAX_NUM_SENSORS[VER_1_X],
};
static const struct reg_field tsens_v1_regfields[MAX_REGFIELDS] = {
@@ -32,7 +32,7 @@ static const struct tsens_features tsens_v2_feat = {
.crit_int = 1,
.adc = 0,
.srot_split = 1,
- .max_sensors = 16,
+ .max_sensors = MAX_NUM_SENSORS[VER_2_X],
};
static const struct reg_field tsens_v2_regfields[MAX_REGFIELDS] = {
@@ -26,6 +26,12 @@ enum tsens_ver {
VER_2_X,
};
+static const int MAX_NUM_SENSORS[] = {
+ [VER_0_1] = 11,
+ [VER_1_X] = 11,
+ [VER_2_X] = 16,
+};
+
/**
* struct tsens_sensor - data for each sensor connected to the tsens device
* @priv: tsens device instance that this sensor is connected to
Use a constant array MAX_NUM_SENSORS[] for maximum number of sensors per version (v0.1, v1, v2). Signed-off-by: Carlos Bilbao <carlos.bilbao@amd.com> --- drivers/thermal/qcom/tsens-8960.c | 2 +- drivers/thermal/qcom/tsens-v0_1.c | 4 ++-- drivers/thermal/qcom/tsens-v1.c | 2 +- drivers/thermal/qcom/tsens-v2.c | 2 +- drivers/thermal/qcom/tsens.h | 6 ++++++ 5 files changed, 11 insertions(+), 5 deletions(-)