[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Qemu-ppc] [Qemu-devel] [PATCH 1/1] Add usb option in machine option
From: |
Li Zhang |
Subject: |
Re: [Qemu-ppc] [Qemu-devel] [PATCH 1/1] Add usb option in machine options. |
Date: |
Thu, 28 Jun 2012 21:35:50 +0800 |
On Thu, Jun 28, 2012 at 9:22 PM, Alexander Graf <address@hidden> wrote:
> 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.
>
Got it. Thanks. :)
>
> Alex
>
--
Best Regards
-Li