fix(wos-thermal): store metric IDs instead of indices in zone map#16
Open
Skand Gupta (skandg41) wants to merge 1 commit into
Open
fix(wos-thermal): store metric IDs instead of indices in zone map#16Skand Gupta (skandg41) wants to merge 1 commit into
Skand Gupta (skandg41) wants to merge 1 commit into
Conversation
g_zone_id_to_metric_index_map stored the metrics_data array position (metric_index) instead of the actual metric ID, causing metric_response entries to carry an index value in their metric_id field. This happened to match today because metric ID defines are sequential, but breaks if zone detection order changes or metric IDs become non-sequential. Rename the map and getter to _metric_id_ and store metrics_data[metric_index].metric_id at each zone assignment site. Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com> Signed-off-by: skangupt <skangupt@qti.qualcomm.com>
Vijay Kumbhani (vijaykumbhani)
suggested changes
Jul 2, 2026
|
|
||
| // Store mapping | ||
| g_zone_id_to_metric_index_map[zone_id][0] = metric_index; | ||
| g_zone_id_to_metric_id_map[zone_id][0] = metrics_data[metric_index].metric_id; |
There was a problem hiding this comment.
0 represents temperature and 1 represents passive cooling. If these values are fixed, could we define descriptive macros (or enums) and use them instead of hardcoded constants for better readability and maintainability?
#define TZ_TEMPERATURE 0
#define TZ_PASSIVE_COOLING 1
Then replace the literal values 0 and 1 with TZ_TEMP and TZ_PASSIVE_COOLING respectively.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Issue : #12
g_zone_id_to_metric_index_map stored the metrics_data array position (metric_index) instead of the actual metric ID, causing metric_response entries to carry an index value in their metric_id field. This happened to match today because metric ID defines are sequential, but breaks if zone detection order changes or metric IDs become non-sequential.
Rename the map and getter to metric_id and store metrics_data[metric_index].metric_id at each zone assignment site.
UT :
