drivers: Move SR_ERR_CHANNEL_GROUP log messages to wrappers.

This commit is contained in:
Uwe Hermann 2017-07-25 22:53:02 +02:00
parent 00ed77f27c
commit 87dc541027
3 changed files with 8 additions and 18 deletions

View File

@ -195,7 +195,6 @@ static int config_get(uint32_t key, GVariant **data,
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,
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,
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++) {
@ -317,10 +314,8 @@ static int config_set(uint32_t key, GVariant *data,
}
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,
}
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);

View File

@ -215,7 +215,6 @@ static int config_get(uint32_t key, GVariant **data,
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) {
*data = g_variant_new_int32(model->num_ydivs);
@ -228,7 +227,6 @@ static int config_get(uint32_t key, GVariant **data,
case SR_CONF_VDIV:
ret = SR_ERR_NA;
if (cg_type == CG_NONE) {
sr_err("No channel group specified.");
return SR_ERR_CHANNEL_GROUP;
} else if (cg_type != CG_ANALOG)
break;
@ -258,7 +256,6 @@ static int config_get(uint32_t key, GVariant **data,
case SR_CONF_COUPLING:
ret = SR_ERR_NA;
if (cg_type == CG_NONE) {
sr_err("No channel group specified.");
return SR_ERR_CHANNEL_GROUP;
} else if (cg_type != CG_ANALOG)
break;
@ -325,10 +322,8 @@ static int config_set(uint32_t key, GVariant *data,
}
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);
@ -397,10 +392,8 @@ static int config_set(uint32_t key, GVariant *data,
ret = dlm_trigger_slope_set(sdi->conn, state->trigger_slope);
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);

View File

@ -772,6 +772,10 @@ SR_API int sr_config_get(const struct sr_dev_driver *driver,
g_variant_ref_sink(*data);
}
if (ret == SR_ERR_CHANNEL_GROUP)
sr_err("%s: No channel group specified.",
(sdi) ? sdi->driver->name : "unknown");
return ret;
}