]> sigrok.org Git - libsigrok.git/blobdiff - device.c
sr: No need for dynamic hardware driver registration.
[libsigrok.git] / device.c
index 9cc3b6800691b4debd76555b8b572bb1d20486b7..eb2e2b4cb2c02b392c8f02f31095ca027128a9de 100644 (file)
--- a/device.c
+++ b/device.c
@@ -59,10 +59,11 @@ static GSList *devs = NULL;
  */
 SR_API int sr_dev_scan(void)
 {
-       GSList *plugins, *l;
-       struct sr_dev_plugin *plugin;
+       int i;
+       struct sr_dev_plugin **plugins;
 
-       if (!(plugins = sr_hw_list())) {
+       plugins = sr_hw_list();
+       if (!plugins[0]) {
                sr_err("dev: %s: no supported devices/hwplugins", __func__);
                return SR_ERR; /* TODO: More specific error? */
        }
@@ -72,11 +73,8 @@ SR_API int sr_dev_scan(void)
         * a firmware upload and associated delay, we may as well get all
         * of these out of the way first.
         */
-       for (l = plugins; l; l = l->next) {
-               plugin = l->data;
-               /* TODO: Handle 'plugin' being NULL. */
-               sr_hw_init(plugin);
-       }
+       for (i = 0; plugins[i]; i++)
+               sr_hw_init(plugins[i]);
 
        return SR_OK;
 }