Skip to content

Commit

Permalink
[datapipe] Cache device_inactive_pipe output value
Browse files Browse the repository at this point in the history
Inactivity state can be modified by the filter, thus caching the original
input can lead to subtle errors in case the datapipe value is queried
directly.

Switch to caching filtered output value.

Signed-off-by: Simo Piiroinen <simo.piiroinen@jollamobile.com>
  • Loading branch information
spiiroin committed Jan 18, 2017
1 parent 4c0f8f9 commit b406333
Show file tree
Hide file tree
Showing 9 changed files with 18 additions and 18 deletions.
2 changes: 1 addition & 1 deletion event-input.c
Expand Up @@ -1882,7 +1882,7 @@ evin_iomon_generate_activity(struct input_event *ev, bool cooked, bool raw)
t_cooked = t;
execute_datapipe(&device_inactive_pipe,
GINT_TO_POINTER(FALSE),
USE_INDATA, CACHE_INDATA);
USE_INDATA, CACHE_OUTDATA);
}
}

Expand Down
12 changes: 6 additions & 6 deletions event-switches.c
Expand Up @@ -93,7 +93,7 @@ static gboolean generic_activity_iomon_cb(mce_io_mon_t *iomon, gpointer data, gs

/* Generate activity */
(void)execute_datapipe(&device_inactive_pipe, GINT_TO_POINTER(FALSE),
USE_INDATA, CACHE_INDATA);
USE_INDATA, CACHE_OUTDATA);

return FALSE;
}
Expand Down Expand Up @@ -121,7 +121,7 @@ static gboolean camera_launch_button_iomon_cb(mce_io_mon_t *iomon, gpointer data

/* Generate activity */
(void)execute_datapipe(&device_inactive_pipe, GINT_TO_POINTER(FALSE),
USE_INDATA, CACHE_INDATA);
USE_INDATA, CACHE_OUTDATA);

/* Update camera button state */
(void)execute_datapipe(&camera_button_pipe,
Expand Down Expand Up @@ -179,7 +179,7 @@ static gboolean kbd_slide_iomon_cb(mce_io_mon_t *iomon, gpointer data, gsize byt
/* Generate activity */
(void)execute_datapipe(&device_inactive_pipe,
GINT_TO_POINTER(FALSE),
USE_INDATA, CACHE_INDATA);
USE_INDATA, CACHE_OUTDATA);
} else {
slide_state = COVER_CLOSED;
}
Expand Down Expand Up @@ -211,7 +211,7 @@ static gboolean lid_cover_iomon_cb(mce_io_mon_t *iomon, gpointer data, gsize byt
/* Generate activity */
(void)execute_datapipe(&device_inactive_pipe,
GINT_TO_POINTER(FALSE),
USE_INDATA, CACHE_INDATA);
USE_INDATA, CACHE_OUTDATA);
} else {
lid_cover_state = COVER_CLOSED;
}
Expand Down Expand Up @@ -274,7 +274,7 @@ static gboolean usb_cable_iomon_cb(mce_io_mon_t *iomon, gpointer data, gsize byt

/* Generate activity */
(void)execute_datapipe(&device_inactive_pipe, GINT_TO_POINTER(FALSE),
USE_INDATA, CACHE_INDATA);
USE_INDATA, CACHE_OUTDATA);

(void)execute_datapipe(&usb_cable_pipe,
GINT_TO_POINTER(cable_state),
Expand Down Expand Up @@ -303,7 +303,7 @@ static gboolean lens_cover_iomon_cb(mce_io_mon_t *iomon, gpointer data, gsize by
/* Generate activity */
(void)execute_datapipe(&device_inactive_pipe,
GINT_TO_POINTER(FALSE),
USE_INDATA, CACHE_INDATA);
USE_INDATA, CACHE_OUTDATA);
} else {
lens_cover_state = COVER_CLOSED;
}
Expand Down
6 changes: 3 additions & 3 deletions modules/battery-bme.c
Expand Up @@ -332,7 +332,7 @@ static gboolean charger_charging_failed_dbus_cb(DBusMessage *const msg)

/* Generate activity */
(void)execute_datapipe(&device_inactive_pipe, GINT_TO_POINTER(FALSE),
USE_INDATA, CACHE_INDATA);
USE_INDATA, CACHE_OUTDATA);

status = TRUE;

Expand All @@ -359,7 +359,7 @@ static gboolean charger_connected_dbus_cb(DBusMessage *const msg)
/* Generate activity */
(void)execute_datapipe(&device_inactive_pipe,
GINT_TO_POINTER(FALSE),
USE_INDATA, CACHE_INDATA);
USE_INDATA, CACHE_OUTDATA);
cached_charger_connected = 1;
}

Expand Down Expand Up @@ -399,7 +399,7 @@ static gboolean charger_disconnected_dbus_cb(DBusMessage *const msg)
/* Generate activity */
(void)execute_datapipe(&device_inactive_pipe,
GINT_TO_POINTER(FALSE),
USE_INDATA, CACHE_INDATA);
USE_INDATA, CACHE_OUTDATA);
cached_charger_connected = 0;
}

Expand Down
2 changes: 1 addition & 1 deletion modules/battery-statefs.c
Expand Up @@ -745,7 +745,7 @@ mcebat_update_cb(gpointer user_data)

/* Generate activity */
(void)execute_datapipe(&device_inactive_pipe, GINT_TO_POINTER(FALSE),
USE_INDATA, CACHE_INDATA);
USE_INDATA, CACHE_OUTDATA);
}

if( mcebat.status != prev.status ) {
Expand Down
2 changes: 1 addition & 1 deletion modules/battery-upower.c
Expand Up @@ -713,7 +713,7 @@ mcebat_update_cb(gpointer user_data)

/* Generate activity */
(void)execute_datapipe(&device_inactive_pipe, GINT_TO_POINTER(FALSE),
USE_INDATA, CACHE_INDATA);
USE_INDATA, CACHE_OUTDATA);
}

if( mcebat.status != prev.status ) {
Expand Down
2 changes: 1 addition & 1 deletion modules/camera.c
Expand Up @@ -124,7 +124,7 @@ static gboolean camera_popout_state_iomon_input_cb(mce_io_mon_t *iomon, gpointer

/* Generate activity */
(void)execute_datapipe(&device_inactive_pipe, GINT_TO_POINTER(FALSE),
USE_INDATA, CACHE_INDATA);
USE_INDATA, CACHE_OUTDATA);

if (popout_unlock == FALSE)
goto EXIT;
Expand Down
2 changes: 1 addition & 1 deletion modules/display.c
Expand Up @@ -5856,7 +5856,7 @@ static void mdy_orientation_generate_activity(void)
mce_log(LL_DEBUG, "orientation change; generate activity");
execute_datapipe(&device_inactive_pipe,
GINT_TO_POINTER(FALSE),
USE_INDATA, CACHE_INDATA);
USE_INDATA, CACHE_OUTDATA);

EXIT:
return;
Expand Down
4 changes: 2 additions & 2 deletions modules/inactivity.c
Expand Up @@ -228,15 +228,15 @@ static const char *mia_inactivity_repr(bool inactive)
static void mia_generate_activity(void)
{
execute_datapipe(&device_inactive_pipe, GINT_TO_POINTER(FALSE),
USE_INDATA, CACHE_INDATA);
USE_INDATA, CACHE_OUTDATA);
}

/** Helper for switching to inactive state
*/
static void mia_generate_inactivity(void)
{
execute_datapipe(&device_inactive_pipe, GINT_TO_POINTER(TRUE),
USE_INDATA, CACHE_INDATA);
USE_INDATA, CACHE_OUTDATA);
}

/* ========================================================================= *
Expand Down
4 changes: 2 additions & 2 deletions tests/ut/ut_display.c
Expand Up @@ -1666,7 +1666,7 @@ START_TEST (ut_check_auto_dim)

/* Generate activity so adaptive_dimming_index gets inc. */
execute_datapipe(&device_inactive_pipe, GINT_TO_POINTER(FALSE),
USE_INDATA, CACHE_INDATA);
USE_INDATA, CACHE_OUTDATA);
ut_assert_transition(ut_is_display_state_eq,
GINT_TO_POINTER(MCE_DISPLAY_ON));
}
Expand Down Expand Up @@ -1706,7 +1706,7 @@ START_TEST (ut_check_adaptive_dim_timeout)

/* Generating activity the adaptive_dimming_index gets incremented */
execute_datapipe(&device_inactive_pipe, GINT_TO_POINTER(FALSE),
USE_INDATA, CACHE_INDATA);
USE_INDATA, CACHE_OUTDATA);
/* Verify adaptive_dimming_index=1 by meassuring rime to re-enter DIM */
expected_dim_time = ut_nth_possible_dim_timeout(forced_dti + 1);
ut_assert_transition(ut_is_display_state_eq,
Expand Down

0 comments on commit b406333

Please sign in to comment.