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

@ -643,7 +643,7 @@ out:
libusb_free_transfer(transfer);
}
static void capture_run_state(fpi_ssm *ssm)
static void capture_run_state(fpi_ssm *ssm, struct fp_dev *_dev, void *user_data)
{
struct fp_img_dev *dev = fpi_ssm_get_user_data(ssm);
struct aes1610_dev *aesdev = FP_INSTANCE_DATA(FP_DEV(dev));
@ -690,7 +690,7 @@ static void capture_run_state(fpi_ssm *ssm)
};
}
static void capture_sm_complete(fpi_ssm *ssm)
static void capture_sm_complete(fpi_ssm *ssm, struct fp_dev *_dev, void *user_data)
{
struct fp_img_dev *dev = fpi_ssm_get_user_data(ssm);
struct aes1610_dev *aesdev = FP_INSTANCE_DATA(FP_DEV(dev));
@ -737,7 +737,7 @@ enum activate_states {
ACTIVATE_NUM_STATES,
};
static void activate_run_state(fpi_ssm *ssm)
static void activate_run_state(fpi_ssm *ssm, struct fp_dev *_dev, void *user_data)
{
struct fp_img_dev *dev = fpi_ssm_get_user_data(ssm);
@ -752,7 +752,7 @@ static void activate_run_state(fpi_ssm *ssm)
}
/* jump to finger detection */
static void activate_sm_complete(fpi_ssm *ssm)
static void activate_sm_complete(fpi_ssm *ssm, struct fp_dev *_dev, void *user_data)
{
struct fp_img_dev *dev = fpi_ssm_get_user_data(ssm);
fp_dbg("status %d", fpi_ssm_get_error(ssm));

View file

@ -520,7 +520,7 @@ out:
libusb_free_transfer(transfer);
}
static void capture_run_state(fpi_ssm *ssm)
static void capture_run_state(fpi_ssm *ssm, struct fp_dev *_dev, void *user_data)
{
struct fp_img_dev *dev = fpi_ssm_get_user_data(ssm);
struct aes2501_dev *aesdev = FP_INSTANCE_DATA(FP_DEV(dev));
@ -571,7 +571,7 @@ static void capture_run_state(fpi_ssm *ssm)
};
}
static void capture_sm_complete(fpi_ssm *ssm)
static void capture_sm_complete(fpi_ssm *ssm, struct fp_dev *_dev, void *user_data)
{
struct fp_img_dev *dev = fpi_ssm_get_user_data(ssm);
struct aes2501_dev *aesdev = FP_INSTANCE_DATA(FP_DEV(dev));
@ -736,7 +736,7 @@ static void activate_init3_cb(struct fp_img_dev *dev, int result,
fpi_ssm_mark_failed(ssm, result);
}
static void activate_run_state(fpi_ssm *ssm)
static void activate_run_state(fpi_ssm *ssm, struct fp_dev *_dev, void *user_data)
{
struct fp_img_dev *dev = fpi_ssm_get_user_data(ssm);
@ -790,7 +790,7 @@ static void activate_run_state(fpi_ssm *ssm)
}
}
static void activate_sm_complete(fpi_ssm *ssm)
static void activate_sm_complete(fpi_ssm *ssm, struct fp_dev *_dev, void *user_data)
{
struct fp_img_dev *dev = fpi_ssm_get_user_data(ssm);
fp_dbg("status %d", fpi_ssm_get_error(ssm));

View file

@ -323,7 +323,7 @@ out:
libusb_free_transfer(transfer);
}
static void capture_run_state(fpi_ssm *ssm)
static void capture_run_state(fpi_ssm *ssm, struct fp_dev *_dev, void *user_data)
{
struct fp_img_dev *dev = fpi_ssm_get_user_data(ssm);
int r;
@ -386,7 +386,7 @@ static void capture_run_state(fpi_ssm *ssm)
};
}
static void capture_sm_complete(fpi_ssm *ssm)
static void capture_sm_complete(fpi_ssm *ssm, struct fp_dev *_dev, void *user_data)
{
struct fp_img_dev *dev = fpi_ssm_get_user_data(ssm);
struct aes2550_dev *aesdev = FP_INSTANCE_DATA(FP_DEV(dev));
@ -482,7 +482,7 @@ static void calibrate_read_data_cb(struct libusb_transfer *transfer)
libusb_free_transfer(transfer);
}
static void activate_run_state(fpi_ssm *ssm)
static void activate_run_state(fpi_ssm *ssm, struct fp_dev *_dev, void *user_data)
{
struct fp_img_dev *dev = fpi_ssm_get_user_data(ssm);
int r;
@ -567,7 +567,7 @@ static void activate_run_state(fpi_ssm *ssm)
}
}
static void activate_sm_complete(fpi_ssm *ssm)
static void activate_sm_complete(fpi_ssm *ssm, struct fp_dev *_dev, void *user_data)
{
struct fp_img_dev *dev = fpi_ssm_get_user_data(ssm);
fp_dbg("status %d", fpi_ssm_get_error(ssm));

View file

@ -195,7 +195,7 @@ static void finger_det_set_idle_cmd_cb(struct libusb_transfer *transfer)
libusb_free_transfer(transfer);
}
static void finger_det_sm_complete(fpi_ssm *ssm)
static void finger_det_sm_complete(fpi_ssm *ssm, struct fp_dev *_dev, void *user_data)
{
struct fp_img_dev *dev = fpi_ssm_get_user_data(ssm);
struct aesX660_dev *aesdev = FP_INSTANCE_DATA(FP_DEV(dev));
@ -215,7 +215,7 @@ static void finger_det_sm_complete(fpi_ssm *ssm)
}
}
static void finger_det_run_state(fpi_ssm *ssm)
static void finger_det_run_state(fpi_ssm *ssm, struct fp_dev *_dev, void *user_data)
{
switch (fpi_ssm_get_cur_state(ssm)) {
case FINGER_DET_SEND_LED_CMD:
@ -370,7 +370,7 @@ out:
libusb_free_transfer(transfer);
}
static void capture_run_state(fpi_ssm *ssm)
static void capture_run_state(fpi_ssm *ssm, struct fp_dev *_dev, void *user_data)
{
struct fp_img_dev *dev = fpi_ssm_get_user_data(ssm);
struct aesX660_dev *aesdev = FP_INSTANCE_DATA(FP_DEV(dev));
@ -399,7 +399,7 @@ static void capture_run_state(fpi_ssm *ssm)
}
}
static void capture_sm_complete(fpi_ssm *ssm)
static void capture_sm_complete(fpi_ssm *ssm, struct fp_dev *_dev, void *user_data)
{
struct fp_img_dev *dev = fpi_ssm_get_user_data(ssm);
struct aesX660_dev *aesdev = FP_INSTANCE_DATA(FP_DEV(dev));
@ -532,7 +532,7 @@ out:
libusb_free_transfer(transfer);
}
static void activate_run_state(fpi_ssm *ssm)
static void activate_run_state(fpi_ssm *ssm, struct fp_dev *_dev, void *user_data)
{
struct fp_img_dev *dev = fpi_ssm_get_user_data(ssm);
struct aesX660_dev *aesdev = FP_INSTANCE_DATA(FP_DEV(dev));
@ -578,7 +578,7 @@ static void activate_run_state(fpi_ssm *ssm)
}
}
static void activate_sm_complete(fpi_ssm *ssm)
static void activate_sm_complete(fpi_ssm *ssm, struct fp_dev *_dev, void *user_data)
{
struct fp_img_dev *dev = fpi_ssm_get_user_data(ssm);
int err = fpi_ssm_get_error(ssm);

View file

@ -440,7 +440,7 @@ enum stop_capture_states {
STOP_CAPTURE_NUM_STATES,
};
static void stop_capture_run_state(fpi_ssm *ssm)
static void stop_capture_run_state(fpi_ssm *ssm, struct fp_dev *_dev, void *user_data)
{
G_DEBUG_HERE();
@ -451,7 +451,7 @@ static void stop_capture_run_state(fpi_ssm *ssm)
}
}
static void stop_capture_complete(fpi_ssm *ssm)
static void stop_capture_complete(fpi_ssm *ssm, struct fp_dev *_dev, void *user_data)
{
struct fp_img_dev *dev = fpi_ssm_get_user_data(ssm);
struct elan_dev *elandev = FP_INSTANCE_DATA(FP_DEV(dev));
@ -499,7 +499,7 @@ enum capture_states {
CAPTURE_NUM_STATES,
};
static void capture_run_state(fpi_ssm *ssm)
static void capture_run_state(fpi_ssm *ssm, struct fp_dev *_dev, void *user_data)
{
struct fp_img_dev *dev = fpi_ssm_get_user_data(ssm);
struct elan_dev *elandev = FP_INSTANCE_DATA(FP_DEV(dev));
@ -537,7 +537,7 @@ static void capture_run_state(fpi_ssm *ssm)
}
}
static void capture_complete(fpi_ssm *ssm)
static void capture_complete(fpi_ssm *ssm, struct fp_dev *_dev, void *user_data)
{
struct fp_img_dev *dev = fpi_ssm_get_user_data(ssm);
struct elan_dev *elandev = FP_INSTANCE_DATA(FP_DEV(dev));
@ -622,7 +622,7 @@ enum calibrate_states {
CALIBRATE_NUM_STATES,
};
static void calibrate_run_state(fpi_ssm *ssm)
static void calibrate_run_state(fpi_ssm *ssm, struct fp_dev *_dev, void *user_data)
{
struct fp_img_dev *dev = fpi_ssm_get_user_data(ssm);
struct elan_dev *elandev = FP_INSTANCE_DATA(FP_DEV(dev));
@ -687,7 +687,7 @@ static void calibrate_run_state(fpi_ssm *ssm)
}
}
static void calibrate_complete(fpi_ssm *ssm)
static void calibrate_complete(fpi_ssm *ssm, struct fp_dev *_dev, void *user_data)
{
struct fp_img_dev *dev = fpi_ssm_get_user_data(ssm);
@ -723,7 +723,7 @@ enum activate_states {
ACTIVATE_NUM_STATES,
};
static void activate_run_state(fpi_ssm *ssm)
static void activate_run_state(fpi_ssm *ssm, struct fp_dev *_dev, void *user_data)
{
struct fp_img_dev *dev = fpi_ssm_get_user_data(ssm);
struct elan_dev *elandev = FP_INSTANCE_DATA(FP_DEV(dev));
@ -767,7 +767,7 @@ static void activate_run_state(fpi_ssm *ssm)
}
}
static void activate_complete(fpi_ssm *ssm)
static void activate_complete(fpi_ssm *ssm, struct fp_dev *_dev, void *user_data)
{
struct fp_img_dev *dev = fpi_ssm_get_user_data(ssm);

View file

@ -699,7 +699,7 @@ static void async_tx_cb(struct libusb_transfer *transfer)
}
}
static void m_exit_state(fpi_ssm *ssm)
static void m_exit_state(fpi_ssm *ssm, struct fp_dev *_dev, void *user_data)
{
struct fp_img_dev *idev = fpi_ssm_get_user_data(ssm);
struct etes603_dev *dev = FP_INSTANCE_DATA(FP_DEV(idev));
@ -727,7 +727,7 @@ err:
fpi_ssm_mark_failed(ssm, -EIO);
}
static void m_exit_complete(fpi_ssm *ssm)
static void m_exit_complete(fpi_ssm *ssm, struct fp_dev *_dev, void *user_data)
{
struct fp_img_dev *idev = fpi_ssm_get_user_data(ssm);
@ -748,7 +748,7 @@ static void m_exit_start(struct fp_img_dev *idev)
fpi_ssm_start(ssm, m_exit_complete);
}
static void m_capture_state(fpi_ssm *ssm)
static void m_capture_state(fpi_ssm *ssm, struct fp_dev *_dev, void *user_data)
{
struct fp_img_dev *idev = fpi_ssm_get_user_data(ssm);
struct etes603_dev *dev = FP_INSTANCE_DATA(FP_DEV(idev));
@ -829,7 +829,7 @@ err:
fpi_ssm_mark_failed(ssm, -EIO);
}
static void m_capture_complete(fpi_ssm *ssm)
static void m_capture_complete(fpi_ssm *ssm, struct fp_dev *_dev, void *user_data)
{
struct fp_img_dev *idev = fpi_ssm_get_user_data(ssm);
struct etes603_dev *dev = FP_INSTANCE_DATA(FP_DEV(idev));
@ -851,7 +851,7 @@ static void m_capture_complete(fpi_ssm *ssm)
}
}
static void m_finger_state(fpi_ssm *ssm)
static void m_finger_state(fpi_ssm *ssm, struct fp_dev *_dev, void *user_data)
{
struct fp_img_dev *idev = fpi_ssm_get_user_data(ssm);
struct etes603_dev *dev = FP_INSTANCE_DATA(FP_DEV(idev));
@ -947,7 +947,7 @@ err:
fpi_ssm_mark_failed(ssm, -EIO);
}
static void m_finger_complete(fpi_ssm *ssm)
static void m_finger_complete(fpi_ssm *ssm, struct fp_dev *_dev, void *user_data)
{
struct fp_img_dev *idev = fpi_ssm_get_user_data(ssm);
struct etes603_dev *dev = FP_INSTANCE_DATA(FP_DEV(idev));
@ -979,7 +979,7 @@ static void m_start_fingerdetect(struct fp_img_dev *idev)
/*
* Tune value of VRT and VRB for contrast and brightness.
*/
static void m_tunevrb_state(fpi_ssm *ssm)
static void m_tunevrb_state(fpi_ssm *ssm, struct fp_dev *_dev, void *user_data)
{
struct fp_img_dev *idev = fpi_ssm_get_user_data(ssm);
struct etes603_dev *dev = FP_INSTANCE_DATA(FP_DEV(idev));
@ -1131,7 +1131,7 @@ err:
fpi_ssm_mark_failed(ssm, -EIO);
}
static void m_tunevrb_complete(fpi_ssm *ssm)
static void m_tunevrb_complete(fpi_ssm *ssm, struct fp_dev *_dev, void *user_data)
{
struct fp_img_dev *idev = fpi_ssm_get_user_data(ssm);
@ -1153,7 +1153,7 @@ static void m_tunevrb_complete(fpi_ssm *ssm)
* This function tunes the DCoffset value and adjusts the gain value if
* required.
*/
static void m_tunedc_state(fpi_ssm *ssm)
static void m_tunedc_state(fpi_ssm *ssm, struct fp_dev *_dev, void *user_data)
{
struct fp_img_dev *idev = fpi_ssm_get_user_data(ssm);
struct etes603_dev *dev = FP_INSTANCE_DATA(FP_DEV(idev));
@ -1256,7 +1256,7 @@ err:
}
static void m_tunedc_complete(fpi_ssm *ssm)
static void m_tunedc_complete(fpi_ssm *ssm, struct fp_dev *_dev, void *user_data)
{
struct fp_img_dev *idev = fpi_ssm_get_user_data(ssm);
if (!fpi_ssm_get_error(ssm)) {
@ -1274,7 +1274,7 @@ static void m_tunedc_complete(fpi_ssm *ssm)
fpi_ssm_free(ssm);
}
static void m_init_state(fpi_ssm *ssm)
static void m_init_state(fpi_ssm *ssm, struct fp_dev *_dev, void *user_data)
{
struct fp_img_dev *idev = fpi_ssm_get_user_data(ssm);
struct etes603_dev *dev = FP_INSTANCE_DATA(FP_DEV(idev));
@ -1375,7 +1375,7 @@ err:
}
static void m_init_complete(fpi_ssm *ssm)
static void m_init_complete(fpi_ssm *ssm, struct fp_dev *_dev, void *user_data)
{
struct fp_img_dev *idev = fpi_ssm_get_user_data(ssm);
if (!fpi_ssm_get_error(ssm)) {

View file

@ -763,7 +763,7 @@ enum awfsm_1000_states {
AWFSM_1000_NUM_STATES,
};
static void awfsm_2016_run_state(fpi_ssm *ssm)
static void awfsm_2016_run_state(fpi_ssm *ssm, struct fp_dev *_dev, void *user_data)
{
struct fp_img_dev *dev = fpi_ssm_get_user_data(ssm);
struct sonly_dev *sdev = FP_INSTANCE_DATA(FP_DEV(dev));
@ -810,7 +810,7 @@ static void awfsm_2016_run_state(fpi_ssm *ssm)
}
}
static void awfsm_1000_run_state(fpi_ssm *ssm)
static void awfsm_1000_run_state(fpi_ssm *ssm, struct fp_dev *_dev, void *user_data)
{
switch (fpi_ssm_get_cur_state(ssm)) {
case AWFSM_1000_WRITEV_1:
@ -881,7 +881,7 @@ static void capsm_fire_bulk(fpi_ssm *ssm)
fpi_ssm_next_state(ssm);
}
static void capsm_2016_run_state(fpi_ssm *ssm)
static void capsm_2016_run_state(fpi_ssm *ssm, struct fp_dev *_dev, void *user_data)
{
struct fp_img_dev *dev = fpi_ssm_get_user_data(ssm);
struct sonly_dev *sdev = FP_INSTANCE_DATA(FP_DEV(dev));
@ -913,7 +913,7 @@ static void capsm_2016_run_state(fpi_ssm *ssm)
}
}
static void capsm_1000_run_state(fpi_ssm *ssm)
static void capsm_1000_run_state(fpi_ssm *ssm, struct fp_dev *_dev, void *user_data)
{
struct fp_img_dev *dev = fpi_ssm_get_user_data(ssm);
struct sonly_dev *sdev = FP_INSTANCE_DATA(FP_DEV(dev));
@ -939,7 +939,7 @@ static void capsm_1000_run_state(fpi_ssm *ssm)
}
}
static void capsm_1001_run_state(fpi_ssm *ssm)
static void capsm_1001_run_state(fpi_ssm *ssm, struct fp_dev *_dev, void *user_data)
{
struct fp_img_dev *dev = fpi_ssm_get_user_data(ssm);
struct sonly_dev *sdev = FP_INSTANCE_DATA(FP_DEV(dev));
@ -994,7 +994,7 @@ enum deinitsm_1001_states {
DEINITSM_1001_NUM_STATES,
};
static void deinitsm_2016_run_state(fpi_ssm *ssm)
static void deinitsm_2016_run_state(fpi_ssm *ssm, struct fp_dev *_dev, void *user_data)
{
switch (fpi_ssm_get_cur_state(ssm)) {
case DEINITSM_2016_WRITEV:
@ -1003,7 +1003,7 @@ static void deinitsm_2016_run_state(fpi_ssm *ssm)
}
}
static void deinitsm_1000_run_state(fpi_ssm *ssm)
static void deinitsm_1000_run_state(fpi_ssm *ssm, struct fp_dev *_dev, void *user_data)
{
switch (fpi_ssm_get_cur_state(ssm)) {
case DEINITSM_1000_WRITEV:
@ -1012,7 +1012,7 @@ static void deinitsm_1000_run_state(fpi_ssm *ssm)
}
}
static void deinitsm_1001_run_state(fpi_ssm *ssm)
static void deinitsm_1001_run_state(fpi_ssm *ssm, struct fp_dev *_dev, void *user_data)
{
switch (fpi_ssm_get_cur_state(ssm)) {
case DEINITSM_1001_WRITEV:
@ -1048,7 +1048,7 @@ enum initsm_1001_states {
INITSM_1001_NUM_STATES,
};
static void initsm_2016_run_state(fpi_ssm *ssm)
static void initsm_2016_run_state(fpi_ssm *ssm, struct fp_dev *_dev, void *user_data)
{
struct fp_img_dev *dev = fpi_ssm_get_user_data(ssm);
struct sonly_dev *sdev = FP_INSTANCE_DATA(FP_DEV(dev));
@ -1078,7 +1078,7 @@ static void initsm_2016_run_state(fpi_ssm *ssm)
}
}
static void initsm_1000_run_state(fpi_ssm *ssm)
static void initsm_1000_run_state(fpi_ssm *ssm, struct fp_dev *_dev, void *user_data)
{
switch (fpi_ssm_get_cur_state(ssm)) {
case INITSM_1000_WRITEV_1:
@ -1087,7 +1087,7 @@ static void initsm_1000_run_state(fpi_ssm *ssm)
}
}
static void initsm_1001_run_state(fpi_ssm *ssm)
static void initsm_1001_run_state(fpi_ssm *ssm, struct fp_dev *_dev, void *user_data)
{
switch (fpi_ssm_get_cur_state(ssm)) {
case INITSM_1001_WRITEV_1:
@ -1120,7 +1120,7 @@ enum loopsm_states {
LOOPSM_NUM_STATES,
};
static void loopsm_run_state(fpi_ssm *ssm)
static void loopsm_run_state(fpi_ssm *ssm, struct fp_dev *_dev, void *user_data)
{
struct fp_img_dev *dev = fpi_ssm_get_user_data(ssm);
struct sonly_dev *sdev = FP_INSTANCE_DATA(FP_DEV(dev));
@ -1245,7 +1245,7 @@ static void dev_deactivate(struct fp_img_dev *dev)
cancel_img_transfers(dev);
}
static void loopsm_complete(fpi_ssm *ssm)
static void loopsm_complete(fpi_ssm *ssm, struct fp_dev *_dev, void *user_data)
{
struct fp_img_dev *dev = fpi_ssm_get_user_data(ssm);
struct sonly_dev *sdev = FP_INSTANCE_DATA(FP_DEV(dev));
@ -1264,7 +1264,7 @@ static void loopsm_complete(fpi_ssm *ssm)
}
}
static void initsm_complete(fpi_ssm *ssm)
static void initsm_complete(fpi_ssm *ssm, struct fp_dev *_dev, void *user_data)
{
struct fp_img_dev *dev = fpi_ssm_get_user_data(ssm);
struct sonly_dev *sdev = FP_INSTANCE_DATA(FP_DEV(dev));

View file

@ -98,7 +98,7 @@ static void read_init_data_cb(struct libusb_transfer *transfer)
libusb_free_transfer(transfer);
}
static void activate_run_state(fpi_ssm *ssm)
static void activate_run_state(fpi_ssm *ssm, struct fp_dev *_dev, void *user_data)
{
struct fp_img_dev *dev = fpi_ssm_get_user_data(ssm);
struct upektc_dev *upekdev = FP_INSTANCE_DATA(FP_DEV(dev));
@ -148,7 +148,7 @@ static void activate_run_state(fpi_ssm *ssm)
}
}
static void activate_sm_complete(fpi_ssm *ssm)
static void activate_sm_complete(fpi_ssm *ssm, struct fp_dev *_dev, void *user_data)
{
struct fp_img_dev *dev = fpi_ssm_get_user_data(ssm);
fp_dbg("status %d", fpi_ssm_get_error(ssm));
@ -321,7 +321,7 @@ out:
libusb_free_transfer(transfer);
}
static void capture_run_state(fpi_ssm *ssm)
static void capture_run_state(fpi_ssm *ssm, struct fp_dev *_dev, void *user_data)
{
struct fp_img_dev *dev = fpi_ssm_get_user_data(ssm);
struct upektc_dev *upekdev = FP_INSTANCE_DATA(FP_DEV(dev));
@ -370,7 +370,7 @@ static void capture_run_state(fpi_ssm *ssm)
};
}
static void capture_sm_complete(fpi_ssm *ssm)
static void capture_sm_complete(fpi_ssm *ssm, struct fp_dev *_dev, void *user_data)
{
struct fp_img_dev *dev = fpi_ssm_get_user_data(ssm);
struct upektc_dev *upekdev = FP_INSTANCE_DATA(FP_DEV(dev));

View file

@ -304,7 +304,7 @@ static void capture_read_data_cb(struct libusb_transfer *transfer)
}
}
static void capture_run_state(fpi_ssm *ssm)
static void capture_run_state(fpi_ssm *ssm, struct fp_dev *_dev, void *user_data)
{
struct fp_img_dev *dev = fpi_ssm_get_user_data(ssm);
struct upektc_img_dev *upekdev = FP_INSTANCE_DATA(FP_DEV(dev));
@ -341,7 +341,7 @@ static void capture_run_state(fpi_ssm *ssm)
};
}
static void capture_sm_complete(fpi_ssm *ssm)
static void capture_sm_complete(fpi_ssm *ssm, struct fp_dev *_dev, void *user_data)
{
struct fp_img_dev *dev = fpi_ssm_get_user_data(ssm);
struct upektc_img_dev *upekdev = FP_INSTANCE_DATA(FP_DEV(dev));
@ -401,7 +401,7 @@ static void deactivate_read_data_cb(struct libusb_transfer *transfer)
}
}
static void deactivate_run_state(fpi_ssm *ssm)
static void deactivate_run_state(fpi_ssm *ssm, struct fp_dev *_dev, void *user_data)
{
struct fp_img_dev *dev = fpi_ssm_get_user_data(ssm);
struct upektc_img_dev *upekdev = FP_INSTANCE_DATA(FP_DEV(dev));
@ -418,7 +418,7 @@ static void deactivate_run_state(fpi_ssm *ssm)
};
}
static void deactivate_sm_complete(fpi_ssm *ssm)
static void deactivate_sm_complete(fpi_ssm *ssm, struct fp_dev *_dev, void *user_data)
{
struct fp_img_dev *dev = fpi_ssm_get_user_data(ssm);
struct upektc_img_dev *upekdev = FP_INSTANCE_DATA(FP_DEV(dev));
@ -498,7 +498,7 @@ static void init_read_data_cb(struct libusb_transfer *transfer)
}
}
static void activate_run_state(fpi_ssm *ssm)
static void activate_run_state(fpi_ssm *ssm, struct fp_dev *_dev, void *user_data)
{
struct libusb_transfer *transfer;
struct fp_img_dev *idev = fpi_ssm_get_user_data(ssm);
@ -562,7 +562,7 @@ static void activate_run_state(fpi_ssm *ssm)
}
}
static void activate_sm_complete(fpi_ssm *ssm)
static void activate_sm_complete(fpi_ssm *ssm, struct fp_dev *_dev, void *user_data)
{
struct fp_img_dev *dev = fpi_ssm_get_user_data(ssm);
int err = fpi_ssm_get_error(ssm);

View file

@ -649,7 +649,7 @@ static void initsm_send_msg28_handler(fpi_ssm *ssm,
}
}
static void initsm_run_state(fpi_ssm *ssm)
static void initsm_run_state(fpi_ssm *ssm, struct fp_dev *_dev, void *user_data)
{
struct fp_dev *dev = fpi_ssm_get_dev(ssm);
struct upekts_dev *upekdev = FP_INSTANCE_DATA(dev);
@ -785,7 +785,7 @@ static void read_msg01_cb(struct fp_dev *dev, enum read_msg_status status,
fpi_ssm_next_state(ssm);
}
static void deinitsm_state_handler(fpi_ssm *ssm)
static void deinitsm_state_handler(fpi_ssm *ssm, struct fp_dev *_dev, void *user_data)
{
struct fp_dev *dev = fpi_ssm_get_dev(ssm);
int r;
@ -869,7 +869,7 @@ enum enroll_start_sm_states {
};
/* Called when the device initialization state machine completes */
static void enroll_start_sm_cb_initsm(fpi_ssm *initsm)
static void enroll_start_sm_cb_initsm(fpi_ssm *initsm, struct fp_dev *_dev, void *user_data)
{
fpi_ssm *enroll_start_ssm = fpi_ssm_get_user_data(initsm);
int error = fpi_ssm_get_error(initsm);
@ -917,7 +917,7 @@ static void enroll_start_sm_cb_msg28(struct fp_dev *dev,
}
}
static void enroll_start_sm_run_state(fpi_ssm *ssm)
static void enroll_start_sm_run_state(fpi_ssm *ssm, struct fp_dev *_dev, void *user_data)
{
struct fp_dev *dev = fpi_ssm_get_dev(ssm);
int r;
@ -1112,7 +1112,7 @@ static void enroll_iterate(struct fp_dev *dev)
}
}
static void enroll_started(fpi_ssm *ssm)
static void enroll_started(fpi_ssm *ssm, struct fp_dev *_dev, void *user_data)
{
struct fp_dev *dev = fpi_ssm_get_dev(ssm);
fpi_drvcb_enroll_started(dev, fpi_ssm_get_error(ssm));
@ -1136,7 +1136,7 @@ static int enroll_start(struct fp_dev *dev)
return 0;
}
static void enroll_stop_deinit_cb(fpi_ssm *ssm)
static void enroll_stop_deinit_cb(fpi_ssm *ssm, struct fp_dev *_dev, void *user_data)
{
/* don't really care about errors */
fpi_drvcb_enroll_stopped(fpi_ssm_get_dev(ssm));
@ -1150,7 +1150,7 @@ static int enroll_stop(struct fp_dev *dev)
return 0;
}
static void verify_stop_deinit_cb(fpi_ssm *ssm)
static void verify_stop_deinit_cb(fpi_ssm *ssm, struct fp_dev *_dev, void *user_data)
{
/* don't really care about errors */
fpi_drvcb_verify_stopped(fpi_ssm_get_dev(ssm));
@ -1176,7 +1176,7 @@ enum {
};
/* Called when the device initialization state machine completes */
static void verify_start_sm_cb_initsm(fpi_ssm *initsm)
static void verify_start_sm_cb_initsm(fpi_ssm *initsm, struct fp_dev *_dev, void *user_data)
{
fpi_ssm *verify_start_ssm = fpi_ssm_get_user_data(initsm);
int err;
@ -1201,7 +1201,7 @@ static void verify_init_2803_cb(struct libusb_transfer *transfer)
libusb_free_transfer(transfer);
}
static void verify_start_sm_run_state(fpi_ssm *ssm)
static void verify_start_sm_run_state(fpi_ssm *ssm, struct fp_dev *_dev, void *user_data)
{
struct fp_dev *dev = fpi_ssm_get_dev(ssm);
int r;
@ -1390,7 +1390,7 @@ static void verify_iterate(struct fp_dev *dev)
}
}
static void verify_started(fpi_ssm *ssm)
static void verify_started(fpi_ssm *ssm, struct fp_dev *_dev, void *user_data)
{
struct fp_dev *dev = fpi_ssm_get_dev(ssm);
struct upekts_dev *upekdev = FP_INSTANCE_DATA(dev);

View file

@ -687,7 +687,7 @@ static int calc_dev2(struct uru4k_image *img)
return res / IMAGE_WIDTH;
}
static void imaging_run_state(fpi_ssm *ssm)
static void imaging_run_state(fpi_ssm *ssm, struct fp_dev *_dev, void *user_data)
{
struct fp_img_dev *dev = fpi_ssm_get_user_data(ssm);
struct uru4k_dev *urudev = FP_INSTANCE_DATA(FP_DEV(dev));
@ -810,7 +810,7 @@ static void imaging_run_state(fpi_ssm *ssm)
}
}
static void imaging_complete(fpi_ssm *ssm)
static void imaging_complete(fpi_ssm *ssm, struct fp_dev *_dev, void *user_data)
{
struct fp_img_dev *dev = fpi_ssm_get_user_data(ssm);
struct uru4k_dev *urudev = FP_INSTANCE_DATA(FP_DEV(dev));
@ -874,7 +874,7 @@ static void rebootpwr_pause_cb(void *data)
}
}
static void rebootpwr_run_state(fpi_ssm *ssm)
static void rebootpwr_run_state(fpi_ssm *ssm, struct fp_dev *_dev, void *user_data)
{
struct fp_img_dev *dev = fpi_ssm_get_user_data(ssm);
struct uru4k_dev *urudev = FP_INSTANCE_DATA(FP_DEV(dev));
@ -953,7 +953,7 @@ static void powerup_pause_cb(void *data)
}
}
static void powerup_run_state(fpi_ssm *ssm)
static void powerup_run_state(fpi_ssm *ssm, struct fp_dev *_dev, void *user_data)
{
struct fp_img_dev *dev = fpi_ssm_get_user_data(ssm);
struct uru4k_dev *urudev = FP_INSTANCE_DATA(FP_DEV(dev));
@ -1058,7 +1058,7 @@ static void init_scanpwr_timeout(void *user_data)
}
}
static void init_run_state(fpi_ssm *ssm)
static void init_run_state(fpi_ssm *ssm, struct fp_dev *_dev, void *user_data)
{
struct fp_img_dev *dev = fpi_ssm_get_user_data(ssm);
struct uru4k_dev *urudev = FP_INSTANCE_DATA(FP_DEV(dev));
@ -1136,7 +1136,7 @@ static void init_run_state(fpi_ssm *ssm)
}
}
static void activate_initsm_complete(fpi_ssm *ssm)
static void activate_initsm_complete(fpi_ssm *ssm, struct fp_dev *_dev, void *user_data)
{
struct fp_img_dev *dev = fpi_ssm_get_user_data(ssm);
int r = fpi_ssm_get_error(ssm);

View file

@ -265,7 +265,7 @@ enum loop_states {
LOOP_NUM_STATES,
};
static void loop_run_state(fpi_ssm *ssm)
static void loop_run_state(fpi_ssm *ssm, struct fp_dev *_dev, void *user_data)
{
struct fp_img_dev *dev = fpi_ssm_get_user_data(ssm);
struct v5s_dev *vdev = FP_INSTANCE_DATA(FP_DEV(dev));
@ -293,7 +293,7 @@ static void loop_run_state(fpi_ssm *ssm)
}
}
static void loopsm_complete(fpi_ssm *ssm)
static void loopsm_complete(fpi_ssm *ssm, struct fp_dev *_dev, void *user_data)
{
struct fp_img_dev *dev = fpi_ssm_get_user_data(ssm);
struct v5s_dev *vdev = FP_INSTANCE_DATA(FP_DEV(dev));

View file

@ -279,7 +279,7 @@ static void submit_image(struct fp_img_dev *idev)
/* Proto functions */
/* SSM loop for clear_ep2 */
static void clear_ep2_ssm(fpi_ssm *ssm)
static void clear_ep2_ssm(fpi_ssm *ssm, struct fp_dev *_dev, void *user_data)
{
struct fp_img_dev *idev = fpi_ssm_get_user_data(ssm);
@ -316,7 +316,7 @@ static void clear_ep2(fpi_ssm *ssm)
fpi_ssm_start_subsm(ssm, subsm);
}
static void send_control_packet_ssm(fpi_ssm *ssm)
static void send_control_packet_ssm(fpi_ssm *ssm, struct fp_dev *_dev, void *user_data)
{
struct fp_img_dev *idev = fpi_ssm_get_user_data(ssm);
struct vfs_dev_t *vdev = FP_INSTANCE_DATA(FP_DEV(idev));
@ -516,7 +516,7 @@ static void scan_completed(void *data)
}
/* Main SSM loop */
static void activate_ssm(fpi_ssm *ssm)
static void activate_ssm(fpi_ssm *ssm, struct fp_dev *_dev, void *user_data)
{
struct fp_img_dev *idev = fpi_ssm_get_user_data(ssm);
struct libusb_device_handle *usb_dev = fpi_dev_get_usb_dev(FP_DEV(idev));
@ -669,7 +669,7 @@ static void activate_ssm(fpi_ssm *ssm)
/* Driver functions */
/* Callback for dev_activate ssm */
static void dev_activate_callback(fpi_ssm *ssm)
static void dev_activate_callback(fpi_ssm *ssm, struct fp_dev *_dev, void *user_data)
{
struct fp_img_dev *idev = fpi_ssm_get_user_data(ssm);
struct vfs_dev_t *vdev = FP_INSTANCE_DATA(FP_DEV(idev));
@ -710,7 +710,7 @@ static void dev_deactivate(struct fp_img_dev *idev)
}
/* Callback for dev_open ssm */
static void dev_open_callback(fpi_ssm *ssm)
static void dev_open_callback(fpi_ssm *ssm, struct fp_dev *_dev, void *user_data)
{
/* Notify open complete */
fpi_imgdev_open_complete(fpi_ssm_get_user_data(ssm), 0);

View file

@ -507,7 +507,7 @@ enum
};
/* Exec swap sequential state machine */
static void m_swap_state(fpi_ssm *ssm)
static void m_swap_state(fpi_ssm *ssm, struct fp_dev *_dev, void *user_data)
{
switch (fpi_ssm_get_cur_state(ssm))
{
@ -911,7 +911,7 @@ enum
};
/* Exec loop sequential state machine */
static void m_loop_state(fpi_ssm *ssm)
static void m_loop_state(fpi_ssm *ssm, struct fp_dev *_dev, void *user_data)
{
struct fp_img_dev *dev = fpi_ssm_get_user_data(ssm);
struct vfs101_dev *vdev = FP_INSTANCE_DATA(FP_DEV(dev));
@ -1119,7 +1119,7 @@ static void m_loop_state(fpi_ssm *ssm)
}
/* Complete loop sequential state machine */
static void m_loop_complete(fpi_ssm *ssm)
static void m_loop_complete(fpi_ssm *ssm, struct fp_dev *_dev, void *user_data)
{
/* Free sequential state machine */
fpi_ssm_free(ssm);
@ -1175,7 +1175,7 @@ enum
};
/* Exec init sequential state machine */
static void m_init_state(fpi_ssm *ssm)
static void m_init_state(fpi_ssm *ssm, struct fp_dev *_dev, void *user_data)
{
struct fp_img_dev *dev = fpi_ssm_get_user_data(ssm);
struct vfs101_dev *vdev = FP_INSTANCE_DATA(FP_DEV(dev));
@ -1416,7 +1416,7 @@ static void m_init_state(fpi_ssm *ssm)
}
/* Complete init sequential state machine */
static void m_init_complete(fpi_ssm *ssm)
static void m_init_complete(fpi_ssm *ssm, struct fp_dev *_dev, void *user_data)
{
struct fp_img_dev *dev = fpi_ssm_get_user_data(ssm);
struct vfs101_dev *vdev = FP_INSTANCE_DATA(FP_DEV(dev));

View file

@ -103,7 +103,7 @@ enum
};
/* Exec loop sequential state machine */
static void m_loop_state(fpi_ssm *ssm)
static void m_loop_state(fpi_ssm *ssm, struct fp_dev *_dev, void *user_data)
{
struct fp_img_dev *dev = fpi_ssm_get_user_data(ssm);
vfs301_dev_t *vdev = FP_INSTANCE_DATA(FP_DEV(dev));
@ -161,14 +161,14 @@ static void m_loop_state(fpi_ssm *ssm)
}
/* Complete loop sequential state machine */
static void m_loop_complete(fpi_ssm *ssm)
static void m_loop_complete(fpi_ssm *ssm, struct fp_dev *_dev, void *user_data)
{
/* Free sequential state machine */
fpi_ssm_free(ssm);
}
/* Exec init sequential state machine */
static void m_init_state(fpi_ssm *ssm)
static void m_init_state(fpi_ssm *ssm, struct fp_dev *_dev, void *user_data)
{
struct fp_img_dev *dev = fpi_ssm_get_user_data(ssm);
vfs301_dev_t *vdev = FP_INSTANCE_DATA(FP_DEV(dev));
@ -181,7 +181,7 @@ static void m_init_state(fpi_ssm *ssm)
}
/* Complete init sequential state machine */
static void m_init_complete(fpi_ssm *ssm)
static void m_init_complete(fpi_ssm *ssm, struct fp_dev *_dev, void *user_data)
{
struct fp_img_dev *dev = fpi_ssm_get_user_data(ssm);
fpi_ssm *ssm_loop;

View file

@ -171,7 +171,7 @@ out:
libusb_free_transfer(transfer);
}
static void usbexchange_loop(fpi_ssm *ssm)
static void usbexchange_loop(fpi_ssm *ssm, struct fp_dev *_dev, void *user_data)
{
struct usbexchange_data *data = fpi_ssm_get_user_data(ssm);
if (fpi_ssm_get_cur_state(ssm) >= data->stepcount) {
@ -665,7 +665,7 @@ struct usb_action vfs5011_initiate_capture[] = {
/* ====================== lifprint interface ======================= */
static void activate_loop(fpi_ssm *ssm)
static void activate_loop(fpi_ssm *ssm, struct fp_dev *_dev, void *user_data)
{
enum {READ_TIMEOUT = 0};
@ -742,7 +742,7 @@ static void activate_loop(fpi_ssm *ssm)
}
}
static void activate_loop_complete(fpi_ssm *ssm)
static void activate_loop_complete(fpi_ssm *ssm, struct fp_dev *_dev, void *user_data)
{
struct fp_img_dev *dev = fpi_ssm_get_user_data(ssm);
struct vfs5011_data *data;
@ -772,7 +772,7 @@ static void activate_loop_complete(fpi_ssm *ssm)
}
static void open_loop(fpi_ssm *ssm)
static void open_loop(fpi_ssm *ssm, struct fp_dev *_dev, void *user_data)
{
struct fp_img_dev *dev = fpi_ssm_get_user_data(ssm);
struct vfs5011_data *data;
@ -793,7 +793,7 @@ static void open_loop(fpi_ssm *ssm)
};
}
static void open_loop_complete(fpi_ssm *ssm)
static void open_loop_complete(fpi_ssm *ssm, struct fp_dev *_dev, void *user_data)
{
struct fp_img_dev *dev = fpi_ssm_get_user_data(ssm);
struct vfs5011_data *data;

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);
}
/**

View file

@ -42,20 +42,28 @@ typedef struct fpi_ssm fpi_ssm;
/**
* ssm_completed_fn:
* @ssm: a #fpi_ssm state machine
* @dev: the #fp_dev fingerprint device
* @user_data: the user data passed to fpi_ssm_new()
*
* The callback called when a state machine completes successfully,
* as set when calling fpi_ssm_start().
*/
typedef void (*ssm_completed_fn)(fpi_ssm *ssm);
typedef void (*ssm_completed_fn)(fpi_ssm *ssm,
struct fp_dev *dev,
void *user_data);
/**
* ssm_handler_fn:
* @ssm: a #fpi_ssm state machine
* @dev: the #fp_dev fingerprint device
* @user_data: the user data passed to fpi_ssm_new()
*
* The callback called when a state machine transitions from one
* state to the next, as set when calling fpi_ssm_new().
*/
typedef void (*ssm_handler_fn)(fpi_ssm *ssm);
typedef void (*ssm_handler_fn)(fpi_ssm *ssm,
struct fp_dev *dev,
void *user_data);
/* for library and drivers */
fpi_ssm *fpi_ssm_new(struct fp_dev *dev,