sr: rename all sr_device_instance_* functions to sr_dev_inst_*

This commit is contained in:
Bert Vermeulen 2012-02-13 15:31:59 +01:00
parent c532476aa7
commit d3683c42e7
11 changed files with 89 additions and 89 deletions

View File

@ -77,7 +77,7 @@ static int hw_init(const char *deviceinfo)
return 0;
}
sdi = sr_device_instance_new(0, SR_ST_ACTIVE, "alsa", NULL, NULL);
sdi = sr_dev_inst_new(0, SR_ST_ACTIVE, "alsa", NULL, NULL);
if (!sdi)
goto free_alsa;
@ -97,7 +97,7 @@ static int hw_opendev(int device_index)
struct alsa *alsa;
int err;
if (!(sdi = sr_get_device_instance(device_instances, device_index)))
if (!(sdi = sr_get_dev_inst(device_instances, device_index)))
return SR_ERR;
alsa = sdi->priv;
@ -131,7 +131,7 @@ static int hw_closedev(int device_index)
struct sr_device_instance *sdi;
struct alsa *alsa;
if (!(sdi = sr_get_device_instance(device_instances, device_index))) {
if (!(sdi = sr_get_dev_inst(device_instances, device_index))) {
sr_err("alsa: %s: sdi was NULL", __func__);
return SR_ERR; /* TODO: SR_ERR_ARG? */
}
@ -154,13 +154,13 @@ static int hw_cleanup(void)
{
struct sr_device_instance *sdi;
if (!(sdi = sr_get_device_instance(device_instances, 0))) {
if (!(sdi = sr_get_dev_inst(device_instances, 0))) {
sr_err("alsa: %s: sdi was NULL", __func__);
return SR_ERR_BUG;
}
g_free(sdi->priv);
sr_device_instance_free(sdi);
sr_dev_inst_free(sdi);
return SR_OK;
}
@ -171,7 +171,7 @@ static void *hw_get_device_info(int device_index, int device_info_id)
struct alsa *alsa;
void *info = NULL;
if (!(sdi = sr_get_device_instance(device_instances, device_index)))
if (!(sdi = sr_get_dev_inst(device_instances, device_index)))
return NULL;
alsa = sdi->priv;
@ -214,7 +214,7 @@ static int hw_set_configuration(int device_index, int capability, void *value)
struct sr_device_instance *sdi;
struct alsa *alsa;
if (!(sdi = sr_get_device_instance(device_instances, device_index)))
if (!(sdi = sr_get_dev_inst(device_instances, device_index)))
return SR_ERR;
alsa = sdi->priv;
@ -300,7 +300,7 @@ static int hw_start_acquisition(int device_index, gpointer session_device_id)
int count;
int err;
if (!(sdi = sr_get_device_instance(device_instances, device_index)))
if (!(sdi = sr_get_dev_inst(device_instances, device_index)))
return SR_ERR;
alsa = sdi->priv;

View File

@ -444,7 +444,7 @@ static int hw_init(const char *deviceinfo)
sigma->use_triggers = 0;
/* Register SIGMA device. */
sdi = sr_device_instance_new(0, SR_ST_INITIALIZING,
sdi = sr_dev_inst_new(0, SR_ST_INITIALIZING,
USB_VENDOR_NAME, USB_MODEL_NAME, USB_MODEL_VERSION);
if (!sdi)
goto free;
@ -559,7 +559,7 @@ static int hw_opendev(int device_index)
struct sigma *sigma;
int ret;
if (!(sdi = sr_get_device_instance(device_instances, device_index)))
if (!(sdi = sr_get_dev_inst(device_instances, device_index)))
return SR_ERR;
sigma = sdi->priv;
@ -702,7 +702,7 @@ static int hw_closedev(int device_index)
struct sr_device_instance *sdi;
struct sigma *sigma;
if (!(sdi = sr_get_device_instance(device_instances, device_index))) {
if (!(sdi = sr_get_dev_inst(device_instances, device_index))) {
sr_err("sigma: %s: sdi was NULL", __func__);
return SR_ERR; /* TODO: SR_ERR_ARG? */
}
@ -736,7 +736,7 @@ static int hw_cleanup(void)
continue;
}
g_free(sdi->priv);
sr_device_instance_free(sdi);
sr_dev_inst_free(sdi);
}
g_slist_free(device_instances);
device_instances = NULL;
@ -750,7 +750,7 @@ static void *hw_get_device_info(int device_index, int device_info_id)
struct sigma *sigma;
void *info = NULL;
if (!(sdi = sr_get_device_instance(device_instances, device_index))) {
if (!(sdi = sr_get_dev_inst(device_instances, device_index))) {
sr_err("It's NULL.\n");
return NULL;
}
@ -785,7 +785,7 @@ static int hw_get_status(int device_index)
{
struct sr_device_instance *sdi;
sdi = sr_get_device_instance(device_instances, device_index);
sdi = sr_get_dev_inst(device_instances, device_index);
if (sdi)
return sdi->status;
else
@ -803,7 +803,7 @@ static int hw_set_configuration(int device_index, int capability, void *value)
struct sigma *sigma;
int ret;
if (!(sdi = sr_get_device_instance(device_instances, device_index)))
if (!(sdi = sr_get_dev_inst(device_instances, device_index)))
return SR_ERR;
sigma = sdi->priv;
@ -1267,7 +1267,7 @@ static int hw_start_acquisition(int device_index, gpointer session_data)
/* Avoid compiler warnings. */
(void)session_data;
if (!(sdi = sr_get_device_instance(device_instances, device_index)))
if (!(sdi = sr_get_dev_inst(device_instances, device_index)))
return SR_ERR;
sigma = sdi->priv;
@ -1378,7 +1378,7 @@ static int hw_stop_acquisition(int device_index, gpointer session_data)
/* Avoid compiler warnings. */
(void)session_data;
if (!(sdi = sr_get_device_instance(device_instances, device_index))) {
if (!(sdi = sr_get_dev_inst(device_instances, device_index))) {
sr_err("asix: %s: sdi was NULL", __func__);
return SR_ERR_BUG;
}

View File

@ -527,7 +527,7 @@ static int hw_init(const char *deviceinfo)
sr_dbg("la8: found device");
/* Register the device with libsigrok. */
sdi = sr_device_instance_new(0, SR_ST_INITIALIZING,
sdi = sr_dev_inst_new(0, SR_ST_INITIALIZING,
USB_VENDOR_NAME, USB_MODEL_NAME, USB_MODEL_VERSION);
if (!sdi) {
sr_err("la8: %s: sr_device_instance_new failed", __func__);
@ -564,7 +564,7 @@ static int hw_opendev(int device_index)
struct sr_device_instance *sdi;
struct la8 *la8;
if (!(sdi = sr_get_device_instance(device_instances, device_index))) {
if (!(sdi = sr_get_dev_inst(device_instances, device_index))) {
sr_err("la8: %s: sdi was NULL", __func__);
return SR_ERR; /* TODO: SR_ERR_ARG? */
}
@ -651,7 +651,7 @@ static int hw_closedev(int device_index)
struct sr_device_instance *sdi;
struct la8 *la8;
if (!(sdi = sr_get_device_instance(device_instances, device_index))) {
if (!(sdi = sr_get_dev_inst(device_instances, device_index))) {
sr_err("la8: %s: sdi was NULL", __func__);
return SR_ERR; /* TODO: SR_ERR_ARG? */
}
@ -706,7 +706,7 @@ static int hw_cleanup(void)
sr_err("la8: %s: sdi->priv was NULL, nothing "
"to do", __func__);
#endif
sr_device_instance_free(sdi); /* Returns void. */
sr_dev_inst_free(sdi); /* Returns void. */
}
g_slist_free(device_instances); /* Returns void. */
device_instances = NULL;
@ -722,7 +722,7 @@ static void *hw_get_device_info(int device_index, int device_info_id)
sr_spew("la8: entering %s", __func__);
if (!(sdi = sr_get_device_instance(device_instances, device_index))) {
if (!(sdi = sr_get_dev_inst(device_instances, device_index))) {
sr_err("la8: %s: sdi was NULL", __func__);
return NULL;
}
@ -766,7 +766,7 @@ static int hw_get_status(int device_index)
{
struct sr_device_instance *sdi;
if (!(sdi = sr_get_device_instance(device_instances, device_index))) {
if (!(sdi = sr_get_dev_inst(device_instances, device_index))) {
sr_err("la8: %s: sdi was NULL, device not found", __func__);
return SR_ST_NOT_FOUND;
}
@ -790,7 +790,7 @@ static int hw_set_configuration(int device_index, int capability, void *value)
sr_spew("la8: entering %s", __func__);
if (!(sdi = sr_get_device_instance(device_instances, device_index))) {
if (!(sdi = sr_get_dev_inst(device_instances, device_index))) {
sr_err("la8: %s: sdi was NULL", __func__);
return SR_ERR; /* TODO: SR_ERR_ARG? */
}
@ -1044,7 +1044,7 @@ static int hw_start_acquisition(int device_index, gpointer session_data)
sr_spew("la8: entering %s", __func__);
if (!(sdi = sr_get_device_instance(device_instances, device_index))) {
if (!(sdi = sr_get_dev_inst(device_instances, device_index))) {
sr_err("la8: %s: sdi was NULL", __func__);
return SR_ERR; /* TODO: SR_ERR_ARG? */
}
@ -1116,7 +1116,7 @@ static int hw_stop_acquisition(int device_index, gpointer session_data)
sr_dbg("la8: stopping acquisition");
if (!(sdi = sr_get_device_instance(device_instances, device_index))) {
if (!(sdi = sr_get_dev_inst(device_instances, device_index))) {
sr_err("la8: %s: sdi was NULL", __func__);
return SR_ERR_BUG;
}

View File

@ -143,7 +143,7 @@ static int hw_init(const char *deviceinfo)
/* Avoid compiler warnings. */
(void)deviceinfo;
sdi = sr_device_instance_new(0, SR_ST_ACTIVE, DEMONAME, NULL, NULL);
sdi = sr_dev_inst_new(0, SR_ST_ACTIVE, DEMONAME, NULL, NULL);
if (!sdi) {
sr_err("demo: %s: sr_device_instance_new failed", __func__);
return 0;
@ -185,7 +185,7 @@ static void *hw_get_device_info(int device_index, int device_info_id)
struct sr_device_instance *sdi;
void *info = NULL;
if (!(sdi = sr_get_device_instance(device_instances, device_index))) {
if (!(sdi = sr_get_dev_inst(device_instances, device_index))) {
sr_err("demo: %s: sdi was NULL", __func__);
return NULL;
}

View File

@ -486,7 +486,7 @@ static int hw_init(const char *deviceinfo)
mso->protocol_trigger.spimode = 0;
}
sdi = sr_device_instance_new(devcnt, SR_ST_INITIALIZING,
sdi = sr_dev_inst_new(devcnt, SR_ST_INITIALIZING,
manufacturer, product, hwrev);
if (!sdi) {
sr_err("Unable to create device instance for %s",
@ -497,7 +497,7 @@ static int hw_init(const char *deviceinfo)
/* save a pointer to our private instance data */
sdi->priv = mso;
sdi->serial = sr_serial_device_instance_new(path, -1);
sdi->serial = sr_serial_dev_inst_new(path, -1);
if (!sdi->serial)
goto err_device_instance_free;
@ -506,7 +506,7 @@ static int hw_init(const char *deviceinfo)
continue;
err_device_instance_free:
sr_device_instance_free(sdi);
sr_dev_inst_free(sdi);
err_free_mso:
g_free(mso);
}
@ -536,7 +536,7 @@ static int hw_cleanup(void)
serial_close(sdi->serial->fd);
g_free(sdi->priv);
sdi->priv = NULL;
sr_device_instance_free(sdi);
sr_dev_inst_free(sdi);
}
g_slist_free(device_instances);
device_instances = NULL;
@ -550,7 +550,7 @@ static int hw_opendev(int device_index)
struct mso *mso;
int ret = SR_ERR;
if (!(sdi = sr_get_device_instance(device_instances, device_index)))
if (!(sdi = sr_get_dev_inst(device_instances, device_index)))
return ret;
mso = sdi->priv;
@ -590,7 +590,7 @@ static int hw_closedev(int device_index)
{
struct sr_device_instance *sdi;
if (!(sdi = sr_get_device_instance(device_instances, device_index))) {
if (!(sdi = sr_get_dev_inst(device_instances, device_index))) {
sr_err("mso19: %s: sdi was NULL", __func__);
return SR_ERR; /* TODO: SR_ERR_ARG? */
}
@ -612,7 +612,7 @@ static void *hw_get_device_info(int device_index, int device_info_id)
struct mso *mso;
void *info = NULL;
if (!(sdi = sr_get_device_instance(device_instances, device_index)))
if (!(sdi = sr_get_dev_inst(device_instances, device_index)))
return NULL;
mso = sdi->priv;
@ -643,7 +643,7 @@ static int hw_get_status(int device_index)
{
struct sr_device_instance *sdi;
if (!(sdi = sr_get_device_instance(device_instances, device_index)))
if (!(sdi = sr_get_dev_inst(device_instances, device_index)))
return SR_ST_NOT_FOUND;
return sdi->status;
@ -658,7 +658,7 @@ static int hw_set_configuration(int device_index, int capability, void *value)
{
struct sr_device_instance *sdi;
if (!(sdi = sr_get_device_instance(device_instances, device_index)))
if (!(sdi = sr_get_dev_inst(device_instances, device_index)))
return SR_ERR;
switch (capability) {
@ -755,7 +755,7 @@ static int hw_start_acquisition(int device_index, gpointer session_device_id)
struct sr_datafeed_header header;
int ret = SR_ERR;
if (!(sdi = sr_get_device_instance(device_instances, device_index)))
if (!(sdi = sr_get_dev_inst(device_instances, device_index)))
return ret;
mso = sdi->priv;

View File

@ -231,7 +231,7 @@ static struct sr_device_instance *get_metadata(int fd)
GString *tmp_str, *devicename, *version;
gchar tmp_c;
sdi = sr_device_instance_new(0, SR_ST_INACTIVE, NULL, NULL, NULL);
sdi = sr_dev_inst_new(0, SR_ST_INACTIVE, NULL, NULL, NULL);
ols = ols_device_new();
sdi->priv = ols;
@ -446,13 +446,13 @@ static int hw_init(const char *deviceinfo)
sdi->index = final_devcnt;
} else {
/* not an OLS -- some other board that uses the sump protocol */
sdi = sr_device_instance_new(final_devcnt, SR_ST_INACTIVE,
sdi = sr_dev_inst_new(final_devcnt, SR_ST_INACTIVE,
"Sump", "Logic Analyzer", "v1.0");
ols = ols_device_new();
ols->num_probes = 32;
sdi->priv = ols;
}
ols->serial = sr_serial_device_instance_new(device_names[i], -1);
ols->serial = sr_serial_dev_inst_new(device_names[i], -1);
device_instances = g_slist_append(device_instances, sdi);
final_devcnt++;
serial_close(fds[i].fd);
@ -485,7 +485,7 @@ static int hw_opendev(int device_index)
struct sr_device_instance *sdi;
struct ols_device *ols;
if (!(sdi = sr_get_device_instance(device_instances, device_index)))
if (!(sdi = sr_get_dev_inst(device_instances, device_index)))
return SR_ERR;
ols = sdi->priv;
@ -504,7 +504,7 @@ static int hw_closedev(int device_index)
struct sr_device_instance *sdi;
struct ols_device *ols;
if (!(sdi = sr_get_device_instance(device_instances, device_index))) {
if (!(sdi = sr_get_dev_inst(device_instances, device_index))) {
sr_err("ols: %s: sdi was NULL", __func__);
return SR_ERR; /* TODO: SR_ERR_ARG? */
}
@ -546,8 +546,8 @@ static int hw_cleanup(void)
/* TODO: Check for serial != NULL. */
if (ols->serial->fd != -1)
serial_close(ols->serial->fd);
sr_serial_device_instance_free(ols->serial);
sr_device_instance_free(sdi);
sr_serial_dev_inst_free(ols->serial);
sr_dev_inst_free(sdi);
}
g_slist_free(device_instances);
device_instances = NULL;
@ -561,7 +561,7 @@ static void *hw_get_device_info(int device_index, int device_info_id)
struct ols_device *ols;
void *info;
if (!(sdi = sr_get_device_instance(device_instances, device_index)))
if (!(sdi = sr_get_dev_inst(device_instances, device_index)))
return NULL;
ols = sdi->priv;
@ -594,7 +594,7 @@ static int hw_get_status(int device_index)
{
struct sr_device_instance *sdi;
if (!(sdi = sr_get_device_instance(device_instances, device_index)))
if (!(sdi = sr_get_dev_inst(device_instances, device_index)))
return SR_ST_NOT_FOUND;
return sdi->status;
@ -645,7 +645,7 @@ static int hw_set_configuration(int device_index, int capability, void *value)
int ret;
uint64_t *tmp_u64;
if (!(sdi = sr_get_device_instance(device_instances, device_index)))
if (!(sdi = sr_get_dev_inst(device_instances, device_index)))
return SR_ERR;
ols = sdi->priv;
@ -885,7 +885,7 @@ static int hw_start_acquisition(int device_index, gpointer session_data)
int num_channels;
int i;
if (!(sdi = sr_get_device_instance(device_instances, device_index)))
if (!(sdi = sr_get_dev_inst(device_instances, device_index)))
return SR_ERR;
ols = sdi->priv;

View File

@ -173,7 +173,7 @@ static int sl_open_device(int device_index)
struct fx2_device *fx2;
int err, skip, i;
if (!(sdi = sr_get_device_instance(device_instances, device_index)))
if (!(sdi = sr_get_dev_inst(device_instances, device_index)))
return SR_ERR;
fx2 = sdi->priv;
@ -357,7 +357,7 @@ static int hw_init(const char *deviceinfo)
/* not a supported VID/PID */
continue;
sdi = sr_device_instance_new(devcnt, SR_ST_INITIALIZING,
sdi = sr_dev_inst_new(devcnt, SR_ST_INITIALIZING,
fx2_prof->vendor, fx2_prof->model, fx2_prof->model_version);
if (!sdi)
return 0;
@ -371,7 +371,7 @@ static int hw_init(const char *deviceinfo)
sr_dbg("Found a Saleae Logic with %s firmware.",
new_saleae_logic_firmware ? "new" : "old");
sdi->status = SR_ST_INACTIVE;
fx2->usb = sr_usb_device_instance_new
fx2->usb = sr_usb_dev_inst_new
(libusb_get_bus_number(devlist[i]),
libusb_get_device_address(devlist[i]), NULL);
} else {
@ -380,7 +380,7 @@ static int hw_init(const char *deviceinfo)
g_get_current_time(&fx2->fw_updated);
else
sr_err("firmware upload failed for device %d", devcnt);
fx2->usb = sr_usb_device_instance_new
fx2->usb = sr_usb_dev_inst_new
(libusb_get_bus_number(devlist[i]), 0xff, NULL);
}
devcnt++;
@ -397,7 +397,7 @@ static int hw_opendev(int device_index)
struct fx2_device *fx2;
int timediff, err;
if (!(sdi = sr_get_device_instance(device_instances, device_index)))
if (!(sdi = sr_get_dev_inst(device_instances, device_index)))
return SR_ERR;
fx2 = sdi->priv;
@ -449,7 +449,7 @@ static int hw_closedev(int device_index)
{
struct sr_device_instance *sdi;
if (!(sdi = sr_get_device_instance(device_instances, device_index))) {
if (!(sdi = sr_get_dev_inst(device_instances, device_index))) {
sr_err("logic: %s: sdi was NULL", __func__);
return SR_ERR; /* TODO: SR_ERR_ARG? */
}
@ -483,8 +483,8 @@ static int hw_cleanup(void)
continue;
}
close_device(sdi);
sr_usb_device_instance_free(fx2->usb);
sr_device_instance_free(sdi);
sr_usb_dev_inst_free(fx2->usb);
sr_dev_inst_free(sdi);
}
g_slist_free(device_instances);
@ -503,7 +503,7 @@ static void *hw_get_device_info(int device_index, int device_info_id)
struct fx2_device *fx2;
void *info = NULL;
if (!(sdi = sr_get_device_instance(device_instances, device_index)))
if (!(sdi = sr_get_dev_inst(device_instances, device_index)))
return NULL;
fx2 = sdi->priv;
@ -535,7 +535,7 @@ static int hw_get_status(int device_index)
{
struct sr_device_instance *sdi;
sdi = sr_get_device_instance(device_instances, device_index);
sdi = sr_get_dev_inst(device_instances, device_index);
if (sdi)
return sdi->status;
else
@ -632,7 +632,7 @@ static int hw_set_configuration(int device_index, int capability, void *value)
int ret;
uint64_t *tmp_u64;
if (!(sdi = sr_get_device_instance(device_instances, device_index)))
if (!(sdi = sr_get_dev_inst(device_instances, device_index)))
return SR_ERR;
fx2 = sdi->priv;
@ -815,7 +815,7 @@ static int hw_start_acquisition(int device_index, gpointer session_data)
int size, i;
unsigned char *buf;
if (!(sdi = sr_get_device_instance(device_instances, device_index)))
if (!(sdi = sr_get_dev_inst(device_instances, device_index)))
return SR_ERR;
fx2 = sdi->priv;
fx2->session_data = session_data;

View File

@ -245,7 +245,7 @@ static struct sr_device_instance *zp_open_device(int device_index)
struct libusb_device_descriptor des;
int err, i;
if (!(sdi = sr_get_device_instance(device_instances, device_index)))
if (!(sdi = sr_get_dev_inst(device_instances, device_index)))
return NULL;
libusb_get_device_list(usb_context, &devlist);
@ -385,7 +385,7 @@ static int hw_init(const char *deviceinfo)
* the zeroplus range?
*/
/* Register the device with libsigrok. */
sdi = sr_device_instance_new(devcnt,
sdi = sr_dev_inst_new(devcnt,
SR_ST_INACTIVE, USB_VENDOR_NAME,
USB_MODEL_NAME, USB_MODEL_VERSION);
if (!sdi) {
@ -398,7 +398,7 @@ static int hw_init(const char *deviceinfo)
device_instances =
g_slist_append(device_instances, sdi);
zp->usb = sr_usb_device_instance_new(
zp->usb = sr_usb_dev_inst_new(
libusb_get_bus_number(devlist[i]),
libusb_get_device_address(devlist[i]), NULL);
devcnt++;
@ -474,7 +474,7 @@ static int hw_closedev(int device_index)
{
struct sr_device_instance *sdi;
if (!(sdi = sr_get_device_instance(device_instances, device_index))) {
if (!(sdi = sr_get_dev_inst(device_instances, device_index))) {
sr_err("zp: %s: sdi was NULL", __func__);
return SR_ERR; /* TODO: SR_ERR_ARG? */
}
@ -514,7 +514,7 @@ static void *hw_get_device_info(int device_index, int device_info_id)
struct zp *zp;
void *info;
if (!(sdi = sr_get_device_instance(device_instances, device_index))) {
if (!(sdi = sr_get_dev_inst(device_instances, device_index))) {
sr_err("zp: %s: sdi was NULL", __func__);
return NULL;
}
@ -557,7 +557,7 @@ static int hw_get_status(int device_index)
{
struct sr_device_instance *sdi;
sdi = sr_get_device_instance(device_instances, device_index);
sdi = sr_get_dev_inst(device_instances, device_index);
if (sdi)
return sdi->status;
else
@ -604,7 +604,7 @@ static int hw_set_configuration(int device_index, int capability, void *value)
uint64_t *tmp_u64;
struct zp *zp;
if (!(sdi = sr_get_device_instance(device_instances, device_index))) {
if (!(sdi = sr_get_dev_inst(device_instances, device_index))) {
sr_err("zp: %s: sdi was NULL", __func__);
return SR_ERR;
}
@ -641,7 +641,7 @@ static int hw_start_acquisition(int device_index, gpointer session_data)
unsigned char *buf;
struct zp *zp;
if (!(sdi = sr_get_device_instance(device_instances, device_index))) {
if (!(sdi = sr_get_dev_inst(device_instances, device_index))) {
sr_err("zp: %s: sdi was NULL", __func__);
return SR_ERR;
}
@ -711,7 +711,7 @@ static int hw_stop_acquisition(int device_index, gpointer session_device_id)
packet.type = SR_DF_END;
sr_session_bus(session_device_id, &packet);
if (!(sdi = sr_get_device_instance(device_instances, device_index))) {
if (!(sdi = sr_get_dev_inst(device_instances, device_index))) {
sr_err("zp: %s: sdi was NULL", __func__);
return SR_ERR_BUG;
}

View File

@ -166,7 +166,7 @@ SR_PRIV void sr_hwplugins_cleanup(void)
}
}
SR_PRIV struct sr_device_instance *sr_device_instance_new(int index, int status,
SR_PRIV struct sr_device_instance *sr_dev_inst_new(int index, int status,
const char *vendor, const char *model, const char *version)
{
struct sr_device_instance *sdi;
@ -187,7 +187,7 @@ SR_PRIV struct sr_device_instance *sr_device_instance_new(int index, int status,
return sdi;
}
SR_PRIV struct sr_device_instance *sr_get_device_instance(
SR_PRIV struct sr_device_instance *sr_get_dev_inst(
GSList *device_instances, int device_index)
{
struct sr_device_instance *sdi;
@ -203,7 +203,7 @@ SR_PRIV struct sr_device_instance *sr_get_device_instance(
return NULL;
}
SR_PRIV void sr_device_instance_free(struct sr_device_instance *sdi)
SR_PRIV void sr_dev_inst_free(struct sr_device_instance *sdi)
{
g_free(sdi->priv);
g_free(sdi->vendor);
@ -214,7 +214,7 @@ SR_PRIV void sr_device_instance_free(struct sr_device_instance *sdi)
#ifdef HAVE_LIBUSB_1_0
SR_PRIV struct sr_usb_device_instance *sr_usb_device_instance_new(uint8_t bus,
SR_PRIV struct sr_usb_device_instance *sr_usb_dev_inst_new(uint8_t bus,
uint8_t address, struct libusb_device_handle *hdl)
{
struct sr_usb_device_instance *udi;
@ -231,7 +231,7 @@ SR_PRIV struct sr_usb_device_instance *sr_usb_device_instance_new(uint8_t bus,
return udi;
}
SR_PRIV void sr_usb_device_instance_free(struct sr_usb_device_instance *usb)
SR_PRIV void sr_usb_dev_inst_free(struct sr_usb_device_instance *usb)
{
/* Avoid compiler warnings. */
(void)usb;
@ -241,7 +241,7 @@ SR_PRIV void sr_usb_device_instance_free(struct sr_usb_device_instance *usb)
#endif
SR_PRIV struct sr_serial_device_instance *sr_serial_device_instance_new(
SR_PRIV struct sr_serial_device_instance *sr_serial_dev_inst_new(
const char *port, int fd)
{
struct sr_serial_device_instance *serial;
@ -257,7 +257,7 @@ SR_PRIV struct sr_serial_device_instance *sr_serial_device_instance_new(
return serial;
}
SR_PRIV void sr_serial_device_instance_free(
SR_PRIV void sr_serial_dev_inst_free(
struct sr_serial_device_instance *serial)
{
g_free(serial->port);
@ -270,7 +270,7 @@ SR_PRIV void sr_serial_device_instance_free(
* returned by a plugin's get_capabilities() function.
* @param hwcap The capability to find in the list.
*
* @return Returns TRUE if found, FALSE otherwise.
* @return TRUE if found, FALSE otherwise.
*/
SR_API gboolean sr_has_hwcap(int *capabilities, int hwcap)
{
@ -289,7 +289,7 @@ SR_API gboolean sr_has_hwcap(int *capabilities, int hwcap)
*
* @param hwcap The capability to find
*
* @return Returns a struct with information about the parameter, or NULL
* @return A struct with information about the parameter, or NULL
* if not found.
*/
SR_API struct sr_hwcap_option *sr_find_hwcap_option(int hwcap)

View File

@ -59,7 +59,7 @@ static struct session_vdevice *get_vdevice_by_index(int device_index)
/* TODO: Sanity checks on device_index. */
if (!(sdi = sr_get_device_instance(device_instances, device_index))) {
if (!(sdi = sr_get_dev_inst(device_instances, device_index))) {
sr_err("session driver: %s: device instance with device "
"index %d was not found", __func__, device_index);
return NULL;
@ -165,7 +165,7 @@ static int hw_cleanup(void)
/* TODO: Error handling. */
for (l = device_instances; l; l = l->next)
sr_device_instance_free(l->data);
sr_dev_inst_free(l->data);
g_slist_free(device_instances);
device_instances = NULL;
@ -181,7 +181,7 @@ static int hw_opendev(int device_index)
{
struct sr_device_instance *sdi;
sdi = sr_device_instance_new(device_index, SR_ST_INITIALIZING,
sdi = sr_dev_inst_new(device_index, SR_ST_INITIALIZING,
NULL, NULL, NULL);
if (!sdi)
return SR_ERR;

View File

@ -55,15 +55,15 @@ struct sr_serial_device_instance {
#ifdef HAVE_LIBUSB_1_0
/* USB-specific instances */
SR_PRIV struct sr_usb_device_instance *sr_usb_device_instance_new(uint8_t bus,
SR_PRIV struct sr_usb_device_instance *sr_usb_dev_inst_new(uint8_t bus,
uint8_t address, struct libusb_device_handle *hdl);
SR_PRIV void sr_usb_device_instance_free(struct sr_usb_device_instance *usb);
SR_PRIV void sr_usb_dev_inst_free(struct sr_usb_device_instance *usb);
#endif
/* Serial-specific instances */
SR_PRIV struct sr_serial_device_instance *sr_serial_device_instance_new(
SR_PRIV struct sr_serial_device_instance *sr_serial_dev_inst_new(
const char *port, int fd);
SR_PRIV void sr_serial_device_instance_free(
SR_PRIV void sr_serial_dev_inst_free(
struct sr_serial_device_instance *serial);
/*--- log.c -----------------------------------------------------------------*/
@ -86,11 +86,11 @@ SR_PRIV int sr_session_bus(struct sr_device *device,
struct sr_datafeed_packet *packet);
/* Generic device instances */
SR_PRIV struct sr_device_instance *sr_device_instance_new(int index,
SR_PRIV struct sr_device_instance *sr_dev_inst_new(int index,
int status, const char *vendor, const char *model, const char *version);
SR_PRIV struct sr_device_instance *sr_get_device_instance(
SR_PRIV struct sr_device_instance *sr_get_dev_inst(
GSList *device_instances, int device_index);
SR_PRIV void sr_device_instance_free(struct sr_device_instance *sdi);
SR_PRIV void sr_dev_inst_free(struct sr_device_instance *sdi);
SR_PRIV void sr_source_remove(int fd);
SR_PRIV void sr_source_add(int fd, int events, int timeout,