Revision ff952ba2 hw/qdev.c

b/hw/qdev.c
153 153
    return 0;
154 154
}
155 155

  
156
int qdev_device_help(QemuOpts *opts)
157
{
158
    const char *driver;
159
    DeviceInfo *info;
160
    char msg[256];
161

  
162
    driver = qemu_opt_get(opts, "driver");
163
    if (driver && !strcmp(driver, "?")) {
164
        for (info = device_info_list; info != NULL; info = info->next) {
165
            qdev_print_devinfo(info, msg, sizeof(msg));
166
            qemu_error("%s\n", msg);
167
        }
168
        return 1;
169
    }
170

  
171
    return 0;
172
}
173

  
156 174
DeviceState *qdev_device_add(QemuOpts *opts)
157 175
{
158 176
    const char *driver, *path, *id;
......
165 183
        qemu_error("-device: no driver specified\n");
166 184
        return NULL;
167 185
    }
168
    if (strcmp(driver, "?") == 0) {
169
        char msg[256];
170
        for (info = device_info_list; info != NULL; info = info->next) {
171
            qdev_print_devinfo(info, msg, sizeof(msg));
172
            qemu_error("%s\n", msg);
173
        }
174
        return NULL;
175
    }
176 186

  
177 187
    /* find driver */
178 188
    info = qdev_find_info(NULL, driver);
......
726 736

  
727 737
    opts = qemu_opts_parse(&qemu_device_opts,
728 738
                           qdict_get_str(qdict, "config"), "driver");
729
    if (opts)
739
    if (opts && !qdev_device_help(opts))
730 740
        qdev_device_add(opts);
731 741
}
732 742

  

Also available in: Unified diff