Skip to content

Commit

Permalink
[dsme] Do not use filter for system_state_pipe
Browse files Browse the repository at this point in the history
Filter is used in order to get the callback executed before output
triggers, while input triggers are executed even earlier and are
less likely to cause subtle errors later on.

Use input trigger instead of filter callback.

Signed-off-by: Simo Piiroinen <simo.piiroinen@jollamobile.com>
  • Loading branch information
spiiroin committed Jan 18, 2017
1 parent edffdac commit acd4f9c
Showing 1 changed file with 6 additions and 8 deletions.
14 changes: 6 additions & 8 deletions mce-dsme.c
Expand Up @@ -142,7 +142,7 @@ static void mce_dsme_dbus_quit(void);
* ------------------------------------------------------------------------- */

static void mce_dsme_datapipe_dsme_available_cb (gconstpointer data);
static gpointer mce_dsme_datapipe_system_state_cb (gpointer data);
static void mce_dsme_datapipe_system_state_cb (gconstpointer data);

static void mce_dsme_datapipe_init(void);
static void mce_dsme_datapipe_quit(void);
Expand Down Expand Up @@ -904,14 +904,12 @@ static void mce_dsme_datapipe_dsme_available_cb(gconstpointer const data)

/** Handle system_state_pipe notifications
*
* Implemented as an input filter to ensure this function gets
* Implemented as an input trigger to ensure this function gets
* executed before output triggers from other modules/plugins.
*
* @param data The system state (as a void pointer)
*
* @return system state (as a void pointer)
*/
static gpointer mce_dsme_datapipe_system_state_cb(gpointer data)
static void mce_dsme_datapipe_system_state_cb(gconstpointer data)
{
system_state_t prev = system_state;
system_state = GPOINTER_TO_INT(data);
Expand Down Expand Up @@ -965,16 +963,16 @@ static gpointer mce_dsme_datapipe_system_state_cb(gpointer data)
}

EXIT:
return GINT_TO_POINTER(system_state);
return;
}

/** Array of datapipe handlers */
static datapipe_handler_t mce_dsme_datapipe_handlers[] =
{
// input filters
// input triggers
{
.datapipe = &system_state_pipe,
.filter_cb = mce_dsme_datapipe_system_state_cb,
.input_cb = mce_dsme_datapipe_system_state_cb,
},
// output triggers
{
Expand Down

0 comments on commit acd4f9c

Please sign in to comment.