Commit 058f9190 authored by Bastien Nocera's avatar Bastien Nocera

lib: Remove fp_img_dev->priv

And use the new instance data helper.
parent 4f75e63e
......@@ -247,7 +247,7 @@ static void finger_det_reqs_cb(struct fp_img_dev *dev, int result, void *user_da
static void start_finger_detection(struct fp_img_dev *dev)
{
struct aes1610_dev *aesdev = fpi_imgdev_get_user_data(dev);
struct aes1610_dev *aesdev = FP_INSTANCE_DATA(FP_DEV(dev));
if (aesdev->deactivating) {
complete_deactivation(dev);
......@@ -559,7 +559,7 @@ static void capture_read_strip_cb(struct libusb_transfer *transfer)
unsigned char *stripdata;
fpi_ssm *ssm = transfer->user_data;
struct fp_img_dev *dev = fpi_ssm_get_user_data(ssm);
struct aes1610_dev *aesdev = fpi_imgdev_get_user_data(dev);
struct aes1610_dev *aesdev = FP_INSTANCE_DATA(FP_DEV(dev));
unsigned char *data = transfer->buffer;
int sum, i;
......@@ -646,7 +646,7 @@ out:
static void capture_run_state(fpi_ssm *ssm)
{
struct fp_img_dev *dev = fpi_ssm_get_user_data(ssm);
struct aes1610_dev *aesdev = fpi_imgdev_get_user_data(dev);
struct aes1610_dev *aesdev = FP_INSTANCE_DATA(FP_DEV(dev));
int r;
switch (fpi_ssm_get_cur_state(ssm)) {
......@@ -693,7 +693,7 @@ static void capture_run_state(fpi_ssm *ssm)
static void capture_sm_complete(fpi_ssm *ssm)
{
struct fp_img_dev *dev = fpi_ssm_get_user_data(ssm);
struct aes1610_dev *aesdev = fpi_imgdev_get_user_data(dev);
struct aes1610_dev *aesdev = FP_INSTANCE_DATA(FP_DEV(dev));
G_DEBUG_HERE();
if (aesdev->deactivating)
......@@ -707,7 +707,7 @@ static void capture_sm_complete(fpi_ssm *ssm)
static void start_capture(struct fp_img_dev *dev)
{
struct aes1610_dev *aesdev = fpi_imgdev_get_user_data(dev);
struct aes1610_dev *aesdev = FP_INSTANCE_DATA(FP_DEV(dev));
fpi_ssm *ssm;
if (aesdev->deactivating) {
......@@ -766,7 +766,7 @@ static void activate_sm_complete(fpi_ssm *ssm)
static int dev_activate(struct fp_img_dev *dev, enum fp_imgdev_state state)
{
struct aes1610_dev *aesdev = fpi_imgdev_get_user_data(dev);
struct aes1610_dev *aesdev = FP_INSTANCE_DATA(FP_DEV(dev));
fpi_ssm *ssm = fpi_ssm_new(fpi_imgdev_get_dev(dev), activate_run_state,
ACTIVATE_NUM_STATES);
fpi_ssm_set_user_data(ssm, dev);
......@@ -777,7 +777,7 @@ static int dev_activate(struct fp_img_dev *dev, enum fp_imgdev_state state)
static void dev_deactivate(struct fp_img_dev *dev)
{
struct aes1610_dev *aesdev = fpi_imgdev_get_user_data(dev);
struct aes1610_dev *aesdev = FP_INSTANCE_DATA(FP_DEV(dev));
/* FIXME: audit cancellation points, probably need more, specifically
* in error handling paths? */
aesdev->deactivating = TRUE;
......@@ -785,7 +785,7 @@ static void dev_deactivate(struct fp_img_dev *dev)
static void complete_deactivation(struct fp_img_dev *dev)
{
struct aes1610_dev *aesdev = fpi_imgdev_get_user_data(dev);
struct aes1610_dev *aesdev = FP_INSTANCE_DATA(FP_DEV(dev));
G_DEBUG_HERE();
/* FIXME: if we're in the middle of a scan, we should cancel the scan.
......@@ -812,7 +812,7 @@ static int dev_init(struct fp_img_dev *dev, unsigned long driver_data)
}
aesdev = g_malloc0(sizeof(struct aes1610_dev));
fpi_imgdev_set_user_data(dev, aesdev);
fp_dev_set_instance_data(FP_DEV(dev), aesdev);
fpi_imgdev_open_complete(dev, 0);
return 0;
}
......@@ -820,7 +820,7 @@ static int dev_init(struct fp_img_dev *dev, unsigned long driver_data)
static void dev_deinit(struct fp_img_dev *dev)
{
struct aes1610_dev *aesdev;
aesdev = fpi_imgdev_get_user_data(dev);
aesdev = FP_INSTANCE_DATA(FP_DEV(dev));
g_free(aesdev);
libusb_release_interface(fpi_imgdev_get_usb_dev(dev), 0);
fpi_imgdev_close_complete(dev);
......
......@@ -47,7 +47,7 @@ static int dev_init(struct fp_img_dev *dev, unsigned long driver_data)
}
aesdev = g_malloc0(sizeof(struct aesX660_dev));
fpi_imgdev_set_user_data(dev, aesdev);
fp_dev_set_instance_data(FP_DEV(dev), aesdev);
aesdev->buffer = g_malloc0(AES1660_FRAME_SIZE + AESX660_HEADER_SIZE);
aesdev->init_seqs[0] = aes1660_init_1;
aesdev->init_seqs_len[0] = G_N_ELEMENTS(aes1660_init_1);
......@@ -64,7 +64,7 @@ static int dev_init(struct fp_img_dev *dev, unsigned long driver_data)
static void dev_deinit(struct fp_img_dev *dev)
{
struct aesX660_dev *aesdev = fpi_imgdev_get_user_data(dev);
struct aesX660_dev *aesdev = FP_INSTANCE_DATA(FP_DEV(dev));
g_free(aesdev->buffer);
g_free(aesdev);
libusb_release_interface(fpi_imgdev_get_usb_dev(dev), 0);
......
......@@ -346,7 +346,7 @@ static void finger_det_reqs_cb(struct fp_img_dev *dev, int result,
static void start_finger_detection(struct fp_img_dev *dev)
{
struct aes2501_dev *aesdev = fpi_imgdev_get_user_data(dev);
struct aes2501_dev *aesdev = FP_INSTANCE_DATA(FP_DEV(dev));
G_DEBUG_HERE();
if (aesdev->deactivating) {
......@@ -438,7 +438,7 @@ static void capture_read_strip_cb(struct libusb_transfer *transfer)
unsigned char *stripdata;
fpi_ssm *ssm = transfer->user_data;
struct fp_img_dev *dev = fpi_ssm_get_user_data(ssm);
struct aes2501_dev *aesdev = fpi_imgdev_get_user_data(dev);
struct aes2501_dev *aesdev = FP_INSTANCE_DATA(FP_DEV(dev));
unsigned char *data = transfer->buffer;
int sum;
int threshold;
......@@ -523,7 +523,7 @@ out:
static void capture_run_state(fpi_ssm *ssm)
{
struct fp_img_dev *dev = fpi_ssm_get_user_data(ssm);
struct aes2501_dev *aesdev = fpi_imgdev_get_user_data(dev);
struct aes2501_dev *aesdev = FP_INSTANCE_DATA(FP_DEV(dev));
int r;
switch (fpi_ssm_get_cur_state(ssm)) {
......@@ -574,7 +574,7 @@ static void capture_run_state(fpi_ssm *ssm)
static void capture_sm_complete(fpi_ssm *ssm)
{
struct fp_img_dev *dev = fpi_ssm_get_user_data(ssm);
struct aes2501_dev *aesdev = fpi_imgdev_get_user_data(dev);
struct aes2501_dev *aesdev = FP_INSTANCE_DATA(FP_DEV(dev));
G_DEBUG_HERE();
if (aesdev->deactivating)
......@@ -588,7 +588,7 @@ static void capture_sm_complete(fpi_ssm *ssm)
static void start_capture(struct fp_img_dev *dev)
{
struct aes2501_dev *aesdev = fpi_imgdev_get_user_data(dev);
struct aes2501_dev *aesdev = FP_INSTANCE_DATA(FP_DEV(dev));
fpi_ssm *ssm;
if (aesdev->deactivating) {
......@@ -714,7 +714,7 @@ void activate_read_regs_cb(struct fp_img_dev *dev, int status,
unsigned char *regs, void *user_data)
{
fpi_ssm *ssm = user_data;
struct aes2501_dev *aesdev = fpi_imgdev_get_user_data(dev);
struct aes2501_dev *aesdev = FP_INSTANCE_DATA(FP_DEV(dev));
if (status != 0) {
fpi_ssm_mark_failed(ssm, status);
......@@ -804,7 +804,7 @@ static void activate_sm_complete(fpi_ssm *ssm)
static int dev_activate(struct fp_img_dev *dev, enum fp_imgdev_state state)
{
struct aes2501_dev *aesdev = fpi_imgdev_get_user_data(dev);
struct aes2501_dev *aesdev = FP_INSTANCE_DATA(FP_DEV(dev));
fpi_ssm *ssm = fpi_ssm_new(fpi_imgdev_get_dev(dev), activate_run_state,
ACTIVATE_NUM_STATES);
fpi_ssm_set_user_data(ssm, dev);
......@@ -815,7 +815,7 @@ static int dev_activate(struct fp_img_dev *dev, enum fp_imgdev_state state)
static void dev_deactivate(struct fp_img_dev *dev)
{
struct aes2501_dev *aesdev = fpi_imgdev_get_user_data(dev);
struct aes2501_dev *aesdev = FP_INSTANCE_DATA(FP_DEV(dev));
/* FIXME: audit cancellation points, probably need more, specifically
* in error handling paths? */
aesdev->deactivating = TRUE;
......@@ -823,7 +823,7 @@ static void dev_deactivate(struct fp_img_dev *dev)
static void complete_deactivation(struct fp_img_dev *dev)
{
struct aes2501_dev *aesdev = fpi_imgdev_get_user_data(dev);
struct aes2501_dev *aesdev = FP_INSTANCE_DATA(FP_DEV(dev));
G_DEBUG_HERE();
/* FIXME: if we're in the middle of a scan, we should cancel the scan.
......@@ -849,14 +849,14 @@ static int dev_init(struct fp_img_dev *dev, unsigned long driver_data)
}
aesdev = g_malloc0(sizeof(struct aes2501_dev));
fpi_imgdev_set_user_data(dev, aesdev);
fp_dev_set_instance_data(FP_DEV(dev), aesdev);
fpi_imgdev_open_complete(dev, 0);
return 0;
}
static void dev_deinit(struct fp_img_dev *dev)
{
struct aes2501_dev *aesdev = fpi_imgdev_get_user_data(dev);
struct aes2501_dev *aesdev = FP_INSTANCE_DATA(FP_DEV(dev));
g_free(aesdev);
libusb_release_interface(fpi_imgdev_get_usb_dev(dev), 0);
fpi_imgdev_close_complete(dev);
......
......@@ -149,7 +149,7 @@ exit_free_transfer:
static void start_finger_detection(struct fp_img_dev *dev)
{
int r;
struct aes2550_dev *aesdev = fpi_imgdev_get_user_data(dev);
struct aes2550_dev *aesdev = FP_INSTANCE_DATA(FP_DEV(dev));
struct libusb_transfer *transfer;
G_DEBUG_HERE();
......@@ -204,7 +204,7 @@ static int process_strip_data(fpi_ssm *ssm, unsigned char *data)
{
unsigned char *stripdata;
struct fp_img_dev *dev = fpi_ssm_get_user_data(ssm);
struct aes2550_dev *aesdev = fpi_imgdev_get_user_data(dev);
struct aes2550_dev *aesdev = FP_INSTANCE_DATA(FP_DEV(dev));
struct fpi_frame *stripe;
int len;
......@@ -246,7 +246,7 @@ static void capture_set_idle_reqs_cb(struct libusb_transfer *transfer)
{
fpi_ssm *ssm = transfer->user_data;
struct fp_img_dev *dev = fpi_ssm_get_user_data(ssm);
struct aes2550_dev *aesdev = fpi_imgdev_get_user_data(dev);
struct aes2550_dev *aesdev = FP_INSTANCE_DATA(FP_DEV(dev));
if ((transfer->status == LIBUSB_TRANSFER_COMPLETED) &&
(transfer->length == transfer->actual_length) &&
......@@ -274,7 +274,7 @@ static void capture_read_data_cb(struct libusb_transfer *transfer)
{
fpi_ssm *ssm = transfer->user_data;
struct fp_img_dev *dev = fpi_ssm_get_user_data(ssm);
struct aes2550_dev *aesdev = fpi_imgdev_get_user_data(dev);
struct aes2550_dev *aesdev = FP_INSTANCE_DATA(FP_DEV(dev));
unsigned char *data = transfer->buffer;
int r;
......@@ -389,7 +389,7 @@ static void capture_run_state(fpi_ssm *ssm)
static void capture_sm_complete(fpi_ssm *ssm)
{
struct fp_img_dev *dev = fpi_ssm_get_user_data(ssm);
struct aes2550_dev *aesdev = fpi_imgdev_get_user_data(dev);
struct aes2550_dev *aesdev = FP_INSTANCE_DATA(FP_DEV(dev));
fp_dbg("Capture completed");
if (aesdev->deactivating)
......@@ -403,7 +403,7 @@ static void capture_sm_complete(fpi_ssm *ssm)
static void start_capture(struct fp_img_dev *dev)
{
struct aes2550_dev *aesdev = fpi_imgdev_get_user_data(dev);
struct aes2550_dev *aesdev = FP_INSTANCE_DATA(FP_DEV(dev));
fpi_ssm *ssm;
if (aesdev->deactivating) {
......@@ -590,14 +590,14 @@ static int dev_activate(struct fp_img_dev *dev, enum fp_imgdev_state state)
static void dev_deactivate(struct fp_img_dev *dev)
{
struct aes2550_dev *aesdev = fpi_imgdev_get_user_data(dev);
struct aes2550_dev *aesdev = FP_INSTANCE_DATA(FP_DEV(dev));
aesdev->deactivating = TRUE;
}
static void complete_deactivation(struct fp_img_dev *dev)
{
struct aes2550_dev *aesdev = fpi_imgdev_get_user_data(dev);
struct aes2550_dev *aesdev = FP_INSTANCE_DATA(FP_DEV(dev));
G_DEBUG_HERE();
aesdev->deactivating = FALSE;
......@@ -620,7 +620,7 @@ static int dev_init(struct fp_img_dev *dev, unsigned long driver_data)
}
aes2550_dev = g_malloc0(sizeof(struct aes2550_dev));
fpi_imgdev_set_user_data(dev, aes2550_dev);
fp_dev_set_instance_data(FP_DEV(dev), aes2550_dev);
fpi_imgdev_open_complete(dev, 0);
return 0;
}
......@@ -628,7 +628,7 @@ static int dev_init(struct fp_img_dev *dev, unsigned long driver_data)
static void dev_deinit(struct fp_img_dev *dev)
{
struct aes2550_dev *aesdev;
aesdev = fpi_imgdev_get_user_data(dev);
aesdev = FP_INSTANCE_DATA(FP_DEV(dev));
g_free(aesdev);
libusb_release_interface(fpi_imgdev_get_usb_dev(dev), 0);
fpi_imgdev_close_complete(dev);
......
......@@ -47,7 +47,7 @@ static int dev_init(struct fp_img_dev *dev, unsigned long driver_data)
}
aesdev = g_malloc0(sizeof(struct aesX660_dev));
fpi_imgdev_set_user_data(dev, aesdev);
fp_dev_set_instance_data(FP_DEV(dev), aesdev);
aesdev->buffer = g_malloc0(AES2660_FRAME_SIZE + AESX660_HEADER_SIZE);
/* No scaling for AES2660 */
aesdev->init_seqs[0] = aes2660_init_1;
......@@ -66,7 +66,7 @@ static int dev_init(struct fp_img_dev *dev, unsigned long driver_data)
static void dev_deinit(struct fp_img_dev *dev)
{
struct aesX660_dev *aesdev;
aesdev = fpi_imgdev_get_user_data(dev);
aesdev = FP_INSTANCE_DATA(FP_DEV(dev));
g_free(aesdev->buffer);
g_free(aesdev);
libusb_release_interface(fpi_imgdev_get_usb_dev(dev), 0);
......
......@@ -129,7 +129,7 @@ static int dev_init(struct fp_img_dev *dev, unsigned long driver_data)
}
aesdev = g_malloc0(sizeof(struct aes3k_dev));
fpi_imgdev_set_user_data(dev, aesdev);
fp_dev_set_instance_data(FP_DEV(dev), aesdev);
if (!aesdev)
return -ENOMEM;
......@@ -148,7 +148,7 @@ static int dev_init(struct fp_img_dev *dev, unsigned long driver_data)
static void dev_deinit(struct fp_img_dev *dev)
{
struct aes3k_dev *aesdev = fpi_imgdev_get_user_data(dev);
struct aes3k_dev *aesdev = FP_INSTANCE_DATA(FP_DEV(dev));
g_free(aesdev);
libusb_release_interface(fpi_imgdev_get_usb_dev(dev), 0);
fpi_imgdev_close_complete(dev);
......
......@@ -63,7 +63,7 @@ static void aes3k_assemble_image(unsigned char *input, size_t width, size_t heig
static void img_cb(struct libusb_transfer *transfer)
{
struct fp_img_dev *dev = transfer->user_data;
struct aes3k_dev *aesdev = fpi_imgdev_get_user_data(dev);
struct aes3k_dev *aesdev = FP_INSTANCE_DATA(FP_DEV(dev));
unsigned char *ptr = transfer->buffer;
struct fp_img *tmp;
struct fp_img *img;
......@@ -112,7 +112,7 @@ err:
static void do_capture(struct fp_img_dev *dev)
{
struct aes3k_dev *aesdev = fpi_imgdev_get_user_data(dev);
struct aes3k_dev *aesdev = FP_INSTANCE_DATA(FP_DEV(dev));
unsigned char *data;
int r;
......@@ -144,14 +144,14 @@ static void init_reqs_cb(struct fp_img_dev *dev, int result, void *user_data)
int aes3k_dev_activate(struct fp_img_dev *dev, enum fp_imgdev_state state)
{
struct aes3k_dev *aesdev = fpi_imgdev_get_user_data(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);
return 0;
}
void aes3k_dev_deactivate(struct fp_img_dev *dev)
{
struct aes3k_dev *aesdev = fpi_imgdev_get_user_data(dev);
struct aes3k_dev *aesdev = FP_INSTANCE_DATA(FP_DEV(dev));
/* FIXME: should wait for cancellation to complete before returning
* from deactivation, otherwise app may legally exit before we've
......
......@@ -126,7 +126,7 @@ static int dev_init(struct fp_img_dev *dev, unsigned long driver_data)
}
aesdev = g_malloc0(sizeof(struct aes3k_dev));
fpi_imgdev_set_user_data(dev, aesdev);
fp_dev_set_instance_data(FP_DEV(dev), aesdev);
if (!aesdev)
return -ENOMEM;
......@@ -145,7 +145,7 @@ static int dev_init(struct fp_img_dev *dev, unsigned long driver_data)
static void dev_deinit(struct fp_img_dev *dev)
{
struct aes3k_dev *aesdev = fpi_imgdev_get_user_data(dev);
struct aes3k_dev *aesdev = FP_INSTANCE_DATA(FP_DEV(dev));
g_free(aesdev);
libusb_release_interface(fpi_imgdev_get_usb_dev(dev), 0);
fpi_imgdev_close_complete(dev);
......
......@@ -145,7 +145,7 @@ static void finger_det_read_fd_data_cb(struct libusb_transfer *transfer)
{
fpi_ssm *ssm = transfer->user_data;
struct fp_img_dev *dev = fpi_ssm_get_user_data(ssm);
struct aesX660_dev *aesdev = fpi_imgdev_get_user_data(dev);
struct aesX660_dev *aesdev = FP_INSTANCE_DATA(FP_DEV(dev));
unsigned char *data = transfer->buffer;
aesdev->fd_data_transfer = NULL;
......@@ -198,7 +198,7 @@ static void finger_det_set_idle_cmd_cb(struct libusb_transfer *transfer)
static void finger_det_sm_complete(fpi_ssm *ssm)
{
struct fp_img_dev *dev = fpi_ssm_get_user_data(ssm);
struct aesX660_dev *aesdev = fpi_imgdev_get_user_data(dev);
struct aesX660_dev *aesdev = FP_INSTANCE_DATA(FP_DEV(dev));
int err = fpi_ssm_get_error(ssm);
fp_dbg("Finger detection completed");
......@@ -240,7 +240,7 @@ static void finger_det_run_state(fpi_ssm *ssm)
static void start_finger_detection(struct fp_img_dev *dev)
{
fpi_ssm *ssm;
struct aesX660_dev *aesdev = fpi_imgdev_get_user_data(dev);
struct aesX660_dev *aesdev = FP_INSTANCE_DATA(FP_DEV(dev));
if (aesdev->deactivating) {
complete_deactivation(dev);
......@@ -268,7 +268,7 @@ static int process_stripe_data(fpi_ssm *ssm, unsigned char *data)
struct fpi_frame *stripe;
unsigned char *stripdata;
struct fp_img_dev *dev = fpi_ssm_get_user_data(ssm);
struct aesX660_dev *aesdev = fpi_imgdev_get_user_data(dev);
struct aesX660_dev *aesdev = FP_INSTANCE_DATA(FP_DEV(dev));
stripe = g_malloc(aesdev->assembling_ctx->frame_width * FRAME_HEIGHT / 2 + sizeof(struct fpi_frame)); /* 4 bpp */
stripdata = stripe->data;
......@@ -296,7 +296,7 @@ static void capture_set_idle_cmd_cb(struct libusb_transfer *transfer)
{
fpi_ssm *ssm = transfer->user_data;
struct fp_img_dev *dev = fpi_ssm_get_user_data(ssm);
struct aesX660_dev *aesdev = fpi_imgdev_get_user_data(dev);
struct aesX660_dev *aesdev = FP_INSTANCE_DATA(FP_DEV(dev));
if ((transfer->status == LIBUSB_TRANSFER_COMPLETED) &&
(transfer->length == transfer->actual_length)) {
......@@ -322,7 +322,7 @@ static void capture_read_stripe_data_cb(struct libusb_transfer *transfer)
{
fpi_ssm *ssm = transfer->user_data;
struct fp_img_dev *dev = fpi_ssm_get_user_data(ssm);
struct aesX660_dev *aesdev = fpi_imgdev_get_user_data(dev);
struct aesX660_dev *aesdev = FP_INSTANCE_DATA(FP_DEV(dev));
unsigned char *data = transfer->buffer;
int finger_missing = 0;
size_t copied, actual_len = transfer->actual_length;
......@@ -374,7 +374,7 @@ out:
static void capture_run_state(fpi_ssm *ssm)
{
struct fp_img_dev *dev = fpi_ssm_get_user_data(ssm);
struct aesX660_dev *aesdev = fpi_imgdev_get_user_data(dev);
struct aesX660_dev *aesdev = FP_INSTANCE_DATA(FP_DEV(dev));
switch (fpi_ssm_get_cur_state(ssm)) {
case CAPTURE_SEND_LED_CMD:
......@@ -403,7 +403,7 @@ static void capture_run_state(fpi_ssm *ssm)
static void capture_sm_complete(fpi_ssm *ssm)
{
struct fp_img_dev *dev = fpi_ssm_get_user_data(ssm);
struct aesX660_dev *aesdev = fpi_imgdev_get_user_data(dev);
struct aesX660_dev *aesdev = FP_INSTANCE_DATA(FP_DEV(dev));
int err = fpi_ssm_get_error(ssm);
fp_dbg("Capture completed");
......@@ -419,7 +419,7 @@ static void capture_sm_complete(fpi_ssm *ssm)
static void start_capture(struct fp_img_dev *dev)
{
struct aesX660_dev *aesdev = fpi_imgdev_get_user_data(dev);
struct aesX660_dev *aesdev = FP_INSTANCE_DATA(FP_DEV(dev));
fpi_ssm *ssm;
if (aesdev->deactivating) {
......@@ -450,7 +450,7 @@ static void activate_read_id_cb(struct libusb_transfer *transfer)
{
fpi_ssm *ssm = transfer->user_data;
struct fp_img_dev *dev = fpi_ssm_get_user_data(ssm);
struct aesX660_dev *aesdev = fpi_imgdev_get_user_data(dev);
struct aesX660_dev *aesdev = FP_INSTANCE_DATA(FP_DEV(dev));
unsigned char *data = transfer->buffer;
if ((transfer->status != LIBUSB_TRANSFER_COMPLETED) ||
......@@ -501,7 +501,7 @@ static void activate_read_init_cb(struct libusb_transfer *transfer)
{
fpi_ssm *ssm = transfer->user_data;
struct fp_img_dev *dev = fpi_ssm_get_user_data(ssm);
struct aesX660_dev *aesdev = fpi_imgdev_get_user_data(dev);
struct aesX660_dev *aesdev = FP_INSTANCE_DATA(FP_DEV(dev));
unsigned char *data = transfer->buffer;
fp_dbg("read_init_cb\n");
......@@ -537,7 +537,7 @@ out:
static void activate_run_state(fpi_ssm *ssm)
{
struct fp_img_dev *dev = fpi_ssm_get_user_data(ssm);
struct aesX660_dev *aesdev = fpi_imgdev_get_user_data(dev);
struct aesX660_dev *aesdev = FP_INSTANCE_DATA(FP_DEV(dev));
switch (fpi_ssm_get_cur_state(ssm)) {
case ACTIVATE_SET_IDLE:
......@@ -603,7 +603,7 @@ int aesX660_dev_activate(struct fp_img_dev *dev, enum fp_imgdev_state state)
void aesX660_dev_deactivate(struct fp_img_dev *dev)
{
struct aesX660_dev *aesdev = fpi_imgdev_get_user_data(dev);
struct aesX660_dev *aesdev = FP_INSTANCE_DATA(FP_DEV(dev));
if (aesdev->fd_data_transfer)
libusb_cancel_transfer(aesdev->fd_data_transfer);
......@@ -613,7 +613,7 @@ void aesX660_dev_deactivate(struct fp_img_dev *dev)
static void complete_deactivation(struct fp_img_dev *dev)
{
struct aesX660_dev *aesdev = fpi_imgdev_get_user_data(dev);
struct aesX660_dev *aesdev = FP_INSTANCE_DATA(FP_DEV(dev));
G_DEBUG_HERE();
aesdev->deactivating = FALSE;
......
......@@ -290,7 +290,7 @@ static void elan_process_frame_thirds(unsigned short *raw_frame,
static void elan_submit_image(struct fp_img_dev *dev)
{
struct elan_dev *elandev = fpi_imgdev_get_user_data(dev);
struct elan_dev *elandev = FP_INSTANCE_DATA(FP_DEV(dev));
GSList *frames = NULL;
struct fp_img *img;
......@@ -323,7 +323,7 @@ static void elan_cmd_cb(struct libusb_transfer *transfer)
{
fpi_ssm *ssm = transfer->user_data;
struct fp_img_dev *dev = fpi_ssm_get_user_data(ssm);
struct elan_dev *elandev = fpi_imgdev_get_user_data(dev);
struct elan_dev *elandev = FP_INSTANCE_DATA(FP_DEV(dev));
G_DEBUG_HERE();
......@@ -365,7 +365,7 @@ static void elan_cmd_cb(struct libusb_transfer *transfer)
static void elan_cmd_read(fpi_ssm *ssm)
{
struct fp_img_dev *dev = fpi_ssm_get_user_data(ssm);
struct elan_dev *elandev = fpi_imgdev_get_user_data(dev);
struct elan_dev *elandev = FP_INSTANCE_DATA(FP_DEV(dev));
int response_len = elandev->cmd->response_len;
G_DEBUG_HERE();
......@@ -405,7 +405,7 @@ static void elan_run_cmd(fpi_ssm *ssm, const struct elan_cmd *cmd,
int cmd_timeout)
{
struct fp_img_dev *dev = fpi_ssm_get_user_data(ssm);
struct elan_dev *elandev = fpi_imgdev_get_user_data(dev);
struct elan_dev *elandev = FP_INSTANCE_DATA(FP_DEV(dev));
dbg_buf(cmd->cmd, 2);
......@@ -454,7 +454,7 @@ static void stop_capture_run_state(fpi_ssm *ssm)
static void stop_capture_complete(fpi_ssm *ssm)
{
struct fp_img_dev *dev = fpi_ssm_get_user_data(ssm);
struct elan_dev *elandev = fpi_imgdev_get_user_data(dev);
struct elan_dev *elandev = FP_INSTANCE_DATA(FP_DEV(dev));
int error = fpi_ssm_get_error(ssm);
G_DEBUG_HERE();
......@@ -479,7 +479,7 @@ static void stop_capture_complete(fpi_ssm *ssm)
static void elan_stop_capture(struct fp_img_dev *dev)
{
struct elan_dev *elandev = fpi_imgdev_get_user_data(dev);
struct elan_dev *elandev = FP_INSTANCE_DATA(FP_DEV(dev));
G_DEBUG_HERE();
......@@ -503,7 +503,7 @@ enum capture_states {
static void capture_run_state(fpi_ssm *ssm)
{
struct fp_img_dev *dev = fpi_ssm_get_user_data(ssm);
struct elan_dev *elandev = fpi_imgdev_get_user_data(dev);
struct elan_dev *elandev = FP_INSTANCE_DATA(FP_DEV(dev));
int r;
switch (fpi_ssm_get_cur_state(ssm)) {
......@@ -541,7 +541,7 @@ static void capture_run_state(fpi_ssm *ssm)
static void capture_complete(fpi_ssm *ssm)
{
struct fp_img_dev *dev = fpi_ssm_get_user_data(ssm);
struct elan_dev *elandev = fpi_imgdev_get_user_data(dev);
struct elan_dev *elandev = FP_INSTANCE_DATA(FP_DEV(dev));
G_DEBUG_HERE();
......@@ -573,7 +573,7 @@ static void capture_complete(fpi_ssm *ssm)
static void elan_capture(struct fp_img_dev *dev)
{
struct elan_dev *elandev = fpi_imgdev_get_user_data(dev);
struct elan_dev *elandev = FP_INSTANCE_DATA(FP_DEV(dev));
G_DEBUG_HERE();
......@@ -627,7 +627,7 @@ enum calibrate_states {
static void calibrate_run_state(fpi_ssm *ssm)
{
struct fp_img_dev *dev = fpi_ssm_get_user_data(ssm);
struct elan_dev *elandev = fpi_imgdev_get_user_data(dev);
struct elan_dev *elandev = FP_INSTANCE_DATA(FP_DEV(dev));
G_DEBUG_HERE();
......@@ -704,7 +704,7 @@ static void calibrate_complete(fpi_ssm *ssm)
static void elan_calibrate(struct fp_img_dev *dev)
{
struct elan_dev *elandev = fpi_imgdev_get_user_data(dev);
struct elan_dev *elandev = FP_INSTANCE_DATA(FP_DEV(dev));
G_DEBUG_HERE();
......@@ -729,7 +729,7 @@ enum activate_states {
static void activate_run_state(fpi_ssm *ssm)
{
struct fp_img_dev *dev = fpi_ssm_get_user_data(ssm);
struct elan_dev *elandev = fpi_imgdev_get_user_data(dev);
struct elan_dev *elandev = FP_INSTANCE_DATA(FP_DEV(dev));
G_DEBUG_HERE();
......@@ -785,7 +785,7 @@ static void activate_complete(fpi_ssm *ssm)
static void elan_activate(struct fp_img_dev *dev)
{
struct elan_dev *elandev = fpi_imgdev_get_user_data(dev);
struct elan_dev *elandev = FP_INSTANCE_DATA(FP_DEV(dev));
G_DEBUG_HERE();
elan_dev_reset(elandev);
......@@ -810,7 +810,7 @@ static int dev_init(struct fp_img_dev *dev, unsigned long driver_data)
}
elandev = g_malloc0(sizeof(struct elan_dev));
fpi_imgdev_set_user_data(dev, elandev);
fp_dev_set_instance_data(FP_DEV(dev), elandev);
/* common params */
elandev->dev_type = driver_data;
......@@ -836,7 +836,7 @@ static void elan_deactivate(struct fp_img_dev *dev)
static void dev_deinit(struct fp_img_dev *dev)
{
struct elan_dev *elandev = fpi_imgdev_get_user_data(dev);
struct elan_dev *elandev = FP_INSTANCE_DATA(FP_DEV(dev));
G_DEBUG_HERE();
......@@ -856,7 +856,7 @@ static int dev_activate(struct fp_img_dev *dev, enum fp_imgdev_state state)
static void elan_change_state(struct fp_img_dev *dev)
{
struct elan_dev *elandev = fpi_imgdev_get_user_data(dev);
struct elan_dev *elandev = FP_INSTANCE_DATA(FP_DEV(dev));
enum fp_imgdev_state next_state = elandev->dev_state_next;
if (elandev->dev_state == next_state) {
......@@ -894,7 +894,7 @@ static void elan_change_state_async(void *data)
static int dev_change_state(struct fp_img_dev *dev, enum fp_imgdev_state state)
{
struct elan_dev *elandev = fpi_imgdev_get_user_data(dev);
struct elan_dev *elandev = FP_INSTANCE_DATA(FP_DEV(dev));
G_DEBUG_HERE();
......
......@@ -639,7 +639,7 @@ enum {
static int async_tx(struct fp_img_dev *idev, unsigned int ep, void *cb,
void *cb_arg)
{
struct etes603_dev *dev = fpi_imgdev_get_user_data(idev);
struct etes603_dev *dev = FP_INSTANCE_DATA(FP_DEV(idev));
struct libusb_transfer *transfer = libusb_alloc_transfer(0);
unsigned char *buffer;
int length;
......@@ -671,7 +671,7 @@ static void async_tx_cb(struct libusb_transfer *transfer)
{
fpi_ssm *ssm = transfer->user_data;
struct fp_img_dev *idev = fpi_ssm_get_user_data(ssm);
struct etes603_dev *dev = fpi_imgdev_get_user_data(idev);
struct etes603_dev *dev = FP_INSTANCE_DATA(FP_DEV(idev));
if (transfer->status != LIBUSB_TRANSFER_COMPLETED) {
fp_warn("transfer is not completed (status=%d)",
......@@ -702,7 +702,7 @@ static void async_tx_cb(struct libusb_transfer *transfer)
static void m_exit_state(fpi_ssm *ssm)
{
struct fp_img_dev *idev = fpi_ssm_get_user_data(ssm);
struct etes603_dev *dev = fpi_imgdev_get_user_data(idev);
struct etes603_dev *dev = FP_INSTANCE_DATA(FP_DEV(idev));
switch (fpi_ssm_get_cur_state(ssm)) {
case EXIT_SET_REGS_REQ:
......@@ -752,7 +752,7 @@ static void m_exit_start(struct fp_img_dev *idev)
static void m_capture_state(fpi_ssm *ssm)
{
struct fp_img_dev *idev = fpi_ssm_get_user_data(ssm);
struct etes603_dev *dev = fpi_imgdev_get_user_data(idev);
struct etes603_dev *dev = FP_INSTANCE_DATA(FP_DEV(idev));
if (dev->is_active == FALSE) {
fpi_ssm_mark_completed(ssm);
......@@ -833,7 +833,7 @@ err:
static void m_capture_complete(fpi_ssm *ssm)
{
struct fp_img_dev *idev = fpi_ssm_get_user_data(ssm);
struct etes603_dev *dev = fpi_imgdev_get_user_data(idev);
struct etes603_dev *dev = FP_INSTANCE_DATA(FP_DEV(idev));
if (fpi_ssm_get_error(ssm)) {
if (fpi_imgdev_get_action_state(idev) != IMG_ACQUIRE_STATE_DEACTIVATING) {
......@@ -855,7 +855,7 @@ static void m_capture_complete(fpi_ssm *ssm)
static void m_finger_state(fpi_ssm *ssm)
{
struct fp_img_dev *idev = fpi_ssm_get_user_data(ssm);
struct etes603_dev *dev = fpi_imgdev_get_user_data(idev);
struct etes603_dev *dev = FP_INSTANCE_DATA(FP_DEV(idev));
if (dev->is_active == FALSE) {
fpi_ssm_mark_completed(ssm);
......@@ -951,7 +951,7 @@ err:
static void m_finger_complete(fpi_ssm *ssm)
{
struct fp_img_dev *idev = fpi_ssm_get_user_data(ssm);
struct etes603_dev *dev = fpi_imgdev_get_user_data(idev);
struct etes603_dev *dev = FP_INSTANCE_DATA(FP_DEV(idev));
if (!fpi_ssm_get_error(ssm)) {
fpi_ssm *ssm_cap;
......@@ -985,7 +985,7 @@ static void m_start_fingerdetect(struct fp_img_dev *idev)
static void m_tunevrb_state(fpi_ssm *ssm)
{
struct fp_img_dev *idev = fpi_ssm_get_user_data(ssm);
struct etes603_dev *dev = fpi_imgdev_get_user_data(idev);
struct etes603_dev *dev = FP_INSTANCE_DATA(FP_DEV(idev));
float hist[5];
if (dev->is_active == FALSE) {
......@@ -1143,7 +1143,7 @@ static void m_tunevrb_complete(fpi_ssm *ssm)
fp_dbg("Tuning is done. Starting finger detection.");
m_start_fingerdetect(idev);
} else {
struct etes603_dev *dev = fpi_imgdev_get_user_data(idev);
struct etes603_dev *dev = FP_INSTANCE_DATA(FP_DEV(idev));
fp_err("Error while tuning VRT");
dev->is_active = FALSE;
reset_param(dev);
......@@ -1159,7 +1159,7 @@ static void m_tunevrb_complete(fpi_ssm *ssm)
static void m_tunedc_state(fpi_ssm *ssm)
{
struct fp_img_dev *idev = fpi_ssm_get_user_data(ssm);