Minor cosmetics, cleanups.

This commit is contained in:
Uwe Hermann 2015-03-21 18:26:52 +01:00
parent 8852eb75d1
commit 1a8639164e
9 changed files with 52 additions and 43 deletions

View File

@ -214,7 +214,8 @@ SR_PRIV struct sr_dev_driver **drivers_lists[] = {
(DRVS) {
&center_309_driver_info,
&voltcraft_k204_driver_info,
NULL},
NULL
},
#endif
#ifdef HAVE_HW_CHRONOVU_LA
(DRVS) {&chronovu_la_driver_info, NULL},
@ -241,7 +242,8 @@ SR_PRIV struct sr_dev_driver **drivers_lists[] = {
(DRVS) {
&gmc_mh_1x_2x_rs232_driver_info,
&gmc_mh_2x_bd232_driver_info,
NULL},
NULL
},
#endif
#ifdef HAVE_HW_HAMEG_HMO
(DRVS) {&hameg_hmo_driver_info, NULL},
@ -271,7 +273,8 @@ SR_PRIV struct sr_dev_driver **drivers_lists[] = {
(DRVS) {
&mic_98581_driver_info,
&mic_98583_driver_info,
NULL},
NULL
},
#endif
#ifdef HAVE_HW_MOTECH_LPS_30X
(DRVS) {&motech_lps_301_driver_info, NULL},
@ -280,7 +283,8 @@ SR_PRIV struct sr_dev_driver **drivers_lists[] = {
(DRVS) {
&norma_dmm_driver_info,
&siemens_b102x_driver_info,
NULL},
NULL
},
#endif
#ifdef HAVE_HW_OPENBENCH_LOGIC_SNIFFER
(DRVS) {&ols_driver_info, NULL},
@ -337,7 +341,8 @@ SR_PRIV struct sr_dev_driver **drivers_lists[] = {
&voltcraft_vc960_driver_info,
&tenma_72_7745_driver_info,
&tenma_72_7750_driver_info,
NULL},
NULL
},
#endif
#ifdef HAVE_HW_UNI_T_UT32X
(DRVS) {&uni_t_ut32x_driver_info, NULL},
@ -354,4 +359,3 @@ SR_PRIV struct sr_dev_driver **drivers_lists[] = {
NULL,
};
/** @endcond */

View File

@ -240,20 +240,19 @@ static int dev_acquisition_stop(struct sr_dev_inst *sdi, void *cb_data)
/* Driver-specific API function wrappers */
#define HW_INIT(X) \
static int init_##X(struct sr_dev_driver *d, \
struct sr_context *sr_ctx) { \
(void) d; return init(sr_ctx, X); }
struct sr_context *sr_ctx) { (void)d; return init(sr_ctx, X); }
#define HW_CLEANUP(X) \
static int cleanup_##X(const struct sr_dev_driver *d) { \
(void) d; return cleanup(X); }
(void)d; return cleanup(X); }
#define HW_SCAN(X) \
static GSList *scan_##X(struct sr_dev_driver *d, GSList *options) { \
(void) d; return scan(options, X); }
(void)d; return scan(options, X); }
#define HW_DEV_LIST(X) \
static GSList *dev_list_##X(const struct sr_dev_driver *d) { \
(void) d; return dev_list(X); }
(void)d; return dev_list(X); }
#define HW_DEV_CLEAR(X) \
static int dev_clear_##X(const struct sr_dev_driver *d) { \
(void) d; return dev_clear(X); }
(void)d; return dev_clear(X); }
#define HW_DEV_ACQUISITION_START(X) \
static int dev_acquisition_start_##X(const struct sr_dev_inst *sdi, \
void *cb_data) { return dev_acquisition_start(sdi, cb_data, X); }

View File

@ -598,9 +598,8 @@ static int receive_data(int fd, int revents, void *cb_data)
(void)fd;
(void)revents;
(void)cb_data;
drvc = (struct drv_context *) cb_data;
drvc = (struct drv_context *)cb_data;
tv.tv_sec = tv.tv_usec = 0;
libusb_handle_events_timeout(drvc->sr_ctx->libusb_ctx, &tv);

View File

@ -66,7 +66,6 @@ static const uint32_t devopts_bd[] = {
* Need to implement device-specific lists.
*/
/** Init driver. */
static int init(struct sr_dev_driver *di, struct sr_context *sr_ctx)
{
return std_init(sr_ctx, di, LOG_PREFIX);
@ -237,8 +236,9 @@ static GSList *scan_1x_2x_rs232(struct sr_dev_driver *di, GSList *options)
return devices;
}
/** Scan for Metrahit 2x in a bidirectional mode using Gossen Metrawatt 'BD 232' interface.
*
/**
* Scan for Metrahit 2x in a bidirectional mode using Gossen Metrawatt
* 'BD 232' interface.
*/
static GSList *scan_2x_bd232(struct sr_dev_driver *di, GSList *options)
{
@ -354,7 +354,6 @@ exit_err:
return NULL;
}
/** Driver device list function */
static GSList *dev_list(const struct sr_dev_driver *di)
{
return ((struct drv_context *)(di->priv))->instances;
@ -383,7 +382,6 @@ static int cleanup(const struct sr_dev_driver *di)
return std_dev_clear(di, NULL);
}
/** Get value of configuration item */
static int config_get(uint32_t key, GVariant **data, const struct sr_dev_inst *sdi,
const struct sr_channel_group *cg)
{
@ -415,7 +413,7 @@ static int config_get(uint32_t key, GVariant **data, const struct sr_dev_inst *s
return ret;
}
/** Implementation of config_list, auxiliary function for common parts, */
/** Implementation of config_list, auxiliary function for common parts. */
static int config_list_common(uint32_t key, GVariant **data, const struct sr_dev_inst *sdi,
const struct sr_channel_group *cg)
{

View File

@ -249,19 +249,19 @@ static int dev_acquisition_stop(struct sr_dev_inst *sdi, void *cb_data)
/* Driver-specific API function wrappers */
#define HW_INIT(X) \
static int init_##X(struct sr_dev_driver *di, struct sr_context *sr_ctx) { \
(void) di; return init(sr_ctx, X); }
(void)di; return init(sr_ctx, X); }
#define HW_CLEANUP(X) \
static int cleanup_##X(const struct sr_dev_driver *di) { \
(void) di; return cleanup(X); }
(void)di; return cleanup(X); }
#define HW_SCAN(X) \
static GSList *scan_##X(struct sr_dev_driver *di, GSList *options) { \
(void) di; return scan(options, X); }
(void)di; return scan(options, X); }
#define HW_DEV_LIST(X) \
static GSList *dev_list_##X(const struct sr_dev_driver *di) { \
(void) di; return dev_list(X); }
(void)di; return dev_list(X); }
#define HW_DEV_CLEAR(X) \
static int dev_clear_##X(const struct sr_dev_driver *di) { \
(void) di; return dev_clear(X); }
(void)di; return dev_clear(X); }
#define HW_CONFIG_LIST(X) \
static int config_list_##X(uint32_t key, GVariant **data, \
const struct sr_dev_inst *sdi, const struct sr_channel_group *cg) { \

View File

@ -53,7 +53,7 @@ static int init(struct sr_dev_driver *di, struct sr_context *sr_ctx)
static GSList *scan(struct sr_dev_driver *di, GSList *options)
{
struct dmm_info *dmm = (struct dmm_info *) di;
struct dmm_info *dmm;
struct sr_config *src;
GSList *l, *devices;
const char *conn, *serialcomm;
@ -65,6 +65,8 @@ static GSList *scan(struct sr_dev_driver *di, GSList *options)
size_t len;
uint8_t buf[128];
dmm = (struct dmm_info *)di;
conn = serialcomm = NULL;
for (l = options; l; l = l->next) {
src = l->data;

View File

@ -41,12 +41,14 @@ static void log_dmm_packet(const uint8_t *buf)
static void handle_packet(const uint8_t *buf, struct sr_dev_inst *sdi,
void *info)
{
struct dmm_info *dmm = (struct dmm_info *) sdi->driver;
struct dmm_info *dmm;
float floatval;
struct sr_datafeed_packet packet;
struct sr_datafeed_analog analog;
struct dev_context *devc;
dmm = (struct dmm_info *)sdi->driver;
log_dmm_packet(buf);
devc = sdi->priv;
@ -75,11 +77,13 @@ static void handle_packet(const uint8_t *buf, struct sr_dev_inst *sdi,
/** Request packet, if required. */
SR_PRIV int req_packet(struct sr_dev_inst *sdi)
{
struct dmm_info *dmm = (struct dmm_info *) sdi->driver;
struct dmm_info *dmm;
struct dev_context *devc;
struct sr_serial_dev_inst *serial;
int ret;
dmm = (struct dmm_info *)sdi->driver;
if (!dmm->packet_request)
return SR_OK;
@ -106,11 +110,13 @@ SR_PRIV int req_packet(struct sr_dev_inst *sdi)
static void handle_new_data(struct sr_dev_inst *sdi, void *info)
{
struct dmm_info *dmm = (struct dmm_info *) sdi->driver;
struct dmm_info *dmm;
struct dev_context *devc;
int len, i, offset = 0;
struct sr_serial_dev_inst *serial;
dmm = (struct dmm_info *)sdi->driver;
devc = sdi->priv;
serial = sdi->conn;
@ -165,7 +171,7 @@ int receive_data(int fd, int revents, void *cb_data)
if (!(devc = sdi->priv))
return TRUE;
dmm = (struct dmm_info *) sdi->driver;
dmm = (struct dmm_info *)sdi->driver;
if (revents == G_IO_IN) {
/* Serial data arrived. */

View File

@ -415,19 +415,19 @@ static int dev_acquisition_stop(struct sr_dev_inst *sdi, void *cb_data)
/* Driver-specific API function wrappers */
#define HW_INIT(X) \
static int init_##X(struct sr_dev_driver *di, struct sr_context *sr_ctx) { \
(void) di; return init(sr_ctx, X); }
(void)di; return init(sr_ctx, X); }
#define HW_CLEANUP(X) \
static int cleanup_##X(const struct sr_dev_driver *di) { \
(void) di; return cleanup(X); }
(void)di; return cleanup(X); }
#define HW_SCAN(X) \
static GSList *scan_##X(struct sr_dev_driver *di, GSList *options) { \
(void) di; return scan(options, X); }
(void)di; return scan(options, X); }
#define HW_DEV_LIST(X) \
static GSList *dev_list_##X(const struct sr_dev_driver *di) { \
(void) di; return dev_list(X); }
(void)di; return dev_list(X); }
#define HW_DEV_CLEAR(X) \
static int dev_clear_##X(const struct sr_dev_driver *di) { \
(void) di; return dev_clear(X); }
(void)di; return dev_clear(X); }
#define HW_DEV_ACQUISITION_START(X) \
static int dev_acquisition_start_##X(const struct sr_dev_inst *sdi, \
void *cb_data) { return dev_acquisition_start(sdi, cb_data, X); }

View File

@ -269,14 +269,15 @@ SR_API struct sr_dev_driver **sr_driver_list(void)
struct sr_dev_driver ***lists, **drivers;
GArray *array;
if (!combined_list) {
array = g_array_new(TRUE, FALSE, sizeof(struct sr_dev_driver *));
for (lists = drivers_lists; *lists; lists++)
for (drivers = *lists; *drivers; drivers++)
g_array_append_val(array, *drivers);
combined_list = (struct sr_dev_driver **) array->data;
g_array_free(array, FALSE);
}
if (combined_list)
return combined_list;
array = g_array_new(TRUE, FALSE, sizeof(struct sr_dev_driver *));
for (lists = drivers_lists; *lists; lists++)
for (drivers = *lists; *drivers; drivers++)
g_array_append_val(array, *drivers);
combined_list = (struct sr_dev_driver **)array->data;
g_array_free(array, FALSE);
return combined_list;
}