]> sigrok.org Git - libsigrok.git/blobdiff - src/hardware/hameg-hmo/api.c
drivers: Move SR_ERR_CHANNEL_GROUP log messages to wrappers.
[libsigrok.git] / src / hardware / hameg-hmo / api.c
index c4b75fe991adf9c3f381c71821b6cabdf55d746b..994c43e1a0fc8c6e3be81dee19c01169884e1826 100644 (file)
@@ -162,8 +162,8 @@ static int check_channel_group(struct dev_context *devc,
        return CG_INVALID;
 }
 
-static int config_get(uint32_t key, GVariant **data, const struct sr_dev_inst *sdi,
-                     const struct sr_channel_group *cg)
+static int config_get(uint32_t key, GVariant **data,
+       const struct sr_dev_inst *sdi, const struct sr_channel_group *cg)
 {
        int ret, cg_type;
        unsigned int i;
@@ -195,7 +195,6 @@ static int config_get(uint32_t key, GVariant **data, const struct sr_dev_inst *s
                break;
        case SR_CONF_NUM_VDIV:
                if (cg_type == CG_NONE) {
-                       sr_err("No channel group specified.");
                        return SR_ERR_CHANNEL_GROUP;
                } else if (cg_type == CG_ANALOG) {
                        for (i = 0; i < model->analog_channels; i++) {
@@ -212,7 +211,6 @@ static int config_get(uint32_t key, GVariant **data, const struct sr_dev_inst *s
                break;
        case SR_CONF_VDIV:
                if (cg_type == CG_NONE) {
-                       sr_err("No channel group specified.");
                        return SR_ERR_CHANNEL_GROUP;
                } else if (cg_type == CG_ANALOG) {
                        for (i = 0; i < model->analog_channels; i++) {
@@ -243,7 +241,6 @@ static int config_get(uint32_t key, GVariant **data, const struct sr_dev_inst *s
                break;
        case SR_CONF_COUPLING:
                if (cg_type == CG_NONE) {
-                       sr_err("No channel group specified.");
                        return SR_ERR_CHANNEL_GROUP;
                } else if (cg_type == CG_ANALOG) {
                        for (i = 0; i < model->analog_channels; i++) {
@@ -269,8 +266,8 @@ static int config_get(uint32_t key, GVariant **data, const struct sr_dev_inst *s
        return ret;
 }
 
-static int config_set(uint32_t key, GVariant *data, const struct sr_dev_inst *sdi,
-                     const struct sr_channel_group *cg)
+static int config_set(uint32_t key, GVariant *data,
+       const struct sr_dev_inst *sdi, const struct sr_channel_group *cg)
 {
        int ret, cg_type;
        unsigned int i, j;
@@ -317,10 +314,8 @@ static int config_set(uint32_t key, GVariant *data, const struct sr_dev_inst *sd
                }
                break;
        case SR_CONF_VDIV:
-               if (cg_type == CG_NONE) {
-                       sr_err("No channel group specified.");
+               if (cg_type == CG_NONE)
                        return SR_ERR_CHANNEL_GROUP;
-               }
 
                g_variant_get(data, "(tt)", &p, &q);
 
@@ -400,10 +395,8 @@ static int config_set(uint32_t key, GVariant *data, const struct sr_dev_inst *sd
                }
                break;
        case SR_CONF_COUPLING:
-               if (cg_type == CG_NONE) {
-                       sr_err("No channel group specified.");
+               if (cg_type == CG_NONE)
                        return SR_ERR_CHANNEL_GROUP;
-               }
 
                tmp = g_variant_get_string(data, NULL);
 
@@ -443,8 +436,8 @@ static int config_set(uint32_t key, GVariant *data, const struct sr_dev_inst *sd
        return ret;
 }
 
-static int config_list(uint32_t key, GVariant **data, const struct sr_dev_inst *sdi,
-                      const struct sr_channel_group *cg)
+static int config_list(uint32_t key, GVariant **data,
+       const struct sr_dev_inst *sdi, const struct sr_channel_group *cg)
 {
        int cg_type = CG_NONE;
        struct dev_context *devc = NULL;
@@ -495,12 +488,12 @@ static int config_list(uint32_t key, GVariant **data, const struct sr_dev_inst *
        case SR_CONF_TIMEBASE:
                if (!model)
                        return SR_ERR_ARG;
-               *data = std_gvar_tuple_array(model->timebases, model->num_timebases);
+               *data = std_gvar_tuple_array(*model->timebases, model->num_timebases);
                break;
        case SR_CONF_VDIV:
                if (cg_type == CG_NONE)
                        return SR_ERR_CHANNEL_GROUP;
-               *data = std_gvar_tuple_array(model->vdivs, model->num_vdivs);
+               *data = std_gvar_tuple_array(*model->vdivs, model->num_vdivs);
                break;
        default:
                return SR_ERR_NA;