lib: s/array_n_elements/G_N_ELEMENTS/
This commit is contained in:
parent
2a4893d946
commit
ef807d9d0e
7 changed files with 21 additions and 23 deletions
|
@ -50,9 +50,9 @@ static int dev_init(struct fp_img_dev *dev, unsigned long driver_data)
|
||||||
fpi_imgdev_set_user_data(dev, aesdev);
|
fpi_imgdev_set_user_data(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] = array_n_elements(aes1660_init_1);
|
aesdev->init_seqs_len[0] = G_N_ELEMENTS(aes1660_init_1);
|
||||||
aesdev->init_seqs[1] = aes1660_init_2;
|
aesdev->init_seqs[1] = aes1660_init_2;
|
||||||
aesdev->init_seqs_len[1] = array_n_elements(aes1660_init_2);
|
aesdev->init_seqs_len[1] = G_N_ELEMENTS(aes1660_init_2);
|
||||||
aesdev->start_imaging_cmd = (unsigned char *)aes1660_start_imaging_cmd;
|
aesdev->start_imaging_cmd = (unsigned char *)aes1660_start_imaging_cmd;
|
||||||
aesdev->start_imaging_cmd_len = sizeof(aes1660_start_imaging_cmd);
|
aesdev->start_imaging_cmd_len = sizeof(aes1660_start_imaging_cmd);
|
||||||
aesdev->assembling_ctx = &assembling_ctx;
|
aesdev->assembling_ctx = &assembling_ctx;
|
||||||
|
|
|
@ -51,9 +51,9 @@ static int dev_init(struct fp_img_dev *dev, unsigned long driver_data)
|
||||||
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;
|
||||||
aesdev->init_seqs_len[0] = array_n_elements(aes2660_init_1);
|
aesdev->init_seqs_len[0] = G_N_ELEMENTS(aes2660_init_1);
|
||||||
aesdev->init_seqs[1] = aes2660_init_2;
|
aesdev->init_seqs[1] = aes2660_init_2;
|
||||||
aesdev->init_seqs_len[1] = array_n_elements(aes2660_init_2);
|
aesdev->init_seqs_len[1] = G_N_ELEMENTS(aes2660_init_2);
|
||||||
aesdev->start_imaging_cmd = (unsigned char *)aes2660_start_imaging_cmd;
|
aesdev->start_imaging_cmd = (unsigned char *)aes2660_start_imaging_cmd;
|
||||||
aesdev->start_imaging_cmd_len = sizeof(aes2660_start_imaging_cmd);
|
aesdev->start_imaging_cmd_len = sizeof(aes2660_start_imaging_cmd);
|
||||||
aesdev->assembling_ctx = &assembling_ctx;
|
aesdev->assembling_ctx = &assembling_ctx;
|
||||||
|
|
|
@ -61,7 +61,7 @@ static const struct elan_cmd get_sensor_dim_cmds[] = {
|
||||||
};
|
};
|
||||||
|
|
||||||
static const size_t get_sensor_dim_cmds_len =
|
static const size_t get_sensor_dim_cmds_len =
|
||||||
array_n_elements(get_sensor_dim_cmds);
|
G_N_ELEMENTS(get_sensor_dim_cmds);
|
||||||
|
|
||||||
static const struct elan_cmd init_start_cmds[] = {
|
static const struct elan_cmd init_start_cmds[] = {
|
||||||
{
|
{
|
||||||
|
@ -76,7 +76,7 @@ static const struct elan_cmd init_start_cmds[] = {
|
||||||
},
|
},
|
||||||
};
|
};
|
||||||
|
|
||||||
static const size_t init_start_cmds_len = array_n_elements(init_start_cmds);
|
static const size_t init_start_cmds_len = G_N_ELEMENTS(init_start_cmds);
|
||||||
|
|
||||||
static const struct elan_cmd read_cmds[] = {
|
static const struct elan_cmd read_cmds[] = {
|
||||||
/* raw frame sizes are calculated from image dimesions reported by the
|
/* raw frame sizes are calculated from image dimesions reported by the
|
||||||
|
@ -88,7 +88,7 @@ static const struct elan_cmd read_cmds[] = {
|
||||||
},
|
},
|
||||||
};
|
};
|
||||||
|
|
||||||
const size_t read_cmds_len = array_n_elements(read_cmds);
|
const size_t read_cmds_len = G_N_ELEMENTS(read_cmds);
|
||||||
|
|
||||||
/* issued after data reads during init and calibration */
|
/* issued after data reads during init and calibration */
|
||||||
static const struct elan_cmd init_end_cmds[] = {
|
static const struct elan_cmd init_end_cmds[] = {
|
||||||
|
@ -99,7 +99,7 @@ static const struct elan_cmd init_end_cmds[] = {
|
||||||
},
|
},
|
||||||
};
|
};
|
||||||
|
|
||||||
static const size_t init_end_cmds_len = array_n_elements(init_end_cmds);
|
static const size_t init_end_cmds_len = G_N_ELEMENTS(init_end_cmds);
|
||||||
|
|
||||||
/* same command 2 times
|
/* same command 2 times
|
||||||
* original driver may observe return value to determine how many times it
|
* original driver may observe return value to determine how many times it
|
||||||
|
@ -118,7 +118,7 @@ static const struct elan_cmd calibrate_start_cmds[] = {
|
||||||
};
|
};
|
||||||
|
|
||||||
static const size_t calibrate_start_cmds_len =
|
static const size_t calibrate_start_cmds_len =
|
||||||
array_n_elements(calibrate_start_cmds);
|
G_N_ELEMENTS(calibrate_start_cmds);
|
||||||
|
|
||||||
/* issued after data reads during init and calibration */
|
/* issued after data reads during init and calibration */
|
||||||
static const struct elan_cmd calibrate_end_cmds[] = {
|
static const struct elan_cmd calibrate_end_cmds[] = {
|
||||||
|
@ -130,7 +130,7 @@ static const struct elan_cmd calibrate_end_cmds[] = {
|
||||||
};
|
};
|
||||||
|
|
||||||
static const size_t calibrate_end_cmds_len =
|
static const size_t calibrate_end_cmds_len =
|
||||||
array_n_elements(calibrate_end_cmds);
|
G_N_ELEMENTS(calibrate_end_cmds);
|
||||||
|
|
||||||
static const struct elan_cmd capture_start_cmds[] = {
|
static const struct elan_cmd capture_start_cmds[] = {
|
||||||
/* led on */
|
/* led on */
|
||||||
|
@ -141,7 +141,7 @@ static const struct elan_cmd capture_start_cmds[] = {
|
||||||
},
|
},
|
||||||
};
|
};
|
||||||
|
|
||||||
static size_t capture_start_cmds_len = array_n_elements(capture_start_cmds);
|
static size_t capture_start_cmds_len = G_N_ELEMENTS(capture_start_cmds);
|
||||||
|
|
||||||
static const struct elan_cmd capture_wait_finger_cmds[] = {
|
static const struct elan_cmd capture_wait_finger_cmds[] = {
|
||||||
/* wait for finger
|
/* wait for finger
|
||||||
|
@ -154,7 +154,7 @@ static const struct elan_cmd capture_wait_finger_cmds[] = {
|
||||||
};
|
};
|
||||||
|
|
||||||
static size_t capture_wait_finger_cmds_len =
|
static size_t capture_wait_finger_cmds_len =
|
||||||
array_n_elements(capture_wait_finger_cmds);
|
G_N_ELEMENTS(capture_wait_finger_cmds);
|
||||||
|
|
||||||
static const struct elan_cmd deactivate_cmds[] = {
|
static const struct elan_cmd deactivate_cmds[] = {
|
||||||
/* led off */
|
/* led off */
|
||||||
|
@ -165,7 +165,7 @@ static const struct elan_cmd deactivate_cmds[] = {
|
||||||
},
|
},
|
||||||
};
|
};
|
||||||
|
|
||||||
static const size_t deactivate_cmds_len = array_n_elements(deactivate_cmds);
|
static const size_t deactivate_cmds_len = G_N_ELEMENTS(deactivate_cmds);
|
||||||
|
|
||||||
static void elan_cmd_cb(struct libusb_transfer *transfer);
|
static void elan_cmd_cb(struct libusb_transfer *transfer);
|
||||||
static void elan_cmd_read(struct fpi_ssm *ssm);
|
static void elan_cmd_read(struct fpi_ssm *ssm);
|
||||||
|
|
|
@ -447,14 +447,14 @@ static int dev_init(struct fp_img_dev *dev, unsigned long driver_data)
|
||||||
upekdev->ep_in = UPEKTC_EP_IN;
|
upekdev->ep_in = UPEKTC_EP_IN;
|
||||||
upekdev->ep_out = UPEKTC_EP_OUT;
|
upekdev->ep_out = UPEKTC_EP_OUT;
|
||||||
upekdev->setup_commands = upektc_setup_commands;
|
upekdev->setup_commands = upektc_setup_commands;
|
||||||
upekdev->setup_commands_len = array_n_elements(upektc_setup_commands);
|
upekdev->setup_commands_len = G_N_ELEMENTS(upektc_setup_commands);
|
||||||
upekdev->sum_threshold = UPEKTC_SUM_THRESHOLD;
|
upekdev->sum_threshold = UPEKTC_SUM_THRESHOLD;
|
||||||
break;
|
break;
|
||||||
case UPEKTC_3001:
|
case UPEKTC_3001:
|
||||||
upekdev->ep_in = UPEKET_EP_IN;
|
upekdev->ep_in = UPEKET_EP_IN;
|
||||||
upekdev->ep_out = UPEKET_EP_OUT;
|
upekdev->ep_out = UPEKET_EP_OUT;
|
||||||
upekdev->setup_commands = upeket_setup_commands;
|
upekdev->setup_commands = upeket_setup_commands;
|
||||||
upekdev->setup_commands_len = array_n_elements(upeket_setup_commands);
|
upekdev->setup_commands_len = G_N_ELEMENTS(upeket_setup_commands);
|
||||||
upekdev->sum_threshold = UPEKET_SUM_THRESHOLD;
|
upekdev->sum_threshold = UPEKET_SUM_THRESHOLD;
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
|
|
|
@ -664,7 +664,7 @@ static int calc_dev2(struct uru4k_image *img)
|
||||||
uint8_t *b[2] = { NULL, NULL };
|
uint8_t *b[2] = { NULL, NULL };
|
||||||
int res = 0, mean = 0, i, r, j, idx;
|
int res = 0, mean = 0, i, r, j, idx;
|
||||||
|
|
||||||
for (i = r = idx = 0; i < array_n_elements(img->block_info) && idx < 2; i++) {
|
for (i = r = idx = 0; i < G_N_ELEMENTS(img->block_info) && idx < 2; i++) {
|
||||||
if (img->block_info[i].flags & BLOCKF_NOT_PRESENT)
|
if (img->block_info[i].flags & BLOCKF_NOT_PRESENT)
|
||||||
continue;
|
continue;
|
||||||
for (j = 0; j < img->block_info[i].num_lines && idx < 2; j++)
|
for (j = 0; j < img->block_info[i].num_lines && idx < 2; j++)
|
||||||
|
@ -747,7 +747,7 @@ static void imaging_run_state(struct fpi_ssm *ssm)
|
||||||
key ^= urudev->img_enc_seed;
|
key ^= urudev->img_enc_seed;
|
||||||
|
|
||||||
fp_dbg("encryption id %02x -> key %08x", img->key_number, key);
|
fp_dbg("encryption id %02x -> key %08x", img->key_number, key);
|
||||||
while (urudev->img_block < array_n_elements(img->block_info) &&
|
while (urudev->img_block < G_N_ELEMENTS(img->block_info) &&
|
||||||
urudev->img_lines_done < img->num_lines) {
|
urudev->img_lines_done < img->num_lines) {
|
||||||
flags = img->block_info[urudev->img_block].flags;
|
flags = img->block_info[urudev->img_block].flags;
|
||||||
num_lines = img->block_info[urudev->img_block].num_lines;
|
num_lines = img->block_info[urudev->img_block].num_lines;
|
||||||
|
@ -785,7 +785,7 @@ static void imaging_run_state(struct fpi_ssm *ssm)
|
||||||
fpimg = fpi_img_new_for_imgdev(dev);
|
fpimg = fpi_img_new_for_imgdev(dev);
|
||||||
|
|
||||||
to = r = 0;
|
to = r = 0;
|
||||||
for (i = 0; i < array_n_elements(img->block_info) && r < img->num_lines; i++) {
|
for (i = 0; i < G_N_ELEMENTS(img->block_info) && r < img->num_lines; i++) {
|
||||||
flags = img->block_info[i].flags;
|
flags = img->block_info[i].flags;
|
||||||
num_lines = img->block_info[i].num_lines;
|
num_lines = img->block_info[i].num_lines;
|
||||||
if (num_lines == 0)
|
if (num_lines == 0)
|
||||||
|
|
|
@ -679,7 +679,7 @@ static void activate_loop(struct fpi_ssm *ssm)
|
||||||
switch (fpi_ssm_get_cur_state(ssm)) {
|
switch (fpi_ssm_get_cur_state(ssm)) {
|
||||||
case DEV_ACTIVATE_REQUEST_FPRINT:
|
case DEV_ACTIVATE_REQUEST_FPRINT:
|
||||||
data->init_sequence.stepcount =
|
data->init_sequence.stepcount =
|
||||||
array_n_elements(vfs5011_initiate_capture);
|
G_N_ELEMENTS(vfs5011_initiate_capture);
|
||||||
data->init_sequence.actions = vfs5011_initiate_capture;
|
data->init_sequence.actions = vfs5011_initiate_capture;
|
||||||
data->init_sequence.device = dev;
|
data->init_sequence.device = dev;
|
||||||
if (data->init_sequence.receive_buf == NULL)
|
if (data->init_sequence.receive_buf == NULL)
|
||||||
|
@ -721,7 +721,7 @@ static void activate_loop(struct fpi_ssm *ssm)
|
||||||
|
|
||||||
case DEV_ACTIVATE_PREPARE_NEXT_CAPTURE:
|
case DEV_ACTIVATE_PREPARE_NEXT_CAPTURE:
|
||||||
data->init_sequence.stepcount =
|
data->init_sequence.stepcount =
|
||||||
array_n_elements(vfs5011_initiate_capture);
|
G_N_ELEMENTS(vfs5011_initiate_capture);
|
||||||
data->init_sequence.actions = vfs5011_initiate_capture;
|
data->init_sequence.actions = vfs5011_initiate_capture;
|
||||||
data->init_sequence.device = dev;
|
data->init_sequence.device = dev;
|
||||||
if (data->init_sequence.receive_buf == NULL)
|
if (data->init_sequence.receive_buf == NULL)
|
||||||
|
@ -774,7 +774,7 @@ static void open_loop(struct fpi_ssm *ssm)
|
||||||
switch (fpi_ssm_get_cur_state(ssm)) {
|
switch (fpi_ssm_get_cur_state(ssm)) {
|
||||||
case DEV_OPEN_START:
|
case DEV_OPEN_START:
|
||||||
data->init_sequence.stepcount =
|
data->init_sequence.stepcount =
|
||||||
array_n_elements(vfs5011_initialization);
|
G_N_ELEMENTS(vfs5011_initialization);
|
||||||
data->init_sequence.actions = vfs5011_initialization;
|
data->init_sequence.actions = vfs5011_initialization;
|
||||||
data->init_sequence.device = dev;
|
data->init_sequence.device = dev;
|
||||||
data->init_sequence.receive_buf =
|
data->init_sequence.receive_buf =
|
||||||
|
|
|
@ -37,8 +37,6 @@
|
||||||
#include "assembling.h"
|
#include "assembling.h"
|
||||||
#include "drivers/driver_ids.h"
|
#include "drivers/driver_ids.h"
|
||||||
|
|
||||||
#define array_n_elements(array) G_N_ELEMENTS(array)
|
|
||||||
|
|
||||||
#define fp_dbg g_debug
|
#define fp_dbg g_debug
|
||||||
#define fp_info g_debug
|
#define fp_info g_debug
|
||||||
#define fp_warn g_warning
|
#define fp_warn g_warning
|
||||||
|
|
Loading…
Reference in a new issue