mirror of
https://github.com/GOSTSec/sgminer
synced 2025-09-12 22:21:56 +00:00
adl: code cleanup after last commit.
This commit is contained in:
parent
a7bca56633
commit
6089dfbbac
30
adl.c
30
adl.c
@ -39,7 +39,6 @@
|
||||
|
||||
bool adl_active;
|
||||
bool opt_reorder = false;
|
||||
bool adl6 = false;
|
||||
|
||||
int opt_hysteresis = 3;
|
||||
const int opt_targettemp = 75;
|
||||
@ -64,7 +63,7 @@ static void * __stdcall ADL_Main_Memory_Alloc(int iSize)
|
||||
// Optional Memory de-allocation function
|
||||
static void __stdcall ADL_Main_Memory_Free (void **lpBuffer)
|
||||
{
|
||||
if (NULL != *lpBuffer) {
|
||||
if (*lpBuffer != NULL) {
|
||||
free (*lpBuffer);
|
||||
*lpBuffer = NULL;
|
||||
}
|
||||
@ -170,11 +169,9 @@ static bool init_overdrive5()
|
||||
!ADL_Overdrive5_ODPerformanceLevels_Get || !ADL_Overdrive5_ODPerformanceLevels_Set ||
|
||||
!ADL_Overdrive5_PowerControl_Get || !ADL_Overdrive5_PowerControl_Set ||
|
||||
!ADL_Overdrive5_FanSpeedToDefault_Set) {
|
||||
applog(LOG_WARNING, "ATI ADL Overdrive5's API is missing");
|
||||
applog(LOG_WARNING, "ATI ADL Overdrive5's API is missing or broken.");
|
||||
return false;
|
||||
}
|
||||
else
|
||||
{
|
||||
} else {
|
||||
applog(LOG_INFO, "ATI ADL Overdrive5 API found.");
|
||||
}
|
||||
|
||||
@ -202,12 +199,9 @@ static bool init_overdrive6()
|
||||
!ADL_Overdrive6_PowerControl_Caps || !ADL_Overdrive6_PowerControlInfo_Get ||
|
||||
!ADL_Overdrive6_PowerControl_Get || !ADL_Overdrive6_FanSpeed_Set ||
|
||||
!ADL_Overdrive6_State_Set || !ADL_Overdrive6_PowerControl_Set) {
|
||||
applog(LOG_WARNING, "ATI ADL Overdrive6's API is missing");
|
||||
applog(LOG_WARNING, "ATI ADL Overdrive6's API is missing or broken.");
|
||||
return false;
|
||||
}
|
||||
else
|
||||
{
|
||||
adl6 = true;
|
||||
} else {
|
||||
applog(LOG_INFO, "ATI ADL Overdrive6 API found.");
|
||||
}
|
||||
|
||||
@ -228,7 +222,7 @@ static bool prepare_adl(void)
|
||||
hDLL = LoadLibrary("atiadlxy.dll");
|
||||
#endif
|
||||
if (hDLL == NULL) {
|
||||
applog(LOG_INFO, "Unable to load ati adl library");
|
||||
applog(LOG_INFO, "Unable to load ATI ADL library.");
|
||||
return false;
|
||||
}
|
||||
ADL_Main_Control_Create = (ADL_MAIN_CONTROL_CREATE) GetProcAddress(hDLL,"ADL_Main_Control_Create");
|
||||
@ -248,7 +242,7 @@ static bool prepare_adl(void)
|
||||
!ADL_Display_DisplayInfo_Get ||
|
||||
!ADL_Adapter_ID_Get || !ADL_Main_Control_Refresh ||
|
||||
!ADL_Adapter_VideoBiosInfo_Get || !ADL_Overdrive_Caps) {
|
||||
applog(LOG_WARNING, "ATI ADL's API is missing");
|
||||
applog(LOG_WARNING, "ATI ADL API is missing or broken.");
|
||||
return false;
|
||||
}
|
||||
|
||||
@ -256,18 +250,18 @@ 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! Error %d!", result);
|
||||
applog(LOG_INFO, "ADL initialisation error: %d!", result);
|
||||
return false;
|
||||
}
|
||||
|
||||
result = ADL_Main_Control_Refresh();
|
||||
if (result != ADL_OK) {
|
||||
applog(LOG_INFO, "ADL Refresh Error! Error %d!", result);
|
||||
applog(LOG_INFO, "ADL refresh error: %d!", result);
|
||||
return false;
|
||||
}
|
||||
|
||||
init_overdrive5();
|
||||
init_overdrive6();
|
||||
init_overdrive6(); // FIXME: don't if ADL6 is not present
|
||||
|
||||
return true;
|
||||
}
|
||||
@ -280,7 +274,7 @@ void init_adl(int nDevs)
|
||||
ADLBiosInfo BiosInfo;
|
||||
int iNumDisplays;
|
||||
|
||||
applog(LOG_INFO, "Number of ADL devices %d", nDevs);
|
||||
applog(LOG_INFO, "Number of ADL devices: %d", nDevs);
|
||||
|
||||
if (unlikely(pthread_mutex_init(&adl_lock, NULL))) {
|
||||
applog(LOG_ERR, "Failed to init adl_lock in init_adl");
|
||||
@ -334,7 +328,7 @@ void init_adl(int nDevs)
|
||||
if (result != ADL_OK) {
|
||||
applog(LOG_INFO, "Failed to ADL_Adapter_ID_Get. Error %d", result);
|
||||
if (result == -10)
|
||||
applog(LOG_INFO, "This error says the device is not enabled");
|
||||
applog(LOG_INFO, "(Device is not enabled.)");
|
||||
continue;
|
||||
}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user