From 71c7488ae10003c7d2f28fb68bd1188b1a426793 Mon Sep 17 00:00:00 2001 From: Corinna Vinschen Date: Tue, 10 Apr 2018 11:57:37 +0200 Subject: power: fix sysfs_read/sysfs_write usage * The incoming path to sysfs_read/sysfs_write should be const, as in open(2) call. * Redefine scaling_gov_path as const pointer array. * Since sysfs_read works on a simple absolute path anyway, make sure the scaling_gov_path paths *are* absolute. Otherwise the code only works if Power HAL has / as CWD, which is a bit fragile. Change-Id: I70c08f8137842569514bcb3f6e0617d46044e6ab Signed-off-by: Corinna Vinschen --- utils.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'utils.h') diff --git a/utils.h b/utils.h index 2d45e72..e5748dc 100644 --- a/utils.h +++ b/utils.h @@ -29,8 +29,8 @@ #include -int sysfs_read(char* path, char* s, int num_bytes); -int sysfs_write(char* path, char* s); +int sysfs_read(const char* path, char* s, int num_bytes); +int sysfs_write(const char* path, char* s); int get_scaling_governor(char governor[], int size); int get_scaling_governor_check_cores(char governor[], int size, int core_num); int is_interactive_governor(char*); -- cgit v1.2.3