diff mbox

[v3,1/1] char: cadence_uart: Convert to realize()

Message ID 54F0B09C.90105@suse.de
State New
Headers show

Commit Message

Andreas Färber Feb. 27, 2015, 5:59 p.m. UTC
Am 27.02.2015 um 02:48 schrieb Alistair Francis:
> Use the DeviceClass realize() and init() instead of
> the deprecated SysBusDevice init().
> 
> Signed-off-by: Alistair Francis <alistair.francis@xilinx.com>
> Reviewed-by: Peter Crosthwaite <peter.crosthwaite@xilinx.com>

Thanks, applied to qom-next with some wording/syntax changes and the
following QOM cast cleanup:

     sysbus_init_mmio(sbd, &s->iomem);

https://github.com/afaerber/qemu-cpu/commits/qom-next

Regards,
Andreas

Comments

Alistair Francis Feb. 28, 2015, 8:52 a.m. UTC | #1
On Sat, Feb 28, 2015 at 3:59 AM, Andreas Färber <afaerber@suse.de> wrote:
> Am 27.02.2015 um 02:48 schrieb Alistair Francis:
>> Use the DeviceClass realize() and init() instead of
>> the deprecated SysBusDevice init().
>>
>> Signed-off-by: Alistair Francis <alistair.francis@xilinx.com>
>> Reviewed-by: Peter Crosthwaite <peter.crosthwaite@xilinx.com>
>
> Thanks, applied to qom-next with some wording/syntax changes and the
> following QOM cast cleanup:
>
> diff --git a/hw/char/cadence_uart.c b/hw/char/cadence_uart.c
> index a713a08..36084d5 100644
> --- a/hw/char/cadence_uart.c
> +++ b/hw/char/cadence_uart.c
> @@ -494,10 +494,11 @@ static void cadence_uart_realize(DeviceState *dev,
> Error **errp)
>  static void cadence_uart_init(Object *obj)
>  {
>      UartState *s = CADENCE_UART(obj);
> +    SysBusDevice *sbd = SYS_BUS_DEVICE(obj);
>
>      memory_region_init_io(&s->iomem, obj, &uart_ops, s, "uart", 0x1000);
> -    sysbus_init_mmio(SYS_BUS_DEVICE(obj), &s->iomem);
> -    sysbus_init_irq(SYS_BUS_DEVICE(obj), &s->irq);
> +    sysbus_init_mmio(sbd, &s->iomem);
> +    sysbus_init_irq(sbd, &s->irq);
>
>      s->char_tx_time = (get_ticks_per_sec() / 9600) * 10;
>  }
>
> fixing myself up with the canonical order:
>
> diff --git a/hw/char/cadence_uart.c b/hw/char/cadence_uart.c
> index 36084d5..a5dc2a4 100644
> --- a/hw/char/cadence_uart.c
> +++ b/hw/char/cadence_uart.c
> @@ -493,8 +493,8 @@ static void cadence_uart_realize(DeviceState *dev,
> Error **errp)
>
>  static void cadence_uart_init(Object *obj)
>  {
> -    UartState *s = CADENCE_UART(obj);
>      SysBusDevice *sbd = SYS_BUS_DEVICE(obj);
> +    UartState *s = CADENCE_UART(obj);
>
>      memory_region_init_io(&s->iomem, obj, &uart_ops, s, "uart", 0x1000);
>      sysbus_init_mmio(sbd, &s->iomem);
>
> https://github.com/afaerber/qemu-cpu/commits/qom-next

Looks good, thanks for taking it via qom-next.

Thanks,

Alistair

>
> Regards,
> Andreas
>
> --
> SUSE Linux GmbH, Maxfeldstr. 5, 90409 Nürnberg, Germany
> GF: Felix Imendörffer, Jane Smithard, Jennifer Guild, Dilip Upmanyu,
> Graham Norton; HRB 21284 (AG Nürnberg)
>
Alistair Francis March 16, 2015, 11:19 p.m. UTC | #2
On Sat, Feb 28, 2015 at 6:52 PM, Alistair Francis
<alistair.francis@xilinx.com> wrote:
> On Sat, Feb 28, 2015 at 3:59 AM, Andreas Färber <afaerber@suse.de> wrote:
>> Am 27.02.2015 um 02:48 schrieb Alistair Francis:
>>> Use the DeviceClass realize() and init() instead of
>>> the deprecated SysBusDevice init().
>>>
>>> Signed-off-by: Alistair Francis <alistair.francis@xilinx.com>
>>> Reviewed-by: Peter Crosthwaite <peter.crosthwaite@xilinx.com>
>>
>> Thanks, applied to qom-next with some wording/syntax changes and the
>> following QOM cast cleanup:

I haven't seen the pull request for this one yet. Is it going into 2.3?

Thanks,

Alistair

>>
>> diff --git a/hw/char/cadence_uart.c b/hw/char/cadence_uart.c
>> index a713a08..36084d5 100644
>> --- a/hw/char/cadence_uart.c
>> +++ b/hw/char/cadence_uart.c
>> @@ -494,10 +494,11 @@ static void cadence_uart_realize(DeviceState *dev,
>> Error **errp)
>>  static void cadence_uart_init(Object *obj)
>>  {
>>      UartState *s = CADENCE_UART(obj);
>> +    SysBusDevice *sbd = SYS_BUS_DEVICE(obj);
>>
>>      memory_region_init_io(&s->iomem, obj, &uart_ops, s, "uart", 0x1000);
>> -    sysbus_init_mmio(SYS_BUS_DEVICE(obj), &s->iomem);
>> -    sysbus_init_irq(SYS_BUS_DEVICE(obj), &s->irq);
>> +    sysbus_init_mmio(sbd, &s->iomem);
>> +    sysbus_init_irq(sbd, &s->irq);
>>
>>      s->char_tx_time = (get_ticks_per_sec() / 9600) * 10;
>>  }
>>
>> fixing myself up with the canonical order:
>>
>> diff --git a/hw/char/cadence_uart.c b/hw/char/cadence_uart.c
>> index 36084d5..a5dc2a4 100644
>> --- a/hw/char/cadence_uart.c
>> +++ b/hw/char/cadence_uart.c
>> @@ -493,8 +493,8 @@ static void cadence_uart_realize(DeviceState *dev,
>> Error **errp)
>>
>>  static void cadence_uart_init(Object *obj)
>>  {
>> -    UartState *s = CADENCE_UART(obj);
>>      SysBusDevice *sbd = SYS_BUS_DEVICE(obj);
>> +    UartState *s = CADENCE_UART(obj);
>>
>>      memory_region_init_io(&s->iomem, obj, &uart_ops, s, "uart", 0x1000);
>>      sysbus_init_mmio(sbd, &s->iomem);
>>
>> https://github.com/afaerber/qemu-cpu/commits/qom-next
>
> Looks good, thanks for taking it via qom-next.
>
> Thanks,
>
> Alistair
>
>>
>> Regards,
>> Andreas
>>
>> --
>> SUSE Linux GmbH, Maxfeldstr. 5, 90409 Nürnberg, Germany
>> GF: Felix Imendörffer, Jane Smithard, Jennifer Guild, Dilip Upmanyu,
>> Graham Norton; HRB 21284 (AG Nürnberg)
>>
Andreas Färber March 16, 2015, 11:35 p.m. UTC | #3
Am 17.03.2015 um 00:19 schrieb Alistair Francis:
> On Sat, Feb 28, 2015 at 6:52 PM, Alistair Francis
> <alistair.francis@xilinx.com> wrote:
>> On Sat, Feb 28, 2015 at 3:59 AM, Andreas Färber <afaerber@suse.de> wrote:
>>> Am 27.02.2015 um 02:48 schrieb Alistair Francis:
>>>> Use the DeviceClass realize() and init() instead of
>>>> the deprecated SysBusDevice init().
>>>>
>>>> Signed-off-by: Alistair Francis <alistair.francis@xilinx.com>
>>>> Reviewed-by: Peter Crosthwaite <peter.crosthwaite@xilinx.com>
>>>
>>> Thanks, applied to qom-next with some wording/syntax changes and the
>>> following QOM cast cleanup:
> 
> I haven't seen the pull request for this one yet. Is it going into 2.3?

It is currently the only patch in my queue - was hoping to send a pull
together with some patches from my HMP patchset. Second pair of eyes or
quick testing welcome!

Thanks,
Andreas
Alistair Francis March 16, 2015, 11:45 p.m. UTC | #4
On Tue, Mar 17, 2015 at 9:35 AM, Andreas Färber <afaerber@suse.de> wrote:
> Am 17.03.2015 um 00:19 schrieb Alistair Francis:
>> On Sat, Feb 28, 2015 at 6:52 PM, Alistair Francis
>> <alistair.francis@xilinx.com> wrote:
>>> On Sat, Feb 28, 2015 at 3:59 AM, Andreas Färber <afaerber@suse.de> wrote:
>>>> Am 27.02.2015 um 02:48 schrieb Alistair Francis:
>>>>> Use the DeviceClass realize() and init() instead of
>>>>> the deprecated SysBusDevice init().
>>>>>
>>>>> Signed-off-by: Alistair Francis <alistair.francis@xilinx.com>
>>>>> Reviewed-by: Peter Crosthwaite <peter.crosthwaite@xilinx.com>
>>>>
>>>> Thanks, applied to qom-next with some wording/syntax changes and the
>>>> following QOM cast cleanup:
>>
>> I haven't seen the pull request for this one yet. Is it going into 2.3?
>
> It is currently the only patch in my queue - was hoping to send a pull
> together with some patches from my HMP patchset. Second pair of eyes or
> quick testing welcome!

Great, thanks. I'll try to read over you HMP patchset today.

Thanks,

Alistair

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

Patch

diff --git a/hw/char/cadence_uart.c b/hw/char/cadence_uart.c
index a713a08..36084d5 100644
--- a/hw/char/cadence_uart.c
+++ b/hw/char/cadence_uart.c
@@ -494,10 +494,11 @@  static void cadence_uart_realize(DeviceState *dev,
Error **errp)
 static void cadence_uart_init(Object *obj)
 {
     UartState *s = CADENCE_UART(obj);
+    SysBusDevice *sbd = SYS_BUS_DEVICE(obj);

     memory_region_init_io(&s->iomem, obj, &uart_ops, s, "uart", 0x1000);
-    sysbus_init_mmio(SYS_BUS_DEVICE(obj), &s->iomem);
-    sysbus_init_irq(SYS_BUS_DEVICE(obj), &s->irq);
+    sysbus_init_mmio(sbd, &s->iomem);
+    sysbus_init_irq(sbd, &s->irq);

     s->char_tx_time = (get_ticks_per_sec() / 9600) * 10;
 }

fixing myself up with the canonical order:

diff --git a/hw/char/cadence_uart.c b/hw/char/cadence_uart.c
index 36084d5..a5dc2a4 100644
--- a/hw/char/cadence_uart.c
+++ b/hw/char/cadence_uart.c
@@ -493,8 +493,8 @@  static void cadence_uart_realize(DeviceState *dev,
Error **errp)

 static void cadence_uart_init(Object *obj)
 {
-    UartState *s = CADENCE_UART(obj);
     SysBusDevice *sbd = SYS_BUS_DEVICE(obj);
+    UartState *s = CADENCE_UART(obj);

     memory_region_init_io(&s->iomem, obj, &uart_ops, s, "uart", 0x1000);