From: Peter Stuge Date: Mon, 3 Dec 2012 01:47:55 +0000 (+0100) Subject: Add a struct sr_context * parameter to hw_init() X-Git-Tag: dsupstream~484 X-Git-Url: https://sigrok.org/gitaction?a=commitdiff_plain;h=34f06b903e3529a73feb7a6e74fae934a999f821;p=libsigrok.git Add a struct sr_context * parameter to hw_init() --- diff --git a/hardware/agilent-dmm/api.c b/hardware/agilent-dmm/api.c index fcd51d54..b68c9e7f 100644 --- a/hardware/agilent-dmm/api.c +++ b/hardware/agilent-dmm/api.c @@ -94,7 +94,7 @@ static int clear_instances(void) return SR_OK; } -static int hw_init(void) +static int hw_init(struct sr_context *sr_ctx) { struct drv_context *drvc; diff --git a/hardware/alsa/alsa.c b/hardware/alsa/alsa.c index 55d96c32..23339dcd 100644 --- a/hardware/alsa/alsa.c +++ b/hardware/alsa/alsa.c @@ -75,7 +75,7 @@ struct context { void *session_dev_id; }; -static int hw_init(void) +static int hw_init(struct sr_context *sr_ctx) { struct sr_dev_inst *sdi; struct context *ctx; diff --git a/hardware/asix-sigma/asix-sigma.c b/hardware/asix-sigma/asix-sigma.c index 515718c1..6d9bea2d 100644 --- a/hardware/asix-sigma/asix-sigma.c +++ b/hardware/asix-sigma/asix-sigma.c @@ -432,7 +432,7 @@ static int clear_instances(void) return SR_OK; } -static int hw_init(void) +static int hw_init(struct sr_context *sr_ctx) { struct drv_context *drvc; diff --git a/hardware/chronovu-la8/api.c b/hardware/chronovu-la8/api.c index 705a68bc..b3c37910 100644 --- a/hardware/chronovu-la8/api.c +++ b/hardware/chronovu-la8/api.c @@ -68,7 +68,7 @@ static int clear_instances(void) return SR_OK; } -static int hw_init(void) +static int hw_init(struct sr_context *sr_ctx) { struct drv_context *drvc; diff --git a/hardware/colead-slm/api.c b/hardware/colead-slm/api.c index 45e19ba6..f7d596dc 100644 --- a/hardware/colead-slm/api.c +++ b/hardware/colead-slm/api.c @@ -77,7 +77,7 @@ static int clear_instances(void) return SR_OK; } -static int hw_init(void) +static int hw_init(struct sr_context *sr_ctx) { struct drv_context *drvc; diff --git a/hardware/demo/demo.c b/hardware/demo/demo.c index 0c4c211e..ff7ba06b 100644 --- a/hardware/demo/demo.c +++ b/hardware/demo/demo.c @@ -153,7 +153,7 @@ static int clear_instances(void) return SR_OK; } -static int hw_init(void) +static int hw_init(struct sr_context *sr_ctx) { struct drv_context *drvc; diff --git a/hardware/fluke-dmm/api.c b/hardware/fluke-dmm/api.c index d6391fa0..2687c12e 100644 --- a/hardware/fluke-dmm/api.c +++ b/hardware/fluke-dmm/api.c @@ -81,7 +81,7 @@ static int clear_instances(void) return SR_OK; } -static int hw_init(void) +static int hw_init(struct sr_context *sr_ctx) { struct drv_context *drvc; diff --git a/hardware/fx2lafw/fx2lafw.c b/hardware/fx2lafw/fx2lafw.c index b3df9731..c82cef87 100644 --- a/hardware/fx2lafw/fx2lafw.c +++ b/hardware/fx2lafw/fx2lafw.c @@ -399,7 +399,7 @@ static int clear_instances(void) * API callbacks */ -static int hw_init(void) +static int hw_init(struct sr_context *sr_ctx) { struct drv_context *drvc; diff --git a/hardware/hantek-dso/api.c b/hardware/hantek-dso/api.c index c819fbbe..e221b5f2 100644 --- a/hardware/hantek-dso/api.c +++ b/hardware/hantek-dso/api.c @@ -253,7 +253,7 @@ static int clear_instances(void) return SR_OK; } -static int hw_init(void) +static int hw_init(struct sr_context *sr_ctx) { struct drv_context *drvc; diff --git a/hardware/link-mso19/link-mso19.c b/hardware/link-mso19/link-mso19.c index 521c8440..6fdf51c6 100644 --- a/hardware/link-mso19/link-mso19.c +++ b/hardware/link-mso19/link-mso19.c @@ -401,7 +401,7 @@ static int mso_parse_serial(const char *iSerial, const char *iProduct, return SR_OK; } -static int hw_init(void) +static int hw_init(struct sr_context *sr_ctx) { /* Nothing to do. */ diff --git a/hardware/openbench-logic-sniffer/ols.c b/hardware/openbench-logic-sniffer/ols.c index a8d9dbea..4d369bac 100644 --- a/hardware/openbench-logic-sniffer/ols.c +++ b/hardware/openbench-logic-sniffer/ols.c @@ -362,7 +362,7 @@ static struct sr_dev_inst *get_metadata(struct sr_serial_dev_inst *serial) return sdi; } -static int hw_init(void) +static int hw_init(struct sr_context *sr_ctx) { struct drv_context *drvc; diff --git a/hardware/serial-dmm/api.c b/hardware/serial-dmm/api.c index 986e649b..a146ec86 100644 --- a/hardware/serial-dmm/api.c +++ b/hardware/serial-dmm/api.c @@ -169,7 +169,7 @@ static int clear_instances(void) return SR_OK; } -static int hw_init(int dmm) +static int hw_init(struct sr_context *sr_ctx, int dmm) { struct drv_context *drvc; @@ -207,59 +207,59 @@ static int hw_init(int dmm) return SR_OK; } -static int hw_init_digitek_dt4000zc(void) +static int hw_init_digitek_dt4000zc(struct sr_context *sr_ctx) { - return hw_init(DIGITEK_DT4000ZC); + return hw_init(sr_ctx, DIGITEK_DT4000ZC); } -static int hw_init_tekpower_tp4000zc(void) +static int hw_init_tekpower_tp4000zc(struct sr_context *sr_ctx) { - return hw_init(TEKPOWER_TP4000ZC); + return hw_init(sr_ctx, TEKPOWER_TP4000ZC); } -static int hw_init_metex_me31(void) +static int hw_init_metex_me31(struct sr_context *sr_ctx) { - return hw_init(METEX_ME31); + return hw_init(sr_ctx, METEX_ME31); } -static int hw_init_peaktech_3410(void) +static int hw_init_peaktech_3410(struct sr_context *sr_ctx) { - return hw_init(PEAKTECH_3410); + return hw_init(sr_ctx, PEAKTECH_3410); } -static int hw_init_mastech_mas345(void) +static int hw_init_mastech_mas345(struct sr_context *sr_ctx) { - return hw_init(MASTECH_MAS345); + return hw_init(sr_ctx, MASTECH_MAS345); } -static int hw_init_va_va18b(void) +static int hw_init_va_va18b(struct sr_context *sr_ctx) { - return hw_init(VA_VA18B); + return hw_init(sr_ctx, VA_VA18B); } -static int hw_init_metex_m3640d(void) +static int hw_init_metex_m3640d(struct sr_context *sr_ctx) { - return hw_init(METEX_M3640D); + return hw_init(sr_ctx, METEX_M3640D); } -static int hw_init_peaktech_4370(void) +static int hw_init_peaktech_4370(struct sr_context *sr_ctx) { - return hw_init(PEAKTECH_4370); + return hw_init(sr_ctx, PEAKTECH_4370); } -static int hw_init_pce_pce_dm32(void) +static int hw_init_pce_pce_dm32(struct sr_context *sr_ctx) { - return hw_init(PCE_PCE_DM32); + return hw_init(sr_ctx, PCE_PCE_DM32); } -static int hw_init_radioshack_22_168(void) +static int hw_init_radioshack_22_168(struct sr_context *sr_ctx) { - return hw_init(RADIOSHACK_22_168); + return hw_init(sr_ctx, RADIOSHACK_22_168); } -static int hw_init_radioshack_22_812(void) +static int hw_init_radioshack_22_812(struct sr_context *sr_ctx) { - return hw_init(RADIOSHACK_22_812); + return hw_init(sr_ctx, RADIOSHACK_22_812); } static GSList *scan(const char *conn, const char *serialcomm, int dmm) diff --git a/hardware/tondaj-sl-814/api.c b/hardware/tondaj-sl-814/api.c index beb8c337..89624370 100644 --- a/hardware/tondaj-sl-814/api.c +++ b/hardware/tondaj-sl-814/api.c @@ -73,7 +73,7 @@ static int clear_instances(void) return SR_OK; } -static int hw_init(void) +static int hw_init(struct sr_context *sr_ctx) { struct drv_context *drvc; diff --git a/hardware/uni-t-dmm/api.c b/hardware/uni-t-dmm/api.c index cf4c3435..e96cf00a 100644 --- a/hardware/uni-t-dmm/api.c +++ b/hardware/uni-t-dmm/api.c @@ -53,7 +53,7 @@ static int clear_instances(void) return SR_OK; } -static int hw_init(int dmm) +static int hw_init(struct sr_context *sr_ctx, int dmm) { int ret; struct drv_context *drvc; @@ -80,14 +80,14 @@ static int hw_init(int dmm) return SR_OK; } -static int hw_init_ut61d(void) +static int hw_init_ut61d(struct sr_context *sr_ctx) { - return hw_init(UNI_T_UT61D); + return hw_init(sr_ctx, UNI_T_UT61D); } -static int hw_init_vc820(void) +static int hw_init_vc820(struct sr_context *sr_ctx) { - return hw_init(VOLTCRAFT_VC820); + return hw_init(sr_ctx, VOLTCRAFT_VC820); } static GSList *hw_scan(GSList *options) diff --git a/hardware/victor-dmm/api.c b/hardware/victor-dmm/api.c index ae471d76..b5a28a6e 100644 --- a/hardware/victor-dmm/api.c +++ b/hardware/victor-dmm/api.c @@ -76,7 +76,7 @@ static int clear_instances(void) return SR_OK; } -static int hw_init(void) +static int hw_init(struct sr_context *sr_ctx) { struct drv_context *drvc; diff --git a/hardware/zeroplus-logic-cube/zeroplus.c b/hardware/zeroplus-logic-cube/zeroplus.c index cb83d11d..57345da8 100644 --- a/hardware/zeroplus-logic-cube/zeroplus.c +++ b/hardware/zeroplus-logic-cube/zeroplus.c @@ -303,7 +303,7 @@ static int clear_instances(void) * API callbacks */ -static int hw_init(void) +static int hw_init(struct sr_context *sr_ctx) { struct drv_context *drvc; diff --git a/hwdriver.c b/hwdriver.c index d2f62e3a..2b04e229 100644 --- a/hwdriver.c +++ b/hwdriver.c @@ -222,7 +222,7 @@ SR_API int sr_driver_init(struct sr_context *ctx, struct sr_dev_driver *driver) { if (driver->init) - return driver->init(); + return driver->init(ctx); return SR_OK; } diff --git a/libsigrok.h b/libsigrok.h index d7d31a33..94bc5229 100644 --- a/libsigrok.h +++ b/libsigrok.h @@ -605,7 +605,7 @@ struct sr_dev_driver { char *name; char *longname; int api_version; - int (*init) (void); + int (*init) (struct sr_context *sr_ctx); int (*cleanup) (void); GSList *(*scan) (GSList *options); GSList *(*dev_list) (void); diff --git a/session_driver.c b/session_driver.c index 43ad24d6..011b7312 100644 --- a/session_driver.c +++ b/session_driver.c @@ -117,8 +117,10 @@ static int receive_data(int fd, int revents, void *cb_data) /* driver callbacks */ static int hw_cleanup(void); -static int hw_init(void) +static int hw_init(struct sr_context *sr_ctx) { + (void)sr_ctx; + return SR_OK; }