lib: Remove state from fp_img_driver activate handler
The state was always AWAIT_FINGER and it was never used by any driver (except for error checking). So remove it, in particular as a correct state change will be done after activation anyway. The only driver with code that actually did anything based on this was the URU4000 driver. However, all it did was an explicit state change execution. This is not necessary, as the state_change handler is called anyway (i.e. we now only write the AWAIT_FINGER register once rather than twice). Manual changes plus: @ init @ identifier driver_name; identifier activate_func; @@ struct fp_img_driver driver_name = { ..., .activate = activate_func, ..., }; @ remove_arg @ identifier dev; identifier state; identifier init.activate_func; @@ activate_func ( struct fp_img_dev *dev - , enum fp_imgdev_state state ) { <... - if (state != IMGDEV_STATE_AWAIT_FINGER_ON) { ... } ...> }
This commit is contained in:
parent
3b32baccf6
commit
4cec28416e
20 changed files with 22 additions and 39 deletions
|
@ -749,7 +749,7 @@ static void activate_sm_complete(fpi_ssm *ssm, struct fp_dev *_dev, void *user_d
|
|||
fpi_ssm_free(ssm);
|
||||
}
|
||||
|
||||
static int dev_activate(struct fp_img_dev *dev, enum fp_imgdev_state state)
|
||||
static int dev_activate(struct fp_img_dev *dev)
|
||||
{
|
||||
struct aes1610_dev *aesdev = FP_INSTANCE_DATA(FP_DEV(dev));
|
||||
fpi_ssm *ssm = fpi_ssm_new(FP_DEV(dev), activate_run_state,
|
||||
|
|
|
@ -792,7 +792,7 @@ static void activate_sm_complete(fpi_ssm *ssm, struct fp_dev *_dev, void *user_d
|
|||
fpi_ssm_free(ssm);
|
||||
}
|
||||
|
||||
static int dev_activate(struct fp_img_dev *dev, enum fp_imgdev_state state)
|
||||
static int dev_activate(struct fp_img_dev *dev)
|
||||
{
|
||||
struct aes2501_dev *aesdev = FP_INSTANCE_DATA(FP_DEV(dev));
|
||||
fpi_ssm *ssm = fpi_ssm_new(FP_DEV(dev), activate_run_state,
|
||||
|
|
|
@ -541,7 +541,7 @@ static void activate_sm_complete(fpi_ssm *ssm, struct fp_dev *_dev, void *user_d
|
|||
fpi_ssm_free(ssm);
|
||||
}
|
||||
|
||||
static int dev_activate(struct fp_img_dev *dev, enum fp_imgdev_state state)
|
||||
static int dev_activate(struct fp_img_dev *dev)
|
||||
{
|
||||
fpi_ssm *ssm = fpi_ssm_new(FP_DEV(dev), activate_run_state,
|
||||
ACTIVATE_NUM_STATES, dev);
|
||||
|
|
|
@ -137,7 +137,7 @@ static void init_reqs_cb(struct fp_img_dev *dev, int result, void *user_data)
|
|||
do_capture(dev);
|
||||
}
|
||||
|
||||
int aes3k_dev_activate(struct fp_img_dev *dev, enum fp_imgdev_state state)
|
||||
int aes3k_dev_activate(struct fp_img_dev *dev)
|
||||
{
|
||||
struct aes3k_dev *aesdev = FP_INSTANCE_DATA(FP_DEV(dev));
|
||||
aes_write_regv(dev, aesdev->init_reqs, aesdev->init_reqs_len, init_reqs_cb, NULL);
|
||||
|
|
|
@ -52,7 +52,7 @@ struct aes3k_dev {
|
|||
};
|
||||
|
||||
|
||||
int aes3k_dev_activate(struct fp_img_dev *dev, enum fp_imgdev_state state);
|
||||
int aes3k_dev_activate(struct fp_img_dev *dev);
|
||||
void aes3k_dev_deactivate(struct fp_img_dev *dev);
|
||||
|
||||
#endif
|
||||
|
|
|
@ -589,7 +589,7 @@ static void activate_sm_complete(fpi_ssm *ssm, struct fp_dev *_dev, void *user_d
|
|||
start_finger_detection(dev);
|
||||
}
|
||||
|
||||
int aesX660_dev_activate(struct fp_img_dev *dev, enum fp_imgdev_state state)
|
||||
int aesX660_dev_activate(struct fp_img_dev *dev)
|
||||
{
|
||||
fpi_ssm *ssm = fpi_ssm_new(FP_DEV(dev), activate_run_state,
|
||||
ACTIVATE_NUM_STATES, dev);
|
||||
|
|
|
@ -116,7 +116,7 @@ static const unsigned char calibrate_cmd[] = {
|
|||
0x06,
|
||||
};
|
||||
|
||||
int aesX660_dev_activate(struct fp_img_dev *dev, enum fp_imgdev_state state);
|
||||
int aesX660_dev_activate(struct fp_img_dev *dev);
|
||||
void aesX660_dev_deactivate(struct fp_img_dev *dev);
|
||||
|
||||
#endif
|
||||
|
|
|
@ -874,7 +874,7 @@ static void dev_deinit(struct fp_img_dev *dev)
|
|||
fpi_imgdev_close_complete(dev);
|
||||
}
|
||||
|
||||
static int dev_activate(struct fp_img_dev *dev, enum fp_imgdev_state state)
|
||||
static int dev_activate(struct fp_img_dev *dev)
|
||||
{
|
||||
G_DEBUG_HERE();
|
||||
elan_activate(dev);
|
||||
|
|
|
@ -1390,19 +1390,13 @@ static void m_init_complete(fpi_ssm *ssm, struct fp_dev *_dev, void *user_data)
|
|||
fpi_ssm_free(ssm);
|
||||
}
|
||||
|
||||
static int dev_activate(struct fp_img_dev *idev, enum fp_imgdev_state state)
|
||||
static int dev_activate(struct fp_img_dev *idev)
|
||||
{
|
||||
struct etes603_dev *dev = FP_INSTANCE_DATA(FP_DEV(idev));
|
||||
fpi_ssm *ssm;
|
||||
|
||||
g_assert(dev);
|
||||
|
||||
if (state != IMGDEV_STATE_AWAIT_FINGER_ON) {
|
||||
fp_err("The driver is in an unexpected state: %d.", state);
|
||||
fpi_imgdev_activate_complete(idev, 1);
|
||||
return -1;
|
||||
}
|
||||
|
||||
/* Reset info and data */
|
||||
dev->is_active = TRUE;
|
||||
|
||||
|
|
|
@ -1268,7 +1268,7 @@ static void initsm_complete(fpi_ssm *ssm, struct fp_dev *_dev, void *user_data)
|
|||
fpi_ssm_start(sdev->loopsm, loopsm_complete);
|
||||
}
|
||||
|
||||
static int dev_activate(struct fp_img_dev *dev, enum fp_imgdev_state state)
|
||||
static int dev_activate(struct fp_img_dev *dev)
|
||||
{
|
||||
struct sonly_dev *sdev = FP_INSTANCE_DATA(FP_DEV(dev));
|
||||
fpi_ssm *ssm = NULL;
|
||||
|
|
|
@ -377,7 +377,7 @@ static void start_capture(struct fp_img_dev *dev)
|
|||
fpi_ssm_start(ssm, capture_sm_complete);
|
||||
}
|
||||
|
||||
static int dev_activate(struct fp_img_dev *dev, enum fp_imgdev_state state)
|
||||
static int dev_activate(struct fp_img_dev *dev)
|
||||
{
|
||||
struct upektc_dev *upekdev = FP_INSTANCE_DATA(FP_DEV(dev));
|
||||
fpi_ssm *ssm = fpi_ssm_new(FP_DEV(dev), activate_run_state,
|
||||
|
|
|
@ -567,7 +567,7 @@ static void activate_sm_complete(fpi_ssm *ssm, struct fp_dev *_dev, void *user_d
|
|||
start_capture(dev);
|
||||
}
|
||||
|
||||
static int dev_activate(struct fp_img_dev *dev, enum fp_imgdev_state state)
|
||||
static int dev_activate(struct fp_img_dev *dev)
|
||||
{
|
||||
struct upektc_img_dev *upekdev = FP_INSTANCE_DATA(FP_DEV(dev));
|
||||
fpi_ssm *ssm = fpi_ssm_new(FP_DEV(dev), activate_run_state,
|
||||
|
|
|
@ -1161,20 +1161,10 @@ static void activate_initsm_complete(fpi_ssm *ssm, struct fp_dev *_dev, void *us
|
|||
int r = fpi_ssm_get_error(ssm);
|
||||
fpi_ssm_free(ssm);
|
||||
|
||||
if (r) {
|
||||
fpi_imgdev_activate_complete(dev, r);
|
||||
return;
|
||||
}
|
||||
|
||||
r = execute_state_change(dev);
|
||||
fpi_imgdev_activate_complete(dev, r);
|
||||
}
|
||||
|
||||
/* FIXME: having state parameter here is kinda useless, will we ever
|
||||
* see a scenario where the parameter is useful so early on in the activation
|
||||
* process? asynchronity means that it'll only be used in a later function
|
||||
* call. */
|
||||
static int dev_activate(struct fp_img_dev *dev, enum fp_imgdev_state state)
|
||||
static int dev_activate(struct fp_img_dev *dev)
|
||||
{
|
||||
struct uru4k_dev *urudev = FP_INSTANCE_DATA(FP_DEV(dev));
|
||||
fpi_ssm *ssm;
|
||||
|
@ -1185,7 +1175,6 @@ static int dev_activate(struct fp_img_dev *dev, enum fp_imgdev_state state)
|
|||
return r;
|
||||
|
||||
urudev->scanpwr_irq_timeouts = 0;
|
||||
urudev->activate_state = state;
|
||||
ssm = fpi_ssm_new(FP_DEV(dev), init_run_state, INIT_NUM_STATES, dev);
|
||||
fpi_ssm_start(ssm, activate_initsm_complete);
|
||||
return 0;
|
||||
|
|
|
@ -302,7 +302,7 @@ static void loopsm_complete(fpi_ssm *ssm, struct fp_dev *_dev, void *user_data)
|
|||
fpi_imgdev_deactivate_complete(dev);
|
||||
}
|
||||
|
||||
static int dev_activate(struct fp_img_dev *dev, enum fp_imgdev_state state)
|
||||
static int dev_activate(struct fp_img_dev *dev)
|
||||
{
|
||||
struct v5s_dev *vdev = FP_INSTANCE_DATA(FP_DEV(dev));
|
||||
fpi_ssm *ssm = fpi_ssm_new(FP_DEV(dev), loop_run_state,
|
||||
|
|
|
@ -684,7 +684,7 @@ static void dev_activate_callback(fpi_ssm *ssm, struct fp_dev *_dev, void *user_
|
|||
}
|
||||
|
||||
/* Activate device */
|
||||
static int dev_activate(struct fp_img_dev *idev, enum fp_imgdev_state state)
|
||||
static int dev_activate(struct fp_img_dev *idev)
|
||||
{
|
||||
struct vfs_dev_t *vdev = FP_INSTANCE_DATA(FP_DEV(idev));
|
||||
|
||||
|
|
|
@ -1424,7 +1424,7 @@ static void m_init_complete(fpi_ssm *ssm, struct fp_dev *_dev, void *user_data)
|
|||
}
|
||||
|
||||
/* Activate device */
|
||||
static int dev_activate(struct fp_img_dev *dev, enum fp_imgdev_state state)
|
||||
static int dev_activate(struct fp_img_dev *dev)
|
||||
{
|
||||
struct vfs101_dev *vdev = FP_INSTANCE_DATA(FP_DEV(dev));
|
||||
fpi_ssm *ssm;
|
||||
|
|
|
@ -191,7 +191,7 @@ static void m_init_complete(fpi_ssm *ssm, struct fp_dev *_dev, void *user_data)
|
|||
}
|
||||
|
||||
/* Activate device */
|
||||
static int dev_activate(struct fp_img_dev *dev, enum fp_imgdev_state state)
|
||||
static int dev_activate(struct fp_img_dev *dev)
|
||||
{
|
||||
fpi_ssm *ssm;
|
||||
|
||||
|
|
|
@ -846,7 +846,7 @@ static void start_scan(struct fp_img_dev *dev)
|
|||
fp_dbg("ssm done, getting out");
|
||||
}
|
||||
|
||||
static int dev_activate(struct fp_img_dev *dev, enum fp_imgdev_state state)
|
||||
static int dev_activate(struct fp_img_dev *dev)
|
||||
{
|
||||
struct vfs5011_data *data;
|
||||
|
||||
|
|
|
@ -110,7 +110,7 @@ struct fp_img_driver {
|
|||
/* Device operations */
|
||||
int (*open)(struct fp_img_dev *dev, unsigned long driver_data);
|
||||
void (*close)(struct fp_img_dev *dev);
|
||||
int (*activate)(struct fp_img_dev *dev, enum fp_imgdev_state state);
|
||||
int (*activate)(struct fp_img_dev *dev);
|
||||
int (*change_state)(struct fp_img_dev *dev, enum fp_imgdev_state state);
|
||||
void (*deactivate)(struct fp_img_dev *dev);
|
||||
};
|
||||
|
|
|
@ -533,14 +533,14 @@ int fpi_imgdev_get_img_height(struct fp_img_dev *imgdev)
|
|||
return height;
|
||||
}
|
||||
|
||||
static int dev_activate(struct fp_img_dev *imgdev, enum fp_imgdev_state state)
|
||||
static int dev_activate(struct fp_img_dev *imgdev)
|
||||
{
|
||||
struct fp_driver *drv = FP_DEV(imgdev)->drv;
|
||||
struct fp_img_driver *imgdrv = fpi_driver_to_img_driver(drv);
|
||||
|
||||
if (!imgdrv->activate)
|
||||
return 0;
|
||||
return imgdrv->activate(imgdev, state);
|
||||
return imgdrv->activate(imgdev);
|
||||
}
|
||||
|
||||
static void dev_deactivate(struct fp_img_dev *imgdev)
|
||||
|
@ -562,7 +562,7 @@ static int generic_acquire_start(struct fp_dev *dev, int action)
|
|||
imgdev->action_state = IMG_ACQUIRE_STATE_ACTIVATING;
|
||||
imgdev->enroll_stage = 0;
|
||||
|
||||
r = dev_activate(imgdev, IMGDEV_STATE_AWAIT_FINGER_ON);
|
||||
r = dev_activate(imgdev);
|
||||
if (r < 0)
|
||||
fp_err("activation failed with error %d", r);
|
||||
|
||||
|
|
Loading…
Reference in a new issue