From 3ae7531fa9b1bb0d16d4797a4b039bab2490cee7 Mon Sep 17 00:00:00 2001 From: Noel Maersk Date: Tue, 4 Feb 2014 20:55:58 +0200 Subject: [PATCH] adl: rename adl_errors() to adl_error_desc(), shorten error desc's, handle unknown error --- adl.c | 32 ++++++++++++++++---------------- 1 file changed, 16 insertions(+), 16 deletions(-) diff --git a/adl.c b/adl.c index 4ec723b9..8d01c32c 100644 --- a/adl.c +++ b/adl.c @@ -126,56 +126,56 @@ static LPADLDisplayInfo lpAdlDisplayInfo = NULL; int set_fanspeed(int gpu, int iFanSpeed); static float __gpu_temp(struct gpu_adl *ga); -char *adl_errors(int error) +char *adl_error_desc(int error) { char *result; switch(error) { case ADL_ERR: - result = "Generic Error. Most likely one or more of the Escape calls to the driver failed!"; + result = "Generic error (escape call failed?)"; break; case ADL_ERR_NOT_INIT: result = "ADL not initialized"; break; case ADL_ERR_INVALID_PARAM: - result = "One of the parameter passed is invalid"; + result = "Invalid parameter"; break; case ADL_ERR_INVALID_PARAM_SIZE: - result = "One of the parameter size is invalid"; + result = "Invalid parameter size"; break; case ADL_ERR_INVALID_ADL_IDX: - result = "Invalid ADL index passed"; + result = "Invalid ADL index"; break; case ADL_ERR_INVALID_CONTROLLER_IDX: - result = "Invalid controller index passed"; + result = "Invalid controller index"; break; case ADL_ERR_INVALID_DIPLAY_IDX: - result = "Invalid display index passed"; + result = "Invalid display index"; break; case ADL_ERR_NOT_SUPPORTED: - result = "Function not supported by the driver"; + result = "Function not supported by the driver"; break; case ADL_ERR_NULL_POINTER: result = "Null Pointer error"; break; case ADL_ERR_DISABLED_ADAPTER: - result = "Call can't be made due to disabled adapter"; + result = "Disabled adapter, can't make call"; break; case ADL_ERR_INVALID_CALLBACK: - result = "Invalid Callback"; + result = "Invalid callback"; break; case ADL_ERR_RESOURCE_CONFLICT: - result = "Display Resource conflict"; + result = "Display resource conflict"; break; case ADL_ERR_SET_INCOMPLETE: - result = "Failed to update some of the values. Can be returned by set request that include multiple values if not all values were successfully committed."; + result = "Failed to update some of the values"; break; case ADL_ERR_NO_XDISPLAY: - result = "There's no Linux XDisplay in Linux Console environment"; + result = "No Linux XDisplay in Linux Console environment"; break; default: + result = "Unhandled error"; break; - } return result; } @@ -304,13 +304,13 @@ static bool prepare_adl(void) // retrieve adapter information only for adapters that are physically present and enabled in the system result = ADL_Main_Control_Create(ADL_Main_Memory_Alloc, 1); if (result != ADL_OK) { - applog(LOG_INFO, "ADL initialisation error: %d! %s", result, adl_errors(result)); + applog(LOG_INFO, "ADL initialisation error: %d (%s)", result, adl_error_desc(result)); return false; } result = ADL_Main_Control_Refresh(); if (result != ADL_OK) { - applog(LOG_INFO, "ADL refresh error: %d! %s", result, adl_errors(result)); + applog(LOG_INFO, "ADL refresh error: %d (%s)", result, adl_error_desc(result)); return false; }