]> sigrok.org Git - libsigrok.git/commitdiff
Introduce standard implementation of the dev_list() callback
authorLars-Peter Clausen <redacted>
Fri, 29 Apr 2016 13:47:04 +0000 (15:47 +0200)
committerLars-Peter Clausen <redacted>
Tue, 3 May 2016 19:25:16 +0000 (21:25 +0200)
Every single hardware driver has the very same implementation of the
dev_list() callback. Put this into a helper function in the standard helper
library and use it throughout the drivers. This reduces boiler-plate code
by quite a bit.

Signed-off-by: Lars-Peter Clausen <redacted>
56 files changed:
src/hardware/agilent-dmm/api.c
src/hardware/appa-55ii/api.c
src/hardware/arachnid-labs-re-load-pro/api.c
src/hardware/asix-sigma/api.c
src/hardware/atten-pps3xxx/api.c
src/hardware/baylibre-acme/api.c
src/hardware/beaglelogic/api.c
src/hardware/brymen-bm86x/api.c
src/hardware/brymen-dmm/api.c
src/hardware/cem-dt-885x/api.c
src/hardware/center-3xx/api.c
src/hardware/chronovu-la/api.c
src/hardware/colead-slm/api.c
src/hardware/conrad-digi-35-cpu/api.c
src/hardware/demo/demo.c
src/hardware/deree-de5000/api.c
src/hardware/fluke-dmm/api.c
src/hardware/ftdi-la/api.c
src/hardware/fx2lafw/api.c
src/hardware/gmc-mh-1x-2x/api.c
src/hardware/gwinstek-gds-800/api.c
src/hardware/hameg-hmo/api.c
src/hardware/hantek-6xxx/api.c
src/hardware/hantek-dso/api.c
src/hardware/hp-3457a/api.c
src/hardware/hung-chang-dso-2100/api.c
src/hardware/ikalogic-scanalogic2/api.c
src/hardware/ikalogic-scanaplus/api.c
src/hardware/kecheng-kc-330b/api.c
src/hardware/kern-scale/api.c
src/hardware/korad-kaxxxxp/api.c
src/hardware/lascar-el-usb/api.c
src/hardware/lecroy-logicstudio/api.c
src/hardware/link-mso19/api.c
src/hardware/manson-hcs-3xxx/api.c
src/hardware/maynuo-m97/api.c
src/hardware/mic-985xx/api.c
src/hardware/motech-lps-30x/api.c
src/hardware/norma-dmm/api.c
src/hardware/openbench-logic-sniffer/api.c
src/hardware/pipistrello-ols/api.c
src/hardware/rigol-ds/api.c
src/hardware/saleae-logic16/api.c
src/hardware/scpi-pps/api.c
src/hardware/serial-dmm/api.c
src/hardware/sysclk-lwla/api.c
src/hardware/teleinfo/api.c
src/hardware/testo/api.c
src/hardware/tondaj-sl-814/api.c
src/hardware/uni-t-dmm/api.c
src/hardware/uni-t-ut32x/api.c
src/hardware/victor-dmm/api.c
src/hardware/yokogawa-dlm/api.c
src/hardware/zeroplus-logic-cube/api.c
src/libsigrok-internal.h
src/std.c

index d2a11cc7c71e0482b45afc44d3c90206f1e0b1de..4ce966d9d67dfc722cbd3f5ea35abcc44cb4269c 100644 (file)
@@ -161,11 +161,6 @@ static GSList *scan(struct sr_dev_driver *di, GSList *options)
        return devices;
 }
 
-static GSList *dev_list(const struct sr_dev_driver *di)
-{
-       return ((struct drv_context *)(di->context))->instances;
-}
-
 static int config_set(uint32_t key, GVariant *data, const struct sr_dev_inst *sdi,
                const struct sr_channel_group *cg)
 {
@@ -251,7 +246,7 @@ SR_PRIV struct sr_dev_driver agdmm_driver_info = {
        .init = init,
        .cleanup = std_cleanup,
        .scan = scan,
-       .dev_list = dev_list,
+       .dev_list = std_dev_list,
        .dev_clear = NULL,
        .config_get = NULL,
        .config_set = config_set,
index 27b4399abe97e056222e5ca4724c9620101cead1..cdf30af8bf850a3d5c052d0a52ec2c0a3c54540c 100644 (file)
@@ -121,11 +121,6 @@ scan_cleanup:
        return devices;
 }
 
-static GSList *dev_list(const struct sr_dev_driver *di)
-{
-       return ((struct drv_context *)(di->context))->instances;
-}
-
 static int config_get(uint32_t key, GVariant **data, const struct sr_dev_inst *sdi,
                const struct sr_channel_group *cg)
 {
@@ -261,7 +256,7 @@ SR_PRIV struct sr_dev_driver appa_55ii_driver_info = {
        .init = init,
        .cleanup = std_cleanup,
        .scan = scan,
-       .dev_list = dev_list,
+       .dev_list = std_dev_list,
        .dev_clear = NULL,
        .config_get = config_get,
        .config_set = config_set,
index 323f7cf5bed65683d630b5fc073ac73e8503b8b9..5a6ad00748cc9abcd3fa6a7620636a2018681b0a 100644 (file)
@@ -164,11 +164,6 @@ static GSList *scan(struct sr_dev_driver *di, GSList *options)
        return devices;
 }
 
-static GSList *dev_list(const struct sr_dev_driver *di)
-{
-       return ((struct drv_context *)(di->context))->instances;
-}
-
 static int config_list(uint32_t key, GVariant **data,
        const struct sr_dev_inst *sdi, const struct sr_channel_group *cg)
 {
@@ -377,7 +372,7 @@ SR_PRIV struct sr_dev_driver arachnid_labs_re_load_pro_driver_info = {
        .init = init,
        .cleanup = std_cleanup,
        .scan = scan,
-       .dev_list = dev_list,
+       .dev_list = std_dev_list,
        .config_get = config_get,
        .config_set = config_set,
        .config_list = config_list,
index 25b5cad3b22b366445c1fce26fcaea5bf7eb8536..77e989a934e9a04a0414922dde14bfbafb361eb5 100644 (file)
@@ -146,11 +146,6 @@ free:
        return NULL;
 }
 
-static GSList *dev_list(const struct sr_dev_driver *di)
-{
-       return ((struct drv_context *)(di->context))->instances;
-}
-
 static int dev_open(struct sr_dev_inst *sdi)
 {
        struct dev_context *devc;
@@ -422,7 +417,7 @@ SR_PRIV struct sr_dev_driver asix_sigma_driver_info = {
        .init = init,
        .cleanup = std_cleanup,
        .scan = scan,
-       .dev_list = dev_list,
+       .dev_list = std_dev_list,
        .dev_clear = dev_clear,
        .config_get = config_get,
        .config_set = config_set,
index ce0531c967195cad2487a5bb85f632750fcbf2b2..85a32a4a99a4e144800a417eec1c8056fa8a4afa 100644 (file)
@@ -199,11 +199,6 @@ static GSList *scan_3203(struct sr_dev_driver *di, GSList *options)
        return scan(di, options, PPS_3203T_3S);
 }
 
-static GSList *dev_list(const struct sr_dev_driver *di)
-{
-       return ((struct drv_context *)(di->context))->instances;
-}
-
 static int config_get(uint32_t key, GVariant **data, const struct sr_dev_inst *sdi,
                const struct sr_channel_group *cg)
 {
@@ -504,7 +499,7 @@ SR_PRIV struct sr_dev_driver atten_pps3203_driver_info = {
        .init = init,
        .cleanup = std_cleanup,
        .scan = scan_3203,
-       .dev_list = dev_list,
+       .dev_list = std_dev_list,
        .dev_clear = NULL,
        .config_get = config_get,
        .config_set = config_set,
index cdf9968b20b94ad33217ebfa1c6f8ff93849d8be..b4a7f8c6d7491ac252c0ac7786effaa489d1d5e5 100644 (file)
@@ -142,11 +142,6 @@ err_out:
        return NULL;
 }
 
-static GSList *dev_list(const struct sr_dev_driver *di)
-{
-       return ((struct drv_context *)(di->context))->instances;
-}
-
 static int dev_open(struct sr_dev_inst *sdi)
 {
        (void)sdi;
@@ -412,7 +407,7 @@ SR_PRIV struct sr_dev_driver baylibre_acme_driver_info = {
        .init = init,
        .cleanup = std_cleanup,
        .scan = scan,
-       .dev_list = dev_list,
+       .dev_list = std_dev_list,
        .config_get = config_get,
        .config_set = config_set,
        .config_list = config_list,
index cba429cacdd4966a928a07818632130ac2448143..8694d8fde6c8eb607742305c22b2d91553968312 100644 (file)
@@ -145,11 +145,6 @@ static GSList *scan(struct sr_dev_driver *di, GSList *options)
        return devices;
 }
 
-static GSList *dev_list(const struct sr_dev_driver *di)
-{
-       return ((struct drv_context *)(di->context))->instances;
-}
-
 static int dev_open(struct sr_dev_inst *sdi)
 {
        struct dev_context *devc = sdi->priv;
@@ -375,7 +370,7 @@ SR_PRIV struct sr_dev_driver beaglelogic_driver_info = {
        .init = init,
        .cleanup = std_cleanup,
        .scan = scan,
-       .dev_list = dev_list,
+       .dev_list = std_dev_list,
        .config_get = config_get,
        .config_set = config_set,
        .config_list = config_list,
index 8b6f5ee30f02b9b064acb0a0c1b2e6f6b3ad7fb6..87c328d9114a69a9c81773476e33ac8aed2d9961 100644 (file)
@@ -92,11 +92,6 @@ static GSList *scan(struct sr_dev_driver *di, GSList *options)
        return devices;
 }
 
-static GSList *dev_list(const struct sr_dev_driver *di)
-{
-       return ((struct drv_context *)(di->context))->instances;
-}
-
 static int dev_open(struct sr_dev_inst *sdi)
 {
        struct sr_dev_driver *di = sdi->driver;
@@ -281,7 +276,7 @@ SR_PRIV struct sr_dev_driver brymen_bm86x_driver_info = {
        .init = init,
        .cleanup = std_cleanup,
        .scan = scan,
-       .dev_list = dev_list,
+       .dev_list = std_dev_list,
        .dev_clear = NULL,
        .config_get = config_get,
        .config_set = config_set,
index 9868cdf1480d182c84c642ac1f181ef91be7c04e..a4f96a44c54f9a1c89bfc5d4938bcda1a5655467 100644 (file)
@@ -131,11 +131,6 @@ static GSList *scan(struct sr_dev_driver *di, GSList *options)
        return devices;
 }
 
-static GSList *dev_list(const struct sr_dev_driver *di)
-{
-       return ((struct drv_context *)(di->context))->instances;
-}
-
 static int config_set(uint32_t key, GVariant *data, const struct sr_dev_inst *sdi,
                const struct sr_channel_group *cg)
 {
@@ -230,7 +225,7 @@ SR_PRIV struct sr_dev_driver brymen_bm857_driver_info = {
        .init = init,
        .cleanup = std_cleanup,
        .scan = scan,
-       .dev_list = dev_list,
+       .dev_list = std_dev_list,
        .dev_clear = NULL,
        .config_get = NULL,
        .config_set = config_set,
index 59137d6da2ac236e4330c17542ce615d572e2b82..9eb8bf0624f5c10c272cf2f5a4b43c578f53307a 100644 (file)
@@ -136,11 +136,6 @@ static GSList *scan(struct sr_dev_driver *di, GSList *options)
        return devices;
 }
 
-static GSList *dev_list(const struct sr_dev_driver *di)
-{
-       return ((struct drv_context *)(di->context))->instances;
-}
-
 static int config_get(uint32_t key, GVariant **data, const struct sr_dev_inst *sdi,
                const struct sr_channel_group *cg)
 {
@@ -399,7 +394,7 @@ SR_PRIV struct sr_dev_driver cem_dt_885x_driver_info = {
        .init = init,
        .cleanup = std_cleanup,
        .scan = scan,
-       .dev_list = dev_list,
+       .dev_list = std_dev_list,
        .dev_clear = NULL,
        .config_get = config_get,
        .config_set = config_set,
index 7f08d9dad70832af465e9833bf60c87b31ee86ba..2e72cc969ce68b820bfda39374e19699337f4c9f 100644 (file)
@@ -134,11 +134,6 @@ static GSList *scan(GSList *options, int idx)
        return devices;
 }
 
-static GSList *dev_list(int idx)
-{
-       return ((struct drv_context *)(center_devs[idx].di->context))->instances;
-}
-
 static int config_set(uint32_t key, GVariant *data, const struct sr_dev_inst *sdi,
                const struct sr_channel_group *cg)
 {
@@ -229,9 +224,6 @@ static int init_##X(struct sr_dev_driver *d, \
 #define HW_SCAN(X) \
 static GSList *scan_##X(struct sr_dev_driver *d, GSList *options) { \
        (void)d; return scan(options, X); }
-#define HW_DEV_LIST(X) \
-static GSList *dev_list_##X(const struct sr_dev_driver *d) { \
-       (void)d; return dev_list(X); }
 #define HW_DEV_ACQUISITION_START(X) \
 static int dev_acquisition_start_##X(const struct sr_dev_inst *sdi \
 ) { return dev_acquisition_start(sdi, X); }
@@ -240,7 +232,6 @@ static int dev_acquisition_start_##X(const struct sr_dev_inst *sdi \
 #define DRV(ID, ID_UPPER, NAME, LONGNAME) \
 HW_INIT(ID_UPPER) \
 HW_SCAN(ID_UPPER) \
-HW_DEV_LIST(ID_UPPER) \
 HW_DEV_ACQUISITION_START(ID_UPPER) \
 SR_PRIV struct sr_dev_driver ID##_driver_info = { \
        .name = NAME, \
@@ -249,7 +240,7 @@ SR_PRIV struct sr_dev_driver ID##_driver_info = { \
        .init = init_##ID_UPPER, \
        .cleanup = std_cleanup, \
        .scan = scan_##ID_UPPER, \
-       .dev_list = dev_list_##ID_UPPER, \
+       .dev_list = std_dev_list, \
        .config_get = NULL, \
        .config_set = config_set, \
        .config_list = config_list, \
index bd922d0570bb4363c2d7e31fe6fbfa86a5fac63a..1e6f5f415bdeed7f660766372b2588d1817c348d 100644 (file)
@@ -245,11 +245,6 @@ static GSList *scan(struct sr_dev_driver *di, GSList *options)
        return devices;
 }
 
-static GSList *dev_list(const struct sr_dev_driver *di)
-{
-       return ((struct drv_context *)(di->context))->instances;
-}
-
 static int dev_open(struct sr_dev_inst *sdi)
 {
        struct dev_context *devc;
@@ -585,7 +580,7 @@ SR_PRIV struct sr_dev_driver chronovu_la_driver_info = {
        .init = init,
        .cleanup = std_cleanup,
        .scan = scan,
-       .dev_list = dev_list,
+       .dev_list = std_dev_list,
        .dev_clear = dev_clear,
        .config_get = config_get,
        .config_set = config_set,
index 4a0b61e5a8c99458aecdcad78a761ac30233feb7..880c6039f44402f377c21e2d34409dc4cfdb17ab 100644 (file)
@@ -96,11 +96,6 @@ static GSList *scan(struct sr_dev_driver *di, GSList *options)
        return devices;
 }
 
-static GSList *dev_list(const struct sr_dev_driver *di)
-{
-       return ((struct drv_context *)(di->context))->instances;
-}
-
 static int config_set(uint32_t key, GVariant *data, const struct sr_dev_inst *sdi,
                const struct sr_channel_group *cg)
 {
@@ -183,7 +178,7 @@ SR_PRIV struct sr_dev_driver colead_slm_driver_info = {
        .init = init,
        .cleanup = std_cleanup,
        .scan = scan,
-       .dev_list = dev_list,
+       .dev_list = std_dev_list,
        .dev_clear = NULL,
        .config_get = NULL,
        .config_set = config_set,
index 0195f4809d471b2b708d78e17898d23a6698d357..92798e8212d2330895166b86f4d8ab6cea023336 100644 (file)
@@ -106,11 +106,6 @@ static GSList *scan(struct sr_dev_driver *di, GSList *options)
        return devices;
 }
 
-static GSList *dev_list(const struct sr_dev_driver *di)
-{
-       return ((struct drv_context *)(di->context))->instances;
-}
-
 static int config_set(uint32_t key, GVariant *data, const struct sr_dev_inst *sdi,
                const struct sr_channel_group *cg)
 {
@@ -200,7 +195,7 @@ SR_PRIV struct sr_dev_driver conrad_digi_35_cpu_driver_info = {
        .init = init,
        .cleanup = std_cleanup,
        .scan = scan,
-       .dev_list = dev_list,
+       .dev_list = std_dev_list,
        .dev_clear = NULL,
        .config_get = NULL,
        .config_set = config_set,
index 15a4c60d3f9aac4838d81a395d9bd75ef1dac905..10a3eb029cb28d858f0c5360ce83ef7b0d28e8e6 100644 (file)
@@ -354,11 +354,6 @@ static GSList *scan(struct sr_dev_driver *di, GSList *options)
        return devices;
 }
 
-static GSList *dev_list(const struct sr_dev_driver *di)
-{
-       return ((struct drv_context *)(di->context))->instances;
-}
-
 static int dev_open(struct sr_dev_inst *sdi)
 {
        sdi->status = SR_ST_ACTIVE;
@@ -891,7 +886,7 @@ SR_PRIV struct sr_dev_driver demo_driver_info = {
        .init = init,
        .cleanup = std_cleanup,
        .scan = scan,
-       .dev_list = dev_list,
+       .dev_list = std_dev_list,
        .dev_clear = dev_clear,
        .config_get = config_get,
        .config_set = config_set,
index 8c24eb18d2631a0a341a8c5ba66b9cfef3116bb8..2f1109b553f66646d1cd75d42a077041ce6aea1c 100644 (file)
@@ -35,11 +35,6 @@ static void std_dev_attach(struct sr_dev_driver *di, struct sr_dev_inst *sdi)
        drvc->instances = g_slist_append(drvc->instances, sdi);
 }
 
-static GSList *dev_list(const struct sr_dev_driver *di)
-{
-       return ((struct drv_context *)di->context)->instances;
-}
-
 #define LOG_PREFIX "deree-de5000"
 
 SR_PRIV struct sr_dev_driver deree_de5000_driver_info;
@@ -73,7 +68,7 @@ SR_PRIV struct sr_dev_driver deree_de5000_driver_info = {
        .init = init,
        .cleanup = std_cleanup,
        .scan = scan,
-       .dev_list = dev_list,
+       .dev_list = std_dev_list,
        .dev_clear = dev_clear,
        .config_get = es51919_serial_config_get,
        .config_set = es51919_serial_config_set,
index dc55aa4143cf3ad16727907945e222f09f4c6d35..b352355c35186b6ac0338e5694eb13fc1b0e7fac 100644 (file)
@@ -189,11 +189,6 @@ static GSList *scan(struct sr_dev_driver *di, GSList *options)
        return devices;
 }
 
-static GSList *dev_list(const struct sr_dev_driver *di)
-{
-       return ((struct drv_context *)(di->context))->instances;
-}
-
 static int config_set(uint32_t key, GVariant *data, const struct sr_dev_inst *sdi,
                const struct sr_channel_group *cg)
 {
@@ -286,7 +281,7 @@ SR_PRIV struct sr_dev_driver flukedmm_driver_info = {
        .init = init,
        .cleanup = std_cleanup,
        .scan = scan,
-       .dev_list = dev_list,
+       .dev_list = std_dev_list,
        .dev_clear = NULL,
        .config_get = NULL,
        .config_set = config_set,
index 547e25e4c4ffe06e7d40720350aee6173b3cf11a..a2cc4a75db3d8333b545d234bd84f69d52b8897f 100644 (file)
@@ -263,11 +263,6 @@ static GSList *scan(struct sr_dev_driver *di, GSList *options)
                return scan_all(di, options);
 }
 
-static GSList *dev_list(const struct sr_dev_driver *di)
-{
-       return ((struct drv_context *)(di->context))->instances;
-}
-
 static void clear_helper(void *priv)
 {
        struct dev_context *devc;
@@ -499,7 +494,7 @@ SR_PRIV struct sr_dev_driver ftdi_la_driver_info = {
        .init = init,
        .cleanup = std_cleanup,
        .scan = scan,
-       .dev_list = dev_list,
+       .dev_list = std_dev_list,
        .dev_clear = dev_clear,
        .config_get = config_get,
        .config_set = config_set,
index fcc98fa9a0861753d6159cb052156d06369a665b..368873abaeec7f316efc7c8c84c5d24c6daac2e2 100644 (file)
@@ -399,11 +399,6 @@ static int dev_clear(const struct sr_dev_driver *di)
        return std_dev_clear(di, clear_dev_context);
 }
 
-static GSList *dev_list(const struct sr_dev_driver *di)
-{
-       return ((struct drv_context *)(di->context))->instances;
-}
-
 static int dev_open(struct sr_dev_inst *sdi)
 {
        struct sr_dev_driver *di = sdi->driver;
@@ -899,7 +894,7 @@ SR_PRIV struct sr_dev_driver fx2lafw_driver_info = {
        .init = init,
        .cleanup = std_cleanup,
        .scan = scan,
-       .dev_list = dev_list,
+       .dev_list = std_dev_list,
        .dev_clear = dev_clear,
        .config_get = config_get,
        .config_set = config_set,
index b8f71c2fda17c648d2c610e9622fd6c9183e0612..2f0f671c90f6a8204da88632cf83e6ba576e7d84 100644 (file)
@@ -351,11 +351,6 @@ exit_err:
        return NULL;
 }
 
-static GSList *dev_list(const struct sr_dev_driver *di)
-{
-       return ((struct drv_context *)(di->context))->instances;
-}
-
 static int dev_close(struct sr_dev_inst *sdi)
 {
        struct dev_context *devc;
@@ -526,7 +521,7 @@ SR_PRIV struct sr_dev_driver gmc_mh_1x_2x_rs232_driver_info = {
        .init = init,
        .cleanup = std_cleanup,
        .scan = scan_1x_2x_rs232,
-       .dev_list = dev_list,
+       .dev_list = std_dev_list,
        .dev_clear = NULL,
        .config_get = config_get,
        .config_set = config_set,
@@ -545,7 +540,7 @@ SR_PRIV struct sr_dev_driver gmc_mh_2x_bd232_driver_info = {
        .init = init,
        .cleanup = std_cleanup,
        .scan = scan_2x_bd232,
-       .dev_list = dev_list,
+       .dev_list = std_dev_list,
        .dev_clear = NULL,
        .config_get = config_get,
        .config_set = config_set,
index c26ec2617142e5d19c9575b62e128bf6ccd3d467..0da6760ab875d253ba370302b919610efa543b3f 100644 (file)
@@ -93,11 +93,6 @@ static GSList *scan(struct sr_dev_driver *di, GSList *options)
        return sr_scpi_scan(di->context, options, probe_device);
 }
 
-static GSList *dev_list(const struct sr_dev_driver *di)
-{
-       return ((struct drv_context *)(di->context))->instances;
-}
-
 static int dev_open(struct sr_dev_inst *sdi)
 {
        int ret;
@@ -252,7 +247,7 @@ SR_PRIV struct sr_dev_driver gwinstek_gds_800_driver_info = {
        .init = init,
        .cleanup = std_cleanup,
        .scan = scan,
-       .dev_list = dev_list,
+       .dev_list = std_dev_list,
        .config_get = config_get,
        .config_set = config_set,
        .config_list = config_list,
index 2ea5ca79efaf3c8ab3694f9292138e78976553c4..b810b9f1d6d42d1d7083c23bf4d2cb2a5d1be13e 100644 (file)
@@ -117,11 +117,6 @@ static GSList *scan(struct sr_dev_driver *di, GSList *options)
        return sr_scpi_scan(di->context, options, hmo_probe_serial_device);
 }
 
-static GSList *dev_list(const struct sr_dev_driver *di)
-{
-       return ((struct drv_context *)(di->context))->instances;
-}
-
 static void clear_helper(void *priv)
 {
        struct dev_context *devc;
@@ -785,7 +780,7 @@ SR_PRIV struct sr_dev_driver hameg_hmo_driver_info = {
        .init = init,
        .cleanup = std_cleanup,
        .scan = scan,
-       .dev_list = dev_list,
+       .dev_list = std_dev_list,
        .dev_clear = dev_clear,
        .config_get = config_get,
        .config_set = config_set,
index 4d15383406b8dfe213901dbf44a77cd5124d3ecb..1d600648ce15420124a89da34f32cd537d9d91a4 100644 (file)
@@ -267,11 +267,6 @@ static GSList *scan(struct sr_dev_driver *di, GSList *options)
        return devices;
 }
 
-static GSList *dev_list(const struct sr_dev_driver *di)
-{
-       return ((struct drv_context *)(di->context))->instances;
-}
-
 static int dev_open(struct sr_dev_inst *sdi)
 {
        struct dev_context *devc;
@@ -821,7 +816,7 @@ SR_PRIV struct sr_dev_driver hantek_6xxx_driver_info = {
        .init = init,
        .cleanup = std_cleanup,
        .scan = scan,
-       .dev_list = dev_list,
+       .dev_list = std_dev_list,
        .dev_clear = dev_clear,
        .config_get = config_get,
        .config_set = config_set,
index 10e5193994cd75a96b9bdae00984a0451ac8ffa2..ddea80846f80011f5e45257b2a0409bfcdbfdf31 100644 (file)
@@ -358,11 +358,6 @@ static GSList *scan(struct sr_dev_driver *di, GSList *options)
        return devices;
 }
 
-static GSList *dev_list(const struct sr_dev_driver *di)
-{
-       return ((struct drv_context *)(di->context))->instances;
-}
-
 static int dev_open(struct sr_dev_inst *sdi)
 {
        struct dev_context *devc;
@@ -1012,7 +1007,7 @@ SR_PRIV struct sr_dev_driver hantek_dso_driver_info = {
        .init = init,
        .cleanup = std_cleanup,
        .scan = scan,
-       .dev_list = dev_list,
+       .dev_list = std_dev_list,
        .dev_clear = dev_clear,
        .config_get = config_get,
        .config_set = config_set,
index 1a5e5d920a8f9f0f03191ba3f4de204582681c73..129e1e59656e7ed9dc458295da8631eade6af5b6 100644 (file)
@@ -176,11 +176,6 @@ static GSList *scan(struct sr_dev_driver *di, GSList *options)
        return sr_scpi_scan(di->context, options, probe_device);
 }
 
-static GSList *dev_list(const struct sr_dev_driver *di)
-{
-       return ((struct drv_context *)(di->context))->instances;
-}
-
 /*
  * We need to set the HP 3457A to a known state, and there are quite a number
  * of knobs to tweak. Here's a brief explanation of what's going on. For more
@@ -454,7 +449,7 @@ SR_PRIV struct sr_dev_driver hp_3457a_driver_info = {
        .init = init,
        .cleanup = std_cleanup,
        .scan = scan,
-       .dev_list = dev_list,
+       .dev_list = std_dev_list,
        .config_get = config_get,
        .config_set = config_set,
        .config_list = config_list,
index 55b9922b3a24fe736383ce2924380bf6b1369344..791fd5d67c026bc44a7a677cdde5cc54069f37ee 100644 (file)
@@ -230,11 +230,6 @@ static GSList *scan(struct sr_dev_driver *di, GSList *options)
        return devices;
 }
 
-static GSList *dev_list(const struct sr_dev_driver *di)
-{
-       return ((struct drv_context *)(di->context))->instances;
-}
-
 static void clear_private(void *priv)
 {
        struct dev_context *devc = priv;
@@ -731,7 +726,7 @@ SR_PRIV struct sr_dev_driver hung_chang_dso_2100_driver_info = {
        .init = init,
        .cleanup = std_cleanup,
        .scan = scan,
-       .dev_list = dev_list,
+       .dev_list = std_dev_list,
        .dev_clear = dev_clear,
        .config_get = config_get,
        .config_set = config_set,
index a9d3fcb74bb600c84c376a4cdda254795ca79bf2..dd2e421120fd21f73596aa5aa1b5330c94742159 100644 (file)
@@ -162,11 +162,6 @@ static GSList *scan(struct sr_dev_driver *di, GSList *options)
        return devices;
 }
 
-static GSList *dev_list(const struct sr_dev_driver *di)
-{
-       return ((struct drv_context *)(di->context))->instances;
-}
-
 static void clear_dev_context(void *priv)
 {
        struct dev_context *devc;
@@ -486,7 +481,7 @@ SR_PRIV struct sr_dev_driver ikalogic_scanalogic2_driver_info = {
        .init = init,
        .cleanup = std_cleanup,
        .scan = scan,
-       .dev_list = dev_list,
+       .dev_list = std_dev_list,
        .dev_clear = dev_clear,
        .config_get = config_get,
        .config_set = config_set,
index 2bdf28d954cf19469c6bf64d7df8eb1f7a31a1f5..8c8ee13f33750f0921ebd4d12061a889f6a8b541 100644 (file)
@@ -149,11 +149,6 @@ err_free_devc:
        return NULL;
 }
 
-static GSList *dev_list(const struct sr_dev_driver *di)
-{
-       return ((struct drv_context *)(di->context))->instances;
-}
-
 static int dev_open(struct sr_dev_inst *sdi)
 {
        struct dev_context *devc;
@@ -395,7 +390,7 @@ SR_PRIV struct sr_dev_driver ikalogic_scanaplus_driver_info = {
        .init = init,
        .cleanup = std_cleanup,
        .scan = scan,
-       .dev_list = dev_list,
+       .dev_list = std_dev_list,
        .dev_clear = dev_clear,
        .config_get = config_get,
        .config_set = config_set,
index d30f1604ec8aaaeea00e008902038125a5a6e1eb..15c43b1b95fa21c155165983e832754e67a2e727 100644 (file)
@@ -160,11 +160,6 @@ static GSList *scan(struct sr_dev_driver *di, GSList *options)
        return devices;
 }
 
-static GSList *dev_list(const struct sr_dev_driver *di)
-{
-       return ((struct drv_context *)(di->context))->instances;
-}
-
 static int dev_open(struct sr_dev_inst *sdi)
 {
        struct sr_dev_driver *di = sdi->driver;
@@ -537,7 +532,7 @@ SR_PRIV struct sr_dev_driver kecheng_kc_330b_driver_info = {
        .init = init,
        .cleanup = std_cleanup,
        .scan = scan,
-       .dev_list = dev_list,
+       .dev_list = std_dev_list,
        .dev_clear = NULL,
        .config_get = config_get,
        .config_set = config_set,
index e16bf596e30d8df2dfa8df3064da995dae8264d3..c38e515ff31db7a9e2bd74b193cd1e8f8eb36ec8 100644 (file)
@@ -119,11 +119,6 @@ scan_cleanup:
        return devices;
 }
 
-static GSList *dev_list(const struct sr_dev_driver *di)
-{
-       return ((struct drv_context *)(di->context))->instances;
-}
-
 static int config_set(uint32_t key, GVariant *data, const struct sr_dev_inst *sdi,
                const struct sr_channel_group *cg)
 {
@@ -217,7 +212,7 @@ static int dev_acquisition_stop(struct sr_dev_inst *sdi)
                        .init = init, \
                        .cleanup = std_cleanup, \
                        .scan = scan, \
-                       .dev_list = dev_list, \
+                       .dev_list = std_dev_list, \
                        .config_get = NULL, \
                        .config_set = config_set, \
                        .config_list = config_list, \
index 26b1ee8ef8aefc6b55cd3823132bea45756eab5b..f60d0d69354ab1101e05fd76008a04f181b3a07a 100644 (file)
@@ -178,11 +178,6 @@ exit_err:
        return NULL;
 }
 
-static GSList *dev_list(const struct sr_dev_driver *di)
-{
-       return ((struct drv_context *)(di->context))->instances;
-}
-
 static int config_get(uint32_t key, GVariant **data,
        const struct sr_dev_inst *sdi, const struct sr_channel_group *cg)
 {
@@ -410,7 +405,7 @@ SR_PRIV struct sr_dev_driver korad_kaxxxxp_driver_info = {
        .init = init,
        .cleanup = std_cleanup,
        .scan = scan,
-       .dev_list = dev_list,
+       .dev_list = std_dev_list,
        .config_get = config_get,
        .config_set = config_set,
        .config_list = config_list,
index 6244172098f4eed6bdabab0294e80cb93e702d11..fb9d19309073a4e99b18768d6e8f8ba15a36a7d5 100644 (file)
@@ -89,11 +89,6 @@ static GSList *scan(struct sr_dev_driver *di, GSList *options)
        return devices;
 }
 
-static GSList *dev_list(const struct sr_dev_driver *di)
-{
-       return ((struct drv_context *)(di->context))->instances;
-}
-
 static int dev_open(struct sr_dev_inst *sdi)
 {
        struct sr_dev_driver *di = sdi->driver;
@@ -457,7 +452,7 @@ SR_PRIV struct sr_dev_driver lascar_el_usb_driver_info = {
        .init = init,
        .cleanup = std_cleanup,
        .scan = scan,
-       .dev_list = dev_list,
+       .dev_list = std_dev_list,
        .dev_clear = NULL,
        .config_get = config_get,
        .config_set = config_set,
index 458be366f24f02122119ca8b9c768363cd11fc6a..9cf7018eb810e93f7a72a76a499da046675c04d2 100644 (file)
@@ -191,11 +191,6 @@ static GSList *scan(struct sr_dev_driver *di, GSList *options)
        return devices;
 }
 
-static GSList *dev_list(const struct sr_dev_driver *di)
-{
-       return ((struct drv_context *)(di->context))->instances;
-}
-
 static int open_device(struct sr_dev_inst *sdi)
 {
        struct drv_context *drvc;
@@ -524,7 +519,7 @@ SR_PRIV struct sr_dev_driver lecroy_logicstudio_driver_info = {
        .init = init,
        .cleanup = std_cleanup,
        .scan = scan,
-       .dev_list = dev_list,
+       .dev_list = std_dev_list,
        .config_get = config_get,
        .config_set = config_set,
        .config_list = config_list,
index 5107d309f0d15ec172fa36ec60a0db0ac71199ab..faee455c42408eebaeadf93cc5d4f565e6c8f988 100644 (file)
@@ -228,11 +228,6 @@ static GSList *scan(struct sr_dev_driver *di, GSList *options)
        return devices;
 }
 
-static GSList *dev_list(const struct sr_dev_driver *di)
-{
-       return ((struct drv_context *)(di->context))->instances;
-}
-
 static int dev_open(struct sr_dev_inst *sdi)
 {
        int ret;
@@ -467,7 +462,7 @@ SR_PRIV struct sr_dev_driver link_mso19_driver_info = {
        .init = init,
        .cleanup = std_cleanup,
        .scan = scan,
-       .dev_list = dev_list,
+       .dev_list = std_dev_list,
        .dev_clear = dev_clear,
        .config_get = config_get,
        .config_set = config_set,
index d3901954288801c49370695d767985234fa10065..f803c2b8fbcb2f71ecb656e67b4ac32e904c6eb6 100644 (file)
@@ -200,11 +200,6 @@ exit_err:
        return NULL;
 }
 
-static GSList *dev_list(const struct sr_dev_driver *di)
-{
-       return ((struct drv_context *)(di->context))->instances;
-}
-
 static int config_get(uint32_t key, GVariant **data, const struct sr_dev_inst *sdi,
                const struct sr_channel_group *cg)
 {
@@ -415,7 +410,7 @@ SR_PRIV struct sr_dev_driver manson_hcs_3xxx_driver_info = {
        .init = init,
        .cleanup = std_cleanup,
        .scan = scan,
-       .dev_list = dev_list,
+       .dev_list = std_dev_list,
        .config_get = config_get,
        .config_set = config_set,
        .config_list = config_list,
index 5716d3bd484f7c8ec6d84426689017a2c0123181..3878e6f90778328929c4bb5db60adecfde15cd3f 100644 (file)
@@ -199,11 +199,6 @@ static GSList *scan(struct sr_dev_driver *di, GSList *options)
        return devices;
 }
 
-static GSList *dev_list(const struct sr_dev_driver *di)
-{
-       return ((struct drv_context *)(di->context))->instances;
-}
-
 static int dev_open(struct sr_dev_inst *sdi)
 {
        struct sr_modbus_dev_inst *modbus = sdi->conn;
@@ -488,7 +483,7 @@ SR_PRIV struct sr_dev_driver maynuo_m97_driver_info = {
        .init = init,
        .cleanup = std_cleanup,
        .scan = scan,
-       .dev_list = dev_list,
+       .dev_list = std_dev_list,
        .config_get = config_get,
        .config_set = config_set,
        .config_list = config_list,
index 2bf20627a02d1381cb7bc3c3a9e045d489bad6d0..8e1bba8d780913d43db06716628f263563054cf0 100644 (file)
@@ -140,11 +140,6 @@ static GSList *scan(GSList *options, int idx)
        return devices;
 }
 
-static GSList *dev_list(int idx)
-{
-       return ((struct drv_context *)(mic_devs[idx].di->context))->instances;
-}
-
 static int config_set(uint32_t key, GVariant *data, const struct sr_dev_inst *sdi,
                const struct sr_channel_group *cg)
 {
@@ -237,9 +232,6 @@ static int init_##X(struct sr_dev_driver *di, struct sr_context *sr_ctx) { \
 #define HW_SCAN(X) \
 static GSList *scan_##X(struct sr_dev_driver *di, GSList *options) { \
        (void)di; return scan(options, X); }
-#define HW_DEV_LIST(X) \
-static GSList *dev_list_##X(const struct sr_dev_driver *di) { \
-       (void)di; return dev_list(X); }
 #define HW_CONFIG_LIST(X) \
 static int config_list_##X(uint32_t key, GVariant **data, \
 const struct sr_dev_inst *sdi, const struct sr_channel_group *cg) { \
@@ -252,7 +244,6 @@ static int dev_acquisition_start_##X(const struct sr_dev_inst *sdi \
 #define DRV(ID, ID_UPPER, NAME, LONGNAME) \
 HW_INIT(ID_UPPER) \
 HW_SCAN(ID_UPPER) \
-HW_DEV_LIST(ID_UPPER) \
 HW_CONFIG_LIST(ID_UPPER) \
 HW_DEV_ACQUISITION_START(ID_UPPER) \
 SR_PRIV struct sr_dev_driver ID##_driver_info = { \
@@ -262,7 +253,7 @@ SR_PRIV struct sr_dev_driver ID##_driver_info = { \
        .init = init_##ID_UPPER, \
        .cleanup = std_cleanup, \
        .scan = scan_##ID_UPPER, \
-       .dev_list = dev_list_##ID_UPPER, \
+       .dev_list = std_dev_list, \
        .config_get = NULL, \
        .config_set = config_set, \
        .config_list = config_list_##ID_UPPER, \
index 693f6e4a85baff11fe1a03e2d3c268e6700d0b0a..4bda494a70f1ed7b342e46efff565e9fd9c82ee6 100644 (file)
@@ -517,11 +517,6 @@ static GSList *scan_lps301(struct sr_dev_driver *di, GSList *options)
        return do_scan(LPS_301, di, options);
 }
 
-static GSList *dev_list_lps301(const struct sr_dev_driver *di)
-{
-       return ((struct drv_context *)(di->context))->instances;
-}
-
 static void dev_clear_private(struct dev_context *devc)
 {
        int ch_idx;
@@ -837,7 +832,7 @@ SR_PRIV struct sr_dev_driver motech_lps_301_driver_info = {
        .init = init_lps301,
        .cleanup = std_cleanup,
        .scan = scan_lps301,
-       .dev_list = dev_list_lps301,
+       .dev_list = std_dev_list,
        .dev_clear = dev_clear_lps301,
        .config_get = config_get,
        .config_set = config_set,
index 67735d49da30418dd229b91322e90e24f7dd91e3..a48ef6a2800dfc2ba9c6cd1ba9ee8e0c950fc122 100644 (file)
@@ -172,11 +172,6 @@ static GSList *scan(struct sr_dev_driver *drv, GSList *options)
        return devices;
 }
 
-static GSList *dev_list(const struct sr_dev_driver *di)
-{
-       return ((struct drv_context *)(di->context))->instances;
-}
-
 static int dev_close(struct sr_dev_inst *sdi)
 {
        struct dev_context *devc;
@@ -287,7 +282,7 @@ SR_PRIV struct sr_dev_driver norma_dmm_driver_info = {
        .init = init,
        .cleanup = std_cleanup,
        .scan = scan,
-       .dev_list = dev_list,
+       .dev_list = std_dev_list,
        .dev_clear = NULL,
        .config_get = NULL,
        .config_set = config_set,
@@ -306,7 +301,7 @@ SR_PRIV struct sr_dev_driver siemens_b102x_driver_info = {
        .init = init,
        .cleanup = std_cleanup,
        .scan = scan,
-       .dev_list = dev_list,
+       .dev_list = std_dev_list,
        .dev_clear = NULL,
        .config_get = NULL,
        .config_set = config_set,
index c50509bacc716898aa3d5cb6fa2e732b3454e1d8..9a96e234407f3bf24f095786d1ed7439e56d6800 100644 (file)
@@ -210,11 +210,6 @@ static GSList *scan(struct sr_dev_driver *di, GSList *options)
        return devices;
 }
 
-static GSList *dev_list(const struct sr_dev_driver *di)
-{
-       return ((struct drv_context *)(di->context))->instances;
-}
-
 static int config_get(uint32_t key, GVariant **data, const struct sr_dev_inst *sdi,
                const struct sr_channel_group *cg)
 {
@@ -589,7 +584,7 @@ SR_PRIV struct sr_dev_driver ols_driver_info = {
        .init = init,
        .cleanup = std_cleanup,
        .scan = scan,
-       .dev_list = dev_list,
+       .dev_list = std_dev_list,
        .dev_clear = NULL,
        .config_get = config_get,
        .config_set = config_set,
index 86ad7f9f1817583df1fbc89f2640ce81fca841cd..a2b01dce199b648f874dfa17355003ae19b584cf 100644 (file)
@@ -200,11 +200,6 @@ err_free_ftdi_buf:
        return NULL;
 }
 
-static GSList *dev_list(const struct sr_dev_driver *di)
-{
-       return ((struct drv_context *)(di->context))->instances;
-}
-
 static void clear_helper(void *priv)
 {
        struct dev_context *devc;
@@ -719,7 +714,7 @@ SR_PRIV struct sr_dev_driver p_ols_driver_info = {
        .init = init,
        .cleanup = std_cleanup,
        .scan = scan,
-       .dev_list = dev_list,
+       .dev_list = std_dev_list,
        .dev_clear = dev_clear,
        .config_get = config_get,
        .config_set = config_set,
index d8ad1a06887c778c0822053f912881fa844aa25b..f38ad8db24990aa2c8c5583677f97329f7af9eeb 100644 (file)
@@ -411,11 +411,6 @@ static GSList *scan(struct sr_dev_driver *di, GSList *options)
        return sr_scpi_scan(di->context, options, probe_device);
 }
 
-static GSList *dev_list(const struct sr_dev_driver *di)
-{
-       return ((struct drv_context *)(di->context))->instances;
-}
-
 static int dev_open(struct sr_dev_inst *sdi)
 {
        int ret;
@@ -1069,7 +1064,7 @@ SR_PRIV struct sr_dev_driver rigol_ds_driver_info = {
        .init = init,
        .cleanup = std_cleanup,
        .scan = scan,
-       .dev_list = dev_list,
+       .dev_list = std_dev_list,
        .dev_clear = dev_clear,
        .config_get = config_get,
        .config_set = config_set,
index 4450a22cc1e08bcf894ed1526330ec51d05c0879..4990ce82cff0fe317a64dc9f5d9558b79e9e03fc 100644 (file)
@@ -235,11 +235,6 @@ static GSList *scan(struct sr_dev_driver *di, GSList *options)
        return devices;
 }
 
-static GSList *dev_list(const struct sr_dev_driver *di)
-{
-       return ((struct drv_context *)(di->context))->instances;
-}
-
 static int logic16_dev_open(struct sr_dev_inst *sdi)
 {
        struct sr_dev_driver *di;
@@ -804,7 +799,7 @@ SR_PRIV struct sr_dev_driver saleae_logic16_driver_info = {
        .init = init,
        .cleanup = std_cleanup,
        .scan = scan,
-       .dev_list = dev_list,
+       .dev_list = std_dev_list,
        .dev_clear = NULL,
        .config_get = config_get,
        .config_set = config_set,
index e2afad3bead0f9ce016e8910ebf4b27404c78314..5fd83d4e9215d83c6d327109ec4b00eedfc8ca82 100644 (file)
@@ -176,11 +176,6 @@ static GSList *scan(struct sr_dev_driver *di, GSList *options)
        return sr_scpi_scan(di->context, options, probe_device);
 }
 
-static GSList *dev_list(const struct sr_dev_driver *di)
-{
-       return ((struct drv_context *)(di->context))->instances;
-}
-
 static int dev_open(struct sr_dev_inst *sdi)
 {
        struct dev_context *devc;
@@ -639,7 +634,7 @@ SR_PRIV struct sr_dev_driver scpi_pps_driver_info = {
        .init = init,
        .cleanup = std_cleanup,
        .scan = scan,
-       .dev_list = dev_list,
+       .dev_list = std_dev_list,
        .dev_clear = dev_clear,
        .config_get = config_get,
        .config_set = config_set,
index f29a0e0b2015c89b0a17e5b72be5f0f91d45597b..a9de067467011ed8a492f1e467e4a9e9ae64b0c6 100644 (file)
@@ -145,11 +145,6 @@ scan_cleanup:
        return devices;
 }
 
-static GSList *dev_list(const struct sr_dev_driver *di)
-{
-       return ((struct drv_context *)(di->context))->instances;
-}
-
 static int config_set(uint32_t key, GVariant *data, const struct sr_dev_inst *sdi,
                const struct sr_channel_group *cg)
 {
@@ -245,7 +240,7 @@ static int dev_acquisition_stop(struct sr_dev_inst *sdi)
                        .init = init, \
                        .cleanup = std_cleanup, \
                        .scan = scan, \
-                       .dev_list = dev_list, \
+                       .dev_list = std_dev_list, \
                        .config_get = NULL, \
                        .config_set = config_set, \
                        .config_list = config_list, \
index be7c9ee72bca13391fe4d79512e87dd1ef3c5dd8..59d126334c99900c8e5f222c28e1cf8a233b62af 100644 (file)
@@ -212,13 +212,6 @@ static GSList *scan(struct sr_dev_driver *di, GSList *options)
        return devices;
 }
 
-/* Return the list of devices found during scan.
- */
-static GSList *dev_list(const struct sr_dev_driver *di)
-{
-       return ((struct drv_context *)(di->context))->instances;
-}
-
 /* Destroy the private device context.
  */
 static void clear_dev_context(void *priv)
@@ -805,7 +798,7 @@ SR_PRIV struct sr_dev_driver sysclk_lwla_driver_info = {
        .init = init,
        .cleanup = std_cleanup,
        .scan = scan,
-       .dev_list = dev_list,
+       .dev_list = std_dev_list,
        .dev_clear = dev_clear,
        .config_get = config_get,
        .config_set = config_set,
index 245f550119421921f2bad753b0ffdb093f77b2b0..302373d6b27d2cbe53d7b06e668ca4fa8dd71d23 100644 (file)
@@ -133,11 +133,6 @@ scan_cleanup:
        return devices;
 }
 
-static GSList *dev_list(const struct sr_dev_driver *di)
-{
-       return ((struct drv_context *)(di->context))->instances;
-}
-
 static int config_set(uint32_t key, GVariant *data, const struct sr_dev_inst *sdi,
                const struct sr_channel_group *cg)
 {
@@ -229,7 +224,7 @@ SR_PRIV struct sr_dev_driver teleinfo_driver_info = {
        .init = init,
        .cleanup = std_cleanup,
        .scan = scan,
-       .dev_list = dev_list,
+       .dev_list = std_dev_list,
        .dev_clear = NULL,
        .config_get = NULL,
        .config_set = config_set,
index 6e3511c013eb4bd76ec169e792a800a53547a834..d0e60237cd0f3192ef9f886a547e4055a7b68913 100644 (file)
@@ -146,11 +146,6 @@ static GSList *scan(struct sr_dev_driver *di, GSList *options)
        return devices;
 }
 
-static GSList *dev_list(const struct sr_dev_driver *di)
-{
-       return ((struct drv_context *)(di->context))->instances;
-}
-
 static int dev_open(struct sr_dev_inst *sdi)
 {
        struct sr_dev_driver *di = sdi->driver;
@@ -501,7 +496,7 @@ SR_PRIV struct sr_dev_driver testo_driver_info = {
        .init = init,
        .cleanup = std_cleanup,
        .scan = scan,
-       .dev_list = dev_list,
+       .dev_list = std_dev_list,
        .config_get = config_get,
        .config_set = config_set,
        .config_list = config_list,
index 1d067e3989888d85cc0891182b39c2bd4415ce83..5b1a85f9b2a5eb8a3242d40913dcc6a112902221 100644 (file)
@@ -106,11 +106,6 @@ static GSList *scan(struct sr_dev_driver *di, GSList *options)
        return devices;
 }
 
-static GSList *dev_list(const struct sr_dev_driver *di)
-{
-       return ((struct drv_context *)(di->context))->instances;
-}
-
 static int config_set(uint32_t key, GVariant *data, const struct sr_dev_inst *sdi,
                const struct sr_channel_group *cg)
 {
@@ -186,7 +181,7 @@ SR_PRIV struct sr_dev_driver tondaj_sl_814_driver_info = {
        .init = init,
        .cleanup = std_cleanup,
        .scan = scan,
-       .dev_list = dev_list,
+       .dev_list = std_dev_list,
        .dev_clear = NULL,
        .config_get = NULL,
        .config_set = config_set,
index 7e55d857f253c0c6e8731eb323cb8e0330ef3a1b..b4e667c57066e059cc7618845746c7f1f46d83e7 100644 (file)
@@ -103,11 +103,6 @@ static GSList *scan(struct sr_dev_driver *di, GSList *options)
        return devices;
 }
 
-static GSList *dev_list(const struct sr_dev_driver *di)
-{
-       return ((struct drv_context *)(di->context))->instances;
-}
-
 static int dev_open(struct sr_dev_inst *sdi)
 {
        struct sr_dev_driver *di;
@@ -213,7 +208,7 @@ static int dev_acquisition_stop(struct sr_dev_inst *sdi)
                        .init = init, \
                        .cleanup = std_cleanup, \
                        .scan = scan, \
-                       .dev_list = dev_list, \
+                       .dev_list = std_dev_list, \
                        .config_get = NULL, \
                        .config_set = config_set, \
                        .config_list = config_list, \
index 13c2a637303e9920a39c0cb40306fc47091f0fdc..f19dabeff55015f0bad2d20de530650b8821aec5 100644 (file)
@@ -98,11 +98,6 @@ static GSList *scan(struct sr_dev_driver *di, GSList *options)
        return devices;
 }
 
-static GSList *dev_list(const struct sr_dev_driver *di)
-{
-       return ((struct drv_context *)(di->context))->instances;
-}
-
 static int dev_open(struct sr_dev_inst *sdi)
 {
        struct sr_dev_driver *di = sdi->driver;
@@ -336,7 +331,7 @@ SR_PRIV struct sr_dev_driver uni_t_ut32x_driver_info = {
        .init = init,
        .cleanup = std_cleanup,
        .scan = scan,
-       .dev_list = dev_list,
+       .dev_list = std_dev_list,
        .dev_clear = NULL,
        .config_get = config_get,
        .config_set = config_set,
index 023388f4f345705eb1db72d9d71cd0c6ae04fdee..9323e70015770c902d9b29c89d3a385edace2a67 100644 (file)
@@ -101,11 +101,6 @@ static GSList *scan(struct sr_dev_driver *di, GSList *options)
        return devices;
 }
 
-static GSList *dev_list(const struct sr_dev_driver *di)
-{
-       return ((struct drv_context *)(di->context))->instances;
-}
-
 static int dev_open(struct sr_dev_inst *sdi)
 {
        struct sr_dev_driver *di = sdi->driver;
@@ -413,7 +408,7 @@ SR_PRIV struct sr_dev_driver victor_dmm_driver_info = {
        .init = init,
        .cleanup = std_cleanup,
        .scan = scan,
-       .dev_list = dev_list,
+       .dev_list = std_dev_list,
        .dev_clear = NULL,
        .config_get = config_get,
        .config_set = config_set,
index 25a292ad5f9691256e1b1132ebd64df4e69fd343..082c01796ef5d578f4edcdbd78de28d8d14fc2fb 100644 (file)
@@ -128,11 +128,6 @@ static GSList *scan(struct sr_dev_driver *di, GSList *options)
        return sr_scpi_scan(di->context, options, probe_usbtmc_device);
 }
 
-static GSList *dev_list(const struct sr_dev_driver *di)
-{
-       return ((struct drv_context *)(di->context))->instances;
-}
-
 static void clear_helper(void *priv)
 {
        struct dev_context *devc;
@@ -691,7 +686,7 @@ SR_PRIV struct sr_dev_driver yokogawa_dlm_driver_info = {
        .init = init,
        .cleanup = std_cleanup,
        .scan = scan,
-       .dev_list = dev_list,
+       .dev_list = std_dev_list,
        .dev_clear = dev_clear,
        .config_get = config_get,
        .config_set = config_set,
index f9f2ba795d6bd4185e834a226d7f98f0c156b8bc..1081b81c2b461ec4cf059a9f8f0dc8c6df80dfd5 100644 (file)
@@ -256,11 +256,6 @@ static GSList *scan(struct sr_dev_driver *di, GSList *options)
        return devices;
 }
 
-static GSList *dev_list(const struct sr_dev_driver *di)
-{
-       return ((struct drv_context *)(di->context))->instances;
-}
-
 static int dev_open(struct sr_dev_inst *sdi)
 {
        struct sr_dev_driver *di = sdi->driver;
@@ -703,7 +698,7 @@ SR_PRIV struct sr_dev_driver zeroplus_logic_cube_driver_info = {
        .init = init,
        .cleanup = std_cleanup,
        .scan = scan,
-       .dev_list = dev_list,
+       .dev_list = std_dev_list,
        .dev_clear = NULL,
        .config_get = config_get,
        .config_set = config_set,
index d859e934f7c37d57883996c818fb0155eadaf805..0af77db6c33e4dc41cd898b996631a058395a72c 100644 (file)
@@ -862,6 +862,7 @@ SR_PRIV int std_session_send_df_end(const struct sr_dev_inst *sdi,
                const char *prefix);
 SR_PRIV int std_dev_clear(const struct sr_dev_driver *driver,
                std_dev_clear_callback clear_private);
+SR_PRIV GSList *std_dev_list(const struct sr_dev_driver *di);
 SR_PRIV int std_serial_dev_close(struct sr_dev_inst *sdi);
 
 /*--- resource.c ------------------------------------------------------------*/
index b66ed8f0b4884c603d4e235a972775c1a1ab40c6..aadf8236a790a3f79c38ece2cf6ebd191166991c 100644 (file)
--- a/src/std.c
+++ b/src/std.c
@@ -337,3 +337,22 @@ SR_PRIV int std_dev_clear(const struct sr_dev_driver *driver,
 
        return ret;
 }
+
+/**
+ * Standard implementation for the driver dev_list() callback
+ *
+ * This function can be used as the dev_list callback by most drivers that use
+ * the standard helper functions. It returns the devices contained in the driver
+ * context instances list.
+ *
+ * @param di The driver instance to use.
+ *
+ * @return The list of devices/instances of this driver, or NULL upon errors
+ *         or if the list is empty.
+ */
+SR_PRIV GSList *std_dev_list(const struct sr_dev_driver *di)
+{
+       struct drv_context *drvc = di->context;
+
+       return drvc->instances;
+}