From: Peter Stuge Date: Mon, 3 Dec 2012 01:49:36 +0000 (+0100) Subject: hw_init(): Save struct sr_context * parameter in struct drv_context X-Git-Tag: dsupstream~483 X-Git-Url: https://sigrok.org/gitaction?a=commitdiff_plain;h=1ebe4b4e6926eb1288ce77b179a92bc670eb9eca;p=libsigrok.git hw_init(): Save struct sr_context * parameter in struct drv_context --- diff --git a/hardware/agilent-dmm/api.c b/hardware/agilent-dmm/api.c index b68c9e7f..de89422a 100644 --- a/hardware/agilent-dmm/api.c +++ b/hardware/agilent-dmm/api.c @@ -103,6 +103,7 @@ static int hw_init(struct sr_context *sr_ctx) return SR_ERR_MALLOC; } + drvc->sr_ctx = sr_ctx; di->priv = drvc; return SR_OK; diff --git a/hardware/asix-sigma/asix-sigma.c b/hardware/asix-sigma/asix-sigma.c index 6d9bea2d..ed263acb 100644 --- a/hardware/asix-sigma/asix-sigma.c +++ b/hardware/asix-sigma/asix-sigma.c @@ -440,6 +440,7 @@ static int hw_init(struct sr_context *sr_ctx) sr_err("Driver context malloc failed."); return SR_ERR_MALLOC; } + drvc->sr_ctx = sr_ctx; adi->priv = drvc; return SR_OK; diff --git a/hardware/chronovu-la8/api.c b/hardware/chronovu-la8/api.c index b3c37910..9a512f90 100644 --- a/hardware/chronovu-la8/api.c +++ b/hardware/chronovu-la8/api.c @@ -77,6 +77,7 @@ static int hw_init(struct sr_context *sr_ctx) return SR_ERR_MALLOC; } + drvc->sr_ctx = sr_ctx; di->priv = drvc; return SR_OK; diff --git a/hardware/colead-slm/api.c b/hardware/colead-slm/api.c index f7d596dc..c4346ba6 100644 --- a/hardware/colead-slm/api.c +++ b/hardware/colead-slm/api.c @@ -86,6 +86,7 @@ static int hw_init(struct sr_context *sr_ctx) return SR_ERR; } + drvc->sr_ctx = sr_ctx; di->priv = drvc; return SR_OK; diff --git a/hardware/demo/demo.c b/hardware/demo/demo.c index ff7ba06b..68fda728 100644 --- a/hardware/demo/demo.c +++ b/hardware/demo/demo.c @@ -161,6 +161,7 @@ static int hw_init(struct sr_context *sr_ctx) sr_err("Driver context malloc failed."); return SR_ERR_MALLOC; } + drvc->sr_ctx = sr_ctx; ddi->priv = drvc; return SR_OK; diff --git a/hardware/fluke-dmm/api.c b/hardware/fluke-dmm/api.c index 2687c12e..154479cc 100644 --- a/hardware/fluke-dmm/api.c +++ b/hardware/fluke-dmm/api.c @@ -90,6 +90,7 @@ static int hw_init(struct sr_context *sr_ctx) return SR_ERR_MALLOC; } + drvc->sr_ctx = sr_ctx; di->priv = drvc; return SR_OK; diff --git a/hardware/fx2lafw/fx2lafw.c b/hardware/fx2lafw/fx2lafw.c index c82cef87..c1940041 100644 --- a/hardware/fx2lafw/fx2lafw.c +++ b/hardware/fx2lafw/fx2lafw.c @@ -414,6 +414,7 @@ static int hw_init(struct sr_context *sr_ctx) return SR_ERR; } + drvc->sr_ctx = sr_ctx; fdi->priv = drvc; return SR_OK; diff --git a/hardware/hantek-dso/api.c b/hardware/hantek-dso/api.c index e221b5f2..08c11642 100644 --- a/hardware/hantek-dso/api.c +++ b/hardware/hantek-dso/api.c @@ -268,6 +268,7 @@ static int hw_init(struct sr_context *sr_ctx) return SR_ERR; } + drvc->sr_ctx = sr_ctx; hdi->priv = drvc; return SR_OK; diff --git a/hardware/openbench-logic-sniffer/ols.c b/hardware/openbench-logic-sniffer/ols.c index 4d369bac..23104cfd 100644 --- a/hardware/openbench-logic-sniffer/ols.c +++ b/hardware/openbench-logic-sniffer/ols.c @@ -370,6 +370,7 @@ static int hw_init(struct sr_context *sr_ctx) sr_err("ols: driver context malloc failed."); return SR_ERR_MALLOC; } + drvc->sr_ctx = sr_ctx; odi->priv = drvc; return SR_OK; diff --git a/hardware/serial-dmm/api.c b/hardware/serial-dmm/api.c index a146ec86..8a2d7be2 100644 --- a/hardware/serial-dmm/api.c +++ b/hardware/serial-dmm/api.c @@ -202,6 +202,7 @@ static int hw_init(struct sr_context *sr_ctx, int dmm) di = di_22_812; sr_dbg("Selected '%s' subdriver.", di->name); + drvc->sr_ctx = sr_ctx; di->priv = drvc; return SR_OK; diff --git a/hardware/tondaj-sl-814/api.c b/hardware/tondaj-sl-814/api.c index 89624370..17fbc2b1 100644 --- a/hardware/tondaj-sl-814/api.c +++ b/hardware/tondaj-sl-814/api.c @@ -82,6 +82,7 @@ static int hw_init(struct sr_context *sr_ctx) return SR_ERR_MALLOC; } + drvc->sr_ctx = sr_ctx; di->priv = drvc; return SR_OK; diff --git a/hardware/uni-t-dmm/api.c b/hardware/uni-t-dmm/api.c index e96cf00a..8e390c06 100644 --- a/hardware/uni-t-dmm/api.c +++ b/hardware/uni-t-dmm/api.c @@ -75,6 +75,7 @@ static int hw_init(struct sr_context *sr_ctx, int dmm) di = di_vc820; sr_dbg("Selected '%s' subdriver.", di->name); + drvc->sr_ctx = sr_ctx; di->priv = drvc; return SR_OK; diff --git a/hardware/victor-dmm/api.c b/hardware/victor-dmm/api.c index b5a28a6e..07c61faf 100644 --- a/hardware/victor-dmm/api.c +++ b/hardware/victor-dmm/api.c @@ -84,6 +84,7 @@ static int hw_init(struct sr_context *sr_ctx) sr_err("Driver context malloc failed."); return SR_ERR_MALLOC; } + drvc->sr_ctx = sr_ctx; di->priv = drvc; return SR_OK; diff --git a/hardware/zeroplus-logic-cube/zeroplus.c b/hardware/zeroplus-logic-cube/zeroplus.c index 57345da8..a67e4600 100644 --- a/hardware/zeroplus-logic-cube/zeroplus.c +++ b/hardware/zeroplus-logic-cube/zeroplus.c @@ -311,6 +311,7 @@ static int hw_init(struct sr_context *sr_ctx) sr_err("zeroplus: driver context malloc failed."); return SR_ERR_MALLOC; } + drvc->sr_ctx = sr_ctx; zdi->priv = drvc; if (libusb_init(&usb_context) != 0) { diff --git a/libsigrok-internal.h b/libsigrok-internal.h index 4b3ae68d..ddb4f995 100644 --- a/libsigrok-internal.h +++ b/libsigrok-internal.h @@ -76,6 +76,7 @@ struct sr_serial_dev_inst { /* Private driver context. */ struct drv_context { + struct sr_context *sr_ctx; GSList *instances; };