From: Lars-Peter Clausen Date: Sun, 8 May 2016 13:47:31 +0000 (+0200) Subject: std_init(): Drop check if pass in driver is non-NULL X-Git-Tag: libsigrok-0.5.0~423 X-Git-Url: https://sigrok.org/gitaction?a=commitdiff_plain;h=c45c32ce47f429099cb0f1cabc1b45b9bcf44855;p=libsigrok.git std_init(): Drop check if pass in driver is non-NULL std_init() checks if the pass in struct sr_dev_driver is non-NULL and prints a error message and returns an error if it is NULL. std_init() is exclusively called from driver init() callbacks for which the core already checks if the struct sr_dev_driver is non-NULL before invoking the callback. This means the check in std_init() will always evaluate to false. So drop this check. This also means that the prefix parameter that was used in the error message is no longer needed and can be removed from the function signature. Doing so will make the std_init() function signature identical to the init() callback signature which will allow to directly use it as such. Signed-off-by: Lars-Peter Clausen --- diff --git a/src/hardware/agilent-dmm/api.c b/src/hardware/agilent-dmm/api.c index da6b84ca..b7e4a6bd 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(di, sr_ctx, LOG_PREFIX); + return std_init(di, sr_ctx); } 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 6163f2df..14b8ea91 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(di, sr_ctx, LOG_PREFIX); + return std_init(di, sr_ctx); } 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 4543a025..4bbbf243 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(di, sr_ctx, LOG_PREFIX); + return std_init(di, sr_ctx); } 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 cb5eeca4..cb61b92b 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(di, sr_ctx, LOG_PREFIX); + return std_init(di, sr_ctx); } 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 e46bff41..fea793a1 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(di, sr_ctx, LOG_PREFIX); + return std_init(di, sr_ctx); } 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 49cf96ae..9103aeb1 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(di, sr_ctx, LOG_PREFIX); + return std_init(di, sr_ctx); } 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 e8309bd2..e28350c1 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(di, sr_ctx, LOG_PREFIX); + return std_init(di, sr_ctx); } 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 cf41e90d..88a9a5aa 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(di, sr_ctx, LOG_PREFIX); + return std_init(di, sr_ctx); } 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 28e2a5ba..9aad6504 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(di, sr_ctx, LOG_PREFIX); + return std_init(di, sr_ctx); } 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 40b8c6d8..c7816ba6 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(di, sr_ctx, LOG_PREFIX); + return std_init(di, sr_ctx); } 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 6c0e0890..c78825ab 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(center_devs[idx].di, sr_ctx, LOG_PREFIX); + return std_init(center_devs[idx].di, sr_ctx); } 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 fa28d82e..322ac3b0 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(di, sr_ctx, LOG_PREFIX); + return std_init(di, sr_ctx); } 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 7cbd2e67..56b3ead7 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(di, sr_ctx, LOG_PREFIX); + return std_init(di, sr_ctx); } 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 357dad94..16c4157a 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(di, sr_ctx, LOG_PREFIX); + return std_init(di, sr_ctx); } 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 1587d5e7..3df4eccb 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(di, sr_ctx, LOG_PREFIX); + return std_init(di, sr_ctx); } 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 7a832022..3f2a54a1 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(di, sr_ctx, LOG_PREFIX); + return std_init(di, sr_ctx); } 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 8d4ed2bb..cd34c181 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(di, sr_ctx, LOG_PREFIX); + return std_init(di, sr_ctx); } 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 c258be14..2a64729e 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(di, sr_ctx, LOG_PREFIX); + return std_init(di, sr_ctx); } 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 e56f152f..6f6c53fb 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(di, sr_ctx, LOG_PREFIX); + return std_init(di, sr_ctx); } 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 67ad40d3..de3e9ea5 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(di, sr_ctx, LOG_PREFIX); + return std_init(di, sr_ctx); } /** diff --git a/src/hardware/gwinstek-gds-800/api.c b/src/hardware/gwinstek-gds-800/api.c index 5e4a67fc..bd9461e8 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(di, sr_ctx, LOG_PREFIX); + return std_init(di, sr_ctx); } 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 f75f55e0..1e60a34a 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(di, sr_ctx, LOG_PREFIX); + return std_init(di, sr_ctx); } static int check_manufacturer(const char *manufacturer) diff --git a/src/hardware/hantek-6xxx/api.c b/src/hardware/hantek-6xxx/api.c index ab866a47..838805db 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(di, sr_ctx, LOG_PREFIX); + return std_init(di, sr_ctx); } 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 6162d5c1..c5715733 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(di, sr_ctx, LOG_PREFIX); + return std_init(di, sr_ctx); } 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 a5ff7d98..2d05f29a 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(di, sr_ctx, LOG_PREFIX); + return std_init(di, sr_ctx); } 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 eb2246f6..e628c771 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(di, sr_ctx, LOG_PREFIX); + return std_init(di, sr_ctx); } 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 6a8e0956..7f03a59a 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(di, sr_ctx, LOG_PREFIX); + return std_init(di, sr_ctx); } 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 898d7a3a..e5b6cec8 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(di, sr_ctx, LOG_PREFIX); + return std_init(di, sr_ctx); } 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 309b1b64..6a64b8f8 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(di, sr_ctx, LOG_PREFIX); + return std_init(di, sr_ctx); } 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 ef954306..ed55687f 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(di, sr_ctx, LOG_PREFIX); + return std_init(di, sr_ctx); } 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 9a2b9169..6f4ad65a 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(di, sr_ctx, LOG_PREFIX); + return std_init(di, sr_ctx); } 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 ce61f462..78eab705 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(di, sr_ctx, LOG_PREFIX); + return std_init(di, sr_ctx); } 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 8e58bd04..303309b7 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(di, sr_ctx, LOG_PREFIX); + return std_init(di, sr_ctx); } 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 e25c5578..ff511730 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(di, sr_ctx, LOG_PREFIX); + return std_init(di, sr_ctx); } 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 4ce5909b..30180d3b 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(di, sr_ctx, LOG_PREFIX); + return std_init(di, sr_ctx); } 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 59f9c7ff..f8d615d1 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(di, sr_ctx, LOG_PREFIX); + return std_init(di, sr_ctx); } 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 f6d77f05..70914e1c 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(mic_devs[idx].di, sr_ctx, LOG_PREFIX); + return std_init(mic_devs[idx].di, sr_ctx); } 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 8d87da02..d8aceb50 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(di, sr_ctx, LOG_PREFIX); + return std_init(di, sr_ctx); } /** Send command to device with va_list. diff --git a/src/hardware/norma-dmm/api.c b/src/hardware/norma-dmm/api.c index fa32fa65..ad099c93 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(di, sr_ctx, LOG_PREFIX); + return std_init(di, sr_ctx); } 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 96a7cc09..bee4c3a8 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(di, sr_ctx, LOG_PREFIX); + return std_init(di, sr_ctx); } 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 c4d0cf37..6a51986f 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(di, sr_ctx, LOG_PREFIX); + return std_init(di, sr_ctx); } 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 53208a72..ce8fa116 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(di, sr_ctx, LOG_PREFIX); + return std_init(di, sr_ctx); } 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 5c587eff..5ca534b1 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(di, sr_ctx, LOG_PREFIX); + return std_init(di, sr_ctx); } 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 01ae50cc..c8904b67 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(di, sr_ctx, LOG_PREFIX); + return std_init(di, sr_ctx); } 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 b16caa9a..860062ad 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(di, sr_ctx, LOG_PREFIX); + return std_init(di, sr_ctx); } 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 33992ffe..a2e29933 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(di, sr_ctx, LOG_PREFIX); + return std_init(di, sr_ctx); } /* 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 a99fd37f..d9445e17 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(di, sr_ctx, LOG_PREFIX); + return std_init(di, sr_ctx); } 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 79a11b43..daf4965c 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(di, sr_ctx, LOG_PREFIX); + return std_init(di, sr_ctx); } 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 7c9c1bf8..9b31e1d6 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(di, sr_ctx, LOG_PREFIX); + return std_init(di, sr_ctx); } 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 1c1cd300..6e8663e5 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(di, sr_ctx, LOG_PREFIX); + return std_init(di, sr_ctx); } 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 5e8be27b..67a15518 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(di, sr_ctx, LOG_PREFIX); + return std_init(di, sr_ctx); } 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 c00c29fb..35571549 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(di, sr_ctx, LOG_PREFIX); + return std_init(di, sr_ctx); } 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 547179d0..91eea3e0 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(di, sr_ctx, LOG_PREFIX); + return std_init(di, sr_ctx); } 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 32c86899..a50ea3f2 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(di, sr_ctx, LOG_PREFIX); + return std_init(di, sr_ctx); } static GSList *scan(struct sr_dev_driver *di, GSList *options) diff --git a/src/libsigrok-internal.h b/src/libsigrok-internal.h index 328e1707..588d0908 100644 --- a/src/libsigrok-internal.h +++ b/src/libsigrok-internal.h @@ -859,8 +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_dev_driver *di, struct sr_context *sr_ctx, - const char *prefix); +SR_PRIV int std_init(struct sr_dev_driver *di, struct sr_context *sr_ctx); SR_PRIV int std_cleanup(const struct sr_dev_driver *di); #ifdef HAVE_LIBSERIALPORT SR_PRIV int std_serial_dev_open(struct sr_dev_inst *sdi); diff --git a/src/session_driver.c b/src/session_driver.c index c7f2b3d7..e0dd3fcb 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(di, sr_ctx, LOG_PREFIX); + return std_init(di, sr_ctx); } static int dev_clear(const struct sr_dev_driver *di) diff --git a/src/std.c b/src/std.c index 8f6f3786..a03e509c 100644 --- a/src/std.c +++ b/src/std.c @@ -41,20 +41,13 @@ * * @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_dev_driver *di, struct sr_context *sr_ctx, - const char *prefix) +SR_PRIV int std_init(struct sr_dev_driver *di, struct sr_context *sr_ctx) { struct drv_context *drvc; - if (!di) { - sr_err("%s: Invalid driver, cannot initialize.", prefix); - return SR_ERR_ARG; - } - drvc = g_malloc0(sizeof(struct drv_context)); drvc->sr_ctx = sr_ctx; drvc->instances = NULL;