]> sigrok.org Git - libsigrok.git/commitdiff
Shorten/simplify hw_dev_list() implementations.
authorUwe Hermann <redacted>
Sat, 2 Feb 2013 18:52:26 +0000 (19:52 +0100)
committerUwe Hermann <redacted>
Tue, 5 Feb 2013 17:27:05 +0000 (18:27 +0100)
21 files changed:
hardware/agilent-dmm/api.c
hardware/alsa/api.c
hardware/asix-sigma/asix-sigma.c
hardware/brymen-dmm/api.c
hardware/chronovu-la8/api.c
hardware/colead-slm/api.c
hardware/demo/demo.c
hardware/fluke-dmm/api.c
hardware/fx2lafw/fx2lafw.c
hardware/hantek-dso/api.c
hardware/lascar-el-usb/api.c
hardware/link-mso19/api.c
hardware/mic-985xx/api.c
hardware/nexus-osciprime/api.c
hardware/openbench-logic-sniffer/api.c
hardware/rigol-ds1xx2/api.c
hardware/serial-dmm/api.c
hardware/tondaj-sl-814/api.c
hardware/uni-t-dmm/api.c
hardware/victor-dmm/api.c
hardware/zeroplus-logic-cube/zeroplus.c

index 26213938af2bb09e36d662c65a467f00c8816675..61d4b313ce25cedf206efd895ac38a42c82db7bd 100644 (file)
@@ -188,11 +188,7 @@ static GSList *hw_scan(GSList *options)
 
 static GSList *hw_dev_list(void)
 {
-       struct drv_context *drvc;
-
-       drvc = di->priv;
-
-       return drvc->instances;
+       return ((struct drv_context *)(di->priv))->instances;
 }
 
 static int hw_dev_open(struct sr_dev_inst *sdi)
index d9dd83ef1fc0ef329cf7f8113f02851051e099e5..5751675058a3ec5338e636e47bccc61e28d3b8f2 100644 (file)
@@ -62,11 +62,7 @@ static GSList *hw_scan(GSList *options)
 
 static GSList *hw_dev_list(void)
 {
-       struct drv_context *drvc;
-
-       drvc = di->priv;
-
-       return drvc->instances;
+       return ((struct drv_context *)(di->priv))->instances;
 }
 
 static int hw_dev_open(struct sr_dev_inst *sdi)
index afbf51deb2b3113bff88f2ac72a8afde1c5910ec..6d7fcde4b9b7ac95212aca1d4106464bfb40808f 100644 (file)
@@ -513,11 +513,7 @@ free:
 
 static GSList *hw_dev_list(void)
 {
-       struct drv_context *drvc;
-
-       drvc = di->priv;
-
-       return drvc->instances;
+       return ((struct drv_context *)(di->priv))->instances;
 }
 
 static int upload_firmware(int firmware_idx, struct dev_context *devc)
index b1b3acb929ea21c25d90c0c7387bbe4063de74e2..83c7bc479b3205bf77c16ad2f567751c3b7c8eea 100644 (file)
@@ -172,11 +172,7 @@ static GSList *hw_scan(GSList *options)
 
 static GSList *hw_dev_list(void)
 {
-       struct drv_context *drvc;
-
-       drvc = di->priv;
-
-       return drvc->instances;
+       return ((struct drv_context *)(di->priv))->instances;
 }
 
 static int hw_dev_open(struct sr_dev_inst *sdi)
index b1f889198d13ed99cb56eed95db3c2433ea30685..6bbdcdbbc893197bfeb99433aea8e4ab6ddd9425 100644 (file)
@@ -180,11 +180,7 @@ err_free_nothing:
 
 static GSList *hw_dev_list(void)
 {
-       struct drv_context *drvc;
-
-       drvc = di->priv;
-
-       return drvc->instances;
+       return ((struct drv_context *)(di->priv))->instances;
 }
 
 static int hw_dev_open(struct sr_dev_inst *sdi)
index 5532b1a162fca5e2a93079afd713c6ce35165977..cfeb45bd9a2fe777b1c5ed14356b0350396b48c4 100644 (file)
@@ -134,11 +134,7 @@ static GSList *hw_scan(GSList *options)
 
 static GSList *hw_dev_list(void)
 {
-       struct drv_context *drvc;
-
-       drvc = di->priv;
-
-       return drvc->instances;
+       return ((struct drv_context *)(di->priv))->instances;
 }
 
 static int hw_dev_open(struct sr_dev_inst *sdi)
index be989fe70cca85fd4b1cade5b8aff44752cd0b30..248ee11eabb53756dd3c697ff221f080448b7ce7 100644 (file)
@@ -187,11 +187,7 @@ static GSList *hw_scan(GSList *options)
 
 static GSList *hw_dev_list(void)
 {
-       struct drv_context *drvc;
-
-       drvc = di->priv;
-
-       return drvc->instances;
+       return ((struct drv_context *)(di->priv))->instances;
 }
 
 static int hw_dev_open(struct sr_dev_inst *sdi)
index 0d73fb63780535388682e5a047b90d23aa530fec..3ef69e975639bbf67437c3a59a4f47ad1eec322b 100644 (file)
@@ -222,11 +222,7 @@ static GSList *hw_scan(GSList *options)
 
 static GSList *hw_dev_list(void)
 {
-       struct drv_context *drvc;
-
-       drvc = di->priv;
-
-       return drvc->instances;
+       return ((struct drv_context *)(di->priv))->instances;
 }
 
 static int hw_dev_open(struct sr_dev_inst *sdi)
index fb673d675ac784725cf7e20f78a61bdc49230a6d..75b4557c9ebf70ada03b7497e7060b4c5bb45668 100644 (file)
@@ -478,11 +478,7 @@ static GSList *hw_scan(GSList *options)
 
 static GSList *hw_dev_list(void)
 {
-       struct drv_context *drvc;
-
-       drvc = di->priv;
-
-       return drvc->instances;
+       return ((struct drv_context *)(di->priv))->instances;
 }
 
 static int hw_dev_open(struct sr_dev_inst *sdi)
index 97742ffe88a4a8bb225a2449e016162bbbcd9b4c..4b0dfe37708819b3e061c3111bc588d0331c8c8b 100644 (file)
@@ -341,11 +341,7 @@ static GSList *hw_scan(GSList *options)
 
 static GSList *hw_dev_list(void)
 {
-       struct drv_context *drvc;
-
-       drvc = di->priv;
-
-       return drvc->instances;
+       return ((struct drv_context *)(di->priv))->instances;
 }
 
 static int hw_dev_open(struct sr_dev_inst *sdi)
index 1ab2a68fdb3e7f6a0fc6f23401e1d417dc4c93a4..2b442d6dc101e90585bd98a0f30af93416d35148 100644 (file)
@@ -127,14 +127,7 @@ static GSList *hw_scan(GSList *options)
 
 static GSList *hw_dev_list(void)
 {
-       struct drv_context *drvc;
-
-       if (!(drvc = di->priv)) {
-               sr_err("Driver was not initialized.");
-               return NULL;
-       }
-
-       return drvc->instances;
+       return ((struct drv_context *)(di->priv))->instances;
 }
 
 static int hw_dev_open(struct sr_dev_inst *sdi)
index 93b77673203b30b8927933a56b442b18509398b1..4a71863dc1de0b4b7bb3d19a918934c14d9ade35 100644 (file)
@@ -200,11 +200,7 @@ static GSList *hw_scan(GSList *options)
 
 static GSList *hw_dev_list(void)
 {
-       struct drv_context *drvc;
-
-       drvc = di->priv;
-
-       return drvc->instances;
+       return ((struct drv_context *)(di->priv))->instances;
 }
 
 static int hw_dev_open(struct sr_dev_inst *sdi)
index b8983a6dab69aa336baf78edad383d04cfa89af3..ccc21f7395fa1b89dee10670a83df62d1df5a729 100644 (file)
@@ -169,11 +169,7 @@ static GSList *hw_scan(GSList *options, int idx)
 
 static GSList *hw_dev_list(int idx)
 {
-       struct drv_context *drvc;
-
-       drvc = mic_devs[idx].di->priv;
-
-       return drvc->instances;
+       return ((struct drv_context *)(mic_devs[idx].di->priv))->instances;
 }
 
 static int hw_dev_open(struct sr_dev_inst *sdi)
index bb3936b83b6d4a01f7a39890d6a5ce80ce88955c..af90b753e471439ab0172037f12597bae0ebff40 100644 (file)
@@ -218,11 +218,7 @@ static GSList *hw_scan(GSList *options)
 
 static GSList *hw_dev_list(void)
 {
-       struct drv_context *drvc;
-
-       drvc = di->priv;
-
-       return drvc->instances;
+       return ((struct drv_context *)(di->priv))->instances;
 }
 
 static int hw_dev_open(struct sr_dev_inst *sdi)
index b2717016cd22af2b80954879706c5c16de3121eb..6511e67852d768c9eeadfb04fe6156e7e9e460c1 100644 (file)
@@ -173,11 +173,7 @@ static GSList *hw_scan(GSList *options)
 
 static GSList *hw_dev_list(void)
 {
-       struct drv_context *drvc;
-
-       drvc = di->priv;
-
-       return drvc->instances;
+       return ((struct drv_context *)(di->priv))->instances;
 }
 
 static int hw_dev_open(struct sr_dev_inst *sdi)
index 8107fb8a9ab71380d98dd00f23098538629b823c..fe2ca5d271d14477e63fac26b5def09c3eab55de 100644 (file)
@@ -273,11 +273,7 @@ static GSList *hw_scan(GSList *options)
 
 static GSList *hw_dev_list(void)
 {
-       struct drv_context *drvc;
-
-       drvc = di->priv;
-
-       return drvc->instances;
+       return ((struct drv_context *)(di->priv))->instances;
 }
 
 static int hw_dev_open(struct sr_dev_inst *sdi)
index 987fafbfadbd0f5fb5ff0ce44b0b604103b28f1c..2b5739f46b095dd3681880427e258d71fdd30edc 100644 (file)
@@ -315,11 +315,7 @@ static GSList *hw_scan(GSList *options, int dmm)
 
 static GSList *hw_dev_list(int dmm)
 {
-       struct drv_context *drvc;
-
-       drvc = dmms[dmm].di->priv;
-
-       return drvc->instances;
+       return ((struct drv_context *)(dmms[dmm].di->priv))->instances;
 }
 
 static int hw_dev_open(struct sr_dev_inst *sdi)
index da88bd070d479939db147dde54938d7c8da2e49c..36ec5c2635d9dba3110e7c03d1dca82969710066 100644 (file)
@@ -144,11 +144,7 @@ static GSList *hw_scan(GSList *options)
 
 static GSList *hw_dev_list(void)
 {
-       struct drv_context *drvc;
-
-       drvc = di->priv;
-
-       return drvc->instances;
+       return ((struct drv_context *)(di->priv))->instances;
 }
 
 static int hw_dev_open(struct sr_dev_inst *sdi)
index fcc8c0f6b82456ee80244d1b0caf8a4baae1c21f..9870130a17132cf67f7727058c1b1c27d496edef 100644 (file)
@@ -142,11 +142,7 @@ static GSList *hw_scan(GSList *options)
 
 static GSList *hw_dev_list(void)
 {
-       struct drv_context *drvc;
-
-       drvc = di->priv;
-
-       return drvc->instances;
+       return ((struct drv_context *)(di->priv))->instances;
 }
 
 static int hw_dev_open(struct sr_dev_inst *sdi)
index 75c893d1779150fb34aa1e868b0bec7e78b79bf9..bfe57c437a96f10124459d539917a44fd59b6a03 100644 (file)
@@ -135,14 +135,7 @@ static GSList *hw_scan(GSList *options)
 
 static GSList *hw_dev_list(void)
 {
-       struct drv_context *drvc;
-
-       if (!(drvc = di->priv)) {
-               sr_err("Driver was not initialized.");
-               return NULL;
-       }
-
-       return drvc->instances;
+       return ((struct drv_context *)(di->priv))->instances;
 }
 
 static int hw_dev_open(struct sr_dev_inst *sdi)
index c4add3fc5afc0c9c3beec31f3f3ca2d4dfce89fd..3acc977db2e517c01dd96bb8337924c08180aeb7 100644 (file)
@@ -382,11 +382,7 @@ static GSList *hw_scan(GSList *options)
 
 static GSList *hw_dev_list(void)
 {
-       struct drv_context *drvc;
-
-       drvc = di->priv;
-
-       return drvc->instances;
+       return ((struct drv_context *)(di->priv))->instances;
 }
 
 static int hw_dev_open(struct sr_dev_inst *sdi)