Allow for sdi->priv helper function in std_dev_clear
This commit is contained in:
parent
c118080b1d
commit
ae5859fff0
|
@ -128,6 +128,7 @@ SR_PRIV int sr_session_stop_sync(void);
|
||||||
/*--- std.c -----------------------------------------------------------------*/
|
/*--- std.c -----------------------------------------------------------------*/
|
||||||
|
|
||||||
typedef int (*dev_close_t)(struct sr_dev_inst *sdi);
|
typedef int (*dev_close_t)(struct sr_dev_inst *sdi);
|
||||||
|
typedef void (*std_dev_clear_t)(void *priv);
|
||||||
|
|
||||||
SR_PRIV int std_hw_init(struct sr_context *sr_ctx, struct sr_dev_driver *di,
|
SR_PRIV int std_hw_init(struct sr_context *sr_ctx, struct sr_dev_driver *di,
|
||||||
const char *prefix);
|
const char *prefix);
|
||||||
|
@ -136,7 +137,8 @@ SR_PRIV int std_hw_dev_acquisition_stop_serial(struct sr_dev_inst *sdi,
|
||||||
struct sr_serial_dev_inst *serial, const char *prefix);
|
struct sr_serial_dev_inst *serial, const char *prefix);
|
||||||
SR_PRIV int std_session_send_df_header(const struct sr_dev_inst *sdi,
|
SR_PRIV int std_session_send_df_header(const struct sr_dev_inst *sdi,
|
||||||
const char *prefix);
|
const char *prefix);
|
||||||
SR_PRIV int std_dev_clear(const struct sr_dev_driver *driver);
|
SR_PRIV int std_dev_clear(const struct sr_dev_driver *driver,
|
||||||
|
std_dev_clear_t clear_private);
|
||||||
|
|
||||||
/*--- hardware/common/serial.c ----------------------------------------------*/
|
/*--- hardware/common/serial.c ----------------------------------------------*/
|
||||||
|
|
||||||
|
|
5
std.c
5
std.c
|
@ -174,7 +174,8 @@ SR_PRIV int std_hw_dev_acquisition_stop_serial(struct sr_dev_inst *sdi,
|
||||||
*
|
*
|
||||||
* @return SR_OK on success.
|
* @return SR_OK on success.
|
||||||
*/
|
*/
|
||||||
SR_PRIV int std_dev_clear(const struct sr_dev_driver *driver)
|
SR_PRIV int std_dev_clear(const struct sr_dev_driver *driver,
|
||||||
|
std_dev_clear_t clear_private)
|
||||||
{
|
{
|
||||||
struct sr_dev_inst *sdi;
|
struct sr_dev_inst *sdi;
|
||||||
struct drv_context *drvc;
|
struct drv_context *drvc;
|
||||||
|
@ -203,6 +204,8 @@ SR_PRIV int std_dev_clear(const struct sr_dev_driver *driver)
|
||||||
else if (sdi->inst_type == SR_INST_SERIAL)
|
else if (sdi->inst_type == SR_INST_SERIAL)
|
||||||
sr_serial_dev_inst_free(sdi->conn);
|
sr_serial_dev_inst_free(sdi->conn);
|
||||||
}
|
}
|
||||||
|
if (clear_private)
|
||||||
|
clear_private(sdi->priv);
|
||||||
sdi = l->data;
|
sdi = l->data;
|
||||||
sr_dev_inst_free(sdi);
|
sr_dev_inst_free(sdi);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue