]> sigrok.org Git - libsigrok.git/blobdiff - hardware/asix-sigma/asix-sigma.c
sr/drivers: use sr_dev_inst instead of device index for dev_config_set()
[libsigrok.git] / hardware / asix-sigma / asix-sigma.c
index e0a435a05e9a3b46647e6d59124f1b73b4f075ee..4f802cacc98593d60c7686aa3d21c4879570f749 100644 (file)
@@ -633,7 +633,7 @@ static int hw_dev_open(int dev_index)
        return SR_OK;
 }
 
-static int set_samplerate(struct sr_dev_inst *sdi, uint64_t samplerate)
+static int set_samplerate(const struct sr_dev_inst *sdi, uint64_t samplerate)
 {
        int i, ret;
        struct context *ctx = sdi->priv;
@@ -674,7 +674,7 @@ static int set_samplerate(struct sr_dev_inst *sdi, uint64_t samplerate)
  * The Sigma supports complex triggers using boolean expressions, but this
  * has not been implemented yet.
  */
-static int configure_probes(struct sr_dev_inst *sdi, const GSList *probes)
+static int configure_probes(const struct sr_dev_inst *sdi, const GSList *probes)
 {
        struct context *ctx = sdi->priv;
        const struct sr_probe *probe;
@@ -789,6 +789,9 @@ static int hw_info_get(int info_id, const void **data,
        case SR_DI_INST:
                *data = sdi;
                break;
+       case SR_DI_HWCAPS:
+               *data = hwcaps;
+               break;
        case SR_DI_NUM_PROBES:
                *data = GINT_TO_POINTER(NUM_PROBES);
                break;
@@ -826,20 +829,12 @@ static int hw_dev_status_get(int dev_index)
                return SR_ST_NOT_FOUND;
 }
 
-static const int *hw_hwcap_get_all(void)
-{
-       return hwcaps;
-}
-
-static int hw_dev_config_set(int dev_index, int hwcap, const void *value)
+static int hw_dev_config_set(const struct sr_dev_inst *sdi, int hwcap,
+               const void *value)
 {
-       struct sr_dev_inst *sdi;
        struct context *ctx;
        int ret;
 
-       if (!(sdi = sr_dev_inst_get(adi->instances, dev_index)))
-               return SR_ERR;
-
        ctx = sdi->priv;
 
        if (hwcap == SR_HWCAP_SAMPLERATE) {
@@ -1470,7 +1465,6 @@ SR_PRIV struct sr_dev_driver asix_sigma_driver_info = {
        .dev_close = hw_dev_close,
        .info_get = hw_info_get,
        .dev_status_get = hw_dev_status_get,
-//     .hwcap_get_all = hw_hwcap_get_all,
        .dev_config_set = hw_dev_config_set,
        .dev_acquisition_start = hw_dev_acquisition_start,
        .dev_acquisition_stop = hw_dev_acquisition_stop,