qemu-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Qemu-devel] [PATCH 1/1] Add usb option in machine options.


From: Alexander Graf
Subject: Re: [Qemu-devel] [PATCH 1/1] Add usb option in machine options.
Date: Thu, 28 Jun 2012 15:22:21 +0200
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:10.0.3) Gecko/20120306 Thunderbird/10.0.3

On 06/15/2012 02:46 PM, Li Zhang wrote:
On Fri, Jun 15, 2012 at 7:09 PM, Andreas Färber<address@hidden>  wrote:

You don't seem to be getting what I'm saying: As discussed in great
lengths for how to access a passed-in device tree for ARM, the code
checking this option (i.e., in spapr.c) is expected to call
qemu_opt_get() itself, instead of saving its value globally in vl.c. For
example:

machine_opts = qemu_opts_find(qemu_find_opts("machine"), 0);
usb_opt = qemu_opt_get(machine_opts, "usb");
if (strcmp(usb_opt, "off") != 0) {
    // set up OHCI
}

I see.
I  just thought if every machine has the same code, it can be done in vl.c.
Isn't  the global variable good ?

No, global variables are always bad :). If you see code duplication, just throw the interesting bit into a static inline function in a header and have the users call that.


Alex




reply via email to

[Prev in Thread] Current Thread [Next in Thread]