/*
* Copyright (C) 2010-2011 thgreasi@gmail.com, jeanfi@gmail.com
+ * Copyright (C) 2010-2012 jeanfi@gmail.com
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License as
/* Memory allocation function */
static void __stdcall *adl_main_memory_alloc(int isize)
{
- void *lpbuffer = malloc(isize);
- return lpbuffer;
+ void *lpbuffer = malloc(isize);
+ return lpbuffer;
}
-/* Optional Memory de-allocation function */
-static void __stdcall adl_main_memory_free(void **lpbuffer)
+static void *getprocaddress(void *plibrary, const char *name)
{
- if (*lpbuffer) {
- free(*lpbuffer);
- *lpbuffer = NULL;
- }
-}
-
-static void *getprocaddress(void *plibrary, const char * name)
-{
- return dlsym(plibrary, name);
+ return dlsym(plibrary, name);
}
/*
sid = malloc(strlen("amd") + 1 + strlen(name) + 1);
sprintf(sid, "amd %s", name);
- s = psensor_create(sid, strdup(name),
+ s = psensor_create(sid, strdup(name), strdup("ATI GPU"),
sensor_type, values_len);
s->amd_id = active_amd_adapters[id];
hdll = dlopen("libatiadlxx.so", RTLD_LAZY|RTLD_GLOBAL);
if (!hdll) {
- fprintf(stderr,
- _("ERROR: ADL library not found!\n"));
+ log_err(_("AMD: cannot found ADL library."));
return 0;
}
!adl_adapter_adapterinfo_get ||
!adl_overdrive5_temperature_get ||
!adl_overdrive5_fanspeed_get) {
- fprintf(stderr,
- _("ERROR: ADL's API is missing!\n"));
+ log_err(_("AMD: missing ADL's API."));
return 0;
}
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)) {
- fprintf(stderr,
- _("ERROR: ADL Initialization Error!\n"));
+ log_err(_("AMD: failed to initialize ADL."));
return 0;
}
adl_main_control_done = 1;
/* Obtain the number of adapters for the system */
if (ADL_OK != adl_adapter_numberofadapters_get(&inumberadapters)) {
- fprintf(stderr,
- _("ERROR: Cannot get the number of adapters!\n"));
+ log_err(_("AMD: cannot get the number of adapters."));
return 0;
}
active_amd_adapters[inumberadaptersactive-1] = iadapterindex;
}
- adl_main_memory_free((void **) &lpadapterinfo);
+ free(lpadapterinfo);
/* Each Adapter has one GPU temperature sensor and one fan
control sensor */