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 <xda@vinschen.de>
This commit is contained in:
Corinna Vinschen
2018-04-10 11:57:37 +02:00
committed by Michael Bestas
parent d62a558e09
commit e86755b9fd
2 changed files with 8 additions and 8 deletions

View File

@@ -33,8 +33,8 @@ typedef struct {
char value[PROP_VALUE_MAX];
} PropVal;
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*);