Match std_init() parameter order to the driver init() callback

The std_init() callback has the order of the first two paramters opposite
to the init() callback. This is primarily due to historical development.

Since the std_init() function is usually called from a driver's init()
callback aligning the order will allow direct register pass through rather
than having to swap them around. It also allow to eventually use the
std_init() function directly as the init() callback.

Signed-off-by: Lars-Peter Clausen <lars@metafoo.de>
This commit is contained in:
Lars-Peter Clausen 2016-05-08 14:55:15 +02:00 committed by Uwe Hermann
parent 87629577fe
commit 1f8f5bc08e
57 changed files with 58 additions and 58 deletions

View File

@ -74,7 +74,7 @@ SR_PRIV struct sr_dev_driver agdmm_driver_info;
static int init(struct sr_dev_driver *di, struct sr_context *sr_ctx)
{
return std_init(sr_ctx, di, LOG_PREFIX);
return std_init(di, sr_ctx, LOG_PREFIX);
}
static GSList *scan(struct sr_dev_driver *di, GSList *options)

View File

@ -46,7 +46,7 @@ SR_PRIV struct sr_dev_driver appa_55ii_driver_info;
static int init(struct sr_dev_driver *di, struct sr_context *sr_ctx)
{
return std_init(sr_ctx, di, LOG_PREFIX);
return std_init(di, sr_ctx, LOG_PREFIX);
}
static GSList *scan(struct sr_dev_driver *di, GSList *options)

View File

@ -60,7 +60,7 @@ SR_PRIV struct sr_dev_driver arachnid_labs_re_load_pro_driver_info;
static int init(struct sr_dev_driver *di, struct sr_context *sr_ctx)
{
return std_init(sr_ctx, di, LOG_PREFIX);
return std_init(di, sr_ctx, LOG_PREFIX);
}
static GSList *scan(struct sr_dev_driver *di, GSList *options)

View File

@ -65,7 +65,7 @@ static int dev_clear(const struct sr_dev_driver *di)
static int init(struct sr_dev_driver *di, struct sr_context *sr_ctx)
{
return std_init(sr_ctx, di, LOG_PREFIX);
return std_init(di, sr_ctx, LOG_PREFIX);
}
static GSList *scan(struct sr_dev_driver *di, GSList *options)

View File

@ -79,7 +79,7 @@ SR_PRIV struct sr_dev_driver atten_pps3203_driver_info;
static int init(struct sr_dev_driver *di, struct sr_context *sr_ctx)
{
return std_init(sr_ctx, di, LOG_PREFIX);
return std_init(di, sr_ctx, LOG_PREFIX);
}
static GSList *scan(struct sr_dev_driver *di, GSList *options, int modelid)

View File

@ -55,7 +55,7 @@ static const uint64_t samplerates[] = {
static int init(struct sr_dev_driver *di, struct sr_context *sr_ctx)
{
return std_init(sr_ctx, di, LOG_PREFIX);
return std_init(di, sr_ctx, LOG_PREFIX);
}
static GSList *scan(struct sr_dev_driver *di, GSList *options)

View File

@ -62,7 +62,7 @@ static const uint64_t samplerates[] = {
static int init(struct sr_dev_driver *di, struct sr_context *sr_ctx)
{
return std_init(sr_ctx, di, LOG_PREFIX);
return std_init(di, sr_ctx, LOG_PREFIX);
}
static struct dev_context *beaglelogic_devc_alloc(void)

View File

@ -37,7 +37,7 @@ SR_PRIV struct sr_dev_driver brymen_bm86x_driver_info;
static int init(struct sr_dev_driver *di, struct sr_context *sr_ctx)
{
return std_init(sr_ctx, di, LOG_PREFIX);
return std_init(di, sr_ctx, LOG_PREFIX);
}
static GSList *scan(struct sr_dev_driver *di, GSList *options)

View File

@ -37,7 +37,7 @@ static struct sr_dev_driver *di = &brymen_bm857_driver_info;
static int init(struct sr_dev_driver *di, struct sr_context *sr_ctx)
{
return std_init(sr_ctx, di, LOG_PREFIX);
return std_init(di, sr_ctx, LOG_PREFIX);
}
static GSList *brymen_scan(const char *conn, const char *serialcomm)

View File

@ -73,7 +73,7 @@ SR_PRIV struct sr_dev_driver cem_dt_885x_driver_info;
static int init(struct sr_dev_driver *di, struct sr_context *sr_ctx)
{
return std_init(sr_ctx, di, LOG_PREFIX);
return std_init(di, sr_ctx, LOG_PREFIX);
}
static GSList *scan(struct sr_dev_driver *di, GSList *options)

View File

@ -58,7 +58,7 @@ SR_PRIV const struct center_dev_info center_devs[] = {
static int init(struct sr_context *sr_ctx, int idx)
{
return std_init(sr_ctx, center_devs[idx].di, LOG_PREFIX);
return std_init(center_devs[idx].di, sr_ctx, LOG_PREFIX);
}
static GSList *center_scan(const char *conn, const char *serialcomm, int idx)

View File

@ -66,7 +66,7 @@ static int dev_clear(const struct sr_dev_driver *di)
static int init(struct sr_dev_driver *di, struct sr_context *sr_ctx)
{
return std_init(sr_ctx, di, LOG_PREFIX);
return std_init(di, sr_ctx, LOG_PREFIX);
}
static int add_device(int model, struct libusb_device_descriptor *des,

View File

@ -46,7 +46,7 @@ SR_PRIV struct sr_dev_driver colead_slm_driver_info;
static int init(struct sr_dev_driver *di, struct sr_context *sr_ctx)
{
return std_init(sr_ctx, di, LOG_PREFIX);
return std_init(di, sr_ctx, LOG_PREFIX);
}
static GSList *scan(struct sr_dev_driver *di, GSList *options)

View File

@ -43,7 +43,7 @@ SR_PRIV struct sr_dev_driver conrad_digi_35_cpu_driver_info;
static int init(struct sr_dev_driver *di, struct sr_context *sr_ctx)
{
return std_init(sr_ctx, di, LOG_PREFIX);
return std_init(di, sr_ctx, LOG_PREFIX);
}
static GSList *scan(struct sr_dev_driver *di, GSList *options)

View File

@ -181,7 +181,7 @@ static int dev_acquisition_stop(struct sr_dev_inst *sdi);
static int init(struct sr_dev_driver *di, struct sr_context *sr_ctx)
{
return std_init(sr_ctx, di, LOG_PREFIX);
return std_init(di, sr_ctx, LOG_PREFIX);
}
static void generate_analog_pattern(struct analog_gen *ag, uint64_t sample_rate)

View File

@ -41,7 +41,7 @@ SR_PRIV struct sr_dev_driver deree_de5000_driver_info;
static int init(struct sr_dev_driver *di, struct sr_context *sr_ctx)
{
return std_init(sr_ctx, di, LOG_PREFIX);
return std_init(di, sr_ctx, LOG_PREFIX);
}
static int dev_clear(const struct sr_dev_driver *di)

View File

@ -61,7 +61,7 @@ static const struct flukedmm_profile supported_flukedmm[] = {
static int init(struct sr_dev_driver *di, struct sr_context *sr_ctx)
{
return std_init(sr_ctx, di, LOG_PREFIX);
return std_init(di, sr_ctx, LOG_PREFIX);
}
static GSList *fluke_scan(struct sr_dev_driver *di, const char *conn,

View File

@ -86,7 +86,7 @@ static const struct ftdi_chip_desc *chip_descs[] = {
static int init(struct sr_dev_driver *di, struct sr_context *sr_ctx)
{
return std_init(sr_ctx, di, LOG_PREFIX);
return std_init(di, sr_ctx, LOG_PREFIX);
}
static void scan_device(struct sr_dev_driver *di, struct libusb_device *dev, GSList **devices)

View File

@ -183,7 +183,7 @@ SR_PRIV struct sr_dev_driver fx2lafw_driver_info;
static int init(struct sr_dev_driver *di, struct sr_context *sr_ctx)
{
return std_init(sr_ctx, di, LOG_PREFIX);
return std_init(di, sr_ctx, LOG_PREFIX);
}
static GSList *scan(struct sr_dev_driver *di, GSList *options)

View File

@ -68,7 +68,7 @@ static const uint32_t devopts_bd[] = {
static int init(struct sr_dev_driver *di, struct sr_context *sr_ctx)
{
return std_init(sr_ctx, di, LOG_PREFIX);
return std_init(di, sr_ctx, LOG_PREFIX);
}
/**

View File

@ -35,7 +35,7 @@ SR_PRIV struct sr_dev_driver gwinstek_gds_800_driver_info;
static int init(struct sr_dev_driver *di, struct sr_context *sr_ctx)
{
return std_init(sr_ctx, di, LOG_PREFIX);
return std_init(di, sr_ctx, LOG_PREFIX);
}
static struct sr_dev_inst *probe_device(struct sr_scpi_dev_inst *scpi)

View File

@ -49,7 +49,7 @@ enum {
static int init(struct sr_dev_driver *di, struct sr_context *sr_ctx)
{
return std_init(sr_ctx, di, LOG_PREFIX);
return std_init(di, sr_ctx, LOG_PREFIX);
}
static int check_manufacturer(const char *manufacturer)

View File

@ -165,7 +165,7 @@ static int dev_clear(const struct sr_dev_driver *di)
static int init(struct sr_dev_driver *di, struct sr_context *sr_ctx)
{
return std_init(sr_ctx, di, LOG_PREFIX);
return std_init(di, sr_ctx, LOG_PREFIX);
}
static GSList *scan(struct sr_dev_driver *di, GSList *options)

View File

@ -256,7 +256,7 @@ static int dev_clear(const struct sr_dev_driver *di)
static int init(struct sr_dev_driver *di, struct sr_context *sr_ctx)
{
return std_init(sr_ctx, di, LOG_PREFIX);
return std_init(di, sr_ctx, LOG_PREFIX);
}
static GSList *scan(struct sr_dev_driver *di, GSList *options)

View File

@ -168,7 +168,7 @@ static struct sr_dev_inst *probe_device(struct sr_scpi_dev_inst *scpi)
static int init(struct sr_dev_driver *di, struct sr_context *sr_ctx)
{
return std_init(sr_ctx, di, LOG_PREFIX);
return std_init(di, sr_ctx, LOG_PREFIX);
}
static GSList *scan(struct sr_dev_driver *di, GSList *options)

View File

@ -106,7 +106,7 @@ static const uint8_t coupling_map[] = {
static int init(struct sr_dev_driver *di, struct sr_context *sr_ctx)
{
return std_init(sr_ctx, di, LOG_PREFIX);
return std_init(di, sr_ctx, LOG_PREFIX);
}
static GSList *scan_port(GSList *devices, struct sr_dev_driver *di,

View File

@ -56,7 +56,7 @@ SR_PRIV struct sr_dev_driver ikalogic_scanalogic2_driver_info;
static int init(struct sr_dev_driver *di, struct sr_context *sr_ctx)
{
return std_init(sr_ctx, di, LOG_PREFIX);
return std_init(di, sr_ctx, LOG_PREFIX);
}
static GSList *scan(struct sr_dev_driver *di, GSList *options)

View File

@ -67,7 +67,7 @@ static int dev_clear(const struct sr_dev_driver *di)
static int init(struct sr_dev_driver *di, struct sr_context *sr_ctx)
{
return std_init(sr_ctx, di, LOG_PREFIX);
return std_init(di, sr_ctx, LOG_PREFIX);
}
static GSList *scan(struct sr_dev_driver *di, GSList *options)

View File

@ -65,7 +65,7 @@ SR_PRIV struct sr_dev_driver kecheng_kc_330b_driver_info;
static int init(struct sr_dev_driver *di, struct sr_context *sr_ctx)
{
return std_init(sr_ctx, di, LOG_PREFIX);
return std_init(di, sr_ctx, LOG_PREFIX);
}
static int scan_kecheng(struct sr_dev_driver *di,

View File

@ -38,7 +38,7 @@ static const uint32_t devopts[] = {
static int init(struct sr_dev_driver *di, struct sr_context *sr_ctx)
{
return std_init(sr_ctx, di, LOG_PREFIX);
return std_init(di, sr_ctx, LOG_PREFIX);
}
static GSList *scan(struct sr_dev_driver *di, GSList *options)

View File

@ -66,7 +66,7 @@ SR_PRIV struct sr_dev_driver korad_kaxxxxp_driver_info;
static int init(struct sr_dev_driver *di, struct sr_context *sr_ctx)
{
return std_init(sr_ctx, di, LOG_PREFIX);
return std_init(di, sr_ctx, LOG_PREFIX);
}
static GSList *scan(struct sr_dev_driver *di, GSList *options)

View File

@ -40,7 +40,7 @@ static const uint32_t devopts[] = {
static int init(struct sr_dev_driver *di, struct sr_context *sr_ctx)
{
return std_init(sr_ctx, di, LOG_PREFIX);
return std_init(di, sr_ctx, LOG_PREFIX);
}
static GSList *scan(struct sr_dev_driver *di, GSList *options)

View File

@ -75,7 +75,7 @@ SR_PRIV struct sr_dev_driver lecroy_logicstudio_driver_info;
static int init(struct sr_dev_driver *di, struct sr_context *sr_ctx)
{
return std_init(sr_ctx, di, LOG_PREFIX);
return std_init(di, sr_ctx, LOG_PREFIX);
}
static struct sr_dev_inst *create_device(struct sr_dev_driver *di,

View File

@ -87,7 +87,7 @@ static int dev_clear(const struct sr_dev_driver *di)
static int init(struct sr_dev_driver *di, struct sr_context *sr_ctx)
{
return std_init(sr_ctx, di, LOG_PREFIX);
return std_init(di, sr_ctx, LOG_PREFIX);
}
static GSList *scan(struct sr_dev_driver *di, GSList *options)

View File

@ -77,7 +77,7 @@ SR_PRIV struct sr_dev_driver manson_hcs_3xxx_driver_info;
static int init(struct sr_dev_driver *di, struct sr_context *sr_ctx)
{
return std_init(sr_ctx, di, LOG_PREFIX);
return std_init(di, sr_ctx, LOG_PREFIX);
}
static GSList *scan(struct sr_dev_driver *di, GSList *options)

View File

@ -113,7 +113,7 @@ SR_PRIV struct sr_dev_driver maynuo_m97_driver_info;
static int init(struct sr_dev_driver *di, struct sr_context *sr_ctx)
{
return std_init(sr_ctx, di, LOG_PREFIX);
return std_init(di, sr_ctx, LOG_PREFIX);
}
static struct sr_dev_inst *probe_device(struct sr_modbus_dev_inst *modbus)

View File

@ -59,7 +59,7 @@ SR_PRIV const struct mic_dev_info mic_devs[] = {
static int init(struct sr_context *sr_ctx, int idx)
{
return std_init(sr_ctx, mic_devs[idx].di, LOG_PREFIX);
return std_init(mic_devs[idx].di, sr_ctx, LOG_PREFIX);
}
static GSList *mic_scan(const char *conn, const char *serialcomm, int idx)

View File

@ -135,7 +135,7 @@ static const struct lps_modelspec models[] = {
static int init_lps301(struct sr_dev_driver *di, struct sr_context *sr_ctx)
{
return std_init(sr_ctx, di, LOG_PREFIX);
return std_init(di, sr_ctx, LOG_PREFIX);
}
/** Send command to device with va_list.

View File

@ -67,7 +67,7 @@ static const char *get_typestr(int type, struct sr_dev_driver *drv)
static int init(struct sr_dev_driver *di, struct sr_context *sr_ctx)
{
return std_init(sr_ctx, di, LOG_PREFIX);
return std_init(di, sr_ctx, LOG_PREFIX);
}
static GSList *scan(struct sr_dev_driver *drv, GSList *options)

View File

@ -89,7 +89,7 @@ SR_PRIV struct sr_dev_driver ols_driver_info;
static int init(struct sr_dev_driver *di, struct sr_context *sr_ctx)
{
return std_init(sr_ctx, di, LOG_PREFIX);
return std_init(di, sr_ctx, LOG_PREFIX);
}
static GSList *scan(struct sr_dev_driver *di, GSList *options)

View File

@ -79,7 +79,7 @@ SR_PRIV struct sr_dev_driver p_ols_driver_info;
static int init(struct sr_dev_driver *di, struct sr_context *sr_ctx)
{
return std_init(sr_ctx, di, LOG_PREFIX);
return std_init(di, sr_ctx, LOG_PREFIX);
}
static GSList *scan(struct sr_dev_driver *di, GSList *options)

View File

@ -274,7 +274,7 @@ static int dev_clear(const struct sr_dev_driver *di)
static int init(struct sr_dev_driver *di, struct sr_context *sr_ctx)
{
return std_init(sr_ctx, di, LOG_PREFIX);
return std_init(di, sr_ctx, LOG_PREFIX);
}
static struct sr_dev_inst *probe_device(struct sr_scpi_dev_inst *scpi)

View File

@ -97,7 +97,7 @@ static const uint64_t samplerates[] = {
static int init(struct sr_dev_driver *di, struct sr_context *sr_ctx)
{
return std_init(sr_ctx, di, LOG_PREFIX);
return std_init(di, sr_ctx, LOG_PREFIX);
}
static gboolean check_conf_profile(libusb_device *dev)

View File

@ -43,7 +43,7 @@ static const struct pps_channel_instance pci[] = {
static int init(struct sr_dev_driver *di, struct sr_context *sr_ctx)
{
return std_init(sr_ctx, di, LOG_PREFIX);
return std_init(di, sr_ctx, LOG_PREFIX);
}
static struct sr_dev_inst *probe_device(struct sr_scpi_dev_inst *scpi)

View File

@ -43,7 +43,7 @@ static const uint32_t devopts[] = {
static int init(struct sr_dev_driver *di, struct sr_context *sr_ctx)
{
return std_init(sr_ctx, di, LOG_PREFIX);
return std_init(di, sr_ctx, LOG_PREFIX);
}
static GSList *scan(struct sr_dev_driver *di, GSList *options)

View File

@ -65,7 +65,7 @@ static const char *const signal_edge_names[] = {
*/
static int init(struct sr_dev_driver *di, struct sr_context *sr_ctx)
{
return std_init(sr_ctx, di, LOG_PREFIX);
return std_init(di, sr_ctx, LOG_PREFIX);
}
/* Create a new sigrok device instance for the indicated LWLA model.

View File

@ -40,7 +40,7 @@ SR_PRIV struct sr_dev_driver teleinfo_driver_info;
static int init(struct sr_dev_driver *di, struct sr_context *sr_ctx)
{
return std_init(sr_ctx, di, LOG_PREFIX);
return std_init(di, sr_ctx, LOG_PREFIX);
}
static GSList *scan(struct sr_dev_driver *di, GSList *options)

View File

@ -45,7 +45,7 @@ static const struct testo_model models[] = {
static int init(struct sr_dev_driver *di, struct sr_context *sr_ctx)
{
return std_init(sr_ctx, di, LOG_PREFIX);
return std_init(di, sr_ctx, LOG_PREFIX);
}
static GSList *scan(struct sr_dev_driver *di, GSList *options)

View File

@ -43,7 +43,7 @@ SR_PRIV struct sr_dev_driver tondaj_sl_814_driver_info;
static int init(struct sr_dev_driver *di, struct sr_context *sr_ctx)
{
return std_init(sr_ctx, di, LOG_PREFIX);
return std_init(di, sr_ctx, LOG_PREFIX);
}
static GSList *scan(struct sr_dev_driver *di, GSList *options)

View File

@ -48,7 +48,7 @@ static const uint32_t devopts[] = {
static int init(struct sr_dev_driver *di, struct sr_context *sr_ctx)
{
return std_init(sr_ctx, di, LOG_PREFIX);
return std_init(di, sr_ctx, LOG_PREFIX);
}
static GSList *scan(struct sr_dev_driver *di, GSList *options)

View File

@ -41,7 +41,7 @@ SR_PRIV struct sr_dev_driver uni_t_ut32x_driver_info;
static int init(struct sr_dev_driver *di, struct sr_context *sr_ctx)
{
return std_init(sr_ctx, di, LOG_PREFIX);
return std_init(di, sr_ctx, LOG_PREFIX);
}
static GSList *scan(struct sr_dev_driver *di, GSList *options)

View File

@ -52,7 +52,7 @@ static const uint32_t devopts[] = {
static int init(struct sr_dev_driver *di, struct sr_context *sr_ctx)
{
return std_init(sr_ctx, di, LOG_PREFIX);
return std_init(di, sr_ctx, LOG_PREFIX);
}
static GSList *scan(struct sr_dev_driver *di, GSList *options)

View File

@ -65,7 +65,7 @@ enum {
static int init(struct sr_dev_driver *di, struct sr_context *sr_ctx)
{
return std_init(sr_ctx, di, LOG_PREFIX);
return std_init(di, sr_ctx, LOG_PREFIX);
}
static struct sr_dev_inst *probe_usbtmc_device(struct sr_scpi_dev_inst *scpi)

View File

@ -157,7 +157,7 @@ SR_PRIV int zp_set_samplerate(struct dev_context *devc, uint64_t samplerate)
static int init(struct sr_dev_driver *di, struct sr_context *sr_ctx)
{
return std_init(sr_ctx, di, LOG_PREFIX);
return std_init(di, sr_ctx, LOG_PREFIX);
}
static GSList *scan(struct sr_dev_driver *di, GSList *options)

View File

@ -859,7 +859,7 @@ SR_PRIV int sr_analog_init(struct sr_datafeed_analog *analog,
typedef int (*dev_close_callback)(struct sr_dev_inst *sdi);
typedef void (*std_dev_clear_callback)(void *priv);
SR_PRIV int std_init(struct sr_context *sr_ctx, struct sr_dev_driver *di,
SR_PRIV int std_init(struct sr_dev_driver *di, struct sr_context *sr_ctx,
const char *prefix);
SR_PRIV int std_cleanup(const struct sr_dev_driver *di);
#ifdef HAVE_LIBSERIALPORT

View File

@ -208,7 +208,7 @@ static int receive_data(int fd, int revents, void *cb_data)
static int init(struct sr_dev_driver *di, struct sr_context *sr_ctx)
{
return std_init(sr_ctx, di, LOG_PREFIX);
return std_init(di, sr_ctx, LOG_PREFIX);
}
static int dev_clear(const struct sr_dev_driver *di)

View File

@ -39,13 +39,13 @@
* It creates a new 'struct drv_context' (drvc), assigns sr_ctx to it, and
* then 'drvc' is assigned to the 'struct sr_dev_driver' (di) that is passed.
*
* @param sr_ctx The libsigrok context to assign.
* @param di The driver instance to use.
* @param sr_ctx The libsigrok context to assign.
* @param[in] prefix A driver-specific prefix string used for log messages.
*
* @return SR_OK upon success, SR_ERR_ARG upon invalid arguments.
*/
SR_PRIV int std_init(struct sr_context *sr_ctx, struct sr_dev_driver *di,
SR_PRIV int std_init(struct sr_dev_driver *di, struct sr_context *sr_ctx,
const char *prefix)
{
struct drv_context *drvc;