Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
Remove dead code
There are bunch of commented and #if 0'ed code that has been so for long
time so better to drop them.
  • Loading branch information
Jarkko Nikula committed May 14, 2013
1 parent 815d82c commit 041b178
Show file tree
Hide file tree
Showing 10 changed files with 0 additions and 133 deletions.
28 changes: 0 additions & 28 deletions dsme/dsme-wdd-wd.c
Expand Up @@ -93,25 +93,6 @@ void dsme_wd_kick(void)
}
}
}

#if 0 /* for debugging only */
static struct timespec previous_timestamp = { 0, 0 };
struct timespec timestamp;

if (clock_gettime(CLOCK_MONOTONIC, &timestamp) != -1) {
if (previous_timestamp.tv_sec != 0) {
long ms;

ms = (timestamp.tv_sec - previous_timestamp.tv_sec) * 1000;
ms += (timestamp.tv_nsec - previous_timestamp.tv_nsec) / 1000000;

if (ms > DSME_HEARTBEAT_INTERVAL * 1000 + 100) {
fprintf(stderr, ME "took %ld ms between WD kicks\n", ms);
}
}
previous_timestamp = timestamp;
}
#endif
}

static void check_for_wd_flags(bool wd_enabled[])
Expand All @@ -122,8 +103,6 @@ static void check_for_wd_flags(bool wd_enabled[])

p = dsme_rd_mode_get_flags();
if (p) {
//fprintf(stderr, ME "R&D mode enabled\n");

len = strlen(p);
if (len > 1) {
for (i = 0; i < WD_COUNT; ++i) {
Expand All @@ -140,7 +119,6 @@ static void check_for_wd_flags(bool wd_enabled[])
return;
}


bool dsme_wd_init(void)
{
int opened_wd_count = 0;
Expand Down Expand Up @@ -179,12 +157,6 @@ bool dsme_wd_init(void)
++opened_wd_count;

if (wd[i].period != 0) {
#if 0
fprintf(stderr,
ME "Setting WD period to %d s for %s\n",
wd[i].period,
wd[i].file);
#endif
/* set the wd period */
/* ioctl() will overwrite tmp with the time left */
int tmp = wd[i].period;
Expand Down
5 changes: 0 additions & 5 deletions dsme/dsme-wdd.c
Expand Up @@ -473,11 +473,6 @@ int main(int argc, char *argv[])
}

unsigned sleep_interval = DSME_HEARTBEAT_INTERVAL;
#if 0
fprintf(stderr,
ME "Entering main loop, with %u s interval\n",
sleep_interval);
#endif
mainloop(sleep_interval, to_child[1], from_child[0]);
fprintf(stderr, ME "Exited main loop, quitting\n");

Expand Down
8 changes: 0 additions & 8 deletions dsme/logging.c
Expand Up @@ -279,14 +279,6 @@ void dsme_log_txt(int level, const char* fmt, ...)
sem_post(&ring_buffer_sem);
}

#if 0 /* spam the console */
/* always output significant messages to console */
if (level <= LOG_NOTICE) {
vfprintf(stderr, fmt, ap);
fprintf(stderr, "\n");
}
#endif

va_end(ap);
}

Expand Down
7 changes: 0 additions & 7 deletions modules/dsme_dbus.c
Expand Up @@ -491,15 +491,10 @@ static bool filter_handle_message(Filter* filter, DBusMessage* msg)
switch (dbus_message_get_type(msg)) {

case DBUS_MESSAGE_TYPE_METHOD_CALL:
//dsme_log(LOG_DEBUG, "D-Bus: unknown method call");
// TODO: add logging
break;

case DBUS_MESSAGE_TYPE_SIGNAL:
//dsme_log(LOG_DEBUG, "D-Bus: unknown signal:");
//dsme_log(LOG_DEBUG, "path: '%s'", dbus_message_get_path(msg));
//dsme_log(LOG_DEBUG, "if: '%s'", dbus_message_get_interface(msg));
//dsme_log(LOG_DEBUG, "member: '%s'", dbus_message_get_member(msg));
break;

case DBUS_MESSAGE_TYPE_ERROR:
Expand Down Expand Up @@ -602,7 +597,6 @@ static bool service_handle_message(gpointer servicep,
bool handled = false;

if (dbus_message_get_type(msg) == DBUS_MESSAGE_TYPE_METHOD_CALL) {
//dsme_log(LOG_DEBUG, "D-Bus: method call");
handled = dispatcher_list_dispatch(service->methods, connection, msg);
}

Expand Down Expand Up @@ -720,7 +714,6 @@ static bool client_handle_message(gpointer clientp,
bool handled = false;

if (dbus_message_get_type(msg) == DBUS_MESSAGE_TYPE_SIGNAL) {
//dsme_log(LOG_DEBUG, "D-Bus: signal");
handled = dispatcher_list_dispatch(client->handlers, connection, msg);
}

Expand Down
11 changes: 0 additions & 11 deletions modules/dsme_dbus.h
Expand Up @@ -70,13 +70,6 @@ DsmeDbusMessage* dsme_dbus_signal_new(const char* path,
const char* interface,
const char* name);

#if 0
DsmeDbusMessage* dsme_dbus_call_new(const char* destination,
const char* path,
const char* interface,
const char* method);
#endif

void dsme_dbus_message_append_string(DsmeDbusMessage* msg, const char* s);
void dsme_dbus_message_append_int(DsmeDbusMessage* msg, int i);

Expand All @@ -87,10 +80,6 @@ bool dsme_dbus_message_get_bool(const DsmeDbusMessage* msg);
// NOTE: frees the signal; hence not const
void dsme_dbus_signal_emit(DsmeDbusMessage* sig);

#if 0
void dsme_dbus_call(DsmeDbusMessage* call, DsmeDbusHandler* handler);
#endif

char* dsme_dbus_endpoint_name(const DsmeDbusMessage* request);

#endif
11 changes: 0 additions & 11 deletions modules/powerontimer.c
Expand Up @@ -61,7 +61,6 @@ static bool dbus_bound = false;
static void get_poweron_time(const DsmeDbusMessage* request,
DsmeDbusMessage** reply)
{
// dsme_log(LOG_DEBUG, LOGPFIX"%s() called", __FUNCTION__);
*reply = dsme_dbus_reply_new(request);
dsme_dbus_message_append_int(*reply, (int)pot_get_poweron_secs());
}
Expand Down Expand Up @@ -102,19 +101,16 @@ static void poweron_update_cb(void)

DSME_HANDLER(DSM_MSGTYPE_WAKEUP, client, msg)
{
// dsme_log(LOG_DEBUG, LOGPFIX"%s event received", "WAKEUP");
poweron_update_cb();
}

DSME_HANDLER(DSM_MSGTYPE_DBUS_CONNECT, client, msg)
{
// dsme_log(LOG_INFO, LOGPFIX"%s event received", "DBUS_CONNECT");
dsme_dbus_bind_methods(&dbus_bound, methods, service, interface);
}

DSME_HANDLER(DSM_MSGTYPE_DBUS_DISCONNECT, client, msg)
{
// dsme_log(LOG_INFO, LOGPFIX"%s event received", "DBUS_DISCONNECT");
dsme_dbus_unbind_methods(&dbus_bound, methods, service, interface);
}

Expand All @@ -123,8 +119,6 @@ DSME_HANDLER(DSM_MSGTYPE_STATE_CHANGE_IND, server, msg)
bool user_mode = false;
bool force_save = false;

// dsme_log(LOG_INFO, LOGPFIX"%s event received", "STATE_CHANGE");

switch( msg->state )
{
case DSME_STATE_USER:
Expand Down Expand Up @@ -160,19 +154,14 @@ module_fn_info_t message_handlers[] =

void module_init(module_t* handle)
{
// dsme_log(LOG_DEBUG, LOGPFIX"initializing");
poweron_update_cb();

// dsme_log(LOG_DEBUG, "powerontimer.so loaded");
// QUARANTINE this_module = handle;
}

void module_fini(void)
{
// dsme_log(LOG_DEBUG, LOGPFIX"finalizing");
pot_update_cal(in_user_mode, true);

dsme_dbus_unbind_methods(&dbus_bound, methods, service, interface);

// dsme_log(LOG_DEBUG, "powerontimer.so unloaded");
}
51 changes: 0 additions & 51 deletions modules/powerontimer_backend.c
Expand Up @@ -90,31 +90,6 @@ typedef pot_cal_data_v1 pot_cal_data;
* Generic Utilities
* ========================================================================= */

/* ------------------------------------------------------------------------- *
* prettytime -- #seconds -> "#d #h #m #s"
* ------------------------------------------------------------------------- */

#if 0
static const char *prettytime(int32_t t)
{
static char buf[8][32];
static int i = 0;

uint32_t u = (uint32_t)((t<0) ? -t : t);

unsigned s,m,h,d;

s = u % 60, u /= 60;
m = u % 60, u /= 60;
h = u % 24, u /= 24;
d = u;
i = (i+1)&7;

snprintf(buf[i], sizeof *buf, "%s%ud %uh %um %us",(t<0) ? "-" : "", d,h,m,s);
return buf[i];
}
#endif

/* ------------------------------------------------------------------------- *
* monotime_get -- CLOCK_MONOTONIC -> struct timeval
* ------------------------------------------------------------------------- */
Expand Down Expand Up @@ -319,8 +294,6 @@ static int pot_write_cal(const pot_cal_data *pot)
goto cleanup;
}

// dsme_log(LOG_INFO, LOGPFIX"cal write OK");

err = 0;

cleanup:
Expand Down Expand Up @@ -380,11 +353,6 @@ void pot_update_cal(bool user_mode, bool force_save)
{
static bool pending_save = false;

/* dsme_log(LOG_DEBUG, LOGPFIX"%s(user:%d->%d, force:%d, pending:%d)",
* "update",
* pot_in_user_mode, user_mode, force_save, pending_save);
*/

int32_t uptime_now = 0;
int32_t poweron_dif = 0;
int32_t poweron_lim = 0;
Expand All @@ -393,13 +361,6 @@ void pot_update_cal(bool user_mode, bool force_save)
{
pot_cal_read_done = true;
pot_read_cal(&cal);

/* dsme_log(LOG_INFO, LOGPFIX"read cal: on = %s, up = %s, rb = %"PRId32", wr = %"PRId32"",
* prettytime(cal.poweron),
* prettytime(cal.uptime),
* cal.reboots,
* cal.updates);
*/
}

uptime_now = uptime_get();
Expand Down Expand Up @@ -428,10 +389,6 @@ void pot_update_cal(bool user_mode, bool force_save)
// update frequency depends on power on time stored at cal
poweron_lim = pot_update_lim(cal.poweron);

// dsme_log(LOG_DEBUG, LOGPFIX"tot = %s", prettytime(cal.poweron + poweron_dif));
// dsme_log(LOG_DEBUG, LOGPFIX"lim = %s", prettytime(poweron_lim));
// dsme_log(LOG_DEBUG, LOGPFIX"dif = %s", prettytime(poweron_dif));

// When to save ... the logic is ugly, but boils down to:
// 1. when forced
// 2. in user mode & update is large enough
Expand All @@ -447,17 +404,9 @@ void pot_update_cal(bool user_mode, bool force_save)
cal.poweron += poweron_dif;
pot_write_cal(&cal);
pending_save = false;

/* dsme_log(LOG_INFO, LOGPFIX"write cal: on = %s, up = %s, rb = %"PRId32", wr = %"PRId32"",
* prettytime(cal.poweron),
* prettytime(cal.uptime),
* cal.reboots,
* cal.updates);
*/
}
else
{
// dsme_log(LOG_DEBUG, LOGPFIX"write cal: (skipped)");
pending_save = true;
}
}
Expand Down
3 changes: 0 additions & 3 deletions modules/thermalmanager.c
Expand Up @@ -331,9 +331,6 @@ module_fn_info_t message_handlers[] = {
DSME_HANDLER_BINDING(DSM_MSGTYPE_WAKEUP),
DSME_HANDLER_BINDING(DSM_MSGTYPE_DBUS_CONNECT),
DSME_HANDLER_BINDING(DSM_MSGTYPE_DBUS_DISCONNECT),
#if 0 // TODO
DSME_HANDLER_BINDING(DSM_MSGTYPE_ENABLE_THERMAL_LOGGING),
#endif
#ifdef DSME_THERMAL_TUNING
DSME_HANDLER_BINDING(DSM_MSGTYPE_SET_TA_TEST_MODE),
#endif
Expand Down
6 changes: 0 additions & 6 deletions test/processwdtest.c
Expand Up @@ -170,12 +170,6 @@ int dsmeprocesswdtest(int testnum)
return retval;
}

#if 0
test_cases_begin
test_case_noauto(4241, "DSME Process watchdog test", "dsmeprocesswdtest", 0)
test_cases_end
#endif

int main(void)
{
dsmeprocesswdtest(0);
Expand Down
3 changes: 0 additions & 3 deletions util/dsmetool.c
Expand Up @@ -62,9 +62,6 @@ static void usage(const char* name)
printf(
"Note that the <cmd> should include absolute path.\n"
" -d --start-dbus Start DSME's D-Bus services\n"
#if 0 // TODO
" -s --stop-dbus Stop DSME's D-Bus services\n"
#endif
" -b --reboot Reboot the device\n"
" -v --version Print the versions of DSME and dsmetool\n"
" -t --telinit <runlevel name> Change runlevel\n"
Expand Down

0 comments on commit 041b178

Please sign in to comment.