lib: Add more args to fpi_ssm callbacks

Pass the struct fp_dev and user_data to fpi_ssm callbacks, so that we
might be able to get rid of the fpi_ssm_get_user_data(), and
fpi_ssm_get_dev() as most drivers just get those from the ssm anyway
in their callbacks.
This commit is contained in:
Bastien Nocera
2018-09-18 13:46:39 +02:00
parent d34d7c26de
commit e397571f83
18 changed files with 112 additions and 104 deletions

View File

@@ -164,7 +164,7 @@ void fpi_ssm_free(fpi_ssm *machine)
static void __ssm_call_handler(fpi_ssm *machine)
{
fp_dbg("%p entering state %d", machine, machine->cur_state);
machine->handler(machine);
machine->handler(machine, machine->dev, machine->user_data);
}
/**
@@ -186,7 +186,7 @@ void fpi_ssm_start(fpi_ssm *ssm, ssm_completed_fn callback)
__ssm_call_handler(ssm);
}
static void __subsm_complete(fpi_ssm *ssm)
static void __subsm_complete(fpi_ssm *ssm, struct fp_dev *_dev, void *user_data)
{
fpi_ssm *parent = ssm->parentsm;
BUG_ON(!parent);
@@ -227,7 +227,7 @@ void fpi_ssm_mark_completed(fpi_ssm *machine)
machine->completed = TRUE;
fp_dbg("%p completed with status %d", machine, machine->error);
if (machine->callback)
machine->callback(machine);
machine->callback(machine, machine->dev, machine->user_data);
}
/**