Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

dim: make dim_calc_stats() inputs const pointers

Make the start and end arguments to dim_calc_stats() const pointers
to clarify that the function does not modify their values.

Signed-off-by: Caleb Sander Mateos <csander@purestorage.com>
Reviewed-by: Vladimir Oltean <vladimir.oltean@nxp.com>
Reviewed-by: Florian Fainelli <florian.fainelli@broadcom.com>
Reviewed-by: Arthur Kiyanovski <akiyano@amazon.com>
Link: https://patch.msgid.link/20241031002326.3426181-1-csander@purestorage.com
Signed-off-by: Jakub Kicinski <kuba@kernel.org>

authored by

Caleb Sander Mateos and committed by
Jakub Kicinski
a8652768 6b2d11e2

+4 -2
+2 -1
include/linux/dim.h
··· 351 351 * Takes into consideration counter wrap-around. 352 352 * Returned boolean indicates whether curr_stats are reliable. 353 353 */ 354 - bool dim_calc_stats(struct dim_sample *start, struct dim_sample *end, 354 + bool dim_calc_stats(const struct dim_sample *start, 355 + const struct dim_sample *end, 355 356 struct dim_stats *curr_stats); 356 357 357 358 /**
+2 -1
lib/dim/dim.c
··· 54 54 } 55 55 EXPORT_SYMBOL(dim_park_tired); 56 56 57 - bool dim_calc_stats(struct dim_sample *start, struct dim_sample *end, 57 + bool dim_calc_stats(const struct dim_sample *start, 58 + const struct dim_sample *end, 58 59 struct dim_stats *curr_stats) 59 60 { 60 61 /* u32 holds up to 71 minutes, should be enough */