From: Lars-Peter Clausen Date: Sun, 8 May 2016 12:55:15 +0000 (+0200) Subject: Match std_init() parameter order to the driver init() callback X-Git-Tag: libsigrok-0.5.0~424 X-Git-Url: https://sigrok.org/gitaction?a=commitdiff_plain;h=1f8f5bc08e0f684156baac513431b40d79ab4ea1;p=libsigrok.git Match std_init() parameter order to the driver init() callback The std_init() callback has the order of the first two paramters opposite to the init() callback. This is primarily due to historical development. Since the std_init() function is usually called from a driver's init() callback aligning the order will allow direct register pass through rather than having to swap them around. It also allow to eventually use the std_init() function directly as the init() callback. Signed-off-by: Lars-Peter Clausen --- diff --git a/src/hardware/agilent-dmm/api.c b/src/hardware/agilent-dmm/api.c index 1e5679b2..da6b84ca 100644 --- a/src/hardware/agilent-dmm/api.c +++ b/src/hardware/agilent-dmm/api.c @@ -74,7 +74,7 @@ SR_PRIV struct sr_dev_driver agdmm_driver_info; static int init(struct sr_dev_driver *di, struct sr_context *sr_ctx) { - return std_init(sr_ctx, di, LOG_PREFIX); + return std_init(di, sr_ctx, LOG_PREFIX); } static GSList *scan(struct sr_dev_driver *di, GSList *options) diff --git a/src/hardware/appa-55ii/api.c b/src/hardware/appa-55ii/api.c index 03c14524..6163f2df 100644 --- a/src/hardware/appa-55ii/api.c +++ b/src/hardware/appa-55ii/api.c @@ -46,7 +46,7 @@ SR_PRIV struct sr_dev_driver appa_55ii_driver_info; static int init(struct sr_dev_driver *di, struct sr_context *sr_ctx) { - return std_init(sr_ctx, di, LOG_PREFIX); + return std_init(di, sr_ctx, LOG_PREFIX); } static GSList *scan(struct sr_dev_driver *di, GSList *options) diff --git a/src/hardware/arachnid-labs-re-load-pro/api.c b/src/hardware/arachnid-labs-re-load-pro/api.c index e1bf5fc2..4543a025 100644 --- a/src/hardware/arachnid-labs-re-load-pro/api.c +++ b/src/hardware/arachnid-labs-re-load-pro/api.c @@ -60,7 +60,7 @@ SR_PRIV struct sr_dev_driver arachnid_labs_re_load_pro_driver_info; static int init(struct sr_dev_driver *di, struct sr_context *sr_ctx) { - return std_init(sr_ctx, di, LOG_PREFIX); + return std_init(di, sr_ctx, LOG_PREFIX); } static GSList *scan(struct sr_dev_driver *di, GSList *options) diff --git a/src/hardware/asix-sigma/api.c b/src/hardware/asix-sigma/api.c index 77e989a9..cb5eeca4 100644 --- a/src/hardware/asix-sigma/api.c +++ b/src/hardware/asix-sigma/api.c @@ -65,7 +65,7 @@ static int dev_clear(const struct sr_dev_driver *di) static int init(struct sr_dev_driver *di, struct sr_context *sr_ctx) { - return std_init(sr_ctx, di, LOG_PREFIX); + return std_init(di, sr_ctx, LOG_PREFIX); } static GSList *scan(struct sr_dev_driver *di, GSList *options) diff --git a/src/hardware/atten-pps3xxx/api.c b/src/hardware/atten-pps3xxx/api.c index 21968df4..e46bff41 100644 --- a/src/hardware/atten-pps3xxx/api.c +++ b/src/hardware/atten-pps3xxx/api.c @@ -79,7 +79,7 @@ SR_PRIV struct sr_dev_driver atten_pps3203_driver_info; static int init(struct sr_dev_driver *di, struct sr_context *sr_ctx) { - return std_init(sr_ctx, di, LOG_PREFIX); + return std_init(di, sr_ctx, LOG_PREFIX); } static GSList *scan(struct sr_dev_driver *di, GSList *options, int modelid) diff --git a/src/hardware/baylibre-acme/api.c b/src/hardware/baylibre-acme/api.c index a556449c..49cf96ae 100644 --- a/src/hardware/baylibre-acme/api.c +++ b/src/hardware/baylibre-acme/api.c @@ -55,7 +55,7 @@ static const uint64_t samplerates[] = { static int init(struct sr_dev_driver *di, struct sr_context *sr_ctx) { - return std_init(sr_ctx, di, LOG_PREFIX); + return std_init(di, sr_ctx, LOG_PREFIX); } static GSList *scan(struct sr_dev_driver *di, GSList *options) diff --git a/src/hardware/beaglelogic/api.c b/src/hardware/beaglelogic/api.c index 8694d8fd..e8309bd2 100644 --- a/src/hardware/beaglelogic/api.c +++ b/src/hardware/beaglelogic/api.c @@ -62,7 +62,7 @@ static const uint64_t samplerates[] = { static int init(struct sr_dev_driver *di, struct sr_context *sr_ctx) { - return std_init(sr_ctx, di, LOG_PREFIX); + return std_init(di, sr_ctx, LOG_PREFIX); } static struct dev_context *beaglelogic_devc_alloc(void) diff --git a/src/hardware/brymen-bm86x/api.c b/src/hardware/brymen-bm86x/api.c index 3f270fb0..cf41e90d 100644 --- a/src/hardware/brymen-bm86x/api.c +++ b/src/hardware/brymen-bm86x/api.c @@ -37,7 +37,7 @@ SR_PRIV struct sr_dev_driver brymen_bm86x_driver_info; static int init(struct sr_dev_driver *di, struct sr_context *sr_ctx) { - return std_init(sr_ctx, di, LOG_PREFIX); + return std_init(di, sr_ctx, LOG_PREFIX); } static GSList *scan(struct sr_dev_driver *di, GSList *options) diff --git a/src/hardware/brymen-dmm/api.c b/src/hardware/brymen-dmm/api.c index ffc0e9c6..28e2a5ba 100644 --- a/src/hardware/brymen-dmm/api.c +++ b/src/hardware/brymen-dmm/api.c @@ -37,7 +37,7 @@ static struct sr_dev_driver *di = &brymen_bm857_driver_info; static int init(struct sr_dev_driver *di, struct sr_context *sr_ctx) { - return std_init(sr_ctx, di, LOG_PREFIX); + return std_init(di, sr_ctx, LOG_PREFIX); } static GSList *brymen_scan(const char *conn, const char *serialcomm) diff --git a/src/hardware/cem-dt-885x/api.c b/src/hardware/cem-dt-885x/api.c index 435c236f..40b8c6d8 100644 --- a/src/hardware/cem-dt-885x/api.c +++ b/src/hardware/cem-dt-885x/api.c @@ -73,7 +73,7 @@ SR_PRIV struct sr_dev_driver cem_dt_885x_driver_info; static int init(struct sr_dev_driver *di, struct sr_context *sr_ctx) { - return std_init(sr_ctx, di, LOG_PREFIX); + return std_init(di, sr_ctx, LOG_PREFIX); } static GSList *scan(struct sr_dev_driver *di, GSList *options) diff --git a/src/hardware/center-3xx/api.c b/src/hardware/center-3xx/api.c index 27fcad53..6c0e0890 100644 --- a/src/hardware/center-3xx/api.c +++ b/src/hardware/center-3xx/api.c @@ -58,7 +58,7 @@ SR_PRIV const struct center_dev_info center_devs[] = { static int init(struct sr_context *sr_ctx, int idx) { - return std_init(sr_ctx, center_devs[idx].di, LOG_PREFIX); + return std_init(center_devs[idx].di, sr_ctx, LOG_PREFIX); } static GSList *center_scan(const char *conn, const char *serialcomm, int idx) diff --git a/src/hardware/chronovu-la/api.c b/src/hardware/chronovu-la/api.c index 1e6f5f41..fa28d82e 100644 --- a/src/hardware/chronovu-la/api.c +++ b/src/hardware/chronovu-la/api.c @@ -66,7 +66,7 @@ static int dev_clear(const struct sr_dev_driver *di) static int init(struct sr_dev_driver *di, struct sr_context *sr_ctx) { - return std_init(sr_ctx, di, LOG_PREFIX); + return std_init(di, sr_ctx, LOG_PREFIX); } static int add_device(int model, struct libusb_device_descriptor *des, diff --git a/src/hardware/colead-slm/api.c b/src/hardware/colead-slm/api.c index 01da31a9..7cbd2e67 100644 --- a/src/hardware/colead-slm/api.c +++ b/src/hardware/colead-slm/api.c @@ -46,7 +46,7 @@ SR_PRIV struct sr_dev_driver colead_slm_driver_info; static int init(struct sr_dev_driver *di, struct sr_context *sr_ctx) { - return std_init(sr_ctx, di, LOG_PREFIX); + return std_init(di, sr_ctx, LOG_PREFIX); } static GSList *scan(struct sr_dev_driver *di, GSList *options) diff --git a/src/hardware/conrad-digi-35-cpu/api.c b/src/hardware/conrad-digi-35-cpu/api.c index 92798e82..357dad94 100644 --- a/src/hardware/conrad-digi-35-cpu/api.c +++ b/src/hardware/conrad-digi-35-cpu/api.c @@ -43,7 +43,7 @@ SR_PRIV struct sr_dev_driver conrad_digi_35_cpu_driver_info; static int init(struct sr_dev_driver *di, struct sr_context *sr_ctx) { - return std_init(sr_ctx, di, LOG_PREFIX); + return std_init(di, sr_ctx, LOG_PREFIX); } static GSList *scan(struct sr_dev_driver *di, GSList *options) diff --git a/src/hardware/demo/demo.c b/src/hardware/demo/demo.c index 9a023239..1587d5e7 100644 --- a/src/hardware/demo/demo.c +++ b/src/hardware/demo/demo.c @@ -181,7 +181,7 @@ static int dev_acquisition_stop(struct sr_dev_inst *sdi); static int init(struct sr_dev_driver *di, struct sr_context *sr_ctx) { - return std_init(sr_ctx, di, LOG_PREFIX); + return std_init(di, sr_ctx, LOG_PREFIX); } static void generate_analog_pattern(struct analog_gen *ag, uint64_t sample_rate) diff --git a/src/hardware/deree-de5000/api.c b/src/hardware/deree-de5000/api.c index 2f1109b5..7a832022 100644 --- a/src/hardware/deree-de5000/api.c +++ b/src/hardware/deree-de5000/api.c @@ -41,7 +41,7 @@ SR_PRIV struct sr_dev_driver deree_de5000_driver_info; static int init(struct sr_dev_driver *di, struct sr_context *sr_ctx) { - return std_init(sr_ctx, di, LOG_PREFIX); + return std_init(di, sr_ctx, LOG_PREFIX); } static int dev_clear(const struct sr_dev_driver *di) diff --git a/src/hardware/fluke-dmm/api.c b/src/hardware/fluke-dmm/api.c index b352355c..8d4ed2bb 100644 --- a/src/hardware/fluke-dmm/api.c +++ b/src/hardware/fluke-dmm/api.c @@ -61,7 +61,7 @@ static const struct flukedmm_profile supported_flukedmm[] = { static int init(struct sr_dev_driver *di, struct sr_context *sr_ctx) { - return std_init(sr_ctx, di, LOG_PREFIX); + return std_init(di, sr_ctx, LOG_PREFIX); } static GSList *fluke_scan(struct sr_dev_driver *di, const char *conn, diff --git a/src/hardware/ftdi-la/api.c b/src/hardware/ftdi-la/api.c index a1b3e967..c258be14 100644 --- a/src/hardware/ftdi-la/api.c +++ b/src/hardware/ftdi-la/api.c @@ -86,7 +86,7 @@ static const struct ftdi_chip_desc *chip_descs[] = { static int init(struct sr_dev_driver *di, struct sr_context *sr_ctx) { - return std_init(sr_ctx, di, LOG_PREFIX); + return std_init(di, sr_ctx, LOG_PREFIX); } static void scan_device(struct sr_dev_driver *di, struct libusb_device *dev, GSList **devices) diff --git a/src/hardware/fx2lafw/api.c b/src/hardware/fx2lafw/api.c index 6eeaed0b..e56f152f 100644 --- a/src/hardware/fx2lafw/api.c +++ b/src/hardware/fx2lafw/api.c @@ -183,7 +183,7 @@ SR_PRIV struct sr_dev_driver fx2lafw_driver_info; static int init(struct sr_dev_driver *di, struct sr_context *sr_ctx) { - return std_init(sr_ctx, di, LOG_PREFIX); + return std_init(di, sr_ctx, LOG_PREFIX); } static GSList *scan(struct sr_dev_driver *di, GSList *options) diff --git a/src/hardware/gmc-mh-1x-2x/api.c b/src/hardware/gmc-mh-1x-2x/api.c index 2f0f671c..67ad40d3 100644 --- a/src/hardware/gmc-mh-1x-2x/api.c +++ b/src/hardware/gmc-mh-1x-2x/api.c @@ -68,7 +68,7 @@ static const uint32_t devopts_bd[] = { static int init(struct sr_dev_driver *di, struct sr_context *sr_ctx) { - return std_init(sr_ctx, di, LOG_PREFIX); + return std_init(di, sr_ctx, LOG_PREFIX); } /** diff --git a/src/hardware/gwinstek-gds-800/api.c b/src/hardware/gwinstek-gds-800/api.c index 0da6760a..5e4a67fc 100644 --- a/src/hardware/gwinstek-gds-800/api.c +++ b/src/hardware/gwinstek-gds-800/api.c @@ -35,7 +35,7 @@ SR_PRIV struct sr_dev_driver gwinstek_gds_800_driver_info; static int init(struct sr_dev_driver *di, struct sr_context *sr_ctx) { - return std_init(sr_ctx, di, LOG_PREFIX); + return std_init(di, sr_ctx, LOG_PREFIX); } static struct sr_dev_inst *probe_device(struct sr_scpi_dev_inst *scpi) diff --git a/src/hardware/hameg-hmo/api.c b/src/hardware/hameg-hmo/api.c index b810b9f1..f75f55e0 100644 --- a/src/hardware/hameg-hmo/api.c +++ b/src/hardware/hameg-hmo/api.c @@ -49,7 +49,7 @@ enum { static int init(struct sr_dev_driver *di, struct sr_context *sr_ctx) { - return std_init(sr_ctx, di, LOG_PREFIX); + return std_init(di, sr_ctx, LOG_PREFIX); } static int check_manufacturer(const char *manufacturer) diff --git a/src/hardware/hantek-6xxx/api.c b/src/hardware/hantek-6xxx/api.c index 1d600648..ab866a47 100644 --- a/src/hardware/hantek-6xxx/api.c +++ b/src/hardware/hantek-6xxx/api.c @@ -165,7 +165,7 @@ static int dev_clear(const struct sr_dev_driver *di) static int init(struct sr_dev_driver *di, struct sr_context *sr_ctx) { - return std_init(sr_ctx, di, LOG_PREFIX); + return std_init(di, sr_ctx, LOG_PREFIX); } static GSList *scan(struct sr_dev_driver *di, GSList *options) diff --git a/src/hardware/hantek-dso/api.c b/src/hardware/hantek-dso/api.c index 8a2f42c5..6162d5c1 100644 --- a/src/hardware/hantek-dso/api.c +++ b/src/hardware/hantek-dso/api.c @@ -256,7 +256,7 @@ static int dev_clear(const struct sr_dev_driver *di) static int init(struct sr_dev_driver *di, struct sr_context *sr_ctx) { - return std_init(sr_ctx, di, LOG_PREFIX); + return std_init(di, sr_ctx, LOG_PREFIX); } static GSList *scan(struct sr_dev_driver *di, GSList *options) diff --git a/src/hardware/hp-3457a/api.c b/src/hardware/hp-3457a/api.c index 5dedc921..a5ff7d98 100644 --- a/src/hardware/hp-3457a/api.c +++ b/src/hardware/hp-3457a/api.c @@ -168,7 +168,7 @@ static struct sr_dev_inst *probe_device(struct sr_scpi_dev_inst *scpi) static int init(struct sr_dev_driver *di, struct sr_context *sr_ctx) { - return std_init(sr_ctx, di, LOG_PREFIX); + return std_init(di, sr_ctx, LOG_PREFIX); } static GSList *scan(struct sr_dev_driver *di, GSList *options) diff --git a/src/hardware/hung-chang-dso-2100/api.c b/src/hardware/hung-chang-dso-2100/api.c index 791fd5d6..eb2246f6 100644 --- a/src/hardware/hung-chang-dso-2100/api.c +++ b/src/hardware/hung-chang-dso-2100/api.c @@ -106,7 +106,7 @@ static const uint8_t coupling_map[] = { static int init(struct sr_dev_driver *di, struct sr_context *sr_ctx) { - return std_init(sr_ctx, di, LOG_PREFIX); + return std_init(di, sr_ctx, LOG_PREFIX); } static GSList *scan_port(GSList *devices, struct sr_dev_driver *di, diff --git a/src/hardware/ikalogic-scanalogic2/api.c b/src/hardware/ikalogic-scanalogic2/api.c index 1ce3b91c..6a8e0956 100644 --- a/src/hardware/ikalogic-scanalogic2/api.c +++ b/src/hardware/ikalogic-scanalogic2/api.c @@ -56,7 +56,7 @@ SR_PRIV struct sr_dev_driver ikalogic_scanalogic2_driver_info; static int init(struct sr_dev_driver *di, struct sr_context *sr_ctx) { - return std_init(sr_ctx, di, LOG_PREFIX); + return std_init(di, sr_ctx, LOG_PREFIX); } static GSList *scan(struct sr_dev_driver *di, GSList *options) diff --git a/src/hardware/ikalogic-scanaplus/api.c b/src/hardware/ikalogic-scanaplus/api.c index 8c8ee13f..898d7a3a 100644 --- a/src/hardware/ikalogic-scanaplus/api.c +++ b/src/hardware/ikalogic-scanaplus/api.c @@ -67,7 +67,7 @@ static int dev_clear(const struct sr_dev_driver *di) static int init(struct sr_dev_driver *di, struct sr_context *sr_ctx) { - return std_init(sr_ctx, di, LOG_PREFIX); + return std_init(di, sr_ctx, LOG_PREFIX); } static GSList *scan(struct sr_dev_driver *di, GSList *options) diff --git a/src/hardware/kecheng-kc-330b/api.c b/src/hardware/kecheng-kc-330b/api.c index 86ac30b1..309b1b64 100644 --- a/src/hardware/kecheng-kc-330b/api.c +++ b/src/hardware/kecheng-kc-330b/api.c @@ -65,7 +65,7 @@ SR_PRIV struct sr_dev_driver kecheng_kc_330b_driver_info; static int init(struct sr_dev_driver *di, struct sr_context *sr_ctx) { - return std_init(sr_ctx, di, LOG_PREFIX); + return std_init(di, sr_ctx, LOG_PREFIX); } static int scan_kecheng(struct sr_dev_driver *di, diff --git a/src/hardware/kern-scale/api.c b/src/hardware/kern-scale/api.c index 0705750a..ef954306 100644 --- a/src/hardware/kern-scale/api.c +++ b/src/hardware/kern-scale/api.c @@ -38,7 +38,7 @@ static const uint32_t devopts[] = { static int init(struct sr_dev_driver *di, struct sr_context *sr_ctx) { - return std_init(sr_ctx, di, LOG_PREFIX); + return std_init(di, sr_ctx, LOG_PREFIX); } static GSList *scan(struct sr_dev_driver *di, GSList *options) diff --git a/src/hardware/korad-kaxxxxp/api.c b/src/hardware/korad-kaxxxxp/api.c index 5361908a..9a2b9169 100644 --- a/src/hardware/korad-kaxxxxp/api.c +++ b/src/hardware/korad-kaxxxxp/api.c @@ -66,7 +66,7 @@ SR_PRIV struct sr_dev_driver korad_kaxxxxp_driver_info; static int init(struct sr_dev_driver *di, struct sr_context *sr_ctx) { - return std_init(sr_ctx, di, LOG_PREFIX); + return std_init(di, sr_ctx, LOG_PREFIX); } static GSList *scan(struct sr_dev_driver *di, GSList *options) diff --git a/src/hardware/lascar-el-usb/api.c b/src/hardware/lascar-el-usb/api.c index 3b78b198..ce61f462 100644 --- a/src/hardware/lascar-el-usb/api.c +++ b/src/hardware/lascar-el-usb/api.c @@ -40,7 +40,7 @@ static const uint32_t devopts[] = { static int init(struct sr_dev_driver *di, struct sr_context *sr_ctx) { - return std_init(sr_ctx, di, LOG_PREFIX); + return std_init(di, sr_ctx, LOG_PREFIX); } static GSList *scan(struct sr_dev_driver *di, GSList *options) diff --git a/src/hardware/lecroy-logicstudio/api.c b/src/hardware/lecroy-logicstudio/api.c index b6c51160..8e58bd04 100644 --- a/src/hardware/lecroy-logicstudio/api.c +++ b/src/hardware/lecroy-logicstudio/api.c @@ -75,7 +75,7 @@ SR_PRIV struct sr_dev_driver lecroy_logicstudio_driver_info; static int init(struct sr_dev_driver *di, struct sr_context *sr_ctx) { - return std_init(sr_ctx, di, LOG_PREFIX); + return std_init(di, sr_ctx, LOG_PREFIX); } static struct sr_dev_inst *create_device(struct sr_dev_driver *di, diff --git a/src/hardware/link-mso19/api.c b/src/hardware/link-mso19/api.c index c35fc718..e25c5578 100644 --- a/src/hardware/link-mso19/api.c +++ b/src/hardware/link-mso19/api.c @@ -87,7 +87,7 @@ static int dev_clear(const struct sr_dev_driver *di) static int init(struct sr_dev_driver *di, struct sr_context *sr_ctx) { - return std_init(sr_ctx, di, LOG_PREFIX); + return std_init(di, sr_ctx, LOG_PREFIX); } static GSList *scan(struct sr_dev_driver *di, GSList *options) diff --git a/src/hardware/manson-hcs-3xxx/api.c b/src/hardware/manson-hcs-3xxx/api.c index 29a29f9f..4ce5909b 100644 --- a/src/hardware/manson-hcs-3xxx/api.c +++ b/src/hardware/manson-hcs-3xxx/api.c @@ -77,7 +77,7 @@ SR_PRIV struct sr_dev_driver manson_hcs_3xxx_driver_info; static int init(struct sr_dev_driver *di, struct sr_context *sr_ctx) { - return std_init(sr_ctx, di, LOG_PREFIX); + return std_init(di, sr_ctx, LOG_PREFIX); } static GSList *scan(struct sr_dev_driver *di, GSList *options) diff --git a/src/hardware/maynuo-m97/api.c b/src/hardware/maynuo-m97/api.c index b99f8eeb..59f9c7ff 100644 --- a/src/hardware/maynuo-m97/api.c +++ b/src/hardware/maynuo-m97/api.c @@ -113,7 +113,7 @@ SR_PRIV struct sr_dev_driver maynuo_m97_driver_info; static int init(struct sr_dev_driver *di, struct sr_context *sr_ctx) { - return std_init(sr_ctx, di, LOG_PREFIX); + return std_init(di, sr_ctx, LOG_PREFIX); } static struct sr_dev_inst *probe_device(struct sr_modbus_dev_inst *modbus) diff --git a/src/hardware/mic-985xx/api.c b/src/hardware/mic-985xx/api.c index b0b64115..f6d77f05 100644 --- a/src/hardware/mic-985xx/api.c +++ b/src/hardware/mic-985xx/api.c @@ -59,7 +59,7 @@ SR_PRIV const struct mic_dev_info mic_devs[] = { static int init(struct sr_context *sr_ctx, int idx) { - return std_init(sr_ctx, mic_devs[idx].di, LOG_PREFIX); + return std_init(mic_devs[idx].di, sr_ctx, LOG_PREFIX); } static GSList *mic_scan(const char *conn, const char *serialcomm, int idx) diff --git a/src/hardware/motech-lps-30x/api.c b/src/hardware/motech-lps-30x/api.c index 02ee76dc..8d87da02 100644 --- a/src/hardware/motech-lps-30x/api.c +++ b/src/hardware/motech-lps-30x/api.c @@ -135,7 +135,7 @@ static const struct lps_modelspec models[] = { static int init_lps301(struct sr_dev_driver *di, struct sr_context *sr_ctx) { - return std_init(sr_ctx, di, LOG_PREFIX); + return std_init(di, sr_ctx, LOG_PREFIX); } /** Send command to device with va_list. diff --git a/src/hardware/norma-dmm/api.c b/src/hardware/norma-dmm/api.c index 91fc5a1b..fa32fa65 100644 --- a/src/hardware/norma-dmm/api.c +++ b/src/hardware/norma-dmm/api.c @@ -67,7 +67,7 @@ static const char *get_typestr(int type, struct sr_dev_driver *drv) static int init(struct sr_dev_driver *di, struct sr_context *sr_ctx) { - return std_init(sr_ctx, di, LOG_PREFIX); + return std_init(di, sr_ctx, LOG_PREFIX); } static GSList *scan(struct sr_dev_driver *drv, GSList *options) diff --git a/src/hardware/openbench-logic-sniffer/api.c b/src/hardware/openbench-logic-sniffer/api.c index 9a96e234..96a7cc09 100644 --- a/src/hardware/openbench-logic-sniffer/api.c +++ b/src/hardware/openbench-logic-sniffer/api.c @@ -89,7 +89,7 @@ SR_PRIV struct sr_dev_driver ols_driver_info; static int init(struct sr_dev_driver *di, struct sr_context *sr_ctx) { - return std_init(sr_ctx, di, LOG_PREFIX); + return std_init(di, sr_ctx, LOG_PREFIX); } static GSList *scan(struct sr_dev_driver *di, GSList *options) diff --git a/src/hardware/pipistrello-ols/api.c b/src/hardware/pipistrello-ols/api.c index a2b01dce..c4d0cf37 100644 --- a/src/hardware/pipistrello-ols/api.c +++ b/src/hardware/pipistrello-ols/api.c @@ -79,7 +79,7 @@ SR_PRIV struct sr_dev_driver p_ols_driver_info; static int init(struct sr_dev_driver *di, struct sr_context *sr_ctx) { - return std_init(sr_ctx, di, LOG_PREFIX); + return std_init(di, sr_ctx, LOG_PREFIX); } static GSList *scan(struct sr_dev_driver *di, GSList *options) diff --git a/src/hardware/rigol-ds/api.c b/src/hardware/rigol-ds/api.c index f38ad8db..53208a72 100644 --- a/src/hardware/rigol-ds/api.c +++ b/src/hardware/rigol-ds/api.c @@ -274,7 +274,7 @@ static int dev_clear(const struct sr_dev_driver *di) static int init(struct sr_dev_driver *di, struct sr_context *sr_ctx) { - return std_init(sr_ctx, di, LOG_PREFIX); + return std_init(di, sr_ctx, LOG_PREFIX); } static struct sr_dev_inst *probe_device(struct sr_scpi_dev_inst *scpi) diff --git a/src/hardware/saleae-logic16/api.c b/src/hardware/saleae-logic16/api.c index 4990ce82..5c587eff 100644 --- a/src/hardware/saleae-logic16/api.c +++ b/src/hardware/saleae-logic16/api.c @@ -97,7 +97,7 @@ static const uint64_t samplerates[] = { static int init(struct sr_dev_driver *di, struct sr_context *sr_ctx) { - return std_init(sr_ctx, di, LOG_PREFIX); + return std_init(di, sr_ctx, LOG_PREFIX); } static gboolean check_conf_profile(libusb_device *dev) diff --git a/src/hardware/scpi-pps/api.c b/src/hardware/scpi-pps/api.c index 5fd83d4e..01ae50cc 100644 --- a/src/hardware/scpi-pps/api.c +++ b/src/hardware/scpi-pps/api.c @@ -43,7 +43,7 @@ static const struct pps_channel_instance pci[] = { static int init(struct sr_dev_driver *di, struct sr_context *sr_ctx) { - return std_init(sr_ctx, di, LOG_PREFIX); + return std_init(di, sr_ctx, LOG_PREFIX); } static struct sr_dev_inst *probe_device(struct sr_scpi_dev_inst *scpi) diff --git a/src/hardware/serial-dmm/api.c b/src/hardware/serial-dmm/api.c index b66274c5..b16caa9a 100644 --- a/src/hardware/serial-dmm/api.c +++ b/src/hardware/serial-dmm/api.c @@ -43,7 +43,7 @@ static const uint32_t devopts[] = { static int init(struct sr_dev_driver *di, struct sr_context *sr_ctx) { - return std_init(sr_ctx, di, LOG_PREFIX); + return std_init(di, sr_ctx, LOG_PREFIX); } static GSList *scan(struct sr_dev_driver *di, GSList *options) diff --git a/src/hardware/sysclk-lwla/api.c b/src/hardware/sysclk-lwla/api.c index 0a614f9d..33992ffe 100644 --- a/src/hardware/sysclk-lwla/api.c +++ b/src/hardware/sysclk-lwla/api.c @@ -65,7 +65,7 @@ static const char *const signal_edge_names[] = { */ static int init(struct sr_dev_driver *di, struct sr_context *sr_ctx) { - return std_init(sr_ctx, di, LOG_PREFIX); + return std_init(di, sr_ctx, LOG_PREFIX); } /* Create a new sigrok device instance for the indicated LWLA model. diff --git a/src/hardware/teleinfo/api.c b/src/hardware/teleinfo/api.c index be4261c9..a99fd37f 100644 --- a/src/hardware/teleinfo/api.c +++ b/src/hardware/teleinfo/api.c @@ -40,7 +40,7 @@ SR_PRIV struct sr_dev_driver teleinfo_driver_info; static int init(struct sr_dev_driver *di, struct sr_context *sr_ctx) { - return std_init(sr_ctx, di, LOG_PREFIX); + return std_init(di, sr_ctx, LOG_PREFIX); } static GSList *scan(struct sr_dev_driver *di, GSList *options) diff --git a/src/hardware/testo/api.c b/src/hardware/testo/api.c index a6146e08..79a11b43 100644 --- a/src/hardware/testo/api.c +++ b/src/hardware/testo/api.c @@ -45,7 +45,7 @@ static const struct testo_model models[] = { static int init(struct sr_dev_driver *di, struct sr_context *sr_ctx) { - return std_init(sr_ctx, di, LOG_PREFIX); + return std_init(di, sr_ctx, LOG_PREFIX); } static GSList *scan(struct sr_dev_driver *di, GSList *options) diff --git a/src/hardware/tondaj-sl-814/api.c b/src/hardware/tondaj-sl-814/api.c index 20beb232..7c9c1bf8 100644 --- a/src/hardware/tondaj-sl-814/api.c +++ b/src/hardware/tondaj-sl-814/api.c @@ -43,7 +43,7 @@ SR_PRIV struct sr_dev_driver tondaj_sl_814_driver_info; static int init(struct sr_dev_driver *di, struct sr_context *sr_ctx) { - return std_init(sr_ctx, di, LOG_PREFIX); + return std_init(di, sr_ctx, LOG_PREFIX); } static GSList *scan(struct sr_dev_driver *di, GSList *options) diff --git a/src/hardware/uni-t-dmm/api.c b/src/hardware/uni-t-dmm/api.c index 2d8cff1e..1c1cd300 100644 --- a/src/hardware/uni-t-dmm/api.c +++ b/src/hardware/uni-t-dmm/api.c @@ -48,7 +48,7 @@ static const uint32_t devopts[] = { static int init(struct sr_dev_driver *di, struct sr_context *sr_ctx) { - return std_init(sr_ctx, di, LOG_PREFIX); + return std_init(di, sr_ctx, LOG_PREFIX); } static GSList *scan(struct sr_dev_driver *di, GSList *options) diff --git a/src/hardware/uni-t-ut32x/api.c b/src/hardware/uni-t-ut32x/api.c index 7ed3f88c..5e8be27b 100644 --- a/src/hardware/uni-t-ut32x/api.c +++ b/src/hardware/uni-t-ut32x/api.c @@ -41,7 +41,7 @@ SR_PRIV struct sr_dev_driver uni_t_ut32x_driver_info; static int init(struct sr_dev_driver *di, struct sr_context *sr_ctx) { - return std_init(sr_ctx, di, LOG_PREFIX); + return std_init(di, sr_ctx, LOG_PREFIX); } static GSList *scan(struct sr_dev_driver *di, GSList *options) diff --git a/src/hardware/victor-dmm/api.c b/src/hardware/victor-dmm/api.c index 47854ee9..c00c29fb 100644 --- a/src/hardware/victor-dmm/api.c +++ b/src/hardware/victor-dmm/api.c @@ -52,7 +52,7 @@ static const uint32_t devopts[] = { static int init(struct sr_dev_driver *di, struct sr_context *sr_ctx) { - return std_init(sr_ctx, di, LOG_PREFIX); + return std_init(di, sr_ctx, LOG_PREFIX); } static GSList *scan(struct sr_dev_driver *di, GSList *options) diff --git a/src/hardware/yokogawa-dlm/api.c b/src/hardware/yokogawa-dlm/api.c index 082c0179..547179d0 100644 --- a/src/hardware/yokogawa-dlm/api.c +++ b/src/hardware/yokogawa-dlm/api.c @@ -65,7 +65,7 @@ enum { static int init(struct sr_dev_driver *di, struct sr_context *sr_ctx) { - return std_init(sr_ctx, di, LOG_PREFIX); + return std_init(di, sr_ctx, LOG_PREFIX); } static struct sr_dev_inst *probe_usbtmc_device(struct sr_scpi_dev_inst *scpi) diff --git a/src/hardware/zeroplus-logic-cube/api.c b/src/hardware/zeroplus-logic-cube/api.c index 23a2e69f..32c86899 100644 --- a/src/hardware/zeroplus-logic-cube/api.c +++ b/src/hardware/zeroplus-logic-cube/api.c @@ -157,7 +157,7 @@ SR_PRIV int zp_set_samplerate(struct dev_context *devc, uint64_t samplerate) static int init(struct sr_dev_driver *di, struct sr_context *sr_ctx) { - return std_init(sr_ctx, di, LOG_PREFIX); + return std_init(di, sr_ctx, LOG_PREFIX); } static GSList *scan(struct sr_dev_driver *di, GSList *options) diff --git a/src/libsigrok-internal.h b/src/libsigrok-internal.h index 589d0a4d..328e1707 100644 --- a/src/libsigrok-internal.h +++ b/src/libsigrok-internal.h @@ -859,7 +859,7 @@ SR_PRIV int sr_analog_init(struct sr_datafeed_analog *analog, typedef int (*dev_close_callback)(struct sr_dev_inst *sdi); typedef void (*std_dev_clear_callback)(void *priv); -SR_PRIV int std_init(struct sr_context *sr_ctx, struct sr_dev_driver *di, +SR_PRIV int std_init(struct sr_dev_driver *di, struct sr_context *sr_ctx, const char *prefix); SR_PRIV int std_cleanup(const struct sr_dev_driver *di); #ifdef HAVE_LIBSERIALPORT diff --git a/src/session_driver.c b/src/session_driver.c index d56c22c2..c7f2b3d7 100644 --- a/src/session_driver.c +++ b/src/session_driver.c @@ -208,7 +208,7 @@ static int receive_data(int fd, int revents, void *cb_data) static int init(struct sr_dev_driver *di, struct sr_context *sr_ctx) { - return std_init(sr_ctx, di, LOG_PREFIX); + return std_init(di, sr_ctx, LOG_PREFIX); } static int dev_clear(const struct sr_dev_driver *di) diff --git a/src/std.c b/src/std.c index aadf8236..8f6f3786 100644 --- a/src/std.c +++ b/src/std.c @@ -39,13 +39,13 @@ * It creates a new 'struct drv_context' (drvc), assigns sr_ctx to it, and * then 'drvc' is assigned to the 'struct sr_dev_driver' (di) that is passed. * - * @param sr_ctx The libsigrok context to assign. * @param di The driver instance to use. + * @param sr_ctx The libsigrok context to assign. * @param[in] prefix A driver-specific prefix string used for log messages. * * @return SR_OK upon success, SR_ERR_ARG upon invalid arguments. */ -SR_PRIV int std_init(struct sr_context *sr_ctx, struct sr_dev_driver *di, +SR_PRIV int std_init(struct sr_dev_driver *di, struct sr_context *sr_ctx, const char *prefix) { struct drv_context *drvc;