]> sigrok.org Git - libsigrok.git/blobdiff - src/hardware/motech-lps-30x/api.c
drivers: Consistently use same indentation for config_*() API calls.
[libsigrok.git] / src / hardware / motech-lps-30x / api.c
index 464ce7db8ae923ac5a94537bde4d941d6ed347fb..aa9187e87c5fb71399b5f06565b55b45fb6cdfb6 100644 (file)
@@ -32,8 +32,6 @@ SR_PRIV int lps_query_status(struct sr_dev_inst *sdi);
 
 #define SERIALCOMM "2400/8n1/dtr=1/rts=1/flow=0"
 
-#define VENDOR_MOTECH "Motech"
-
 static const uint32_t scanopts[] = {
        SR_CONF_CONN,
        SR_CONF_SERIALCOMM,
@@ -423,7 +421,7 @@ static GSList *do_scan(lps_modelid modelid, struct sr_dev_driver *drv, GSList *o
 
        sdi = g_malloc0(sizeof(struct sr_dev_inst));
        sdi->status = SR_ST_INACTIVE;
-       sdi->vendor = g_strdup(VENDOR_MOTECH);
+       sdi->vendor = g_strdup("Motech");
        sdi->model = g_strdup(models[modelid].modelstr);
        sdi->version = g_strdup(verstr);
        sdi->inst_type = SR_INST_SERIAL;
@@ -491,8 +489,8 @@ static int dev_clear(const struct sr_dev_driver *di)
        return std_dev_clear_with_callback(di, (std_dev_clear_callback)clear_helper);
 }
 
-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)
 {
        struct dev_context *devc;
        struct sr_channel *ch;
@@ -543,8 +541,8 @@ static int config_get(uint32_t key, GVariant **data, const struct sr_dev_inst *s
        return SR_OK;
 }
 
-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)
 {
        struct dev_context *devc;
        struct sr_channel *ch;
@@ -647,8 +645,8 @@ static int config_set(uint32_t key, GVariant *data, const struct sr_dev_inst *sd
        return SR_OK;
 }
 
-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)
 {
        struct dev_context *devc;
        struct sr_channel *ch;
@@ -667,7 +665,7 @@ static int config_list(uint32_t key, GVariant **data, const struct sr_dev_inst *
                                *data = g_variant_new_strv(channel_modes, 1);
                        } else {
                                /* The other models support all modes. */
-                               *data = g_variant_new_strv(channel_modes, ARRAY_SIZE(channel_modes));
+                               *data = g_variant_new_strv(ARRAY_AND_SIZE(channel_modes));
                        }
                        return SR_OK;
                default:
@@ -682,11 +680,9 @@ static int config_list(uint32_t key, GVariant **data, const struct sr_dev_inst *
        switch (key) {
        case SR_CONF_DEVICE_OPTIONS:
                if ((ch_idx == 0) || (ch_idx == 1)) /* CH1, CH2 */
-                       *data = g_variant_new_fixed_array(G_VARIANT_TYPE_UINT32,
-                               devopts_cg_ch12, ARRAY_SIZE(devopts_cg_ch12), sizeof(uint32_t));
+                       *data = std_gvar_array_u32(ARRAY_AND_SIZE(devopts_cg_ch12));
                else /* Must be CH3 */
-                       *data = g_variant_new_fixed_array(G_VARIANT_TYPE_UINT32,
-                               devopts_cg_ch3, ARRAY_SIZE(devopts_cg_ch3), sizeof(uint32_t));
+                       *data = std_gvar_array_u32(ARRAY_AND_SIZE(devopts_cg_ch3));
                break;
        case SR_CONF_VOLTAGE_TARGET:
                *data = std_gvar_min_max_step_array(devc->model->channels[ch_idx].voltage);