Skip to content

Commit dc75be4

Browse files
sholeksandrfelixradensky
authored andcommitted
hw-mgmt: thermal: Fix not recover PWM after asic sensor reading error
In TC when simulating asic read error we continuously see error logs, even after asic error recovered. This commit fix error. Bug: 4545207 Signed-off-by: Oleksandr Shamray <[email protected]>
1 parent a9c7bab commit dc75be4

File tree

2 files changed

+14
-5
lines changed

2 files changed

+14
-5
lines changed

usr/usr/bin/hw_management_thermal_control.py

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1077,6 +1077,7 @@ def validate_value_in_crit_range(self, value, val_read_file):
10771077
@param val_read_file: file from which value was obtained
10781078
@return: True if value is in critical range, False otherwise (value check passed
10791079
"""
1080+
err_flag = False
10801081
if ((self.val_hcrit is not None and value >= self.val_hcrit) or
10811082
(self.val_lcrit is not None and value <= self.val_lcrit)):
10821083
# fmt: off
@@ -1089,29 +1090,33 @@ def validate_value_in_crit_range(self, value, val_read_file):
10891090
repeat=1)
10901091
# fmt: on
10911092
self.fread_err.handle_err(val_read_file)
1092-
return True
1093+
err_flag = True
10931094
else:
10941095
self.fread_err.handle_err(val_read_file, reset=True)
10951096
self.log.info(None, id="{} crit".format(self.name))
1096-
return False
1097+
err_flag = False
1098+
return err_flag
10971099

10981100
# ----------------------------------------------------------------------
10991101
def validate_value_in_min_max_range(self):
11001102
"""
11011103
@summary:
11021104
Validate value against min/max thresholds and log error if value is out of range
11031105
"""
1106+
err_flag = False
11041107
if self.value > self.val_max:
11051108
self.log.warn("{} value({}) > ({})".format(self.name, self.value, self.val_max),
11061109
id="{} value > max".format(self.name),
11071110
repeat=1)
1111+
err_flag = True
11081112
else:
11091113
self.log.info(None, id="{} value > max".format(self.name))
11101114

11111115
if self.value < self.val_min:
11121116
self.log.debug("{} value({}) < min({})".format(self.name,
11131117
self.value,
11141118
self.val_min))
1119+
return err_flag
11151120

11161121
# ----------------------------------------------------------------------
11171122
def check_sensor_blocked(self, name=None):
@@ -1497,7 +1502,6 @@ def handle_input(self, thermal_table, flow_dir, amb_tmp):
14971502
else:
14981503
self.asic_fault_err.handle_err(val_read_file, reset=True)
14991504
self.log.info(None, id="{} Incorrect value in the file: {}".format(self.name, val_read_file))
1500-
return
15011505

15021506
if self.validate_value_in_crit_range(value, val_read_file) == False:
15031507
self.update_value(value)

usr/usr/bin/hw_management_thermal_control_2_5.py

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1292,6 +1292,7 @@ def validate_value_in_crit_range(self, value, val_read_file):
12921292
@param val_read_file: file from which value was obtained
12931293
@return: True if value is in critical range, False otherwise (value check passed
12941294
"""
1295+
err_flag = False
12951296
if ((self.val_hcrit is not None and value >= self.val_hcrit) or
12961297
(self.val_lcrit is not None and value <= self.val_lcrit)):
12971298
# fmt: off
@@ -1304,29 +1305,33 @@ def validate_value_in_crit_range(self, value, val_read_file):
13041305
repeat=1)
13051306
# fmt: on
13061307
self.fread_err.handle_err(val_read_file)
1307-
return True
1308+
err_flag = True
13081309
else:
13091310
self.fread_err.handle_err(val_read_file, reset=True)
13101311
self.log.info(None, id="{} crit".format(self.name))
1311-
return False
1312+
err_flag = False
1313+
return err_flag
13121314

13131315
# ----------------------------------------------------------------------
13141316
def validate_value_in_min_max_range(self):
13151317
"""
13161318
@summary:
13171319
Validate value against min/max thresholds and log error if value is out of range
13181320
"""
1321+
err_flag = False
13191322
if self.value > self.val_max:
13201323
self.log.warn("{} value({}) > ({})".format(self.name, self.value, self.val_max),
13211324
id="{} value > max".format(self.name),
13221325
repeat=1)
1326+
err_flag = True
13231327
else:
13241328
self.log.info(None, id="{} value > max".format(self.name))
13251329

13261330
if self.value < self.val_min:
13271331
self.log.debug("{} value({}) < min({})".format(self.name,
13281332
self.value,
13291333
self.val_min))
1334+
return err_flag
13301335

13311336
# ----------------------------------------------------------------------
13321337
def check_sensor_blocked(self, name=None):

0 commit comments

Comments
 (0)