Simplify single device list handling

Some driver scan() functions only ever return a single device. For those it
is possible to slightly simplify the handling of the device list by
creating it on demand when the function returns.

Some drivers also have the following expression:
	devices = g_slist_append(devices, sdi);
	...
	if (!devices)
		...

This check will never evaluate to false so it is dropped as well.

Signed-off-by: Lars-Peter Clausen <lars@metafoo.de>
This commit is contained in:
Lars-Peter Clausen 2016-05-16 11:37:23 +02:00 committed by Uwe Hermann
parent 15a5bfe481
commit 43376f3324
17 changed files with 28 additions and 94 deletions

View File

@ -65,14 +65,13 @@ static GSList *scan(struct sr_dev_driver *di, GSList *options)
struct sr_serial_dev_inst *serial; struct sr_serial_dev_inst *serial;
struct sr_channel_group *cg; struct sr_channel_group *cg;
struct sr_channel *ch; struct sr_channel *ch;
GSList *l, *devices; GSList *l;
int ret, len; int ret, len;
const char *conn, *serialcomm; const char *conn, *serialcomm;
char buf[100]; char buf[100];
char *bufptr; char *bufptr;
double version; double version;
devices = NULL;
drvc = di->context; drvc = di->context;
conn = serialcomm = NULL; conn = serialcomm = NULL;
@ -145,13 +144,10 @@ static GSList *scan(struct sr_dev_driver *di, GSList *options)
devc = g_malloc0(sizeof(struct dev_context)); devc = g_malloc0(sizeof(struct dev_context));
sdi->priv = devc; sdi->priv = devc;
devices = g_slist_append(devices, sdi);
serial_close(serial); serial_close(serial);
if (!devices)
sr_serial_dev_inst_free(serial);
return std_scan_complete(di, devices); return std_scan_complete(di, g_slist_append(NULL, sdi));
} }
static int config_list(uint32_t key, GVariant **data, static int config_list(uint32_t key, GVariant **data,

View File

@ -65,7 +65,6 @@ static GSList *scan(struct sr_dev_driver *di, GSList *options)
{ {
struct sr_dev_inst *sdi; struct sr_dev_inst *sdi;
struct dev_context *devc; struct dev_context *devc;
GSList *devices;
struct ftdi_device_list *devlist; struct ftdi_device_list *devlist;
char serial_txt[10]; char serial_txt[10];
uint32_t serial; uint32_t serial;
@ -74,8 +73,6 @@ static GSList *scan(struct sr_dev_driver *di, GSList *options)
(void)options; (void)options;
devices = NULL;
devc = g_malloc0(sizeof(struct dev_context)); devc = g_malloc0(sizeof(struct dev_context));
ftdi_init(&devc->ftdic); ftdi_init(&devc->ftdic);
@ -120,13 +117,12 @@ static GSList *scan(struct sr_dev_driver *di, GSList *options)
for (i = 0; i < ARRAY_SIZE(channel_names); i++) for (i = 0; i < ARRAY_SIZE(channel_names); i++)
sr_channel_new(sdi, i, SR_CHANNEL_LOGIC, TRUE, channel_names[i]); sr_channel_new(sdi, i, SR_CHANNEL_LOGIC, TRUE, channel_names[i]);
devices = g_slist_append(devices, sdi);
sdi->priv = devc; sdi->priv = devc;
/* We will open the device again when we need it. */ /* We will open the device again when we need it. */
ftdi_list_free(&devlist); ftdi_list_free(&devlist);
return std_scan_complete(di, devices); return std_scan_complete(di, g_slist_append(NULL, sdi));
free: free:
ftdi_deinit(&devc->ftdic); ftdi_deinit(&devc->ftdic);

View File

@ -84,7 +84,7 @@ static GSList *scan(struct sr_dev_driver *di, GSList *options, int modelid)
struct sr_channel *ch; struct sr_channel *ch;
struct sr_channel_group *cg; struct sr_channel_group *cg;
struct sr_serial_dev_inst *serial; struct sr_serial_dev_inst *serial;
GSList *l, *devices; GSList *l;
const struct pps_model *model; const struct pps_model *model;
uint8_t packet[PACKET_SIZE]; uint8_t packet[PACKET_SIZE];
unsigned int i; unsigned int i;
@ -92,7 +92,6 @@ static GSList *scan(struct sr_dev_driver *di, GSList *options, int modelid)
const char *conn, *serialcomm; const char *conn, *serialcomm;
char channel[10]; char channel[10];
devices = NULL;
drvc = di->context; drvc = di->context;
conn = serialcomm = NULL; conn = serialcomm = NULL;
@ -175,13 +174,10 @@ static GSList *scan(struct sr_dev_driver *di, GSList *options, int modelid)
devc->config = g_malloc0(sizeof(struct per_channel_config) * model->num_channels); devc->config = g_malloc0(sizeof(struct per_channel_config) * model->num_channels);
devc->delay_ms = delay_ms; devc->delay_ms = delay_ms;
sdi->priv = devc; sdi->priv = devc;
devices = g_slist_append(devices, sdi);
serial_close(serial); serial_close(serial);
if (!devices)
sr_serial_dev_inst_free(serial);
return std_scan_complete(di, devices); return std_scan_complete(di, g_slist_append(NULL, sdi));
} }
static GSList *scan_3203(struct sr_dev_driver *di, GSList *options) static GSList *scan_3203(struct sr_dev_driver *di, GSList *options)

View File

@ -55,14 +55,11 @@ static GSList *scan(struct sr_dev_driver *di, GSList *options)
{ {
struct dev_context *devc; struct dev_context *devc;
struct sr_dev_inst *sdi; struct sr_dev_inst *sdi;
GSList *devices;
gboolean status; gboolean status;
int i; int i;
(void)options; (void)options;
devices = NULL;
devc = g_malloc0(sizeof(struct dev_context)); devc = g_malloc0(sizeof(struct dev_context));
devc->samplerate = SR_HZ(10); devc->samplerate = SR_HZ(10);
@ -120,9 +117,7 @@ static GSList *scan(struct sr_dev_driver *di, GSList *options)
if (!sdi->channel_groups) if (!sdi->channel_groups)
goto err_out; goto err_out;
devices = g_slist_append(devices, sdi); return std_scan_complete(di, g_slist_append(NULL, sdi));
return std_scan_complete(di, devices);
err_out: err_out:
g_free(devc); g_free(devc);

View File

@ -73,14 +73,12 @@ static struct dev_context *beaglelogic_devc_alloc(void)
static GSList *scan(struct sr_dev_driver *di, GSList *options) static GSList *scan(struct sr_dev_driver *di, GSList *options)
{ {
GSList *devices, *l; GSList *l;
struct sr_config *src; struct sr_config *src;
struct sr_dev_inst *sdi; struct sr_dev_inst *sdi;
struct dev_context *devc; struct dev_context *devc;
int i, maxch; int i, maxch;
devices = NULL;
/* Probe for /dev/beaglelogic */ /* Probe for /dev/beaglelogic */
if (!g_file_test(BEAGLELOGIC_DEV_NODE, G_FILE_TEST_EXISTS)) if (!g_file_test(BEAGLELOGIC_DEV_NODE, G_FILE_TEST_EXISTS))
return NULL; return NULL;
@ -128,9 +126,8 @@ static GSList *scan(struct sr_dev_driver *di, GSList *options)
channel_names[i]); channel_names[i]);
sdi->priv = devc; sdi->priv = devc;
devices = g_slist_append(devices, sdi);
return std_scan_complete(di, devices); return std_scan_complete(di, g_slist_append(NULL, sdi));
} }
static int dev_open(struct sr_dev_inst *sdi) static int dev_open(struct sr_dev_inst *sdi)

View File

@ -62,14 +62,12 @@ static GSList *center_scan(const char *conn, const char *serialcomm, int idx)
struct sr_dev_inst *sdi; struct sr_dev_inst *sdi;
struct dev_context *devc; struct dev_context *devc;
struct sr_serial_dev_inst *serial; struct sr_serial_dev_inst *serial;
GSList *devices;
serial = sr_serial_dev_inst_new(conn, serialcomm); serial = sr_serial_dev_inst_new(conn, serialcomm);
if (serial_open(serial, SERIAL_RDWR) != SR_OK) if (serial_open(serial, SERIAL_RDWR) != SR_OK)
return NULL; return NULL;
devices = NULL;
serial_flush(serial); serial_flush(serial);
sr_info("Found device on port %s.", conn); sr_info("Found device on port %s.", conn);
@ -86,11 +84,9 @@ static GSList *center_scan(const char *conn, const char *serialcomm, int idx)
for (i = 0; i < center_devs[idx].num_channels; i++) for (i = 0; i < center_devs[idx].num_channels; i++)
sr_channel_new(sdi, i, SR_CHANNEL_ANALOG, TRUE, channel_names[i]); sr_channel_new(sdi, i, SR_CHANNEL_ANALOG, TRUE, channel_names[i]);
devices = g_slist_append(devices, sdi);
serial_close(serial); serial_close(serial);
return devices; return g_slist_append(NULL, sdi);
} }
static GSList *scan(GSList *options, int idx) static GSList *scan(GSList *options, int idx)

View File

@ -47,11 +47,9 @@ static GSList *scan(struct sr_dev_driver *di, GSList *options)
struct dev_context *devc; struct dev_context *devc;
struct sr_dev_inst *sdi; struct sr_dev_inst *sdi;
struct sr_config *src; struct sr_config *src;
GSList *devices, *l; GSList *l;
const char *conn, *serialcomm; const char *conn, *serialcomm;
devices = NULL;
conn = serialcomm = NULL; conn = serialcomm = NULL;
for (l = options; l; l = l->next) { for (l = options; l; l = l->next) {
src = l->data; src = l->data;
@ -79,9 +77,8 @@ static GSList *scan(struct sr_dev_driver *di, GSList *options)
sdi->inst_type = SR_INST_SERIAL; sdi->inst_type = SR_INST_SERIAL;
sdi->priv = devc; sdi->priv = devc;
sr_channel_new(sdi, 0, SR_CHANNEL_ANALOG, TRUE, "P1"); sr_channel_new(sdi, 0, SR_CHANNEL_ANALOG, TRUE, "P1");
devices = g_slist_append(devices, sdi);
return std_scan_complete(di, devices); return std_scan_complete(di, g_slist_append(NULL, sdi));
} }
static int config_set(uint32_t key, GVariant *data, const struct sr_dev_inst *sdi, static int config_set(uint32_t key, GVariant *data, const struct sr_dev_inst *sdi,

View File

@ -45,10 +45,9 @@ static GSList *scan(struct sr_dev_driver *di, GSList *options)
struct drv_context *drvc; struct drv_context *drvc;
struct sr_config *src; struct sr_config *src;
struct sr_serial_dev_inst *serial; struct sr_serial_dev_inst *serial;
GSList *l, *devices; GSList *l;
const char *conn, *serialcomm; const char *conn, *serialcomm;
devices = NULL;
drvc = di->context; drvc = di->context;
conn = serialcomm = NULL; conn = serialcomm = NULL;
@ -91,9 +90,8 @@ static GSList *scan(struct sr_dev_driver *di, GSList *options)
sdi->conn = serial; sdi->conn = serial;
sdi->priv = NULL; sdi->priv = NULL;
sr_channel_new(sdi, 0, SR_CHANNEL_ANALOG, TRUE, "CH1"); sr_channel_new(sdi, 0, SR_CHANNEL_ANALOG, TRUE, "CH1");
devices = g_slist_append(devices, sdi);
return std_scan_complete(di, devices); return std_scan_complete(di, g_slist_append(NULL, sdi));
} }
static int config_set(uint32_t key, GVariant *data, const struct sr_dev_inst *sdi, static int config_set(uint32_t key, GVariant *data, const struct sr_dev_inst *sdi,

View File

@ -259,7 +259,7 @@ static GSList *scan(struct sr_dev_driver *di, GSList *options)
struct sr_channel_group *cg, *acg; struct sr_channel_group *cg, *acg;
struct sr_config *src; struct sr_config *src;
struct analog_gen *ag; struct analog_gen *ag;
GSList *devices, *l; GSList *l;
int num_logic_channels, num_analog_channels, pattern, i; int num_logic_channels, num_analog_channels, pattern, i;
char channel_name[16]; char channel_name[16];
@ -279,8 +279,6 @@ static GSList *scan(struct sr_dev_driver *di, GSList *options)
} }
} }
devices = NULL;
sdi = g_malloc0(sizeof(struct sr_dev_inst)); sdi = g_malloc0(sizeof(struct sr_dev_inst));
sdi->status = SR_ST_INACTIVE; sdi->status = SR_ST_INACTIVE;
sdi->model = g_strdup("Demo device"); sdi->model = g_strdup("Demo device");
@ -344,9 +342,8 @@ static GSList *scan(struct sr_dev_driver *di, GSList *options)
} }
sdi->priv = devc; sdi->priv = devc;
devices = g_slist_append(devices, sdi);
return std_scan_complete(di, devices); return std_scan_complete(di, g_slist_append(NULL, sdi));
} }
static int dev_open(struct sr_dev_inst *sdi) static int dev_open(struct sr_dev_inst *sdi)

View File

@ -68,7 +68,6 @@ static GSList *scan(struct sr_dev_driver *di, GSList *options)
struct sr_dev_inst *sdi; struct sr_dev_inst *sdi;
struct drv_context *drvc; struct drv_context *drvc;
struct dev_context *devc; struct dev_context *devc;
GSList *devices;
unsigned int i; unsigned int i;
int ret; int ret;
@ -76,8 +75,6 @@ static GSList *scan(struct sr_dev_driver *di, GSList *options)
drvc = di->context; drvc = di->context;
devices = NULL;
/* Allocate memory for our private device context. */ /* Allocate memory for our private device context. */
devc = g_malloc0(sizeof(struct dev_context)); devc = g_malloc0(sizeof(struct dev_context));
@ -120,12 +117,10 @@ static GSList *scan(struct sr_dev_driver *di, GSList *options)
for (i = 0; i < ARRAY_SIZE(channel_names); i++) for (i = 0; i < ARRAY_SIZE(channel_names); i++)
sr_channel_new(sdi, i, SR_CHANNEL_LOGIC, TRUE, channel_names[i]); sr_channel_new(sdi, i, SR_CHANNEL_LOGIC, TRUE, channel_names[i]);
devices = g_slist_append(devices, sdi);
/* Close device. We'll reopen it again when we need it. */ /* Close device. We'll reopen it again when we need it. */
scanaplus_close(devc); scanaplus_close(devc);
return std_scan_complete(di, devices); return std_scan_complete(di, g_slist_append(NULL, sdi));
scanaplus_close(devc); scanaplus_close(devc);
err_free_ftdic: err_free_ftdic:

View File

@ -65,7 +65,7 @@ static const struct korad_kaxxxxp_model models[] = {
static GSList *scan(struct sr_dev_driver *di, GSList *options) static GSList *scan(struct sr_dev_driver *di, GSList *options)
{ {
struct dev_context *devc; struct dev_context *devc;
GSList *devices, *l; GSList *l;
struct sr_dev_inst *sdi; struct sr_dev_inst *sdi;
struct sr_config *src; struct sr_config *src;
const char *conn, *serialcomm; const char *conn, *serialcomm;
@ -74,7 +74,6 @@ static GSList *scan(struct sr_dev_driver *di, GSList *options)
int i, model_id; int i, model_id;
unsigned int len; unsigned int len;
devices = NULL;
conn = NULL; conn = NULL;
serialcomm = NULL; serialcomm = NULL;
@ -151,13 +150,10 @@ static GSList *scan(struct sr_dev_driver *di, GSList *options)
/* Get current status of device. */ /* Get current status of device. */
if (korad_kaxxxxp_get_all_values(serial, devc) < 0) if (korad_kaxxxxp_get_all_values(serial, devc) < 0)
goto exit_err; goto exit_err;
devices = g_slist_append(devices, sdi);
serial_close(serial); serial_close(serial);
if (!devices)
sr_serial_dev_inst_free(serial);
return std_scan_complete(di, devices); return std_scan_complete(di, g_slist_append(NULL, sdi));
exit_err: exit_err:
sr_dev_inst_free(sdi); sr_dev_inst_free(sdi);

View File

@ -79,12 +79,11 @@ static GSList *scan(struct sr_dev_driver *di, GSList *options)
struct dev_context *devc; struct dev_context *devc;
struct sr_dev_inst *sdi; struct sr_dev_inst *sdi;
struct sr_config *src; struct sr_config *src;
GSList *devices, *l; GSList *l;
const char *conn, *serialcomm; const char *conn, *serialcomm;
struct sr_serial_dev_inst *serial; struct sr_serial_dev_inst *serial;
char reply[50], **tokens, *dummy; char reply[50], **tokens, *dummy;
devices = NULL;
conn = NULL; conn = NULL;
serialcomm = NULL; serialcomm = NULL;
devc = NULL; devc = NULL;
@ -174,13 +173,9 @@ static GSList *scan(struct sr_dev_driver *di, GSList *options)
devc->voltage_max_device = g_strtod(tokens[0], &dummy) * devc->model->voltage[2]; devc->voltage_max_device = g_strtod(tokens[0], &dummy) * devc->model->voltage[2];
g_strfreev(tokens); g_strfreev(tokens);
devices = g_slist_append(devices, sdi);
serial_close(serial); serial_close(serial);
if (!devices)
sr_serial_dev_inst_free(serial);
return std_scan_complete(di, devices); return std_scan_complete(di, g_slist_append(NULL, sdi));
exit_err: exit_err:
sr_dev_inst_free(sdi); sr_dev_inst_free(sdi);

View File

@ -62,14 +62,12 @@ static GSList *mic_scan(const char *conn, const char *serialcomm, int idx)
struct sr_dev_inst *sdi; struct sr_dev_inst *sdi;
struct dev_context *devc; struct dev_context *devc;
struct sr_serial_dev_inst *serial; struct sr_serial_dev_inst *serial;
GSList *devices;
serial = sr_serial_dev_inst_new(conn, serialcomm); serial = sr_serial_dev_inst_new(conn, serialcomm);
if (serial_open(serial, SERIAL_RDWR) != SR_OK) if (serial_open(serial, SERIAL_RDWR) != SR_OK)
return NULL; return NULL;
devices = NULL;
serial_flush(serial); serial_flush(serial);
/* TODO: Query device type. */ /* TODO: Query device type. */
@ -93,11 +91,9 @@ static GSList *mic_scan(const char *conn, const char *serialcomm, int idx)
if (mic_devs[idx].has_humidity) if (mic_devs[idx].has_humidity)
sr_channel_new(sdi, 1, SR_CHANNEL_ANALOG, TRUE, "Humidity"); sr_channel_new(sdi, 1, SR_CHANNEL_ANALOG, TRUE, "Humidity");
devices = g_slist_append(devices, sdi);
serial_close(serial); serial_close(serial);
return std_scan_complete(mic_devs[idx].di, devices); return std_scan_complete(mic_devs[idx].di, g_slist_append(NULL, sdi));
} }
static GSList *scan(GSList *options, int idx) static GSList *scan(GSList *options, int idx)

View File

@ -370,7 +370,6 @@ static GSList *do_scan(lps_modelid modelid, struct sr_dev_driver *drv, GSList *o
struct sr_serial_dev_inst *serial; struct sr_serial_dev_inst *serial;
struct sr_channel *ch; struct sr_channel *ch;
struct sr_channel_group *cg; struct sr_channel_group *cg;
GSList *devices;
const char *conn, *serialcomm; const char *conn, *serialcomm;
int cnt, ret; int cnt, ret;
gchar buf[LINELEN_MAX]; gchar buf[LINELEN_MAX];
@ -380,7 +379,6 @@ static GSList *do_scan(lps_modelid modelid, struct sr_dev_driver *drv, GSList *o
sdi = NULL; sdi = NULL;
devc = NULL; devc = NULL;
conn = serialcomm = NULL; conn = serialcomm = NULL;
devices = NULL;
sr_spew("scan() called!"); sr_spew("scan() called!");
@ -468,17 +466,13 @@ static GSList *do_scan(lps_modelid modelid, struct sr_dev_driver *drv, GSList *o
sdi->channel_groups = g_slist_append(sdi->channel_groups, cg); sdi->channel_groups = g_slist_append(sdi->channel_groups, cg);
} }
devices = g_slist_append(devices, sdi);
/* Query status */ /* Query status */
if (lps_query_status(sdi) != SR_OK) if (lps_query_status(sdi) != SR_OK)
goto exit_err; goto exit_err;
serial_close(serial); serial_close(serial);
if (!devices)
sr_serial_dev_inst_free(serial);
return std_scan_complete(drv, devices); return std_scan_complete(drv, g_slist_append(NULL, sdi));
exit_err: exit_err:
sr_info("%s: Error!", __func__); sr_info("%s: Error!", __func__);

View File

@ -90,14 +90,12 @@ static GSList *scan(struct sr_dev_driver *di, GSList *options)
struct sr_config *src; struct sr_config *src;
struct sr_dev_inst *sdi; struct sr_dev_inst *sdi;
struct sr_serial_dev_inst *serial; struct sr_serial_dev_inst *serial;
GSList *l, *devices; GSList *l;
int ret; int ret;
unsigned int i; unsigned int i;
const char *conn, *serialcomm; const char *conn, *serialcomm;
char buf[8]; char buf[8];
devices = NULL;
conn = serialcomm = NULL; conn = serialcomm = NULL;
for (l = options; l; l = l->next) { for (l = options; l; l = l->next) {
src = l->data; src = l->data;
@ -191,11 +189,9 @@ static GSList *scan(struct sr_dev_driver *di, GSList *options)
sdi->inst_type = SR_INST_SERIAL; sdi->inst_type = SR_INST_SERIAL;
sdi->conn = serial; sdi->conn = serial;
devices = g_slist_append(devices, sdi);
serial_close(serial); serial_close(serial);
return std_scan_complete(di, devices); return std_scan_complete(di, g_slist_append(NULL, sdi));
} }
static int config_get(uint32_t key, GVariant **data, const struct sr_dev_inst *sdi, static int config_get(uint32_t key, GVariant **data, const struct sr_dev_inst *sdi,

View File

@ -63,7 +63,7 @@ static GSList *scan(struct sr_dev_driver *di, GSList *options)
struct sr_config *src; struct sr_config *src;
struct sr_serial_dev_inst *serial; struct sr_serial_dev_inst *serial;
struct sr_dev_inst *sdi; struct sr_dev_inst *sdi;
GSList *l, *devices; GSList *l;
const char *conn; const char *conn;
conn = NULL; conn = NULL;
@ -80,8 +80,6 @@ static GSList *scan(struct sr_dev_driver *di, GSList *options)
if (serial_open(serial, SERIAL_RDONLY) != SR_OK) if (serial_open(serial, SERIAL_RDONLY) != SR_OK)
return NULL; return NULL;
devices = NULL;
sdi = g_malloc0(sizeof(struct sr_dev_inst)); sdi = g_malloc0(sizeof(struct sr_dev_inst));
sdi->status = SR_ST_INACTIVE; sdi->status = SR_ST_INACTIVE;
sdi->vendor = g_strdup("PCE"); sdi->vendor = g_strdup("PCE");
@ -92,11 +90,10 @@ static GSList *scan(struct sr_dev_driver *di, GSList *options)
sdi->inst_type = SR_INST_SERIAL; sdi->inst_type = SR_INST_SERIAL;
sdi->priv = devc; sdi->priv = devc;
sr_channel_new(sdi, 0, SR_CHANNEL_ANALOG, TRUE, "SPL"); sr_channel_new(sdi, 0, SR_CHANNEL_ANALOG, TRUE, "SPL");
devices = g_slist_append(devices, sdi);
serial_close(serial); serial_close(serial);
return std_scan_complete(di, devices); return std_scan_complete(di, g_slist_append(NULL, sdi));
} }
static int dev_clear(const struct sr_dev_driver *di) static int dev_clear(const struct sr_dev_driver *di)

View File

@ -45,14 +45,12 @@ static GSList *scan(struct sr_dev_driver *di, GSList *options)
struct dev_context *devc; struct dev_context *devc;
struct sr_dev_inst *sdi; struct sr_dev_inst *sdi;
struct sr_config *src; struct sr_config *src;
GSList *devices, *l; GSList *l;
const char *conn, *serialcomm; const char *conn, *serialcomm;
struct sr_serial_dev_inst *serial; struct sr_serial_dev_inst *serial;
drvc = di->context; drvc = di->context;
devices = NULL;
conn = serialcomm = NULL; conn = serialcomm = NULL;
for (l = options; l; l = l->next) { for (l = options; l; l = l->next) {
if (!(src = l->data)) { if (!(src = l->data)) {
@ -93,9 +91,8 @@ static GSList *scan(struct sr_dev_driver *di, GSList *options)
sdi->priv = devc; sdi->priv = devc;
sr_channel_new(sdi, 0, SR_CHANNEL_ANALOG, TRUE, "P1"); sr_channel_new(sdi, 0, SR_CHANNEL_ANALOG, TRUE, "P1");
devices = g_slist_append(devices, sdi);
return std_scan_complete(di, devices); return std_scan_complete(di, g_slist_append(NULL, sdi));
} }
static int config_set(uint32_t key, GVariant *data, const struct sr_dev_inst *sdi, static int config_set(uint32_t key, GVariant *data, const struct sr_dev_inst *sdi,