lib: Remove fp_img_dev->priv

And use the new instance data helper.
This commit is contained in:
Bastien Nocera 2018-09-15 00:45:42 +02:00
parent 4f75e63e25
commit 058f91909d
23 changed files with 221 additions and 240 deletions

View file

@ -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) 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) { if (aesdev->deactivating) {
complete_deactivation(dev); complete_deactivation(dev);
@ -559,7 +559,7 @@ static void capture_read_strip_cb(struct libusb_transfer *transfer)
unsigned char *stripdata; unsigned char *stripdata;
fpi_ssm *ssm = transfer->user_data; fpi_ssm *ssm = transfer->user_data;
struct fp_img_dev *dev = fpi_ssm_get_user_data(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));
unsigned char *data = transfer->buffer; unsigned char *data = transfer->buffer;
int sum, i; int sum, i;
@ -646,7 +646,7 @@ out:
static void capture_run_state(fpi_ssm *ssm) static void capture_run_state(fpi_ssm *ssm)
{ {
struct fp_img_dev *dev = fpi_ssm_get_user_data(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; int r;
switch (fpi_ssm_get_cur_state(ssm)) { 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) static void capture_sm_complete(fpi_ssm *ssm)
{ {
struct fp_img_dev *dev = fpi_ssm_get_user_data(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(); G_DEBUG_HERE();
if (aesdev->deactivating) if (aesdev->deactivating)
@ -707,7 +707,7 @@ static void capture_sm_complete(fpi_ssm *ssm)
static void start_capture(struct fp_img_dev *dev) 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; fpi_ssm *ssm;
if (aesdev->deactivating) { 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) 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, fpi_ssm *ssm = fpi_ssm_new(fpi_imgdev_get_dev(dev), activate_run_state,
ACTIVATE_NUM_STATES); ACTIVATE_NUM_STATES);
fpi_ssm_set_user_data(ssm, dev); 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) 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 /* FIXME: audit cancellation points, probably need more, specifically
* in error handling paths? */ * in error handling paths? */
aesdev->deactivating = TRUE; 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) 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(); G_DEBUG_HERE();
/* FIXME: if we're in the middle of a scan, we should cancel the scan. /* 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)); 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); fpi_imgdev_open_complete(dev, 0);
return 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) static void dev_deinit(struct fp_img_dev *dev)
{ {
struct aes1610_dev *aesdev; struct aes1610_dev *aesdev;
aesdev = fpi_imgdev_get_user_data(dev); aesdev = FP_INSTANCE_DATA(FP_DEV(dev));
g_free(aesdev); g_free(aesdev);
libusb_release_interface(fpi_imgdev_get_usb_dev(dev), 0); libusb_release_interface(fpi_imgdev_get_usb_dev(dev), 0);
fpi_imgdev_close_complete(dev); fpi_imgdev_close_complete(dev);

View file

@ -47,7 +47,7 @@ static int dev_init(struct fp_img_dev *dev, unsigned long driver_data)
} }
aesdev = g_malloc0(sizeof(struct aesX660_dev)); 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->buffer = g_malloc0(AES1660_FRAME_SIZE + AESX660_HEADER_SIZE);
aesdev->init_seqs[0] = aes1660_init_1; aesdev->init_seqs[0] = aes1660_init_1;
aesdev->init_seqs_len[0] = G_N_ELEMENTS(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) 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->buffer);
g_free(aesdev); g_free(aesdev);
libusb_release_interface(fpi_imgdev_get_usb_dev(dev), 0); libusb_release_interface(fpi_imgdev_get_usb_dev(dev), 0);

View file

@ -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) 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(); G_DEBUG_HERE();
if (aesdev->deactivating) { if (aesdev->deactivating) {
@ -438,7 +438,7 @@ static void capture_read_strip_cb(struct libusb_transfer *transfer)
unsigned char *stripdata; unsigned char *stripdata;
fpi_ssm *ssm = transfer->user_data; fpi_ssm *ssm = transfer->user_data;
struct fp_img_dev *dev = fpi_ssm_get_user_data(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));
unsigned char *data = transfer->buffer; unsigned char *data = transfer->buffer;
int sum; int sum;
int threshold; int threshold;
@ -523,7 +523,7 @@ out:
static void capture_run_state(fpi_ssm *ssm) static void capture_run_state(fpi_ssm *ssm)
{ {
struct fp_img_dev *dev = fpi_ssm_get_user_data(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; int r;
switch (fpi_ssm_get_cur_state(ssm)) { 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) static void capture_sm_complete(fpi_ssm *ssm)
{ {
struct fp_img_dev *dev = fpi_ssm_get_user_data(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(); G_DEBUG_HERE();
if (aesdev->deactivating) if (aesdev->deactivating)
@ -588,7 +588,7 @@ static void capture_sm_complete(fpi_ssm *ssm)
static void start_capture(struct fp_img_dev *dev) 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; fpi_ssm *ssm;
if (aesdev->deactivating) { 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) unsigned char *regs, void *user_data)
{ {
fpi_ssm *ssm = 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) { if (status != 0) {
fpi_ssm_mark_failed(ssm, status); 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) 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, fpi_ssm *ssm = fpi_ssm_new(fpi_imgdev_get_dev(dev), activate_run_state,
ACTIVATE_NUM_STATES); ACTIVATE_NUM_STATES);
fpi_ssm_set_user_data(ssm, dev); 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) 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 /* FIXME: audit cancellation points, probably need more, specifically
* in error handling paths? */ * in error handling paths? */
aesdev->deactivating = TRUE; 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) 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(); G_DEBUG_HERE();
/* FIXME: if we're in the middle of a scan, we should cancel the scan. /* 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)); 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); fpi_imgdev_open_complete(dev, 0);
return 0; return 0;
} }
static void dev_deinit(struct fp_img_dev *dev) 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); g_free(aesdev);
libusb_release_interface(fpi_imgdev_get_usb_dev(dev), 0); libusb_release_interface(fpi_imgdev_get_usb_dev(dev), 0);
fpi_imgdev_close_complete(dev); fpi_imgdev_close_complete(dev);

View file

@ -149,7 +149,7 @@ exit_free_transfer:
static void start_finger_detection(struct fp_img_dev *dev) static void start_finger_detection(struct fp_img_dev *dev)
{ {
int r; 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; struct libusb_transfer *transfer;
G_DEBUG_HERE(); G_DEBUG_HERE();
@ -204,7 +204,7 @@ static int process_strip_data(fpi_ssm *ssm, unsigned char *data)
{ {
unsigned char *stripdata; unsigned char *stripdata;
struct fp_img_dev *dev = fpi_ssm_get_user_data(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));
struct fpi_frame *stripe; struct fpi_frame *stripe;
int len; int len;
@ -246,7 +246,7 @@ static void capture_set_idle_reqs_cb(struct libusb_transfer *transfer)
{ {
fpi_ssm *ssm = transfer->user_data; fpi_ssm *ssm = transfer->user_data;
struct fp_img_dev *dev = fpi_ssm_get_user_data(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));
if ((transfer->status == LIBUSB_TRANSFER_COMPLETED) && if ((transfer->status == LIBUSB_TRANSFER_COMPLETED) &&
(transfer->length == transfer->actual_length) && (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; fpi_ssm *ssm = transfer->user_data;
struct fp_img_dev *dev = fpi_ssm_get_user_data(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));
unsigned char *data = transfer->buffer; unsigned char *data = transfer->buffer;
int r; int r;
@ -389,7 +389,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_img_dev *dev = fpi_ssm_get_user_data(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"); fp_dbg("Capture completed");
if (aesdev->deactivating) if (aesdev->deactivating)
@ -403,7 +403,7 @@ static void capture_sm_complete(fpi_ssm *ssm)
static void start_capture(struct fp_img_dev *dev) 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; fpi_ssm *ssm;
if (aesdev->deactivating) { 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) 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; aesdev->deactivating = TRUE;
} }
static void complete_deactivation(struct fp_img_dev *dev) 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(); G_DEBUG_HERE();
aesdev->deactivating = FALSE; 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)); 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); fpi_imgdev_open_complete(dev, 0);
return 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) static void dev_deinit(struct fp_img_dev *dev)
{ {
struct aes2550_dev *aesdev; struct aes2550_dev *aesdev;
aesdev = fpi_imgdev_get_user_data(dev); aesdev = FP_INSTANCE_DATA(FP_DEV(dev));
g_free(aesdev); g_free(aesdev);
libusb_release_interface(fpi_imgdev_get_usb_dev(dev), 0); libusb_release_interface(fpi_imgdev_get_usb_dev(dev), 0);
fpi_imgdev_close_complete(dev); fpi_imgdev_close_complete(dev);

View file

@ -47,7 +47,7 @@ static int dev_init(struct fp_img_dev *dev, unsigned long driver_data)
} }
aesdev = g_malloc0(sizeof(struct aesX660_dev)); 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); aesdev->buffer = g_malloc0(AES2660_FRAME_SIZE + AESX660_HEADER_SIZE);
/* No scaling for AES2660 */ /* No scaling for AES2660 */
aesdev->init_seqs[0] = aes2660_init_1; 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) static void dev_deinit(struct fp_img_dev *dev)
{ {
struct aesX660_dev *aesdev; 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->buffer);
g_free(aesdev); g_free(aesdev);
libusb_release_interface(fpi_imgdev_get_usb_dev(dev), 0); libusb_release_interface(fpi_imgdev_get_usb_dev(dev), 0);

View file

@ -129,7 +129,7 @@ static int dev_init(struct fp_img_dev *dev, unsigned long driver_data)
} }
aesdev = g_malloc0(sizeof(struct aes3k_dev)); 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) if (!aesdev)
return -ENOMEM; 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) 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); g_free(aesdev);
libusb_release_interface(fpi_imgdev_get_usb_dev(dev), 0); libusb_release_interface(fpi_imgdev_get_usb_dev(dev), 0);
fpi_imgdev_close_complete(dev); fpi_imgdev_close_complete(dev);

View file

@ -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) static void img_cb(struct libusb_transfer *transfer)
{ {
struct fp_img_dev *dev = transfer->user_data; 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; unsigned char *ptr = transfer->buffer;
struct fp_img *tmp; struct fp_img *tmp;
struct fp_img *img; struct fp_img *img;
@ -112,7 +112,7 @@ err:
static void do_capture(struct fp_img_dev *dev) 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; unsigned char *data;
int r; 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) 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); aes_write_regv(dev, aesdev->init_reqs, aesdev->init_reqs_len, init_reqs_cb, NULL);
return 0; return 0;
} }
void aes3k_dev_deactivate(struct fp_img_dev *dev) 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 /* FIXME: should wait for cancellation to complete before returning
* from deactivation, otherwise app may legally exit before we've * from deactivation, otherwise app may legally exit before we've

View file

@ -126,7 +126,7 @@ static int dev_init(struct fp_img_dev *dev, unsigned long driver_data)
} }
aesdev = g_malloc0(sizeof(struct aes3k_dev)); 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) if (!aesdev)
return -ENOMEM; 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) 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); g_free(aesdev);
libusb_release_interface(fpi_imgdev_get_usb_dev(dev), 0); libusb_release_interface(fpi_imgdev_get_usb_dev(dev), 0);
fpi_imgdev_close_complete(dev); fpi_imgdev_close_complete(dev);

View file

@ -145,7 +145,7 @@ static void finger_det_read_fd_data_cb(struct libusb_transfer *transfer)
{ {
fpi_ssm *ssm = transfer->user_data; fpi_ssm *ssm = transfer->user_data;
struct fp_img_dev *dev = fpi_ssm_get_user_data(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));
unsigned char *data = transfer->buffer; unsigned char *data = transfer->buffer;
aesdev->fd_data_transfer = NULL; 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) static void finger_det_sm_complete(fpi_ssm *ssm)
{ {
struct fp_img_dev *dev = fpi_ssm_get_user_data(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); int err = fpi_ssm_get_error(ssm);
fp_dbg("Finger detection completed"); 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) static void start_finger_detection(struct fp_img_dev *dev)
{ {
fpi_ssm *ssm; 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) { if (aesdev->deactivating) {
complete_deactivation(dev); complete_deactivation(dev);
@ -268,7 +268,7 @@ static int process_stripe_data(fpi_ssm *ssm, unsigned char *data)
struct fpi_frame *stripe; struct fpi_frame *stripe;
unsigned char *stripdata; unsigned char *stripdata;
struct fp_img_dev *dev = fpi_ssm_get_user_data(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));
stripe = g_malloc(aesdev->assembling_ctx->frame_width * FRAME_HEIGHT / 2 + sizeof(struct fpi_frame)); /* 4 bpp */ stripe = g_malloc(aesdev->assembling_ctx->frame_width * FRAME_HEIGHT / 2 + sizeof(struct fpi_frame)); /* 4 bpp */
stripdata = stripe->data; stripdata = stripe->data;
@ -296,7 +296,7 @@ static void capture_set_idle_cmd_cb(struct libusb_transfer *transfer)
{ {
fpi_ssm *ssm = transfer->user_data; fpi_ssm *ssm = transfer->user_data;
struct fp_img_dev *dev = fpi_ssm_get_user_data(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));
if ((transfer->status == LIBUSB_TRANSFER_COMPLETED) && if ((transfer->status == LIBUSB_TRANSFER_COMPLETED) &&
(transfer->length == transfer->actual_length)) { (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; fpi_ssm *ssm = transfer->user_data;
struct fp_img_dev *dev = fpi_ssm_get_user_data(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));
unsigned char *data = transfer->buffer; unsigned char *data = transfer->buffer;
int finger_missing = 0; int finger_missing = 0;
size_t copied, actual_len = transfer->actual_length; size_t copied, actual_len = transfer->actual_length;
@ -374,7 +374,7 @@ out:
static void capture_run_state(fpi_ssm *ssm) static void capture_run_state(fpi_ssm *ssm)
{ {
struct fp_img_dev *dev = fpi_ssm_get_user_data(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)) { switch (fpi_ssm_get_cur_state(ssm)) {
case CAPTURE_SEND_LED_CMD: 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) static void capture_sm_complete(fpi_ssm *ssm)
{ {
struct fp_img_dev *dev = fpi_ssm_get_user_data(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); int err = fpi_ssm_get_error(ssm);
fp_dbg("Capture completed"); 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) 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; fpi_ssm *ssm;
if (aesdev->deactivating) { if (aesdev->deactivating) {
@ -450,7 +450,7 @@ static void activate_read_id_cb(struct libusb_transfer *transfer)
{ {
fpi_ssm *ssm = transfer->user_data; fpi_ssm *ssm = transfer->user_data;
struct fp_img_dev *dev = fpi_ssm_get_user_data(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));
unsigned char *data = transfer->buffer; unsigned char *data = transfer->buffer;
if ((transfer->status != LIBUSB_TRANSFER_COMPLETED) || 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; fpi_ssm *ssm = transfer->user_data;
struct fp_img_dev *dev = fpi_ssm_get_user_data(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));
unsigned char *data = transfer->buffer; unsigned char *data = transfer->buffer;
fp_dbg("read_init_cb\n"); fp_dbg("read_init_cb\n");
@ -537,7 +537,7 @@ out:
static void activate_run_state(fpi_ssm *ssm) static void activate_run_state(fpi_ssm *ssm)
{ {
struct fp_img_dev *dev = fpi_ssm_get_user_data(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)) { switch (fpi_ssm_get_cur_state(ssm)) {
case ACTIVATE_SET_IDLE: 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) 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) if (aesdev->fd_data_transfer)
libusb_cancel_transfer(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) 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(); G_DEBUG_HERE();
aesdev->deactivating = FALSE; aesdev->deactivating = FALSE;

View file

@ -290,7 +290,7 @@ static void elan_process_frame_thirds(unsigned short *raw_frame,
static void elan_submit_image(struct fp_img_dev *dev) 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; GSList *frames = NULL;
struct fp_img *img; struct fp_img *img;
@ -323,7 +323,7 @@ static void elan_cmd_cb(struct libusb_transfer *transfer)
{ {
fpi_ssm *ssm = transfer->user_data; fpi_ssm *ssm = transfer->user_data;
struct fp_img_dev *dev = fpi_ssm_get_user_data(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(); G_DEBUG_HERE();
@ -365,7 +365,7 @@ static void elan_cmd_cb(struct libusb_transfer *transfer)
static void elan_cmd_read(fpi_ssm *ssm) static void elan_cmd_read(fpi_ssm *ssm)
{ {
struct fp_img_dev *dev = fpi_ssm_get_user_data(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; int response_len = elandev->cmd->response_len;
G_DEBUG_HERE(); G_DEBUG_HERE();
@ -405,7 +405,7 @@ static void elan_run_cmd(fpi_ssm *ssm, const struct elan_cmd *cmd,
int cmd_timeout) int cmd_timeout)
{ {
struct fp_img_dev *dev = fpi_ssm_get_user_data(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));
dbg_buf(cmd->cmd, 2); 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) static void stop_capture_complete(fpi_ssm *ssm)
{ {
struct fp_img_dev *dev = fpi_ssm_get_user_data(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); int error = fpi_ssm_get_error(ssm);
G_DEBUG_HERE(); 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) 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(); G_DEBUG_HERE();
@ -503,7 +503,7 @@ enum capture_states {
static void capture_run_state(fpi_ssm *ssm) static void capture_run_state(fpi_ssm *ssm)
{ {
struct fp_img_dev *dev = fpi_ssm_get_user_data(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; int r;
switch (fpi_ssm_get_cur_state(ssm)) { 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) static void capture_complete(fpi_ssm *ssm)
{ {
struct fp_img_dev *dev = fpi_ssm_get_user_data(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(); G_DEBUG_HERE();
@ -573,7 +573,7 @@ static void capture_complete(fpi_ssm *ssm)
static void elan_capture(struct fp_img_dev *dev) 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(); G_DEBUG_HERE();
@ -627,7 +627,7 @@ enum calibrate_states {
static void calibrate_run_state(fpi_ssm *ssm) static void calibrate_run_state(fpi_ssm *ssm)
{ {
struct fp_img_dev *dev = fpi_ssm_get_user_data(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(); G_DEBUG_HERE();
@ -704,7 +704,7 @@ static void calibrate_complete(fpi_ssm *ssm)
static void elan_calibrate(struct fp_img_dev *dev) 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(); G_DEBUG_HERE();
@ -729,7 +729,7 @@ enum activate_states {
static void activate_run_state(fpi_ssm *ssm) static void activate_run_state(fpi_ssm *ssm)
{ {
struct fp_img_dev *dev = fpi_ssm_get_user_data(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(); G_DEBUG_HERE();
@ -785,7 +785,7 @@ static void activate_complete(fpi_ssm *ssm)
static void elan_activate(struct fp_img_dev *dev) 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(); G_DEBUG_HERE();
elan_dev_reset(elandev); 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)); 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 */ /* common params */
elandev->dev_type = driver_data; 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) 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(); 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) 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; enum fp_imgdev_state next_state = elandev->dev_state_next;
if (elandev->dev_state == next_state) { 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) 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(); G_DEBUG_HERE();

View file

@ -639,7 +639,7 @@ enum {
static int async_tx(struct fp_img_dev *idev, unsigned int ep, void *cb, static int async_tx(struct fp_img_dev *idev, unsigned int ep, void *cb,
void *cb_arg) 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); struct libusb_transfer *transfer = libusb_alloc_transfer(0);
unsigned char *buffer; unsigned char *buffer;
int length; int length;
@ -671,7 +671,7 @@ static void async_tx_cb(struct libusb_transfer *transfer)
{ {
fpi_ssm *ssm = transfer->user_data; fpi_ssm *ssm = transfer->user_data;
struct fp_img_dev *idev = fpi_ssm_get_user_data(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 (transfer->status != LIBUSB_TRANSFER_COMPLETED) { if (transfer->status != LIBUSB_TRANSFER_COMPLETED) {
fp_warn("transfer is not completed (status=%d)", 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) static void m_exit_state(fpi_ssm *ssm)
{ {
struct fp_img_dev *idev = fpi_ssm_get_user_data(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)) { switch (fpi_ssm_get_cur_state(ssm)) {
case EXIT_SET_REGS_REQ: 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) static void m_capture_state(fpi_ssm *ssm)
{ {
struct fp_img_dev *idev = fpi_ssm_get_user_data(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) { if (dev->is_active == FALSE) {
fpi_ssm_mark_completed(ssm); fpi_ssm_mark_completed(ssm);
@ -833,7 +833,7 @@ err:
static void m_capture_complete(fpi_ssm *ssm) static void m_capture_complete(fpi_ssm *ssm)
{ {
struct fp_img_dev *idev = fpi_ssm_get_user_data(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_ssm_get_error(ssm)) {
if (fpi_imgdev_get_action_state(idev) != IMG_ACQUIRE_STATE_DEACTIVATING) { 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) static void m_finger_state(fpi_ssm *ssm)
{ {
struct fp_img_dev *idev = fpi_ssm_get_user_data(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) { if (dev->is_active == FALSE) {
fpi_ssm_mark_completed(ssm); fpi_ssm_mark_completed(ssm);
@ -951,7 +951,7 @@ err:
static void m_finger_complete(fpi_ssm *ssm) static void m_finger_complete(fpi_ssm *ssm)
{ {
struct fp_img_dev *idev = fpi_ssm_get_user_data(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_ssm_get_error(ssm)) {
fpi_ssm *ssm_cap; 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) static void m_tunevrb_state(fpi_ssm *ssm)
{ {
struct fp_img_dev *idev = fpi_ssm_get_user_data(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]; float hist[5];
if (dev->is_active == FALSE) { 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."); fp_dbg("Tuning is done. Starting finger detection.");
m_start_fingerdetect(idev); m_start_fingerdetect(idev);
} else { } 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"); fp_err("Error while tuning VRT");
dev->is_active = FALSE; dev->is_active = FALSE;
reset_param(dev); reset_param(dev);
@ -1159,7 +1159,7 @@ static void m_tunevrb_complete(fpi_ssm *ssm)
static void m_tunedc_state(fpi_ssm *ssm) static void m_tunedc_state(fpi_ssm *ssm)
{ {
struct fp_img_dev *idev = fpi_ssm_get_user_data(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) { if (dev->is_active == FALSE) {
fpi_ssm_mark_completed(ssm); fpi_ssm_mark_completed(ssm);
@ -1269,7 +1269,7 @@ static void m_tunedc_complete(fpi_ssm *ssm)
fpi_ssm_set_user_data(ssm_tune, idev); fpi_ssm_set_user_data(ssm_tune, idev);
fpi_ssm_start(ssm_tune, m_tunevrb_complete); fpi_ssm_start(ssm_tune, m_tunevrb_complete);
} else { } 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 DCOFFSET"); fp_err("Error while tuning DCOFFSET");
dev->is_active = FALSE; dev->is_active = FALSE;
reset_param(dev); reset_param(dev);
@ -1281,7 +1281,7 @@ static void m_tunedc_complete(fpi_ssm *ssm)
static void m_init_state(fpi_ssm *ssm) static void m_init_state(fpi_ssm *ssm)
{ {
struct fp_img_dev *idev = fpi_ssm_get_user_data(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) { if (dev->is_active == FALSE) {
fpi_ssm_mark_completed(ssm); fpi_ssm_mark_completed(ssm);
@ -1389,7 +1389,7 @@ static void m_init_complete(fpi_ssm *ssm)
fpi_ssm_set_user_data(ssm_tune, idev); fpi_ssm_set_user_data(ssm_tune, idev);
fpi_ssm_start(ssm_tune, m_tunedc_complete); fpi_ssm_start(ssm_tune, m_tunedc_complete);
} else { } else {
struct etes603_dev *dev = fpi_imgdev_get_user_data(idev); struct etes603_dev *dev = FP_INSTANCE_DATA(FP_DEV(idev));
fp_err("Error initializing the device"); fp_err("Error initializing the device");
dev->is_active = FALSE; dev->is_active = FALSE;
reset_param(dev); reset_param(dev);
@ -1400,7 +1400,7 @@ static void m_init_complete(fpi_ssm *ssm)
static int dev_activate(struct fp_img_dev *idev, enum fp_imgdev_state state) static int dev_activate(struct fp_img_dev *idev, enum fp_imgdev_state state)
{ {
struct etes603_dev *dev = fpi_imgdev_get_user_data(idev); struct etes603_dev *dev = FP_INSTANCE_DATA(FP_DEV(idev));
fpi_ssm *ssm; fpi_ssm *ssm;
g_assert(dev); g_assert(dev);
@ -1433,7 +1433,7 @@ static int dev_activate(struct fp_img_dev *idev, enum fp_imgdev_state state)
static void dev_deactivate(struct fp_img_dev *idev) static void dev_deactivate(struct fp_img_dev *idev)
{ {
struct etes603_dev *dev = fpi_imgdev_get_user_data(idev); struct etes603_dev *dev = FP_INSTANCE_DATA(FP_DEV(idev));
fp_dbg("deactivating"); fp_dbg("deactivating");
@ -1450,7 +1450,7 @@ static int dev_open(struct fp_img_dev *idev, unsigned long driver_data)
struct etes603_dev *dev; struct etes603_dev *dev;
dev = g_malloc0(sizeof(struct etes603_dev)); dev = g_malloc0(sizeof(struct etes603_dev));
fpi_imgdev_set_user_data(idev, dev); fp_dev_set_instance_data(FP_DEV(idev), dev);
dev->req = g_malloc(sizeof(struct egis_msg)); dev->req = g_malloc(sizeof(struct egis_msg));
dev->ans = g_malloc(FE_SIZE); dev->ans = g_malloc(FE_SIZE);
@ -1468,7 +1468,7 @@ static int dev_open(struct fp_img_dev *idev, unsigned long driver_data)
static void dev_close(struct fp_img_dev *idev) static void dev_close(struct fp_img_dev *idev)
{ {
struct etes603_dev *dev = fpi_imgdev_get_user_data(idev); struct etes603_dev *dev = FP_INSTANCE_DATA(FP_DEV(idev));
g_free(dev->req); g_free(dev->req);
g_free(dev->ans); g_free(dev->ans);

View file

@ -176,7 +176,7 @@ static void free_img_transfers(struct sonly_dev *sdev)
static void last_transfer_killed(struct fp_img_dev *dev) static void last_transfer_killed(struct fp_img_dev *dev)
{ {
struct sonly_dev *sdev = fpi_imgdev_get_user_data(dev); struct sonly_dev *sdev = FP_INSTANCE_DATA(FP_DEV(dev));
switch (sdev->killing_transfers) { switch (sdev->killing_transfers) {
case ABORT_SSM: case ABORT_SSM:
fp_dbg("abort ssm error %d", sdev->kill_status_code); fp_dbg("abort ssm error %d", sdev->kill_status_code);
@ -197,7 +197,7 @@ static void last_transfer_killed(struct fp_img_dev *dev)
static void cancel_img_transfers(struct fp_img_dev *dev) static void cancel_img_transfers(struct fp_img_dev *dev)
{ {
struct sonly_dev *sdev = fpi_imgdev_get_user_data(dev); struct sonly_dev *sdev = FP_INSTANCE_DATA(FP_DEV(dev));
int i; int i;
if (sdev->num_flying == 0) { if (sdev->num_flying == 0) {
@ -224,7 +224,7 @@ static gboolean is_capturing(struct sonly_dev *sdev)
static void handoff_img(struct fp_img_dev *dev) static void handoff_img(struct fp_img_dev *dev)
{ {
struct sonly_dev *sdev = fpi_imgdev_get_user_data(dev); struct sonly_dev *sdev = FP_INSTANCE_DATA(FP_DEV(dev));
struct fp_img *img; struct fp_img *img;
GSList *elem = sdev->rows; GSList *elem = sdev->rows;
@ -252,7 +252,7 @@ static void handoff_img(struct fp_img_dev *dev)
static void row_complete(struct fp_img_dev *dev) static void row_complete(struct fp_img_dev *dev)
{ {
struct sonly_dev *sdev = fpi_imgdev_get_user_data(dev); struct sonly_dev *sdev = FP_INSTANCE_DATA(FP_DEV(dev));
sdev->rowbuf_offset = -1; sdev->rowbuf_offset = -1;
if (sdev->num_rows > 0) { if (sdev->num_rows > 0) {
@ -340,7 +340,7 @@ static void row_complete(struct fp_img_dev *dev)
/* add data to row buffer */ /* add data to row buffer */
static void add_to_rowbuf(struct fp_img_dev *dev, unsigned char *data, int size) static void add_to_rowbuf(struct fp_img_dev *dev, unsigned char *data, int size)
{ {
struct sonly_dev *sdev = fpi_imgdev_get_user_data(dev); struct sonly_dev *sdev = FP_INSTANCE_DATA(FP_DEV(dev));
memcpy(sdev->rowbuf + sdev->rowbuf_offset, data, size); memcpy(sdev->rowbuf + sdev->rowbuf_offset, data, size);
sdev->rowbuf_offset += size; sdev->rowbuf_offset += size;
@ -374,7 +374,7 @@ static int rowbuf_remaining(struct sonly_dev *sdev)
static void handle_packet(struct fp_img_dev *dev, unsigned char *data) static void handle_packet(struct fp_img_dev *dev, unsigned char *data)
{ {
struct sonly_dev *sdev = fpi_imgdev_get_user_data(dev); struct sonly_dev *sdev = FP_INSTANCE_DATA(FP_DEV(dev));
uint16_t seqnum = data[0] << 8 | data[1]; uint16_t seqnum = data[0] << 8 | data[1];
int abs_base_addr; int abs_base_addr;
int for_rowbuf; int for_rowbuf;
@ -470,7 +470,7 @@ static void img_data_cb(struct libusb_transfer *transfer)
{ {
struct img_transfer_data *idata = transfer->user_data; struct img_transfer_data *idata = transfer->user_data;
struct fp_img_dev *dev = idata->dev; struct fp_img_dev *dev = idata->dev;
struct sonly_dev *sdev = fpi_imgdev_get_user_data(dev); struct sonly_dev *sdev = FP_INSTANCE_DATA(FP_DEV(dev));
int i; int i;
idata->flying = FALSE; idata->flying = FALSE;
@ -649,7 +649,7 @@ static void sm_read_reg_cb(struct libusb_transfer *transfer)
{ {
fpi_ssm *ssm = transfer->user_data; fpi_ssm *ssm = transfer->user_data;
struct fp_img_dev *dev = fpi_ssm_get_user_data(ssm); struct fp_img_dev *dev = fpi_ssm_get_user_data(ssm);
struct sonly_dev *sdev = fpi_imgdev_get_user_data(dev); struct sonly_dev *sdev = FP_INSTANCE_DATA(FP_DEV(dev));
if (transfer->status != LIBUSB_TRANSFER_COMPLETED) { if (transfer->status != LIBUSB_TRANSFER_COMPLETED) {
fpi_ssm_mark_failed(ssm, -EIO); fpi_ssm_mark_failed(ssm, -EIO);
@ -695,7 +695,7 @@ static void sm_await_intr_cb(struct libusb_transfer *transfer)
{ {
fpi_ssm *ssm = transfer->user_data; fpi_ssm *ssm = transfer->user_data;
struct fp_img_dev *dev = fpi_ssm_get_user_data(ssm); struct fp_img_dev *dev = fpi_ssm_get_user_data(ssm);
struct sonly_dev *sdev = fpi_imgdev_get_user_data(dev); struct sonly_dev *sdev = FP_INSTANCE_DATA(FP_DEV(dev));
if (transfer->status != LIBUSB_TRANSFER_COMPLETED) { if (transfer->status != LIBUSB_TRANSFER_COMPLETED) {
g_free(transfer->buffer); g_free(transfer->buffer);
@ -766,7 +766,7 @@ enum awfsm_1000_states {
static void awfsm_2016_run_state(fpi_ssm *ssm) static void awfsm_2016_run_state(fpi_ssm *ssm)
{ {
struct fp_img_dev *dev = fpi_ssm_get_user_data(ssm); struct fp_img_dev *dev = fpi_ssm_get_user_data(ssm);
struct sonly_dev *sdev = fpi_imgdev_get_user_data(dev); struct sonly_dev *sdev = FP_INSTANCE_DATA(FP_DEV(dev));
switch (fpi_ssm_get_cur_state(ssm)) { switch (fpi_ssm_get_cur_state(ssm)) {
case AWFSM_2016_WRITEV_1: case AWFSM_2016_WRITEV_1:
@ -854,7 +854,7 @@ enum capsm_1001_states {
static void capsm_fire_bulk(fpi_ssm *ssm) static void capsm_fire_bulk(fpi_ssm *ssm)
{ {
struct fp_img_dev *dev = fpi_ssm_get_user_data(ssm); struct fp_img_dev *dev = fpi_ssm_get_user_data(ssm);
struct sonly_dev *sdev = fpi_imgdev_get_user_data(dev); struct sonly_dev *sdev = FP_INSTANCE_DATA(FP_DEV(dev));
int i; int i;
for (i = 0; i < NUM_BULK_TRANSFERS; i++) { for (i = 0; i < NUM_BULK_TRANSFERS; i++) {
int r = libusb_submit_transfer(sdev->img_transfer[i]); int r = libusb_submit_transfer(sdev->img_transfer[i]);
@ -884,7 +884,7 @@ static void capsm_fire_bulk(fpi_ssm *ssm)
static void capsm_2016_run_state(fpi_ssm *ssm) static void capsm_2016_run_state(fpi_ssm *ssm)
{ {
struct fp_img_dev *dev = fpi_ssm_get_user_data(ssm); struct fp_img_dev *dev = fpi_ssm_get_user_data(ssm);
struct sonly_dev *sdev = fpi_imgdev_get_user_data(dev); struct sonly_dev *sdev = FP_INSTANCE_DATA(FP_DEV(dev));
switch (fpi_ssm_get_cur_state(ssm)) { switch (fpi_ssm_get_cur_state(ssm)) {
case CAPSM_2016_INIT: case CAPSM_2016_INIT:
@ -916,7 +916,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_img_dev *dev = fpi_ssm_get_user_data(ssm); struct fp_img_dev *dev = fpi_ssm_get_user_data(ssm);
struct sonly_dev *sdev = fpi_imgdev_get_user_data(dev); struct sonly_dev *sdev = FP_INSTANCE_DATA(FP_DEV(dev));
switch (fpi_ssm_get_cur_state(ssm)) { switch (fpi_ssm_get_cur_state(ssm)) {
case CAPSM_1000_INIT: case CAPSM_1000_INIT:
@ -942,7 +942,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_img_dev *dev = fpi_ssm_get_user_data(ssm); struct fp_img_dev *dev = fpi_ssm_get_user_data(ssm);
struct sonly_dev *sdev = fpi_imgdev_get_user_data(dev); struct sonly_dev *sdev = FP_INSTANCE_DATA(FP_DEV(dev));
switch (fpi_ssm_get_cur_state(ssm)) { switch (fpi_ssm_get_cur_state(ssm)) {
case CAPSM_1001_INIT: case CAPSM_1001_INIT:
@ -1051,7 +1051,7 @@ enum initsm_1001_states {
static void initsm_2016_run_state(fpi_ssm *ssm) static void initsm_2016_run_state(fpi_ssm *ssm)
{ {
struct fp_img_dev *dev = fpi_ssm_get_user_data(ssm); struct fp_img_dev *dev = fpi_ssm_get_user_data(ssm);
struct sonly_dev *sdev = fpi_imgdev_get_user_data(dev); struct sonly_dev *sdev = FP_INSTANCE_DATA(FP_DEV(dev));
switch (fpi_ssm_get_cur_state(ssm)) { switch (fpi_ssm_get_cur_state(ssm)) {
case INITSM_2016_WRITEV_1: case INITSM_2016_WRITEV_1:
@ -1123,7 +1123,7 @@ enum loopsm_states {
static void loopsm_run_state(fpi_ssm *ssm) static void loopsm_run_state(fpi_ssm *ssm)
{ {
struct fp_img_dev *dev = fpi_ssm_get_user_data(ssm); struct fp_img_dev *dev = fpi_ssm_get_user_data(ssm);
struct sonly_dev *sdev = fpi_imgdev_get_user_data(dev); struct sonly_dev *sdev = FP_INSTANCE_DATA(FP_DEV(dev));
switch (fpi_ssm_get_cur_state(ssm)) { switch (fpi_ssm_get_cur_state(ssm)) {
case LOOPSM_RUN_AWFSM: ; case LOOPSM_RUN_AWFSM: ;
@ -1218,7 +1218,7 @@ static void loopsm_run_state(fpi_ssm *ssm)
static void deactivate_done(struct fp_img_dev *dev) static void deactivate_done(struct fp_img_dev *dev)
{ {
struct sonly_dev *sdev = fpi_imgdev_get_user_data(dev); struct sonly_dev *sdev = FP_INSTANCE_DATA(FP_DEV(dev));
G_DEBUG_HERE(); G_DEBUG_HERE();
free_img_transfers(sdev); free_img_transfers(sdev);
@ -1235,7 +1235,7 @@ static void deactivate_done(struct fp_img_dev *dev)
static void dev_deactivate(struct fp_img_dev *dev) static void dev_deactivate(struct fp_img_dev *dev)
{ {
struct sonly_dev *sdev = fpi_imgdev_get_user_data(dev); struct sonly_dev *sdev = FP_INSTANCE_DATA(FP_DEV(dev));
if (!sdev->capturing) { if (!sdev->capturing) {
deactivate_done(dev); deactivate_done(dev);
@ -1251,7 +1251,7 @@ static void dev_deactivate(struct fp_img_dev *dev)
static void loopsm_complete(fpi_ssm *ssm) static void loopsm_complete(fpi_ssm *ssm)
{ {
struct fp_img_dev *dev = fpi_ssm_get_user_data(ssm); struct fp_img_dev *dev = fpi_ssm_get_user_data(ssm);
struct sonly_dev *sdev = fpi_imgdev_get_user_data(dev); struct sonly_dev *sdev = FP_INSTANCE_DATA(FP_DEV(dev));
int r = fpi_ssm_get_error(ssm); int r = fpi_ssm_get_error(ssm);
fpi_ssm_free(ssm); fpi_ssm_free(ssm);
@ -1270,7 +1270,7 @@ static void loopsm_complete(fpi_ssm *ssm)
static void initsm_complete(fpi_ssm *ssm) static void initsm_complete(fpi_ssm *ssm)
{ {
struct fp_img_dev *dev = fpi_ssm_get_user_data(ssm); struct fp_img_dev *dev = fpi_ssm_get_user_data(ssm);
struct sonly_dev *sdev = fpi_imgdev_get_user_data(dev); struct sonly_dev *sdev = FP_INSTANCE_DATA(FP_DEV(dev));
int r = fpi_ssm_get_error(ssm); int r = fpi_ssm_get_error(ssm);
fpi_ssm_free(ssm); fpi_ssm_free(ssm);
@ -1285,7 +1285,7 @@ static void initsm_complete(fpi_ssm *ssm)
static int dev_activate(struct fp_img_dev *dev, enum fp_imgdev_state state) static int dev_activate(struct fp_img_dev *dev, enum fp_imgdev_state state)
{ {
struct sonly_dev *sdev = fpi_imgdev_get_user_data(dev); struct sonly_dev *sdev = FP_INSTANCE_DATA(FP_DEV(dev));
fpi_ssm *ssm = NULL; fpi_ssm *ssm = NULL;
int i; int i;
@ -1333,7 +1333,7 @@ static int dev_init(struct fp_img_dev *dev, unsigned long driver_data);
static void dev_deinit(struct fp_img_dev *dev) static void dev_deinit(struct fp_img_dev *dev)
{ {
void *user_data; void *user_data;
user_data = fpi_imgdev_get_user_data(dev); user_data = FP_INSTANCE_DATA(FP_DEV(dev));
g_free(user_data); g_free(user_data);
libusb_release_interface(fpi_imgdev_get_usb_dev(dev), 0); libusb_release_interface(fpi_imgdev_get_usb_dev(dev), 0);
fpi_imgdev_close_complete(dev); fpi_imgdev_close_complete(dev);
@ -1400,7 +1400,7 @@ static int dev_init(struct fp_img_dev *dev, unsigned long driver_data)
} }
sdev = g_malloc0(sizeof(struct sonly_dev)); sdev = g_malloc0(sizeof(struct sonly_dev));
fpi_imgdev_set_user_data(dev, sdev); fp_dev_set_instance_data(FP_DEV(dev), sdev);
sdev->dev_model = (int)driver_data; sdev->dev_model = (int)driver_data;
switch (driver_data) { switch (driver_data) {
case UPEKSONLY_1000: case UPEKSONLY_1000:

View file

@ -59,7 +59,7 @@ enum activate_states {
static void upektc_next_init_cmd(fpi_ssm *ssm) static void upektc_next_init_cmd(fpi_ssm *ssm)
{ {
struct fp_img_dev *dev = fpi_ssm_get_user_data(ssm); struct fp_img_dev *dev = fpi_ssm_get_user_data(ssm);
struct upektc_dev *upekdev = fpi_imgdev_get_user_data(dev); struct upektc_dev *upekdev = FP_INSTANCE_DATA(FP_DEV(dev));
upekdev->init_idx += 1; upekdev->init_idx += 1;
if (upekdev->init_idx == upekdev->setup_commands_len) if (upekdev->init_idx == upekdev->setup_commands_len)
@ -72,7 +72,7 @@ static void write_init_cb(struct libusb_transfer *transfer)
{ {
fpi_ssm *ssm = transfer->user_data; fpi_ssm *ssm = transfer->user_data;
struct fp_img_dev *dev = fpi_ssm_get_user_data(ssm); struct fp_img_dev *dev = fpi_ssm_get_user_data(ssm);
struct upektc_dev *upekdev = fpi_imgdev_get_user_data(dev); struct upektc_dev *upekdev = FP_INSTANCE_DATA(FP_DEV(dev));
if ((transfer->status == LIBUSB_TRANSFER_COMPLETED) && if ((transfer->status == LIBUSB_TRANSFER_COMPLETED) &&
(transfer->length == transfer->actual_length)) { (transfer->length == transfer->actual_length)) {
@ -101,7 +101,7 @@ static void read_init_data_cb(struct libusb_transfer *transfer)
static void activate_run_state(fpi_ssm *ssm) static void activate_run_state(fpi_ssm *ssm)
{ {
struct fp_img_dev *dev = fpi_ssm_get_user_data(ssm); struct fp_img_dev *dev = fpi_ssm_get_user_data(ssm);
struct upektc_dev *upekdev = fpi_imgdev_get_user_data(dev); struct upektc_dev *upekdev = FP_INSTANCE_DATA(FP_DEV(dev));
int r; int r;
switch (fpi_ssm_get_cur_state(ssm)) { switch (fpi_ssm_get_cur_state(ssm)) {
@ -181,7 +181,7 @@ static int finger_present(unsigned char *img, size_t len, int sum_threshold)
static void finger_det_data_cb(struct libusb_transfer *transfer) static void finger_det_data_cb(struct libusb_transfer *transfer)
{ {
struct fp_img_dev *dev = transfer->user_data; struct fp_img_dev *dev = transfer->user_data;
struct upektc_dev *upekdev = fpi_imgdev_get_user_data(dev); struct upektc_dev *upekdev = FP_INSTANCE_DATA(FP_DEV(dev));
unsigned char *data = transfer->buffer; unsigned char *data = transfer->buffer;
if (transfer->status != LIBUSB_TRANSFER_COMPLETED) { if (transfer->status != LIBUSB_TRANSFER_COMPLETED) {
@ -214,7 +214,7 @@ static void finger_det_cmd_cb(struct libusb_transfer *t)
unsigned char *data; unsigned char *data;
int r; int r;
struct fp_img_dev *dev = t->user_data; struct fp_img_dev *dev = t->user_data;
struct upektc_dev *upekdev = fpi_imgdev_get_user_data(dev); struct upektc_dev *upekdev = FP_INSTANCE_DATA(FP_DEV(dev));
if (t->status != LIBUSB_TRANSFER_COMPLETED) { if (t->status != LIBUSB_TRANSFER_COMPLETED) {
fp_dbg("req transfer status %d\n", t->status); fp_dbg("req transfer status %d\n", t->status);
@ -249,7 +249,7 @@ exit_free_transfer:
static void start_finger_detection(struct fp_img_dev *dev) static void start_finger_detection(struct fp_img_dev *dev)
{ {
int r; int r;
struct upektc_dev *upekdev = fpi_imgdev_get_user_data(dev); struct upektc_dev *upekdev = FP_INSTANCE_DATA(FP_DEV(dev));
struct libusb_transfer *transfer; struct libusb_transfer *transfer;
G_DEBUG_HERE(); G_DEBUG_HERE();
@ -324,7 +324,7 @@ out:
static void capture_run_state(fpi_ssm *ssm) static void capture_run_state(fpi_ssm *ssm)
{ {
struct fp_img_dev *dev = fpi_ssm_get_user_data(ssm); struct fp_img_dev *dev = fpi_ssm_get_user_data(ssm);
struct upektc_dev *upekdev = fpi_imgdev_get_user_data(dev); struct upektc_dev *upekdev = FP_INSTANCE_DATA(FP_DEV(dev));
int r; int r;
switch (fpi_ssm_get_cur_state(ssm)) { switch (fpi_ssm_get_cur_state(ssm)) {
@ -373,7 +373,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_img_dev *dev = fpi_ssm_get_user_data(ssm); struct fp_img_dev *dev = fpi_ssm_get_user_data(ssm);
struct upektc_dev *upekdev = fpi_imgdev_get_user_data(dev); struct upektc_dev *upekdev = FP_INSTANCE_DATA(FP_DEV(dev));
fp_dbg("Capture completed"); fp_dbg("Capture completed");
if (upekdev->deactivating) if (upekdev->deactivating)
@ -387,7 +387,7 @@ static void capture_sm_complete(fpi_ssm *ssm)
static void start_capture(struct fp_img_dev *dev) static void start_capture(struct fp_img_dev *dev)
{ {
struct upektc_dev *upekdev = fpi_imgdev_get_user_data(dev); struct upektc_dev *upekdev = FP_INSTANCE_DATA(FP_DEV(dev));
fpi_ssm *ssm; fpi_ssm *ssm;
if (upekdev->deactivating) { if (upekdev->deactivating) {
@ -403,7 +403,7 @@ static void start_capture(struct fp_img_dev *dev)
static int dev_activate(struct fp_img_dev *dev, enum fp_imgdev_state state) static int dev_activate(struct fp_img_dev *dev, enum fp_imgdev_state state)
{ {
struct upektc_dev *upekdev = fpi_imgdev_get_user_data(dev); struct upektc_dev *upekdev = FP_INSTANCE_DATA(FP_DEV(dev));
fpi_ssm *ssm = fpi_ssm_new(fpi_imgdev_get_dev(dev), activate_run_state, fpi_ssm *ssm = fpi_ssm_new(fpi_imgdev_get_dev(dev), activate_run_state,
ACTIVATE_NUM_STATES); ACTIVATE_NUM_STATES);
fpi_ssm_set_user_data(ssm, dev); fpi_ssm_set_user_data(ssm, dev);
@ -414,14 +414,14 @@ static int dev_activate(struct fp_img_dev *dev, enum fp_imgdev_state state)
static void dev_deactivate(struct fp_img_dev *dev) static void dev_deactivate(struct fp_img_dev *dev)
{ {
struct upektc_dev *upekdev = fpi_imgdev_get_user_data(dev); struct upektc_dev *upekdev = FP_INSTANCE_DATA(FP_DEV(dev));
upekdev->deactivating = TRUE; upekdev->deactivating = TRUE;
} }
static void complete_deactivation(struct fp_img_dev *dev) static void complete_deactivation(struct fp_img_dev *dev)
{ {
struct upektc_dev *upekdev = fpi_imgdev_get_user_data(dev); struct upektc_dev *upekdev = FP_INSTANCE_DATA(FP_DEV(dev));
G_DEBUG_HERE(); G_DEBUG_HERE();
upekdev->deactivating = FALSE; upekdev->deactivating = FALSE;
@ -441,7 +441,7 @@ static int dev_init(struct fp_img_dev *dev, unsigned long driver_data)
} }
upekdev = g_malloc0(sizeof(struct upektc_dev)); upekdev = g_malloc0(sizeof(struct upektc_dev));
fpi_imgdev_set_user_data(dev, upekdev); fp_dev_set_instance_data(FP_DEV(dev), upekdev);
switch (driver_data) { switch (driver_data) {
case UPEKTC_2015: case UPEKTC_2015:
upekdev->ep_in = UPEKTC_EP_IN; upekdev->ep_in = UPEKTC_EP_IN;
@ -460,7 +460,7 @@ static int dev_init(struct fp_img_dev *dev, unsigned long driver_data)
default: default:
fp_err("Device variant %lu is not known\n", driver_data); fp_err("Device variant %lu is not known\n", driver_data);
g_free(upekdev); g_free(upekdev);
fpi_imgdev_set_user_data(dev, NULL); fp_dev_set_instance_data(FP_DEV(dev), NULL);
return -ENODEV; return -ENODEV;
break; break;
} }
@ -471,7 +471,7 @@ static int dev_init(struct fp_img_dev *dev, unsigned long driver_data)
static void dev_deinit(struct fp_img_dev *dev) static void dev_deinit(struct fp_img_dev *dev)
{ {
void *user_data; void *user_data;
user_data = fpi_imgdev_get_user_data(dev); user_data = FP_INSTANCE_DATA(FP_DEV(dev));
g_free(user_data); g_free(user_data);
libusb_release_interface(fpi_imgdev_get_usb_dev(dev), 0); libusb_release_interface(fpi_imgdev_get_usb_dev(dev), 0);
fpi_imgdev_close_complete(dev); fpi_imgdev_close_complete(dev);

View file

@ -76,7 +76,7 @@ static void upektc_img_submit_req(fpi_ssm *ssm,
libusb_transfer_cb_fn cb) libusb_transfer_cb_fn cb)
{ {
struct fp_img_dev *dev = fpi_ssm_get_user_data(ssm); struct fp_img_dev *dev = fpi_ssm_get_user_data(ssm);
struct upektc_img_dev *upekdev = fpi_imgdev_get_user_data(dev); struct upektc_img_dev *upekdev = FP_INSTANCE_DATA(FP_DEV(dev));
struct libusb_transfer *transfer = libusb_alloc_transfer(0); struct libusb_transfer *transfer = libusb_alloc_transfer(0);
int r; int r;
@ -107,7 +107,7 @@ static void upektc_img_read_data(fpi_ssm *ssm, size_t buf_size, size_t buf_offse
{ {
struct libusb_transfer *transfer = libusb_alloc_transfer(0); struct libusb_transfer *transfer = libusb_alloc_transfer(0);
struct fp_img_dev *dev = fpi_ssm_get_user_data(ssm); struct fp_img_dev *dev = fpi_ssm_get_user_data(ssm);
struct upektc_img_dev *upekdev = fpi_imgdev_get_user_data(dev); struct upektc_img_dev *upekdev = FP_INSTANCE_DATA(FP_DEV(dev));
int r; int r;
if (!transfer) { if (!transfer) {
@ -183,7 +183,7 @@ static void capture_read_data_cb(struct libusb_transfer *transfer)
{ {
fpi_ssm *ssm = transfer->user_data; fpi_ssm *ssm = transfer->user_data;
struct fp_img_dev *dev = fpi_ssm_get_user_data(ssm); struct fp_img_dev *dev = fpi_ssm_get_user_data(ssm);
struct upektc_img_dev *upekdev = fpi_imgdev_get_user_data(dev); struct upektc_img_dev *upekdev = FP_INSTANCE_DATA(FP_DEV(dev));
unsigned char *data = upekdev->response; unsigned char *data = upekdev->response;
struct fp_img *img; struct fp_img *img;
size_t response_size; size_t response_size;
@ -307,7 +307,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_img_dev *dev = fpi_ssm_get_user_data(ssm); struct fp_img_dev *dev = fpi_ssm_get_user_data(ssm);
struct upektc_img_dev *upekdev = fpi_imgdev_get_user_data(dev); struct upektc_img_dev *upekdev = FP_INSTANCE_DATA(FP_DEV(dev));
switch (fpi_ssm_get_cur_state(ssm)) { switch (fpi_ssm_get_cur_state(ssm)) {
case CAPTURE_INIT_CAPTURE: case CAPTURE_INIT_CAPTURE:
@ -344,7 +344,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_img_dev *dev = fpi_ssm_get_user_data(ssm); struct fp_img_dev *dev = fpi_ssm_get_user_data(ssm);
struct upektc_img_dev *upekdev = fpi_imgdev_get_user_data(dev); struct upektc_img_dev *upekdev = FP_INSTANCE_DATA(FP_DEV(dev));
int err = fpi_ssm_get_error(ssm); int err = fpi_ssm_get_error(ssm);
fp_dbg("Capture completed, %d", err); fp_dbg("Capture completed, %d", err);
@ -360,7 +360,7 @@ static void capture_sm_complete(fpi_ssm *ssm)
static void start_capture(struct fp_img_dev *dev) static void start_capture(struct fp_img_dev *dev)
{ {
struct upektc_img_dev *upekdev = fpi_imgdev_get_user_data(dev); struct upektc_img_dev *upekdev = FP_INSTANCE_DATA(FP_DEV(dev));
fpi_ssm *ssm; fpi_ssm *ssm;
upekdev->image_size = 0; upekdev->image_size = 0;
@ -405,7 +405,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_img_dev *dev = fpi_ssm_get_user_data(ssm); struct fp_img_dev *dev = fpi_ssm_get_user_data(ssm);
struct upektc_img_dev *upekdev = fpi_imgdev_get_user_data(dev); struct upektc_img_dev *upekdev = FP_INSTANCE_DATA(FP_DEV(dev));
switch (fpi_ssm_get_cur_state(ssm)) { switch (fpi_ssm_get_cur_state(ssm)) {
case DEACTIVATE_DEINIT: case DEACTIVATE_DEINIT:
@ -422,7 +422,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_img_dev *dev = fpi_ssm_get_user_data(ssm); struct fp_img_dev *dev = fpi_ssm_get_user_data(ssm);
struct upektc_img_dev *upekdev = fpi_imgdev_get_user_data(dev); struct upektc_img_dev *upekdev = FP_INSTANCE_DATA(FP_DEV(dev));
int err = fpi_ssm_get_error(ssm); int err = fpi_ssm_get_error(ssm);
fp_dbg("Deactivate completed"); fp_dbg("Deactivate completed");
@ -439,7 +439,7 @@ static void deactivate_sm_complete(fpi_ssm *ssm)
static void start_deactivation(struct fp_img_dev *dev) static void start_deactivation(struct fp_img_dev *dev)
{ {
struct upektc_img_dev *upekdev = fpi_imgdev_get_user_data(dev); struct upektc_img_dev *upekdev = FP_INSTANCE_DATA(FP_DEV(dev));
fpi_ssm *ssm; fpi_ssm *ssm;
upekdev->image_size = 0; upekdev->image_size = 0;
@ -504,7 +504,7 @@ static void activate_run_state(fpi_ssm *ssm)
{ {
struct libusb_transfer *transfer; struct libusb_transfer *transfer;
struct fp_img_dev *idev = fpi_ssm_get_user_data(ssm); struct fp_img_dev *idev = fpi_ssm_get_user_data(ssm);
struct upektc_img_dev *upekdev = fpi_imgdev_get_user_data(idev); struct upektc_img_dev *upekdev = FP_INSTANCE_DATA(FP_DEV(idev));
struct fp_dev *dev = fpi_ssm_get_dev(ssm); struct fp_dev *dev = fpi_ssm_get_dev(ssm);
int r; int r;
@ -579,7 +579,7 @@ static void activate_sm_complete(fpi_ssm *ssm)
static int dev_activate(struct fp_img_dev *dev, enum fp_imgdev_state state) static int dev_activate(struct fp_img_dev *dev, enum fp_imgdev_state state)
{ {
struct upektc_img_dev *upekdev = fpi_imgdev_get_user_data(dev); struct upektc_img_dev *upekdev = FP_INSTANCE_DATA(FP_DEV(dev));
fpi_ssm *ssm = fpi_ssm_new(fpi_imgdev_get_dev(dev), activate_run_state, fpi_ssm *ssm = fpi_ssm_new(fpi_imgdev_get_dev(dev), activate_run_state,
ACTIVATE_NUM_STATES); ACTIVATE_NUM_STATES);
fpi_ssm_set_user_data(ssm, dev); fpi_ssm_set_user_data(ssm, dev);
@ -590,7 +590,7 @@ static int dev_activate(struct fp_img_dev *dev, enum fp_imgdev_state state)
static void dev_deactivate(struct fp_img_dev *dev) static void dev_deactivate(struct fp_img_dev *dev)
{ {
struct upektc_img_dev *upekdev = fpi_imgdev_get_user_data(dev); struct upektc_img_dev *upekdev = FP_INSTANCE_DATA(FP_DEV(dev));
upekdev->deactivating = TRUE; upekdev->deactivating = TRUE;
} }
@ -608,14 +608,14 @@ static int dev_init(struct fp_img_dev *dev, unsigned long driver_data)
} }
upekdev = g_malloc0(sizeof(struct upektc_img_dev)); upekdev = g_malloc0(sizeof(struct upektc_img_dev));
fpi_imgdev_set_user_data(dev, upekdev); fp_dev_set_instance_data(FP_DEV(dev), upekdev);
fpi_imgdev_open_complete(dev, 0); fpi_imgdev_open_complete(dev, 0);
return 0; return 0;
} }
static void dev_deinit(struct fp_img_dev *dev) static void dev_deinit(struct fp_img_dev *dev)
{ {
struct upektc_img_dev *upekdev = fpi_imgdev_get_user_data(dev); struct upektc_img_dev *upekdev = FP_INSTANCE_DATA(FP_DEV(dev));
g_free(upekdev); g_free(upekdev);
libusb_release_interface(fpi_imgdev_get_usb_dev(dev), 0); libusb_release_interface(fpi_imgdev_get_usb_dev(dev), 0);
fpi_imgdev_close_complete(dev); fpi_imgdev_close_complete(dev);

View file

@ -317,7 +317,7 @@ static void challenge_cb(struct fp_img_dev *dev, int status,
uint16_t num_regs, unsigned char *data, void *user_data) uint16_t num_regs, unsigned char *data, void *user_data)
{ {
fpi_ssm *ssm = user_data; fpi_ssm *ssm = user_data;
struct uru4k_dev *urudev = fpi_imgdev_get_user_data(dev); struct uru4k_dev *urudev = FP_INSTANCE_DATA(FP_DEV(dev));
unsigned char *respdata; unsigned char *respdata;
PK11Context *ctx; PK11Context *ctx;
int r, outlen; int r, outlen;
@ -374,7 +374,7 @@ static int start_irq_handler(struct fp_img_dev *dev);
static void irq_handler(struct libusb_transfer *transfer) static void irq_handler(struct libusb_transfer *transfer)
{ {
struct fp_img_dev *dev = transfer->user_data; struct fp_img_dev *dev = transfer->user_data;
struct uru4k_dev *urudev = fpi_imgdev_get_user_data(dev); struct uru4k_dev *urudev = FP_INSTANCE_DATA(FP_DEV(dev));
unsigned char *data = transfer->buffer; unsigned char *data = transfer->buffer;
uint16_t type; uint16_t type;
int r = 0; int r = 0;
@ -426,7 +426,7 @@ out:
static int start_irq_handler(struct fp_img_dev *dev) static int start_irq_handler(struct fp_img_dev *dev)
{ {
struct uru4k_dev *urudev = fpi_imgdev_get_user_data(dev); struct uru4k_dev *urudev = FP_INSTANCE_DATA(FP_DEV(dev));
struct libusb_transfer *transfer = libusb_alloc_transfer(0); struct libusb_transfer *transfer = libusb_alloc_transfer(0);
unsigned char *data; unsigned char *data;
int r; int r;
@ -450,7 +450,7 @@ static int start_irq_handler(struct fp_img_dev *dev)
static void stop_irq_handler(struct fp_img_dev *dev, irqs_stopped_cb_fn cb) static void stop_irq_handler(struct fp_img_dev *dev, irqs_stopped_cb_fn cb)
{ {
struct uru4k_dev *urudev = fpi_imgdev_get_user_data(dev); struct uru4k_dev *urudev = FP_INSTANCE_DATA(FP_DEV(dev));
struct libusb_transfer *transfer = urudev->irq_transfer; struct libusb_transfer *transfer = urudev->irq_transfer;
if (transfer) { if (transfer) {
libusb_cancel_transfer(transfer); libusb_cancel_transfer(transfer);
@ -484,7 +484,7 @@ static void change_state_write_reg_cb(struct fp_img_dev *dev, int status,
static int dev_change_state(struct fp_img_dev *dev, enum fp_imgdev_state state) static int dev_change_state(struct fp_img_dev *dev, enum fp_imgdev_state state)
{ {
struct uru4k_dev *urudev = fpi_imgdev_get_user_data(dev); struct uru4k_dev *urudev = FP_INSTANCE_DATA(FP_DEV(dev));
switch (state) { switch (state) {
case IMGDEV_STATE_INACTIVE: case IMGDEV_STATE_INACTIVE:
@ -535,7 +535,7 @@ static void sm_read_reg_cb(struct fp_img_dev *dev, int result,
uint16_t num_regs, unsigned char *data, void *user_data) uint16_t num_regs, unsigned char *data, void *user_data)
{ {
fpi_ssm *ssm = user_data; fpi_ssm *ssm = user_data;
struct uru4k_dev *urudev = fpi_imgdev_get_user_data(dev); struct uru4k_dev *urudev = FP_INSTANCE_DATA(FP_DEV(dev));
if (result) { if (result) {
fpi_ssm_mark_failed(ssm, result); fpi_ssm_mark_failed(ssm, result);
@ -549,7 +549,7 @@ static void sm_read_reg_cb(struct fp_img_dev *dev, int result,
static void sm_read_regs(fpi_ssm *ssm, uint16_t reg, uint16_t num_regs) static void sm_read_regs(fpi_ssm *ssm, uint16_t reg, uint16_t num_regs)
{ {
struct fp_img_dev *dev = fpi_ssm_get_user_data(ssm); struct fp_img_dev *dev = fpi_ssm_get_user_data(ssm);
struct uru4k_dev *urudev = fpi_imgdev_get_user_data(dev); struct uru4k_dev *urudev = FP_INSTANCE_DATA(FP_DEV(dev));
int r; int r;
if (num_regs > sizeof(urudev->last_reg_rd)) { if (num_regs > sizeof(urudev->last_reg_rd)) {
@ -690,7 +690,7 @@ static int calc_dev2(struct uru4k_image *img)
static void imaging_run_state(fpi_ssm *ssm) static void imaging_run_state(fpi_ssm *ssm)
{ {
struct fp_img_dev *dev = fpi_ssm_get_user_data(ssm); struct fp_img_dev *dev = fpi_ssm_get_user_data(ssm);
struct uru4k_dev *urudev = fpi_imgdev_get_user_data(dev); struct uru4k_dev *urudev = FP_INSTANCE_DATA(FP_DEV(dev));
struct uru4k_image *img = urudev->img_data; struct uru4k_image *img = urudev->img_data;
struct fp_img *fpimg; struct fp_img *fpimg;
uint32_t key; uint32_t key;
@ -813,7 +813,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_img_dev *dev = fpi_ssm_get_user_data(ssm); struct fp_img_dev *dev = fpi_ssm_get_user_data(ssm);
struct uru4k_dev *urudev = fpi_imgdev_get_user_data(dev); struct uru4k_dev *urudev = FP_INSTANCE_DATA(FP_DEV(dev));
int r = fpi_ssm_get_error(ssm); int r = fpi_ssm_get_error(ssm);
fpi_ssm_free(ssm); fpi_ssm_free(ssm);
@ -864,7 +864,7 @@ static void rebootpwr_pause_cb(void *data)
{ {
fpi_ssm *ssm = data; fpi_ssm *ssm = data;
struct fp_img_dev *dev = fpi_ssm_get_user_data(ssm); struct fp_img_dev *dev = fpi_ssm_get_user_data(ssm);
struct uru4k_dev *urudev = fpi_imgdev_get_user_data(dev); struct uru4k_dev *urudev = FP_INSTANCE_DATA(FP_DEV(dev));
if (!--urudev->rebootpwr_ctr) { if (!--urudev->rebootpwr_ctr) {
fp_err("could not reboot device power"); fp_err("could not reboot device power");
@ -877,7 +877,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_img_dev *dev = fpi_ssm_get_user_data(ssm); struct fp_img_dev *dev = fpi_ssm_get_user_data(ssm);
struct uru4k_dev *urudev = fpi_imgdev_get_user_data(dev); struct uru4k_dev *urudev = FP_INSTANCE_DATA(FP_DEV(dev));
switch (fpi_ssm_get_cur_state(ssm)) { switch (fpi_ssm_get_cur_state(ssm)) {
case REBOOTPWR_SET_HWSTAT: case REBOOTPWR_SET_HWSTAT:
@ -941,7 +941,7 @@ static void powerup_pause_cb(void *data)
{ {
fpi_ssm *ssm = data; fpi_ssm *ssm = data;
struct fp_img_dev *dev = fpi_ssm_get_user_data(ssm); struct fp_img_dev *dev = fpi_ssm_get_user_data(ssm);
struct uru4k_dev *urudev = fpi_imgdev_get_user_data(dev); struct uru4k_dev *urudev = FP_INSTANCE_DATA(FP_DEV(dev));
if (!--urudev->powerup_ctr) { if (!--urudev->powerup_ctr) {
fp_err("could not power device up"); fp_err("could not power device up");
@ -956,7 +956,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_img_dev *dev = fpi_ssm_get_user_data(ssm); struct fp_img_dev *dev = fpi_ssm_get_user_data(ssm);
struct uru4k_dev *urudev = fpi_imgdev_get_user_data(dev); struct uru4k_dev *urudev = FP_INSTANCE_DATA(FP_DEV(dev));
switch (fpi_ssm_get_cur_state(ssm)) { switch (fpi_ssm_get_cur_state(ssm)) {
case POWERUP_INIT: case POWERUP_INIT:
@ -1025,7 +1025,7 @@ static void init_scanpwr_irq_cb(struct fp_img_dev *dev, int status,
uint16_t type, void *user_data) uint16_t type, void *user_data)
{ {
fpi_ssm *ssm = user_data; fpi_ssm *ssm = user_data;
struct uru4k_dev *urudev = fpi_imgdev_get_user_data(dev); struct uru4k_dev *urudev = FP_INSTANCE_DATA(FP_DEV(dev));
if (status) if (status)
fpi_ssm_mark_failed(ssm, status); fpi_ssm_mark_failed(ssm, status);
@ -1044,7 +1044,7 @@ static void init_scanpwr_timeout(void *user_data)
{ {
fpi_ssm *ssm = user_data; fpi_ssm *ssm = user_data;
struct fp_img_dev *dev = fpi_ssm_get_user_data(ssm); struct fp_img_dev *dev = fpi_ssm_get_user_data(ssm);
struct uru4k_dev *urudev = fpi_imgdev_get_user_data(dev); struct uru4k_dev *urudev = FP_INSTANCE_DATA(FP_DEV(dev));
fp_warn("powerup timed out"); fp_warn("powerup timed out");
urudev->irq_cb = NULL; urudev->irq_cb = NULL;
@ -1061,7 +1061,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_img_dev *dev = fpi_ssm_get_user_data(ssm); struct fp_img_dev *dev = fpi_ssm_get_user_data(ssm);
struct uru4k_dev *urudev = fpi_imgdev_get_user_data(dev); struct uru4k_dev *urudev = FP_INSTANCE_DATA(FP_DEV(dev));
switch (fpi_ssm_get_cur_state(ssm)) { switch (fpi_ssm_get_cur_state(ssm)) {
case INIT_GET_HWSTAT: case INIT_GET_HWSTAT:
@ -1159,7 +1159,7 @@ static void activate_initsm_complete(fpi_ssm *ssm)
* call. */ * call. */
static int dev_activate(struct fp_img_dev *dev, enum fp_imgdev_state state) static int dev_activate(struct fp_img_dev *dev, enum fp_imgdev_state state)
{ {
struct uru4k_dev *urudev = fpi_imgdev_get_user_data(dev); struct uru4k_dev *urudev = FP_INSTANCE_DATA(FP_DEV(dev));
fpi_ssm *ssm; fpi_ssm *ssm;
int r; int r;
@ -1195,7 +1195,7 @@ static void dev_deactivate(struct fp_img_dev *dev)
static int execute_state_change(struct fp_img_dev *dev) static int execute_state_change(struct fp_img_dev *dev)
{ {
struct uru4k_dev *urudev = fpi_imgdev_get_user_data(dev); struct uru4k_dev *urudev = FP_INSTANCE_DATA(FP_DEV(dev));
fpi_ssm *ssm; fpi_ssm *ssm;
switch (urudev->activate_state) { switch (urudev->activate_state) {
@ -1351,7 +1351,7 @@ static int dev_init(struct fp_img_dev *dev, unsigned long driver_data)
} }
urudev->param = PK11_ParamFromIV(urudev->cipher, NULL); urudev->param = PK11_ParamFromIV(urudev->cipher, NULL);
fpi_imgdev_set_user_data(dev, urudev); fp_dev_set_instance_data(FP_DEV(dev), urudev);
fpi_imgdev_open_complete(dev, 0); fpi_imgdev_open_complete(dev, 0);
out: out:
@ -1361,7 +1361,7 @@ out:
static void dev_deinit(struct fp_img_dev *dev) static void dev_deinit(struct fp_img_dev *dev)
{ {
struct uru4k_dev *urudev = fpi_imgdev_get_user_data(dev); struct uru4k_dev *urudev = FP_INSTANCE_DATA(FP_DEV(dev));
if (urudev->symkey) if (urudev->symkey)
PK11_FreeSymKey (urudev->symkey); PK11_FreeSymKey (urudev->symkey);
if (urudev->param) if (urudev->param)

View file

@ -193,7 +193,7 @@ static void capture_cb(struct libusb_transfer *transfer)
{ {
fpi_ssm *ssm = transfer->user_data; fpi_ssm *ssm = transfer->user_data;
struct fp_img_dev *dev = fpi_ssm_get_user_data(ssm); struct fp_img_dev *dev = fpi_ssm_get_user_data(ssm);
struct v5s_dev *vdev = fpi_imgdev_get_user_data(dev); struct v5s_dev *vdev = FP_INSTANCE_DATA(FP_DEV(dev));
if (transfer->status != LIBUSB_TRANSFER_COMPLETED) { if (transfer->status != LIBUSB_TRANSFER_COMPLETED) {
fpi_ssm_mark_failed(ssm, -EIO); fpi_ssm_mark_failed(ssm, -EIO);
@ -221,7 +221,7 @@ out:
static void capture_iterate(fpi_ssm *ssm) static void capture_iterate(fpi_ssm *ssm)
{ {
struct fp_img_dev *dev = fpi_ssm_get_user_data(ssm); struct fp_img_dev *dev = fpi_ssm_get_user_data(ssm);
struct v5s_dev *vdev = fpi_imgdev_get_user_data(dev); struct v5s_dev *vdev = FP_INSTANCE_DATA(FP_DEV(dev));
int iteration = vdev->capture_iteration; int iteration = vdev->capture_iteration;
struct libusb_transfer *transfer = libusb_alloc_transfer(0); struct libusb_transfer *transfer = libusb_alloc_transfer(0);
int r; int r;
@ -246,7 +246,7 @@ static void capture_iterate(fpi_ssm *ssm)
static void sm_do_capture(fpi_ssm *ssm) static void sm_do_capture(fpi_ssm *ssm)
{ {
struct fp_img_dev *dev = fpi_ssm_get_user_data(ssm); struct fp_img_dev *dev = fpi_ssm_get_user_data(ssm);
struct v5s_dev *vdev = fpi_imgdev_get_user_data(dev); struct v5s_dev *vdev = FP_INSTANCE_DATA(FP_DEV(dev));
G_DEBUG_HERE(); G_DEBUG_HERE();
vdev->capture_img = fpi_img_new_for_imgdev(dev); vdev->capture_img = fpi_img_new_for_imgdev(dev);
@ -268,7 +268,7 @@ enum loop_states {
static void loop_run_state(fpi_ssm *ssm) static void loop_run_state(fpi_ssm *ssm)
{ {
struct fp_img_dev *dev = fpi_ssm_get_user_data(ssm); struct fp_img_dev *dev = fpi_ssm_get_user_data(ssm);
struct v5s_dev *vdev = fpi_imgdev_get_user_data(dev); struct v5s_dev *vdev = FP_INSTANCE_DATA(FP_DEV(dev));
switch (fpi_ssm_get_cur_state(ssm)) { switch (fpi_ssm_get_cur_state(ssm)) {
case LOOP_SET_CONTRAST: case LOOP_SET_CONTRAST:
@ -296,7 +296,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_img_dev *dev = fpi_ssm_get_user_data(ssm); struct fp_img_dev *dev = fpi_ssm_get_user_data(ssm);
struct v5s_dev *vdev = fpi_imgdev_get_user_data(dev); struct v5s_dev *vdev = FP_INSTANCE_DATA(FP_DEV(dev));
int r = fpi_ssm_get_error(ssm); int r = fpi_ssm_get_error(ssm);
fpi_ssm_free(ssm); fpi_ssm_free(ssm);
@ -313,7 +313,7 @@ static void loopsm_complete(fpi_ssm *ssm)
static int dev_activate(struct fp_img_dev *dev, enum fp_imgdev_state state) static int dev_activate(struct fp_img_dev *dev, enum fp_imgdev_state state)
{ {
struct v5s_dev *vdev = fpi_imgdev_get_user_data(dev); struct v5s_dev *vdev = FP_INSTANCE_DATA(FP_DEV(dev));
fpi_ssm *ssm = fpi_ssm_new(fpi_imgdev_get_dev(dev), loop_run_state, fpi_ssm *ssm = fpi_ssm_new(fpi_imgdev_get_dev(dev), loop_run_state,
LOOP_NUM_STATES); LOOP_NUM_STATES);
fpi_ssm_set_user_data(ssm, dev); fpi_ssm_set_user_data(ssm, dev);
@ -326,7 +326,7 @@ static int dev_activate(struct fp_img_dev *dev, enum fp_imgdev_state state)
static void dev_deactivate(struct fp_img_dev *dev) static void dev_deactivate(struct fp_img_dev *dev)
{ {
struct v5s_dev *vdev = fpi_imgdev_get_user_data(dev); struct v5s_dev *vdev = FP_INSTANCE_DATA(FP_DEV(dev));
if (vdev->loop_running) if (vdev->loop_running)
vdev->deactivating = TRUE; vdev->deactivating = TRUE;
else else
@ -339,7 +339,7 @@ static int dev_init(struct fp_img_dev *dev, unsigned long driver_data)
struct v5s_dev *v5s_dev; struct v5s_dev *v5s_dev;
v5s_dev = g_malloc0(sizeof(struct v5s_dev)); v5s_dev = g_malloc0(sizeof(struct v5s_dev));
fpi_imgdev_set_user_data(dev, v5s_dev); fp_dev_set_instance_data(FP_DEV(dev), v5s_dev);
r = libusb_claim_interface(fpi_imgdev_get_usb_dev(dev), 0); r = libusb_claim_interface(fpi_imgdev_get_usb_dev(dev), 0);
if (r < 0) if (r < 0)
@ -354,7 +354,7 @@ static int dev_init(struct fp_img_dev *dev, unsigned long driver_data)
static void dev_deinit(struct fp_img_dev *dev) static void dev_deinit(struct fp_img_dev *dev)
{ {
struct v5s_dev *v5s_dev; struct v5s_dev *v5s_dev;
v5s_dev = fpi_imgdev_get_user_data(dev); v5s_dev = FP_INSTANCE_DATA(FP_DEV(dev));
g_free(v5s_dev); g_free(v5s_dev);
libusb_release_interface(fpi_imgdev_get_usb_dev(dev), 0); libusb_release_interface(fpi_imgdev_get_usb_dev(dev), 0);
fpi_imgdev_close_complete(dev); fpi_imgdev_close_complete(dev);

View file

@ -55,7 +55,7 @@ static void async_write(fpi_ssm *ssm, void *data, int len)
{ {
struct fp_img_dev *idev = fpi_ssm_get_user_data(ssm); struct fp_img_dev *idev = fpi_ssm_get_user_data(ssm);
struct libusb_device_handle *usb_dev = fpi_imgdev_get_usb_dev(idev); struct libusb_device_handle *usb_dev = fpi_imgdev_get_usb_dev(idev);
struct vfs_dev_t *vdev = fpi_imgdev_get_user_data(idev); struct vfs_dev_t *vdev = FP_INSTANCE_DATA(FP_DEV(idev));
vdev->transfer = libusb_alloc_transfer(0); vdev->transfer = libusb_alloc_transfer(0);
vdev->transfer->flags |= LIBUSB_TRANSFER_FREE_TRANSFER; vdev->transfer->flags |= LIBUSB_TRANSFER_FREE_TRANSFER;
@ -97,7 +97,7 @@ static void async_read(fpi_ssm *ssm, int ep, void *data, int len)
{ {
struct fp_img_dev *idev = fpi_ssm_get_user_data(ssm); struct fp_img_dev *idev = fpi_ssm_get_user_data(ssm);
struct libusb_device_handle *usb_dev = fpi_imgdev_get_usb_dev(idev); struct libusb_device_handle *usb_dev = fpi_imgdev_get_usb_dev(idev);
struct vfs_dev_t *vdev = fpi_imgdev_get_user_data(idev); struct vfs_dev_t *vdev = FP_INSTANCE_DATA(FP_DEV(idev));
ep |= LIBUSB_ENDPOINT_IN; ep |= LIBUSB_ENDPOINT_IN;
@ -151,7 +151,7 @@ static void async_abort(fpi_ssm *ssm, int ep)
{ {
struct fp_img_dev *idev = fpi_ssm_get_user_data(ssm); struct fp_img_dev *idev = fpi_ssm_get_user_data(ssm);
struct libusb_device_handle *usb_dev = fpi_imgdev_get_usb_dev(idev); struct libusb_device_handle *usb_dev = fpi_imgdev_get_usb_dev(idev);
struct vfs_dev_t *vdev = fpi_imgdev_get_user_data(idev); struct vfs_dev_t *vdev = FP_INSTANCE_DATA(FP_DEV(idev));
int len = VFS_USB_BUFFER_SIZE; int len = VFS_USB_BUFFER_SIZE;
unsigned char *data = g_malloc(VFS_USB_BUFFER_SIZE); unsigned char *data = g_malloc(VFS_USB_BUFFER_SIZE);
@ -259,7 +259,7 @@ static struct fp_img *prepare_image(struct vfs_dev_t *vdev)
/* Processes and submits image after fingerprint received */ /* Processes and submits image after fingerprint received */
static void submit_image(struct fp_img_dev *idev) static void submit_image(struct fp_img_dev *idev)
{ {
struct vfs_dev_t *vdev = fpi_imgdev_get_user_data(idev); struct vfs_dev_t *vdev = FP_INSTANCE_DATA(FP_DEV(idev));
/* We were not asked to submit image actually */ /* We were not asked to submit image actually */
if (!vdev->active) if (!vdev->active)
@ -320,7 +320,7 @@ static void clear_ep2(fpi_ssm *ssm)
static void send_control_packet_ssm(fpi_ssm *ssm) static void send_control_packet_ssm(fpi_ssm *ssm)
{ {
struct fp_img_dev *idev = fpi_ssm_get_user_data(ssm); struct fp_img_dev *idev = fpi_ssm_get_user_data(ssm);
struct vfs_dev_t *vdev = fpi_imgdev_get_user_data(idev); struct vfs_dev_t *vdev = FP_INSTANCE_DATA(FP_DEV(idev));
short result; short result;
unsigned char *commit_result = NULL; unsigned char *commit_result = NULL;
@ -408,7 +408,7 @@ static void interrupt_callback(struct libusb_transfer *transfer)
{ {
fpi_ssm *ssm = transfer->user_data; fpi_ssm *ssm = transfer->user_data;
struct fp_img_dev *idev = fpi_ssm_get_user_data(ssm); struct fp_img_dev *idev = fpi_ssm_get_user_data(ssm);
struct vfs_dev_t *vdev = fpi_imgdev_get_user_data(idev); struct vfs_dev_t *vdev = FP_INSTANCE_DATA(FP_DEV(idev));
char *interrupt = vdev->interrupt; char *interrupt = vdev->interrupt;
int error = transfer->status, transferred = transfer->actual_length; int error = transfer->status, transferred = transfer->actual_length;
@ -468,7 +468,7 @@ static void receive_callback(struct libusb_transfer *transfer)
{ {
fpi_ssm *ssm = transfer->user_data; fpi_ssm *ssm = transfer->user_data;
struct fp_img_dev *idev = fpi_ssm_get_user_data(ssm); struct fp_img_dev *idev = fpi_ssm_get_user_data(ssm);
struct vfs_dev_t *vdev = fpi_imgdev_get_user_data(idev); struct vfs_dev_t *vdev = FP_INSTANCE_DATA(FP_DEV(idev));
int transferred = transfer->actual_length, error = transfer->status; int transferred = transfer->actual_length, error = transfer->status;
@ -496,7 +496,7 @@ static void wait_interrupt(void *data)
{ {
fpi_ssm *ssm = data; fpi_ssm *ssm = data;
struct fp_img_dev *idev = fpi_ssm_get_user_data(ssm); struct fp_img_dev *idev = fpi_ssm_get_user_data(ssm);
struct vfs_dev_t *vdev = fpi_imgdev_get_user_data(idev); struct vfs_dev_t *vdev = FP_INSTANCE_DATA(FP_DEV(idev));
/* Keep sleeping while this flag is on */ /* Keep sleeping while this flag is on */
if (vdev->wait_interrupt) if (vdev->wait_interrupt)
@ -522,7 +522,7 @@ static void activate_ssm(fpi_ssm *ssm)
{ {
struct fp_img_dev *idev = fpi_ssm_get_user_data(ssm); struct fp_img_dev *idev = fpi_ssm_get_user_data(ssm);
struct libusb_device_handle *usb_dev = fpi_imgdev_get_usb_dev(idev); struct libusb_device_handle *usb_dev = fpi_imgdev_get_usb_dev(idev);
struct vfs_dev_t *vdev = fpi_imgdev_get_user_data(idev); struct vfs_dev_t *vdev = FP_INSTANCE_DATA(FP_DEV(idev));
switch (fpi_ssm_get_cur_state(ssm)) { switch (fpi_ssm_get_cur_state(ssm)) {
case SSM_INITIAL_ABORT_1: case SSM_INITIAL_ABORT_1:
@ -674,7 +674,7 @@ static void activate_ssm(fpi_ssm *ssm)
static void dev_activate_callback(fpi_ssm *ssm) static void dev_activate_callback(fpi_ssm *ssm)
{ {
struct fp_img_dev *idev = fpi_ssm_get_user_data(ssm); struct fp_img_dev *idev = fpi_ssm_get_user_data(ssm);
struct vfs_dev_t *vdev = fpi_imgdev_get_user_data(idev); struct vfs_dev_t *vdev = FP_INSTANCE_DATA(FP_DEV(idev));
vdev->ssm_active = 0; vdev->ssm_active = 0;
@ -684,7 +684,7 @@ static void dev_activate_callback(fpi_ssm *ssm)
/* Activate device */ /* 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, enum fp_imgdev_state state)
{ {
struct vfs_dev_t *vdev = fpi_imgdev_get_user_data(idev); struct vfs_dev_t *vdev = FP_INSTANCE_DATA(FP_DEV(idev));
/* Initialize flags */ /* Initialize flags */
vdev->active = 1; vdev->active = 1;
@ -700,7 +700,7 @@ static int dev_activate(struct fp_img_dev *idev, enum fp_imgdev_state state)
/* Deactivate device */ /* Deactivate device */
static void dev_deactivate(struct fp_img_dev *idev) static void dev_deactivate(struct fp_img_dev *idev)
{ {
struct vfs_dev_t *vdev = fpi_imgdev_get_user_data(idev); struct vfs_dev_t *vdev = FP_INSTANCE_DATA(FP_DEV(idev));
if (!vdev->ssm_active) { if (!vdev->ssm_active) {
fpi_imgdev_deactivate_complete(idev); fpi_imgdev_deactivate_complete(idev);
@ -735,7 +735,7 @@ static int dev_open(struct fp_img_dev *idev, unsigned long driver_data)
/* Initialize private structure */ /* Initialize private structure */
vdev = g_malloc0(sizeof(struct vfs_dev_t)); vdev = g_malloc0(sizeof(struct vfs_dev_t));
fpi_imgdev_set_user_data(idev, vdev); fp_dev_set_instance_data(FP_DEV(idev), vdev);
/* Clearing previous device state */ /* Clearing previous device state */
fpi_ssm *ssm = fpi_ssm_new(fpi_imgdev_get_dev(idev), activate_ssm, SSM_STATES); fpi_ssm *ssm = fpi_ssm_new(fpi_imgdev_get_dev(idev), activate_ssm, SSM_STATES);
@ -750,7 +750,7 @@ static void dev_close(struct fp_img_dev *idev)
struct vfs_dev_t *vdev; struct vfs_dev_t *vdev;
/* Release private structure */ /* Release private structure */
vdev = fpi_imgdev_get_user_data(idev); vdev = FP_INSTANCE_DATA(FP_DEV(idev));
g_free(vdev); g_free(vdev);
/* Release usb interface */ /* Release usb interface */

View file

@ -201,7 +201,7 @@ static void async_send_cb(struct libusb_transfer *transfer)
{ {
fpi_ssm *ssm = transfer->user_data; fpi_ssm *ssm = transfer->user_data;
struct fp_img_dev *dev = fpi_ssm_get_user_data(ssm); struct fp_img_dev *dev = fpi_ssm_get_user_data(ssm);
struct vfs101_dev *vdev = fpi_imgdev_get_user_data(dev); struct vfs101_dev *vdev = FP_INSTANCE_DATA(FP_DEV(dev));
/* Cleanup transfer */ /* Cleanup transfer */
vdev->transfer = NULL; vdev->transfer = NULL;
@ -245,7 +245,7 @@ out:
static void async_send(fpi_ssm *ssm) static void async_send(fpi_ssm *ssm)
{ {
struct fp_img_dev *dev = fpi_ssm_get_user_data(ssm); struct fp_img_dev *dev = fpi_ssm_get_user_data(ssm);
struct vfs101_dev *vdev = fpi_imgdev_get_user_data(dev); struct vfs101_dev *vdev = FP_INSTANCE_DATA(FP_DEV(dev));
int r; int r;
/* Allocation of transfer */ /* Allocation of transfer */
@ -285,7 +285,7 @@ static void async_recv_cb(struct libusb_transfer *transfer)
{ {
fpi_ssm *ssm = transfer->user_data; fpi_ssm *ssm = transfer->user_data;
struct fp_img_dev *dev = fpi_ssm_get_user_data(ssm); struct fp_img_dev *dev = fpi_ssm_get_user_data(ssm);
struct vfs101_dev *vdev = fpi_imgdev_get_user_data(dev); struct vfs101_dev *vdev = FP_INSTANCE_DATA(FP_DEV(dev));
/* Cleanup transfer */ /* Cleanup transfer */
vdev->transfer = NULL; vdev->transfer = NULL;
@ -332,7 +332,7 @@ out:
static void async_recv(fpi_ssm *ssm) static void async_recv(fpi_ssm *ssm)
{ {
struct fp_img_dev *dev = fpi_ssm_get_user_data(ssm); struct fp_img_dev *dev = fpi_ssm_get_user_data(ssm);
struct vfs101_dev *vdev = fpi_imgdev_get_user_data(dev); struct vfs101_dev *vdev = FP_INSTANCE_DATA(FP_DEV(dev));
int r; int r;
/* Allocation of transfer */ /* Allocation of transfer */
@ -369,7 +369,7 @@ static void async_load_cb(struct libusb_transfer *transfer)
{ {
fpi_ssm *ssm = transfer->user_data; fpi_ssm *ssm = transfer->user_data;
struct fp_img_dev *dev = fpi_ssm_get_user_data(ssm); struct fp_img_dev *dev = fpi_ssm_get_user_data(ssm);
struct vfs101_dev *vdev = fpi_imgdev_get_user_data(dev); struct vfs101_dev *vdev = FP_INSTANCE_DATA(FP_DEV(dev));
/* Cleanup transfer */ /* Cleanup transfer */
vdev->transfer = NULL; vdev->transfer = NULL;
@ -433,7 +433,7 @@ out:
static void async_load(fpi_ssm *ssm) static void async_load(fpi_ssm *ssm)
{ {
struct fp_img_dev *dev = fpi_ssm_get_user_data(ssm); struct fp_img_dev *dev = fpi_ssm_get_user_data(ssm);
struct vfs101_dev *vdev = fpi_imgdev_get_user_data(dev); struct vfs101_dev *vdev = FP_INSTANCE_DATA(FP_DEV(dev));
unsigned char *buffer; unsigned char *buffer;
int r; int r;
@ -472,7 +472,7 @@ static void async_sleep_cb(void *data)
{ {
fpi_ssm *ssm = data; fpi_ssm *ssm = data;
struct fp_img_dev *dev = fpi_ssm_get_user_data(ssm); struct fp_img_dev *dev = fpi_ssm_get_user_data(ssm);
struct vfs101_dev *vdev = fpi_imgdev_get_user_data(dev); struct vfs101_dev *vdev = FP_INSTANCE_DATA(FP_DEV(dev));
/* Cleanup timeout */ /* Cleanup timeout */
vdev->timeout = NULL; vdev->timeout = NULL;
@ -484,7 +484,7 @@ static void async_sleep_cb(void *data)
static void async_sleep(unsigned int msec, fpi_ssm *ssm) static void async_sleep(unsigned int msec, fpi_ssm *ssm)
{ {
struct fp_img_dev *dev = fpi_ssm_get_user_data(ssm); struct fp_img_dev *dev = fpi_ssm_get_user_data(ssm);
struct vfs101_dev *vdev = fpi_imgdev_get_user_data(dev); struct vfs101_dev *vdev = FP_INSTANCE_DATA(FP_DEV(dev));
/* Add timeout */ /* Add timeout */
vdev->timeout = fpi_timeout_add(msec, async_sleep_cb, ssm); vdev->timeout = fpi_timeout_add(msec, async_sleep_cb, ssm);
@ -527,7 +527,7 @@ static void m_swap_state(fpi_ssm *ssm)
static void m_swap(fpi_ssm *ssm, unsigned char *data, size_t length) static void m_swap(fpi_ssm *ssm, unsigned char *data, size_t length)
{ {
struct fp_img_dev *dev = fpi_ssm_get_user_data(ssm); struct fp_img_dev *dev = fpi_ssm_get_user_data(ssm);
struct vfs101_dev *vdev = fpi_imgdev_get_user_data(dev); struct vfs101_dev *vdev = FP_INSTANCE_DATA(FP_DEV(dev));
fpi_ssm *subsm; fpi_ssm *subsm;
/* Prepare data for sending */ /* Prepare data for sending */
@ -626,7 +626,7 @@ static void vfs_get_finger_state(fpi_ssm *ssm)
static void vfs_img_load(fpi_ssm *ssm) static void vfs_img_load(fpi_ssm *ssm)
{ {
struct fp_img_dev *dev = fpi_ssm_get_user_data(ssm); struct fp_img_dev *dev = fpi_ssm_get_user_data(ssm);
struct vfs101_dev *vdev = fpi_imgdev_get_user_data(dev); struct vfs101_dev *vdev = FP_INSTANCE_DATA(FP_DEV(dev));
G_DEBUG_HERE(); G_DEBUG_HERE();
@ -644,7 +644,7 @@ static void vfs_img_load(fpi_ssm *ssm)
/* Check if action is completed */ /* Check if action is completed */
static int action_completed(struct fp_img_dev *dev) static int action_completed(struct fp_img_dev *dev)
{ {
struct vfs101_dev *vdev = fpi_imgdev_get_user_data(dev); struct vfs101_dev *vdev = FP_INSTANCE_DATA(FP_DEV(dev));
if ((fpi_imgdev_get_action(dev) == IMG_ACTION_ENROLL) && if ((fpi_imgdev_get_action(dev) == IMG_ACTION_ENROLL) &&
(vdev->enroll_stage < fpi_dev_get_nr_enroll_stages(fpi_imgdev_get_dev(dev)))) (vdev->enroll_stage < fpi_dev_get_nr_enroll_stages(fpi_imgdev_get_dev(dev))))
@ -757,7 +757,7 @@ static void img_copy(struct vfs101_dev *vdev, struct fp_img *img)
static void img_extract(fpi_ssm *ssm) static void img_extract(fpi_ssm *ssm)
{ {
struct fp_img_dev *dev = fpi_ssm_get_user_data(ssm); struct fp_img_dev *dev = fpi_ssm_get_user_data(ssm);
struct vfs101_dev *vdev = fpi_imgdev_get_user_data(dev); struct vfs101_dev *vdev = FP_INSTANCE_DATA(FP_DEV(dev));
struct fp_img *img; struct fp_img *img;
/* Screen image to remove noise and find top and bottom line */ /* Screen image to remove noise and find top and bottom line */
@ -915,7 +915,7 @@ enum
static void m_loop_state(fpi_ssm *ssm) static void m_loop_state(fpi_ssm *ssm)
{ {
struct fp_img_dev *dev = fpi_ssm_get_user_data(ssm); struct fp_img_dev *dev = fpi_ssm_get_user_data(ssm);
struct vfs101_dev *vdev = fpi_imgdev_get_user_data(dev); struct vfs101_dev *vdev = FP_INSTANCE_DATA(FP_DEV(dev));
/* Check action state */ /* Check action state */
if (!vdev->active) if (!vdev->active)
@ -1179,7 +1179,7 @@ enum
static void m_init_state(fpi_ssm *ssm) static void m_init_state(fpi_ssm *ssm)
{ {
struct fp_img_dev *dev = fpi_ssm_get_user_data(ssm); struct fp_img_dev *dev = fpi_ssm_get_user_data(ssm);
struct vfs101_dev *vdev = fpi_imgdev_get_user_data(dev); struct vfs101_dev *vdev = FP_INSTANCE_DATA(FP_DEV(dev));
/* Check action state */ /* Check action state */
if (!vdev->active) if (!vdev->active)
@ -1420,7 +1420,7 @@ static void m_init_state(fpi_ssm *ssm)
static void m_init_complete(fpi_ssm *ssm) static void m_init_complete(fpi_ssm *ssm)
{ {
struct fp_img_dev *dev = fpi_ssm_get_user_data(ssm); struct fp_img_dev *dev = fpi_ssm_get_user_data(ssm);
struct vfs101_dev *vdev = fpi_imgdev_get_user_data(dev); struct vfs101_dev *vdev = FP_INSTANCE_DATA(FP_DEV(dev));
fpi_ssm *ssm_loop; fpi_ssm *ssm_loop;
if (!fpi_ssm_get_error(ssm) && vdev->active) if (!fpi_ssm_get_error(ssm) && vdev->active)
@ -1441,7 +1441,7 @@ static void m_init_complete(fpi_ssm *ssm)
/* Activate device */ /* 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, enum fp_imgdev_state state)
{ {
struct vfs101_dev *vdev = fpi_imgdev_get_user_data(dev); struct vfs101_dev *vdev = FP_INSTANCE_DATA(FP_DEV(dev));
fpi_ssm *ssm; fpi_ssm *ssm;
/* Check if already active */ /* Check if already active */
@ -1474,7 +1474,7 @@ static int dev_activate(struct fp_img_dev *dev, enum fp_imgdev_state state)
/* Deactivate device */ /* Deactivate device */
static void dev_deactivate(struct fp_img_dev *dev) static void dev_deactivate(struct fp_img_dev *dev)
{ {
struct vfs101_dev *vdev = fpi_imgdev_get_user_data(dev); struct vfs101_dev *vdev = FP_INSTANCE_DATA(FP_DEV(dev));
/* Reset active state */ /* Reset active state */
vdev->active = FALSE; vdev->active = FALSE;
@ -1505,7 +1505,7 @@ static int dev_open(struct fp_img_dev *dev, unsigned long driver_data)
/* Initialize private structure */ /* Initialize private structure */
vdev = g_malloc0(sizeof(struct vfs101_dev)); vdev = g_malloc0(sizeof(struct vfs101_dev));
vdev->seqnum = -1; vdev->seqnum = -1;
fpi_imgdev_set_user_data(dev, vdev); fp_dev_set_instance_data(FP_DEV(dev), vdev);
/* Notify open complete */ /* Notify open complete */
fpi_imgdev_open_complete(dev, 0); fpi_imgdev_open_complete(dev, 0);
@ -1519,7 +1519,7 @@ static void dev_close(struct fp_img_dev *dev)
struct vfs101_dev *vdev; struct vfs101_dev *vdev;
/* Release private structure */ /* Release private structure */
vdev = fpi_imgdev_get_user_data(dev); vdev = FP_INSTANCE_DATA(FP_DEV(dev));
g_free(vdev); g_free(vdev);
/* Release usb interface */ /* Release usb interface */

View file

@ -54,7 +54,7 @@ static void async_sleep(unsigned int msec, fpi_ssm *ssm)
static int submit_image(fpi_ssm *ssm) static int submit_image(fpi_ssm *ssm)
{ {
struct fp_img_dev *dev = fpi_ssm_get_user_data(ssm); struct fp_img_dev *dev = fpi_ssm_get_user_data(ssm);
vfs301_dev_t *vdev = fpi_imgdev_get_user_data(dev); vfs301_dev_t *vdev = FP_INSTANCE_DATA(FP_DEV(dev));
int height; int height;
struct fp_img *img; struct fp_img *img;
@ -106,7 +106,7 @@ enum
static void m_loop_state(fpi_ssm *ssm) static void m_loop_state(fpi_ssm *ssm)
{ {
struct fp_img_dev *dev = fpi_ssm_get_user_data(ssm); struct fp_img_dev *dev = fpi_ssm_get_user_data(ssm);
vfs301_dev_t *vdev = fpi_imgdev_get_user_data(dev); vfs301_dev_t *vdev = FP_INSTANCE_DATA(FP_DEV(dev));
switch (fpi_ssm_get_cur_state(ssm)) { switch (fpi_ssm_get_cur_state(ssm)) {
case M_REQUEST_PRINT: case M_REQUEST_PRINT:
@ -171,7 +171,7 @@ static void m_loop_complete(fpi_ssm *ssm)
static void m_init_state(fpi_ssm *ssm) static void m_init_state(fpi_ssm *ssm)
{ {
struct fp_img_dev *dev = fpi_ssm_get_user_data(ssm); struct fp_img_dev *dev = fpi_ssm_get_user_data(ssm);
vfs301_dev_t *vdev = fpi_imgdev_get_user_data(dev); vfs301_dev_t *vdev = FP_INSTANCE_DATA(FP_DEV(dev));
g_assert(fpi_ssm_get_cur_state(ssm) == 0); g_assert(fpi_ssm_get_cur_state(ssm) == 0);
@ -218,7 +218,7 @@ static void dev_deactivate(struct fp_img_dev *dev)
{ {
vfs301_dev_t *vdev; vfs301_dev_t *vdev;
vdev = fpi_imgdev_get_user_data(dev); vdev = FP_INSTANCE_DATA(FP_DEV(dev));
vfs301_proto_deinit(fpi_imgdev_get_usb_dev(dev), vdev); vfs301_proto_deinit(fpi_imgdev_get_usb_dev(dev), vdev);
fpi_imgdev_deactivate_complete(dev); fpi_imgdev_deactivate_complete(dev);
} }
@ -238,7 +238,7 @@ static int dev_open(struct fp_img_dev *dev, unsigned long driver_data)
/* Initialize private structure */ /* Initialize private structure */
vdev = g_malloc0(sizeof(vfs301_dev_t)); vdev = g_malloc0(sizeof(vfs301_dev_t));
fpi_imgdev_set_user_data(dev, vdev); fp_dev_set_instance_data(FP_DEV(dev), vdev);
vdev->scanline_buf = malloc(0); vdev->scanline_buf = malloc(0);
vdev->scanline_count = 0; vdev->scanline_count = 0;
@ -254,7 +254,7 @@ static void dev_close(struct fp_img_dev *dev)
vfs301_dev_t *vdev; vfs301_dev_t *vdev;
/* Release private structure */ /* Release private structure */
vdev = fpi_imgdev_get_user_data(dev); vdev = FP_INSTANCE_DATA(FP_DEV(dev));
free(vdev->scanline_buf); free(vdev->scanline_buf);
g_free(vdev); g_free(vdev);

View file

@ -426,7 +426,7 @@ static void chunk_capture_callback(struct libusb_transfer *transfer)
struct fp_img_dev *dev = fpi_ssm_get_user_data(ssm); struct fp_img_dev *dev = fpi_ssm_get_user_data(ssm);
struct vfs5011_data *data; struct vfs5011_data *data;
data = fpi_imgdev_get_user_data(dev); data = FP_INSTANCE_DATA(FP_DEV(dev));
if ((transfer->status == LIBUSB_TRANSFER_COMPLETED) || if ((transfer->status == LIBUSB_TRANSFER_COMPLETED) ||
(transfer->status == LIBUSB_TRANSFER_TIMED_OUT)) { (transfer->status == LIBUSB_TRANSFER_TIMED_OUT)) {
@ -674,7 +674,7 @@ static void activate_loop(fpi_ssm *ssm)
int r; int r;
fpi_timeout *timeout; fpi_timeout *timeout;
data = fpi_imgdev_get_user_data(dev); data = FP_INSTANCE_DATA(FP_DEV(dev));
fp_dbg("main_loop: state %d", fpi_ssm_get_cur_state(ssm)); fp_dbg("main_loop: state %d", fpi_ssm_get_cur_state(ssm));
@ -748,7 +748,7 @@ static void activate_loop_complete(fpi_ssm *ssm)
struct vfs5011_data *data; struct vfs5011_data *data;
int r = fpi_ssm_get_error(ssm); int r = fpi_ssm_get_error(ssm);
data = fpi_imgdev_get_user_data(dev); data = FP_INSTANCE_DATA(FP_DEV(dev));
fp_dbg("finishing"); fp_dbg("finishing");
if (data->init_sequence.receive_buf != NULL) if (data->init_sequence.receive_buf != NULL)
@ -777,7 +777,7 @@ static void open_loop(fpi_ssm *ssm)
struct fp_img_dev *dev = fpi_ssm_get_user_data(ssm); struct fp_img_dev *dev = fpi_ssm_get_user_data(ssm);
struct vfs5011_data *data; struct vfs5011_data *data;
data = fpi_imgdev_get_user_data(dev); data = FP_INSTANCE_DATA(FP_DEV(dev));
switch (fpi_ssm_get_cur_state(ssm)) { switch (fpi_ssm_get_cur_state(ssm)) {
case DEV_OPEN_START: case DEV_OPEN_START:
@ -798,7 +798,7 @@ static void open_loop_complete(fpi_ssm *ssm)
struct fp_img_dev *dev = fpi_ssm_get_user_data(ssm); struct fp_img_dev *dev = fpi_ssm_get_user_data(ssm);
struct vfs5011_data *data; struct vfs5011_data *data;
data = fpi_imgdev_get_user_data(dev); data = FP_INSTANCE_DATA(FP_DEV(dev));
g_free(data->init_sequence.receive_buf); g_free(data->init_sequence.receive_buf);
data->init_sequence.receive_buf = NULL; data->init_sequence.receive_buf = NULL;
@ -815,7 +815,7 @@ static int dev_open(struct fp_img_dev *dev, unsigned long driver_data)
data = (struct vfs5011_data *)g_malloc0(sizeof(*data)); data = (struct vfs5011_data *)g_malloc0(sizeof(*data));
data->capture_buffer = data->capture_buffer =
(unsigned char *)g_malloc0(CAPTURE_LINES * VFS5011_LINE_SIZE); (unsigned char *)g_malloc0(CAPTURE_LINES * VFS5011_LINE_SIZE);
fpi_imgdev_set_user_data(dev, data); fp_dev_set_instance_data(FP_DEV(dev), data);
r = libusb_reset_device(fpi_imgdev_get_usb_dev(dev)); r = libusb_reset_device(fpi_imgdev_get_usb_dev(dev));
if (r != 0) { if (r != 0) {
@ -841,7 +841,7 @@ static void dev_close(struct fp_img_dev *dev)
{ {
libusb_release_interface(fpi_imgdev_get_usb_dev(dev), 0); libusb_release_interface(fpi_imgdev_get_usb_dev(dev), 0);
struct vfs5011_data *data; struct vfs5011_data *data;
data = fpi_imgdev_get_user_data(dev); data = FP_INSTANCE_DATA(FP_DEV(dev));
if (data != NULL) { if (data != NULL) {
g_free(data->capture_buffer); g_free(data->capture_buffer);
g_slist_free_full(data->rows, g_free); g_slist_free_full(data->rows, g_free);
@ -855,7 +855,7 @@ static void start_scan(struct fp_img_dev *dev)
struct vfs5011_data *data; struct vfs5011_data *data;
fpi_ssm *ssm; fpi_ssm *ssm;
data = fpi_imgdev_get_user_data(dev); data = FP_INSTANCE_DATA(FP_DEV(dev));
data->loop_running = TRUE; data->loop_running = TRUE;
fp_dbg("creating ssm"); fp_dbg("creating ssm");
ssm = fpi_ssm_new(fpi_imgdev_get_dev(dev), activate_loop, DEV_ACTIVATE_NUM_STATES); ssm = fpi_ssm_new(fpi_imgdev_get_dev(dev), activate_loop, DEV_ACTIVATE_NUM_STATES);
@ -869,7 +869,7 @@ static int dev_activate(struct fp_img_dev *dev, enum fp_imgdev_state state)
{ {
struct vfs5011_data *data; struct vfs5011_data *data;
data = fpi_imgdev_get_user_data(dev); data = FP_INSTANCE_DATA(FP_DEV(dev));
fp_dbg("device initialized"); fp_dbg("device initialized");
data->deactivating = FALSE; data->deactivating = FALSE;
@ -883,7 +883,7 @@ static void dev_deactivate(struct fp_img_dev *dev)
int r; int r;
struct vfs5011_data *data; struct vfs5011_data *data;
data = fpi_imgdev_get_user_data(dev); data = FP_INSTANCE_DATA(FP_DEV(dev));
if (data->loop_running) { if (data->loop_running) {
data->deactivating = TRUE; data->deactivating = TRUE;
if (data->flying_transfer) { if (data->flying_transfer) {

View file

@ -68,9 +68,6 @@ enum fp_imgdev_enroll_state {
}; };
libusb_device_handle *fpi_imgdev_get_usb_dev(struct fp_img_dev *dev); libusb_device_handle *fpi_imgdev_get_usb_dev(struct fp_img_dev *dev);
void fpi_imgdev_set_user_data(struct fp_img_dev *imgdev,
void *user_data);
void *fpi_imgdev_get_user_data(struct fp_img_dev *imgdev);
struct fp_dev *fpi_imgdev_get_dev(struct fp_img_dev *imgdev); struct fp_dev *fpi_imgdev_get_dev(struct fp_img_dev *imgdev);
enum fp_imgdev_enroll_state fpi_imgdev_get_action_state(struct fp_img_dev *imgdev); enum fp_imgdev_enroll_state fpi_imgdev_get_action_state(struct fp_img_dev *imgdev);
enum fp_imgdev_action fpi_imgdev_get_action(struct fp_img_dev *imgdev); enum fp_imgdev_action fpi_imgdev_get_action(struct fp_img_dev *imgdev);

View file

@ -155,9 +155,6 @@ struct fp_img_dev {
/* FIXME: better place to put this? */ /* FIXME: better place to put this? */
size_t identify_match_offset; size_t identify_match_offset;
/* FIXME: Remove */
void *priv;
}; };
int fpi_imgdev_get_img_width(struct fp_img_dev *imgdev); int fpi_imgdev_get_img_width(struct fp_img_dev *imgdev);

View file

@ -539,19 +539,6 @@ fpi_imgdev_get_usb_dev(struct fp_img_dev *dev)
return FP_DEV(dev)->udev; return FP_DEV(dev)->udev;
} }
void
fpi_imgdev_set_user_data(struct fp_img_dev *imgdev,
void *user_data)
{
imgdev->priv = user_data;
}
void *
fpi_imgdev_get_user_data(struct fp_img_dev *imgdev)
{
return imgdev->priv;
}
struct fp_dev * struct fp_dev *
fpi_imgdev_get_dev(struct fp_img_dev *imgdev) fpi_imgdev_get_dev(struct fp_img_dev *imgdev)
{ {