- GSList *l;
- struct sr_dev_inst *sdi;
- struct drv_context *drvc;
- struct dev_context *devc;
-
- drvc = di->priv;
- for (l = drvc->instances; l; l = l->next) {
- sdi = l->data;
- if (!(devc = sdi->priv)) {
- /* Log error, but continue cleaning up the rest. */
- sr_err("%s: sdi->priv was NULL, continuing", __func__);
- continue;
- }
- sr_usb_dev_inst_free(devc->usb);
- /* Properly close all devices... */
- hw_dev_close(sdi);
- /* ...and free all their memory. */
- sr_dev_inst_free(sdi);
- }
- g_slist_free(drvc->instances);
- drvc->instances = NULL;
-
- return SR_OK;