From: Uwe Hermann Date: Sat, 15 Aug 2015 15:16:01 +0000 (+0200) Subject: Various minor cosmetics and consistency fixes. X-Git-Tag: libsigrok-0.4.0~450 X-Git-Url: https://sigrok.org/gitaction?a=commitdiff_plain;h=c442ffda0fc6fa9bc3c5397a21ef1d04f01a64a1;p=libsigrok.git Various minor cosmetics and consistency fixes. --- diff --git a/src/hardware/fx2lafw/api.c b/src/hardware/fx2lafw/api.c index 4348e680..5cb36330 100644 --- a/src/hardware/fx2lafw/api.c +++ b/src/hardware/fx2lafw/api.c @@ -778,8 +778,7 @@ static int dev_acquisition_start(const struct sr_dev_inst *sdi, void *cb_data) if (devc->dslogic) { dslogic_trigger_request(sdi); - } - else { + } else { start_transfers(sdi); if ((ret = fx2lafw_command_start_acquisition(sdi)) != SR_OK) { fx2lafw_abort_acquisition(devc); diff --git a/src/hardware/gmc-mh-1x-2x/protocol.c b/src/hardware/gmc-mh-1x-2x/protocol.c index 5e12e06f..63ed2572 100644 --- a/src/hardware/gmc-mh-1x-2x/protocol.c +++ b/src/hardware/gmc-mh-1x-2x/protocol.c @@ -27,7 +27,7 @@ #include "protocol.h" /* Internal Headers */ -static guchar calc_chksum_14(guchar* dta); +static guchar calc_chksum_14(guchar *dta); static int chk_msg14(struct sr_dev_inst *sdi); /** Set or clear flags in devc->mqflags. */ @@ -872,7 +872,7 @@ static void process_msg_inf_13(struct sr_dev_inst *sdi) * @param buf Pointer to array of 14 data bytes. * @param[in] raw Write only data bytes, no interpretation. */ -void dump_msg14(guchar* buf, gboolean raw) +void dump_msg14(guchar *buf, gboolean raw) { if (!buf) return; @@ -896,7 +896,7 @@ void dump_msg14(guchar* buf, gboolean raw) * @param[in] dta Pointer to array of 13 data bytes. * @return Checksum. */ -static guchar calc_chksum_14(guchar* dta) +static guchar calc_chksum_14(guchar *dta) { guchar cnt, chs; @@ -1261,7 +1261,7 @@ SR_PRIV int gmc_mh_2x_receive_data(int fd, int revents, void *cb_data) * @param[in] params Further parameters (9 bytes) * @param[out] buf Buffer to create msg in (42 bytes). */ -void create_cmd_14(guchar addr, guchar func, guchar* params, guchar* buf) +void create_cmd_14(guchar addr, guchar func, guchar *params, guchar *buf) { uint8_t dta[GMC_REPLY_SIZE]; /* Unencoded message */ int cnt; diff --git a/src/hardware/gmc-mh-1x-2x/protocol.h b/src/hardware/gmc-mh-1x-2x/protocol.h index 87034e6b..b19cd431 100644 --- a/src/hardware/gmc-mh-1x-2x/protocol.h +++ b/src/hardware/gmc-mh-1x-2x/protocol.h @@ -123,8 +123,8 @@ struct dev_context { /* Forward declarations */ SR_PRIV int config_set(uint32_t key, GVariant *data, const struct sr_dev_inst *sdi, const struct sr_channel_group *cg); -SR_PRIV void create_cmd_14(guchar addr, guchar func, guchar* params, guchar* buf); -SR_PRIV void dump_msg14(guchar* buf, gboolean raw); +SR_PRIV void create_cmd_14(guchar addr, guchar func, guchar *params, guchar *buf); +SR_PRIV void dump_msg14(guchar *buf, gboolean raw); SR_PRIV int gmc_decode_model_bd(uint8_t mcode); SR_PRIV int gmc_decode_model_sm(uint8_t mcode); SR_PRIV int gmc_mh_1x_2x_receive_data(int fd, int revents, void *cb_data); diff --git a/src/hardware/hantek-dso/api.c b/src/hardware/hantek-dso/api.c index b309ea66..160dbb4d 100644 --- a/src/hardware/hantek-dso/api.c +++ b/src/hardware/hantek-dso/api.c @@ -472,10 +472,7 @@ static int config_get(uint32_t key, GVariant **data, const struct sr_dev_inst *s *data = g_variant_new_string(devc->triggersource); break; case SR_CONF_TRIGGER_SLOPE: - if (devc->triggerslope == SLOPE_POSITIVE) - s = "r"; - else - s = "f"; + s = (devc->triggerslope == SLOPE_POSITIVE) ? "r" : "f"; *data = g_variant_new_string(s); break; case SR_CONF_HORIZ_TRIGGERPOS: diff --git a/src/hardware/link-mso19/protocol.c b/src/hardware/link-mso19/protocol.c index ca85ffaf..1a0b7bce 100644 --- a/src/hardware/link-mso19/protocol.c +++ b/src/hardware/link-mso19/protocol.c @@ -198,7 +198,7 @@ SR_PRIV int mso_dac_out(const struct sr_dev_inst *sdi, uint16_t val) return mso_send_control_message(devc->serial, ARRAY_AND_SIZE(ops)); } -SR_PRIV inline uint16_t mso_calc_raw_from_mv(struct dev_context * devc) +SR_PRIV uint16_t mso_calc_raw_from_mv(struct dev_context *devc) { return (uint16_t) (0x200 - ((devc->dso_trigger_voltage / devc->dso_probe_attn) / diff --git a/src/hardware/link-mso19/protocol.h b/src/hardware/link-mso19/protocol.h index e795f38b..337814bf 100644 --- a/src/hardware/link-mso19/protocol.h +++ b/src/hardware/link-mso19/protocol.h @@ -134,7 +134,7 @@ SR_PRIV int mso_read_buffer(struct sr_dev_inst *sdi); SR_PRIV int mso_arm(const struct sr_dev_inst *sdi); SR_PRIV int mso_force_capture(struct sr_dev_inst *sdi); SR_PRIV int mso_dac_out(const struct sr_dev_inst *sdi, uint16_t val); -SR_PRIV inline uint16_t mso_calc_raw_from_mv(struct dev_context *devc); +SR_PRIV uint16_t mso_calc_raw_from_mv(struct dev_context *devc); SR_PRIV int mso_reset_fsm(struct sr_dev_inst *sdi); SR_PRIV int mso_toggle_led(struct sr_dev_inst *sdi, int state); diff --git a/src/hardware/manson-hcs-3xxx/api.c b/src/hardware/manson-hcs-3xxx/api.c index 81370e9f..c09d3205 100644 --- a/src/hardware/manson-hcs-3xxx/api.c +++ b/src/hardware/manson-hcs-3xxx/api.c @@ -20,7 +20,7 @@ */ /** @file - * Manson HCS-3xxx Series power supply driver + * Manson HCS-3xxx series power supply driver * @internal */ diff --git a/src/hardware/manson-hcs-3xxx/protocol.c b/src/hardware/manson-hcs-3xxx/protocol.c index cb333149..2dc09dcd 100644 --- a/src/hardware/manson-hcs-3xxx/protocol.c +++ b/src/hardware/manson-hcs-3xxx/protocol.c @@ -62,7 +62,7 @@ SR_PRIV int hcs_send_cmd(struct sr_serial_dev_inst *serial, const char *cmd, ... * @retval SR_ERR Error. * @retval SR_ERR_ARG Invalid argument. */ -SR_PRIV int hcs_read_reply(struct sr_serial_dev_inst *serial, int lines, char* buf, int buflen) +SR_PRIV int hcs_read_reply(struct sr_serial_dev_inst *serial, int lines, char *buf, int buflen) { int l_recv = 0; int bufpos = 0; diff --git a/src/hardware/manson-hcs-3xxx/protocol.h b/src/hardware/manson-hcs-3xxx/protocol.h index 92e10ce2..465cdd9d 100644 --- a/src/hardware/manson-hcs-3xxx/protocol.h +++ b/src/hardware/manson-hcs-3xxx/protocol.h @@ -92,7 +92,7 @@ struct dev_context { }; SR_PRIV int hcs_parse_volt_curr_mode(struct sr_dev_inst *sdi, char **tokens); -SR_PRIV int hcs_read_reply(struct sr_serial_dev_inst *serial, int lines, char* buf, int buflen); +SR_PRIV int hcs_read_reply(struct sr_serial_dev_inst *serial, int lines, char *buf, int buflen); SR_PRIV int hcs_send_cmd(struct sr_serial_dev_inst *serial, const char *cmd, ...); SR_PRIV int hcs_receive_data(int fd, int revents, void *cb_data); diff --git a/src/hardware/maynuo-m97/api.c b/src/hardware/maynuo-m97/api.c index 3910100a..494153fa 100644 --- a/src/hardware/maynuo-m97/api.c +++ b/src/hardware/maynuo-m97/api.c @@ -128,7 +128,7 @@ static struct sr_dev_inst *probe_device(struct sr_modbus_dev_inst *modbus) int ret = maynuo_m97_get_model_version(modbus, &id, &version); if (ret != SR_OK) return NULL; - for (i=0; ipriv; + devc = (struct dev_context *)sdi->priv; sr_spew("Status: %d", stat); devc->channel_status[0].cc_mode = (stat & 0x01) != 0; @@ -281,13 +281,13 @@ SR_PRIV int lps_process_status(struct sr_dev_inst* sdi, int stat) } /** Send STATUS commend and process status string. */ -SR_PRIV int lps_query_status(struct sr_dev_inst* sdi) +SR_PRIV int lps_query_status(struct sr_dev_inst *sdi) { char buf[LINELEN_MAX]; int stat, ret; - struct dev_context* devc; + struct dev_context *devc; - devc = (struct dev_context*)sdi->priv; + devc = (struct dev_context *)sdi->priv; devc->req_sent_at = g_get_real_time(); @@ -520,7 +520,7 @@ static GSList *dev_list_lps301(const struct sr_dev_driver *di) return ((struct drv_context *)(di->context))->instances; } -static void dev_clear_private(struct dev_context* devc) +static void dev_clear_private(struct dev_context *devc) { int ch_idx; @@ -794,8 +794,7 @@ static int config_list(uint32_t key, GVariant **data, const struct sr_dev_inst * return SR_OK; } -static int dev_acquisition_start(const struct sr_dev_inst *sdi, - void *cb_data) +static int dev_acquisition_start(const struct sr_dev_inst *sdi, void *cb_data) { struct dev_context *devc; struct sr_serial_dev_inst *serial; diff --git a/src/hardware/motech-lps-30x/protocol.h b/src/hardware/motech-lps-30x/protocol.h index 493f7827..de700cf0 100644 --- a/src/hardware/motech-lps-30x/protocol.h +++ b/src/hardware/motech-lps-30x/protocol.h @@ -31,8 +31,8 @@ #include "libsigrok.h" #include "libsigrok-internal.h" -SR_PRIV int lps_process_status(struct sr_dev_inst* sdi, int stat); -SR_PRIV int lps_send_req(struct sr_serial_dev_inst *serial, const char* fmt, ...); +SR_PRIV int lps_process_status(struct sr_dev_inst *sdi, int stat); +SR_PRIV int lps_send_req(struct sr_serial_dev_inst *serial, const char *fmt, ...); #define LOG_PREFIX "motech-lps-30x" @@ -61,7 +61,7 @@ struct channel_spec { /** Model properties specification */ struct lps_modelspec { lps_modelid modelid; - const char* modelstr; + const char *modelstr; uint8_t num_channels; struct channel_spec channels[3]; }; @@ -79,7 +79,7 @@ typedef enum { /** Status of a single channel. */ struct channel_status { /* Channel information (struct channel_info*). data (struct) owned by sdi, just a reference to address a single channel. */ - GSList* info; + GSList *info; /* Received from device. */ gdouble output_voltage_last; gdouble output_current_last; @@ -93,7 +93,7 @@ struct channel_status { /** Private, per-device-instance driver context. */ struct dev_context { /* Model-specific information */ - const struct lps_modelspec* model; + const struct lps_modelspec *model; /* Acquisition status */ gboolean acq_running; /**< Acquisition is running. */ diff --git a/src/hardware/norma-dmm/api.c b/src/hardware/norma-dmm/api.c index fca56b36..2626de6a 100644 --- a/src/hardware/norma-dmm/api.c +++ b/src/hardware/norma-dmm/api.c @@ -43,7 +43,7 @@ static const uint32_t devopts[] = { SR_PRIV struct sr_dev_driver norma_dmm_driver_info; SR_PRIV struct sr_dev_driver siemens_b102x_driver_info; -static const char* get_brandstr(struct sr_dev_driver* drv) +static const char *get_brandstr(struct sr_dev_driver *drv) { if (drv == &norma_dmm_driver_info) return "Norma"; @@ -51,9 +51,9 @@ static const char* get_brandstr(struct sr_dev_driver* drv) return "Siemens"; } -static const char* get_typestr(int type, struct sr_dev_driver* drv) +static const char *get_typestr(int type, struct sr_dev_driver *drv) { - static const char* nameref[5][2] = { + static const char *nameref[5][2] = { {"DM910", "B1024"}, {"DM920", "B1025"}, {"DM930", "B1026"}, @@ -71,7 +71,7 @@ static int init(struct sr_dev_driver *di, struct sr_context *sr_ctx) return std_init(sr_ctx, di, LOG_PREFIX); } -static GSList *scan(struct sr_dev_driver* drv, GSList *options) +static GSList *scan(struct sr_dev_driver *drv, GSList *options) { struct sr_dev_inst *sdi; struct drv_context *drvc; @@ -250,8 +250,7 @@ static int config_list(uint32_t key, GVariant **data, const struct sr_dev_inst * return SR_OK; } -static int dev_acquisition_start(const struct sr_dev_inst *sdi, - void *cb_data) +static int dev_acquisition_start(const struct sr_dev_inst *sdi, void *cb_data) { struct dev_context *devc; struct sr_serial_dev_inst *serial;