aboutsummaryrefslogtreecommitdiff
path: root/modules
diff options
context:
space:
mode:
authorLeandro Pereira <leandro@hardinfo.org>2016-12-30 13:00:18 +0100
committerLeandro Pereira <leandro@hardinfo.org>2016-12-30 13:03:08 +0100
commit13f7d693b35819a555cb1def5261dfec05f1c90f (patch)
tree9bf6a6ec0e0cc247f71b1c30e1791ecb5d45e2d9 /modules
parentf926ee727f607da14c95f70d6f719b57dd61dcb6 (diff)
Fix compile warnings in sensors.c
Diffstat (limited to 'modules')
-rw-r--r--modules/devices/sensors.c24
1 files changed, 5 insertions, 19 deletions
diff --git a/modules/devices/sensors.c b/modules/devices/sensors.c
index ed4bc357..84e89361 100644
--- a/modules/devices/sensors.c
+++ b/modules/devices/sensors.c
@@ -150,22 +150,9 @@ static float adjust_sensor(gchar * name, float value)
return math_postfix_eval(postfix, value);
}
-static char *get_sensor_path(int number, char *prefix)
+static char *get_sensor_path(int number, const char *prefix)
{
- char *path, *last_slash;
-
- path = g_strdup_printf("/sys/class/hwmon/hwmon%d/%s", number, prefix);
- if (g_file_test(path, G_FILE_TEST_EXISTS | G_FILE_TEST_IS_DIR)) {
- return path;
- }
-/* we start at the top of hwmon, this fallback is not needed anymore
- if ((last_slash = strrchr(path, '/'))) {
- *last_slash = '\0';
- return path;
- }
-*/
- g_free(path);
- return NULL;
+ return g_strdup_printf("/sys/class/hwmon/hwmon%d/%s", number, prefix);
}
static char *determine_driver_for_hwmon_path(char *path)
@@ -215,16 +202,15 @@ static const struct HwmonSensor hwmon_sensors[] = {
{ NULL, NULL, NULL, NULL, 0.0, 0 },
};
-const char *hwmon_prefix[] = { "device", "", NULL };
+static const char *hwmon_prefix[] = { "device", "", NULL };
static void read_sensors_hwmon(void)
{
int hwmon, count;
gchar *path_hwmon, *path_sensor, *tmp, *driver, *name, *mon;
- char **prefix;
+ const char **prefix;
- for (prefix = hwmon_prefix; *prefix; prefix++)
- {
+ for (prefix = hwmon_prefix; *prefix; prefix++) {
hwmon = 0;
path_hwmon = get_sensor_path(hwmon, *prefix);
while (path_hwmon && g_file_test(path_hwmon, G_FILE_TEST_EXISTS)) {