X-Git-Url: https://sigrok.org/gitweb/?a=blobdiff_plain;f=src%2Fhardware%2Fhameg-hmo%2Fapi.c;h=4ed9527e5a154a071d023a79505a859a0c572a91;hb=dd5c48a6d567a3cac62c4b0058588273bbeea171;hp=f75f55e07a7c89054a7cbcb24e14ff51921e86ba;hpb=1f8f5bc08e0f684156baac513431b40d79ab4ea1;p=libsigrok.git diff --git a/src/hardware/hameg-hmo/api.c b/src/hardware/hameg-hmo/api.c index f75f55e0..4ed9527e 100644 --- a/src/hardware/hameg-hmo/api.c +++ b/src/hardware/hameg-hmo/api.c @@ -24,7 +24,7 @@ #define SERIALCOMM "115200/8n1/flow=1" -SR_PRIV struct sr_dev_driver hameg_hmo_driver_info; +static struct sr_dev_driver hameg_hmo_driver_info; static const char *manufacturers[] = { "HAMEG", @@ -47,11 +47,6 @@ enum { CG_DIGITAL, }; -static int init(struct sr_dev_driver *di, struct sr_context *sr_ctx) -{ - return std_init(di, sr_ctx, LOG_PREFIX); -} - static int check_manufacturer(const char *manufacturer) { unsigned int i; @@ -194,9 +189,11 @@ static int config_get(uint32_t key, GVariant **data, const struct sr_dev_inst *s const struct scope_config *model; struct scope_state *state; - if (!sdi || !(devc = sdi->priv)) + if (!sdi) return SR_ERR_ARG; + devc = sdi->priv; + if ((cg_type = check_channel_group(devc, cg)) == CG_INVALID) return SR_ERR; @@ -323,9 +320,11 @@ static int config_set(uint32_t key, GVariant *data, const struct sr_dev_inst *sd double tmp_d; gboolean update_sample_rate; - if (!sdi || !(devc = sdi->priv)) + if (!sdi) return SR_ERR_ARG; + devc = sdi->priv; + if ((cg_type = check_channel_group(devc, cg)) == CG_INVALID) return SR_ERR; @@ -488,7 +487,8 @@ static int config_list(uint32_t key, GVariant **data, const struct sr_dev_inst * struct dev_context *devc = NULL; const struct scope_config *model = NULL; - if (sdi && (devc = sdi->priv)) { + if (sdi) { + devc = sdi->priv; if ((cg_type = check_channel_group(devc, cg)) == CG_INVALID) return SR_ERR; @@ -773,11 +773,11 @@ static int dev_acquisition_stop(struct sr_dev_inst *sdi) return SR_OK; } -SR_PRIV struct sr_dev_driver hameg_hmo_driver_info = { +static struct sr_dev_driver hameg_hmo_driver_info = { .name = "hameg-hmo", .longname = "Hameg HMO", .api_version = 1, - .init = init, + .init = std_init, .cleanup = std_cleanup, .scan = scan, .dev_list = std_dev_list, @@ -791,3 +791,4 @@ SR_PRIV struct sr_dev_driver hameg_hmo_driver_info = { .dev_acquisition_stop = dev_acquisition_stop, .context = NULL, }; +SR_REGISTER_DEV_DRIVER(hameg_hmo_driver_info);