X-Git-Url: http://wpitchoune.net/gitweb/?p=psensor-pkg-debian.git;a=blobdiff_plain;f=src%2Flib%2Famd.c;h=72a807e6306435a871c54d4ed498ad4e81ac31ba;hp=c2ec5eb2d3786b661b31ff8b9bd8d9b47e10d57f;hb=bd7036af56a4b61b2b473dccbeac5e26f78b57da;hpb=48da1ac5531838d157762882ee455cec4da05728;ds=sidebyside diff --git a/src/lib/amd.c b/src/lib/amd.c index c2ec5eb..72a807e 100644 --- a/src/lib/amd.c +++ b/src/lib/amd.c @@ -77,7 +77,7 @@ static double get_temp(struct psensor *sensor) v.iSize = sizeof(ADLTemperature); v.iTemperature = -273; - if (ADL_OK == adl_od5_temperature_get(sensor->amd_id, 0, &v)) + if (adl_od5_temperature_get(sensor->amd_id, 0, &v) == ADL_OK) return v.iTemperature/1000; return UNKNOWN_DBL_VALUE; @@ -91,7 +91,7 @@ static double get_fanspeed(struct psensor *sensor) v.iSpeedType = ADL_DL_FANCTRL_SPEED_TYPE_RPM; v.iFanSpeed = -1; - if (ADL_OK == adl_od5_fanspeed_get(sensor->amd_id, 0, &v)) + if (adl_od5_fanspeed_get(sensor->amd_id, 0, &v) == ADL_OK) return v.iFanSpeed; return UNKNOWN_DBL_VALUE; @@ -103,7 +103,7 @@ static double get_usage(struct psensor *sensor) v.iSize = sizeof(ADLPMActivity); - if (ADL_OK == adl_od5_currentactivity_get(sensor->amd_id, &v)) + if (adl_od5_currentactivity_get(sensor->amd_id, &v) == ADL_OK) return v.iActivityPercent; return UNKNOWN_DBL_VALUE; @@ -152,11 +152,11 @@ static struct psensor *create_sensor(int id, int type, int values_len) } /* - Returns the number of active AMD/ATI GPU adapters - - Return 0 if no AMD/ATI GPUs or cannot get information. -*/ -static int init() + * Returns the number of active AMD/ATI GPU adapters + * + * Return 0 if no AMD/ATI GPUs or cannot get information. + */ +static int init(void) { LPAdapterInfo lpadapterinfo; int i, inumberadapters, inumberadaptersactive, lpstatus, iadapterindex; @@ -200,17 +200,17 @@ static int init() } /* - 1 in 2nd parameter means retrieve adapter information only - for adapters that are physically present and enabled in the - system + * 1 in 2nd parameter means retrieve adapter information only + * for adapters that are physically present and enabled in the + * system */ - if (ADL_OK != adl_main_control_create(adl_main_memory_alloc, 1)) { + if (adl_main_control_create(adl_main_memory_alloc, 1) != ADL_OK) { log_err(_("AMD: failed to initialize ADL.")); return 0; } adl_main_control_done = 1; - if (ADL_OK != adl_adapter_numberofadapters_get(&inumberadapters)) { + if (adl_adapter_numberofadapters_get(&inumberadapters) != ADL_OK) { log_err(_("AMD: cannot get the number of adapters.")); return 0; } @@ -228,7 +228,7 @@ static int init() iadapterindex = lpadapterinfo[i].iAdapterIndex; - if (ADL_OK != adl_adapter_active_get(iadapterindex, &lpstatus)) + if (adl_adapter_active_get(iadapterindex, &lpstatus) != ADL_OK) continue; if (lpstatus != ADL_TRUE) continue; @@ -295,7 +295,7 @@ void amd_psensor_list_append(struct psensor ***sensors, int values_len) } } -void amd_cleanup() +void amd_cleanup(void) { if (hdll) { if (adl_main_control_done)