qemu-devel
[Top][All Lists]
Advanced

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

Re: [Qemu-devel] [RFC] QDev explicit constructors & destructors


From: Andreas Färber
Subject: Re: [Qemu-devel] [RFC] QDev explicit constructors & destructors
Date: Wed, 24 Jun 2015 15:50:43 +0200
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:31.0) Gecko/20100101 Thunderbird/31.7.0

Am 24.06.2015 um 11:29 schrieb Liviu Ionescu:
> the machine init code now looks like this:
> 
> static void stm32_h103_board_init_callback(MachineState *machine)
> {
>     cm_board_greeting(machine);
> 
>     {
>         /* Create the MCU */
>         DeviceState *mcu = cm_create(TYPE_STM32F103RB);
> 
>         qdev_prop_set_ptr(mcu, "machine", machine);
> 
>         /* Set the board specific oscillator frequencies. */
>         qdev_prop_set_uint32(mcu, "hse-freq-hz", 8000000); /* 8.0 MHz */
>         qdev_prop_set_uint32(mcu, "lse-freq-hz", 32768); /* 32 KHz */
> 
>         cm_realize(mcu);
>     }
> 
>     {
>         /* Create the board LED */
>         DeviceState *led = cm_create(TYPE_GPIO_LED);
> 
>         /* STM32-H103 Green LED, GPIOC[12], active low */
>         qdev_prop_set_bit(led, "active-low", true);
>         qdev_prop_set_string(led, "on-message", "[Green LED On]\n");
>         qdev_prop_set_string(led, "off-message", "[Green LED Off]\n");
> 
>         gpio_led_connect(led, "/machine/stm32/gpio[c]", 12);
> 
>         cm_realize(led);
>     }
> }
> 
> I hope it is better now.

You're still doing the {...} thing I asked you not to do.

static ...
{
    DeviceState *mcu, *led;

    mcu = ...
    ...

    led = ...
    ...
}

Andreas

-- 
SUSE Linux GmbH, Maxfeldstr. 5, 90409 Nürnberg, Germany
GF: Felix Imendörffer, Jane Smithard, Dilip Upmanyu, Graham Norton; HRB
21284 (AG Nürnberg)



reply via email to

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