summaryrefslogtreecommitdiffstats
path: root/src/power/power.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/power/power.c')
-rw-r--r--src/power/power.c24
1 files changed, 10 insertions, 14 deletions
diff --git a/src/power/power.c b/src/power/power.c
index 6ec24b6..cbd62a5 100644
--- a/src/power/power.c
+++ b/src/power/power.c
@@ -23,8 +23,6 @@
#include <stdlib.h>
#include <assert.h>
-#include <glib.h>
-
#ifdef HAS_GDBUS
# include <gio/gio.h>
@@ -41,8 +39,6 @@
#include "LMI_AssociatedPowerManagementService.h"
#include "LMI_PowerConcreteJob.h"
-#include "globals.h"
-
const char *provider_name = "powermanagement";
const ConfigEntry *provider_config_defaults = NULL;
@@ -137,7 +133,7 @@ Proxy *power_create_logind()
G_DBUS_PROXY_FLAGS_NONE, NULL, LOGIND_NAME, LOGIND_PATH,
LOGIND_INTERFACE, NULL, &err)) == NULL) {
- error("Unable to connect to logind via DBus: %s", err->message);
+ lmi_error("Unable to connect to logind via DBus: %s", err->message);
g_error_free(err);
return NULL;
}
@@ -145,7 +141,7 @@ Proxy *power_create_logind()
// the proxied object doesn't exist => don't use logind
if (g_dbus_proxy_get_cached_property_names(logind_proxy) == NULL) {
g_object_unref(logind_proxy);
- debug("Logind DBus interface is not available");
+ lmi_debug("Logind DBus interface is not available");
return NULL;
}
return logind_proxy;
@@ -164,7 +160,7 @@ bool power_call_logind(Proxy *proxy, const char *method)
g_variant_new("(b)", false), G_DBUS_CALL_FLAGS_NONE, -1, NULL,
&err)) == NULL) {
- error("Unable to call: %s", method, err->message);
+ lmi_error("Unable to call: %s", method, err->message);
g_error_free(err);
return false;
} else {
@@ -186,7 +182,7 @@ bool power_check_logind(Proxy *proxy, const char *method)
if ((result = g_dbus_proxy_call_sync(proxy, method, g_variant_new("()"),
G_DBUS_CALL_FLAGS_NONE, -1, NULL, &err)) == NULL) {
- error("Unable to call %s: %s", method, err->message);
+ lmi_error("Unable to call %s: %s", method, err->message);
g_error_free(err);
return false;
} else {
@@ -236,7 +232,7 @@ void *state_change_thread(void *data)
MUTEX_UNLOCK(powerStateChangeJob->power);
}
- debug("State change thread cancelled\n");
+ lmi_debug("State change thread cancelled\n");
return NULL;
}
@@ -313,7 +309,7 @@ void *state_change_thread(void *data)
powerStateChangeJob->timeOfLastChange = time(NULL);
MUTEX_UNLOCK(powerStateChangeJob);
- debug("State change thread finished\n");
+ lmi_debug("State change thread finished\n");
return NULL;
}
@@ -334,13 +330,13 @@ int power_request_power_state(Power *power, unsigned short state)
}
free(states);
if (!found) {
- error("Invalid state requested: %d\n", state);
+ lmi_error("Invalid state requested: %d\n", state);
return CMPI_RC_ERR_INVALID_PARAMETER;
}
PowerStateChangeJob *powerStateChangeJob = malloc(sizeof(PowerStateChangeJob));
if (powerStateChangeJob == NULL) {
- error("Memory allocation failed");
+ lmi_error("Memory allocation failed");
return CMPI_RC_ERR_FAILED;
}
powerStateChangeJob->id = job_max_id++;
@@ -379,7 +375,7 @@ int power_request_power_state(Power *power, unsigned short state)
powerStateChangeJob->thread = power->broker->xft->newThread(state_change_thread, powerStateChangeJob, 1);
power->jobs = g_list_append(power->jobs, powerStateChangeJob);
MUTEX_UNLOCK(power);
- debug("State change thread started\n");
+ lmi_debug("State change thread started\n");
return rc;
}
@@ -388,7 +384,7 @@ unsigned short *power_available_requested_power_states(Power *power, int *count)
{
unsigned short *list = malloc(17 * sizeof(unsigned short));
if (list == NULL) {
- error("Memory allocation failed");
+ lmi_error("Memory allocation failed");
return NULL;
}
int i = 0;