From: Bert Vermeulen Date: Sun, 22 Jul 2012 10:37:59 +0000 (+0200) Subject: sr/drivers: remove driver API call dev_status_get() X-Git-Tag: dsupstream~777 X-Git-Url: https://sigrok.org/gitaction?a=commitdiff_plain;h=9e90dcba9ce9d8f4a56b0225f146a1f1f055d213;p=libsigrok.git sr/drivers: remove driver API call dev_status_get() It's obsolete: no frontend ever used it, and neither did libsigrok. The sdi->status field is only used internally by some drivers, and should probably be moved to the driver-specific context structs. --- diff --git a/hardware/asix-sigma/asix-sigma.c b/hardware/asix-sigma/asix-sigma.c index b174eaff..ea12da8b 100644 --- a/hardware/asix-sigma/asix-sigma.c +++ b/hardware/asix-sigma/asix-sigma.c @@ -809,17 +809,6 @@ static int hw_info_get(int info_id, const void **data, return SR_OK; } -static int hw_dev_status_get(int dev_index) -{ - struct sr_dev_inst *sdi; - - sdi = sr_dev_inst_get(adi->instances, dev_index); - if (sdi) - return sdi->status; - else - return SR_ST_NOT_FOUND; -} - static int hw_dev_config_set(const struct sr_dev_inst *sdi, int hwcap, const void *value) { @@ -1447,7 +1436,6 @@ SR_PRIV struct sr_dev_driver asix_sigma_driver_info = { .dev_open = hw_dev_open, .dev_close = hw_dev_close, .info_get = hw_info_get, - .dev_status_get = hw_dev_status_get, .dev_config_set = hw_dev_config_set, .dev_acquisition_start = hw_dev_acquisition_start, .dev_acquisition_stop = hw_dev_acquisition_stop, diff --git a/hardware/chronovu-la8/api.c b/hardware/chronovu-la8/api.c index 419fd118..a8888604 100644 --- a/hardware/chronovu-la8/api.c +++ b/hardware/chronovu-la8/api.c @@ -305,20 +305,6 @@ static int hw_info_get(int info_id, const void **data, return SR_OK; } -static int hw_dev_status_get(int dev_index) -{ - struct sr_dev_inst *sdi; - - if (!(sdi = sr_dev_inst_get(cdi->instances, dev_index))) { - sr_err("la8: %s: sdi was NULL, device not found", __func__); - return SR_ST_NOT_FOUND; - } - - sr_dbg("la8: Returning status: %d.", sdi->status); - - return sdi->status; -} - static int hw_dev_config_set(const struct sr_dev_inst *sdi, int hwcap, const void *value) { @@ -526,7 +512,6 @@ SR_PRIV struct sr_dev_driver chronovu_la8_driver_info = { .dev_open = hw_dev_open, .dev_close = hw_dev_close, .info_get = hw_info_get, - .dev_status_get = hw_dev_status_get, .dev_config_set = hw_dev_config_set, .dev_acquisition_start = hw_dev_acquisition_start, .dev_acquisition_stop = hw_dev_acquisition_stop, diff --git a/hardware/demo/demo.c b/hardware/demo/demo.c index 2fbac3ea..2f845108 100644 --- a/hardware/demo/demo.c +++ b/hardware/demo/demo.c @@ -229,14 +229,6 @@ static int hw_info_get(int info_id, const void **data, return SR_OK; } -static int hw_dev_status_get(int dev_index) -{ - /* Avoid compiler warnings. */ - (void)dev_index; - - return SR_ST_ACTIVE; -} - static int hw_dev_config_set(const struct sr_dev_inst *sdi, int hwcap, const void *value) { @@ -525,7 +517,6 @@ SR_PRIV struct sr_dev_driver demo_driver_info = { .dev_open = hw_dev_open, .dev_close = hw_dev_close, .info_get = hw_info_get, - .dev_status_get = hw_dev_status_get, .dev_config_set = hw_dev_config_set, .dev_acquisition_start = hw_dev_acquisition_start, .dev_acquisition_stop = hw_dev_acquisition_stop, diff --git a/hardware/fx2lafw/fx2lafw.c b/hardware/fx2lafw/fx2lafw.c index 87edea6f..3e67c5f5 100644 --- a/hardware/fx2lafw/fx2lafw.c +++ b/hardware/fx2lafw/fx2lafw.c @@ -638,17 +638,6 @@ static int hw_info_get(int info_id, const void **data, return SR_OK; } -static int hw_dev_status_get(int dev_index) -{ - const struct sr_dev_inst *const sdi = - sr_dev_inst_get(fdi->instances, dev_index); - - if (!sdi) - return SR_ST_NOT_FOUND; - - return sdi->status; -} - static int hw_dev_config_set(const struct sr_dev_inst *sdi, int hwcap, const void *value) { @@ -1030,7 +1019,6 @@ SR_PRIV struct sr_dev_driver fx2lafw_driver_info = { .dev_open = hw_dev_open, .dev_close = hw_dev_close, .info_get = hw_info_get, - .dev_status_get = hw_dev_status_get, .dev_config_set = hw_dev_config_set, .dev_acquisition_start = hw_dev_acquisition_start, .dev_acquisition_stop = hw_dev_acquisition_stop, diff --git a/hardware/genericdmm/api.c b/hardware/genericdmm/api.c index 70d49b11..a8e13bee 100644 --- a/hardware/genericdmm/api.c +++ b/hardware/genericdmm/api.c @@ -460,20 +460,6 @@ static int hw_info_get(int info_id, const void **data, return SR_OK; } -static int hw_dev_status_get(int dev_index) -{ - struct sr_dev_inst *sdi; - - if (!(sdi = sr_dev_inst_get(gdi->instances, dev_index))) { - sr_err("genericdmm: sdi was NULL, device not found."); - return SR_ST_NOT_FOUND; - } - - sr_dbg("genericdmm: Returning status: %d.", sdi->status); - - return sdi->status; -} - static int hw_dev_config_set(const struct sr_dev_inst *sdi, int hwcap, const void *value) { @@ -610,7 +596,6 @@ SR_PRIV struct sr_dev_driver genericdmm_driver_info = { .dev_open = hw_dev_open, .dev_close = hw_dev_close, .info_get = hw_info_get, - .dev_status_get = hw_dev_status_get, .dev_config_set = hw_dev_config_set, .dev_acquisition_start = hw_dev_acquisition_start, .dev_acquisition_stop = hw_dev_acquisition_stop, diff --git a/hardware/hantek-dso/api.c b/hardware/hantek-dso/api.c index 60c91314..72f70793 100644 --- a/hardware/hantek-dso/api.c +++ b/hardware/hantek-dso/api.c @@ -427,16 +427,6 @@ static int hw_info_get(int info_id, const void **data, return SR_OK; } -static int hw_dev_status_get(int dev_index) -{ - struct sr_dev_inst *sdi; - - if (!(sdi = sr_dev_inst_get(hdi->instances, dev_index))) - return SR_ST_NOT_FOUND; - - return sdi->status; -} - static int hw_dev_config_set(const struct sr_dev_inst *sdi, int hwcap, const void *value) { @@ -863,7 +853,6 @@ SR_PRIV struct sr_dev_driver hantek_dso_driver_info = { .dev_open = hw_dev_open, .dev_close = hw_dev_close, .info_get = hw_info_get, - .dev_status_get = hw_dev_status_get, .dev_config_set = hw_dev_config_set, .dev_acquisition_start = hw_dev_acquisition_start, .dev_acquisition_stop = hw_dev_acquisition_stop, diff --git a/hardware/openbench-logic-sniffer/ols.c b/hardware/openbench-logic-sniffer/ols.c index ad5e7f29..d0fb4878 100644 --- a/hardware/openbench-logic-sniffer/ols.c +++ b/hardware/openbench-logic-sniffer/ols.c @@ -611,16 +611,6 @@ static int hw_info_get(int info_id, const void **data, return SR_OK; } -static int hw_dev_status_get(int dev_index) -{ - struct sr_dev_inst *sdi; - - if (!(sdi = sr_dev_inst_get(odi->instances, dev_index))) - return SR_ST_NOT_FOUND; - - return sdi->status; -} - static int set_samplerate(const struct sr_dev_inst *sdi, uint64_t samplerate) { struct context *ctx; @@ -1065,7 +1055,6 @@ SR_PRIV struct sr_dev_driver ols_driver_info = { .dev_open = hw_dev_open, .dev_close = hw_dev_close, .info_get = hw_info_get, - .dev_status_get = hw_dev_status_get, .dev_config_set = hw_dev_config_set, .dev_acquisition_start = hw_dev_acquisition_start, .dev_acquisition_stop = hw_dev_acquisition_stop, diff --git a/hardware/zeroplus-logic-cube/zeroplus.c b/hardware/zeroplus-logic-cube/zeroplus.c index c72f2551..07f38366 100644 --- a/hardware/zeroplus-logic-cube/zeroplus.c +++ b/hardware/zeroplus-logic-cube/zeroplus.c @@ -507,17 +507,6 @@ static int hw_info_get(int info_id, const void **data, return SR_OK; } -static int hw_dev_status_get(int dev_index) -{ - struct sr_dev_inst *sdi; - - sdi = sr_dev_inst_get(zdi->instances, dev_index); - if (sdi) - return sdi->status; - else - return SR_ST_NOT_FOUND; -} - static int set_samplerate(const struct sr_dev_inst *sdi, uint64_t samplerate) { struct context *ctx; @@ -676,7 +665,6 @@ SR_PRIV struct sr_dev_driver zeroplus_logic_cube_driver_info = { .dev_open = hw_dev_open, .dev_close = hw_dev_close, .info_get = hw_info_get, - .dev_status_get = hw_dev_status_get, .dev_config_set = hw_dev_config_set, .dev_acquisition_start = hw_dev_acquisition_start, .dev_acquisition_stop = hw_dev_acquisition_stop, diff --git a/libsigrok.h b/libsigrok.h index 33d28697..c3e85c73 100644 --- a/libsigrok.h +++ b/libsigrok.h @@ -494,9 +494,8 @@ struct sr_dev_driver { int (*dev_close) (struct sr_dev_inst *sdi); /* TODO remove this */ const void *(*dev_info_get) (int dev_index, int dev_info_id); - int (*info_get) (int dev_info_id, const void **data, + int (*info_get) (int info_id, const void **data, const struct sr_dev_inst *sdi); - int (*dev_status_get) (int dev_index); int (*dev_config_set) (const struct sr_dev_inst *sdi, int hwcap, const void *value); int (*dev_acquisition_start) (const struct sr_dev_inst *sdi,