Revision 2ff3de68 device_tree.c

b/device_tree.c
21 21
#include "config.h"
22 22
#include "qemu-common.h"
23 23
#include "sysemu/device_tree.h"
24
#include "sysemu/sysemu.h"
24 25
#include "hw/loader.h"
25 26
#include "qemu/option.h"
26 27
#include "qemu/config-file.h"
......
239 240
     * which phandle id to start allocting phandles.
240 241
     */
241 242
    if (!phandle) {
242
        QemuOpts *machine_opts;
243
        machine_opts = qemu_opts_find(qemu_find_opts("machine"), 0);
244
        if (machine_opts) {
245
            const char *phandle_start;
246
            phandle_start = qemu_opt_get(machine_opts, "phandle_start");
247
            if (phandle_start) {
248
                phandle = strtoul(phandle_start, NULL, 0);
249
            }
243
        const char *phandle_start = qemu_opt_get(qemu_get_machine_opts(),
244
                                                 "phandle_start");
245
        if (phandle_start) {
246
            phandle = strtoul(phandle_start, NULL, 0);
250 247
        }
251 248
    }
252 249

  
......
307 304

  
308 305
void qemu_devtree_dumpdtb(void *fdt, int size)
309 306
{
310
    QemuOpts *machine_opts;
311

  
312
    machine_opts = qemu_opts_find(qemu_find_opts("machine"), 0);
313
    if (machine_opts) {
314
        const char *dumpdtb = qemu_opt_get(machine_opts, "dumpdtb");
315
        if (dumpdtb) {
316
            /* Dump the dtb to a file and quit */
317
            exit(g_file_set_contents(dumpdtb, fdt, size, NULL) ? 0 : 1);
318
        }
319
    }
307
    const char *dumpdtb = qemu_opt_get(qemu_get_machine_opts(), "dumpdtb");
320 308

  
309
    if (dumpdtb) {
310
        /* Dump the dtb to a file and quit */
311
        exit(g_file_set_contents(dumpdtb, fdt, size, NULL) ? 0 : 1);
312
    }
321 313
}

Also available in: Unified diff