[25/26] isa bus: use realize for isa bus

Submitted by Hu Tao on June 22, 2013, 8:50 a.m.

Details

Message ID 8be2a07871a424a87790814a23d3b2c13a67724c.1371804804.git.hutao@cn.fujitsu.com
State New
Headers show

Commit Message

Hu Tao June 22, 2013, 8:50 a.m.
Cc: "Andreas Färber" <afaerber@suse.de>
Cc: Paolo Bonzini <pbonzini@redhat.com>
Cc: Anthony Liguori <aliguori@us.ibm.com>
Cc: Avi Kivity <avi@redhat.com>
Cc: Jim Meyering <meyering@redhat.com>
Signed-off-by: Hu Tao <hutao@cn.fujitsu.com>
---
 hw/isa/isa-bus.c | 7 +++----
 1 file changed, 3 insertions(+), 4 deletions(-)

Comments

Andreas Färber June 30, 2013, 2:57 p.m.
The subject is a bit misleading, suggest:
"isa-bus: Use QOM realize for ISA SysBus bridge"

Am 22.06.2013 10:50, schrieb Hu Tao:
> Cc: "Andreas Färber" <afaerber@suse.de>
> Cc: Paolo Bonzini <pbonzini@redhat.com>
> Cc: Anthony Liguori <aliguori@us.ibm.com>

> Cc: Avi Kivity <avi@redhat.com>

This will bounce, please drop. ;)

Also, if you use git-send-email together with
"scripts/get_maintainer.pl --nogit-fallback" you only need to add any
CCs missing in MAINTAINERS file per commit.

> Cc: Jim Meyering <meyering@redhat.com>
> Signed-off-by: Hu Tao <hutao@cn.fujitsu.com>
> ---
>  hw/isa/isa-bus.c | 7 +++----
>  1 file changed, 3 insertions(+), 4 deletions(-)
> 
> diff --git a/hw/isa/isa-bus.c b/hw/isa/isa-bus.c
> index 136d17e..287f941 100644
> --- a/hw/isa/isa-bus.c
> +++ b/hw/isa/isa-bus.c
> @@ -192,18 +192,17 @@ static void isabus_dev_print(Monitor *mon, DeviceState *dev, int indent)
>      }
>  }
>  
> -static int isabus_bridge_init(SysBusDevice *dev)
> +static void isabus_bridge_realize(DeviceState *dev, Error **errp)
>  {
>      /* nothing */
> -    return 0;
> +    return;

Not needed.

>  }
>  
>  static void isabus_bridge_class_init(ObjectClass *klass, void *data)
>  {
>      DeviceClass *dc = DEVICE_CLASS(klass);
> -    SysBusDeviceClass *k = SYS_BUS_DEVICE_CLASS(klass);
>  
> -    k->init = isabus_bridge_init;
> +    dc->realize = isabus_bridge_realize;
>      dc->fw_name = "isa";
>      dc->no_user = 1;
>  }

I would propose to simply drop the init function instead of turning it
into a realize function unless you see a future use case for it.

Historically it was not possible to omit a SysBusDevice init function:
http://git.qemu.org/?p=qemu.git;a=commit;h=4ce5dae88ecf2bafa0cd663de7e923728b1b3672

Andreas
Hu Tao July 1, 2013, 5:30 a.m.
On Sun, Jun 30, 2013 at 04:57:03PM +0200, Andreas Färber wrote:
> The subject is a bit misleading, suggest:
> "isa-bus: Use QOM realize for ISA SysBus bridge"
> 
> Am 22.06.2013 10:50, schrieb Hu Tao:
> > Cc: "Andreas Färber" <afaerber@suse.de>
> > Cc: Paolo Bonzini <pbonzini@redhat.com>
> > Cc: Anthony Liguori <aliguori@us.ibm.com>
> 
> > Cc: Avi Kivity <avi@redhat.com>
> 
> This will bounce, please drop. ;)

Noticed that. :)

> 
> Also, if you use git-send-email together with
> "scripts/get_maintainer.pl --nogit-fallback" you only need to add any
> CCs missing in MAINTAINERS file per commit.

So don't have to CC people in MAINTAINERS? For example:

  ./scripts/get_maintainer.pl --nogit-fallback patch-01

get:

  Gerd Hoffmann <kraxel@redhat.com> (maintainer:USB)

and Gerd Hoffmann is in MAINTAINERS, there is no need to CC him in
patch-01? If so I'll update my script.

> 
> > Cc: Jim Meyering <meyering@redhat.com>
> > Signed-off-by: Hu Tao <hutao@cn.fujitsu.com>
> > ---
> >  hw/isa/isa-bus.c | 7 +++----
> >  1 file changed, 3 insertions(+), 4 deletions(-)
> > 
> > diff --git a/hw/isa/isa-bus.c b/hw/isa/isa-bus.c
> > index 136d17e..287f941 100644
> > --- a/hw/isa/isa-bus.c
> > +++ b/hw/isa/isa-bus.c
> > @@ -192,18 +192,17 @@ static void isabus_dev_print(Monitor *mon, DeviceState *dev, int indent)
> >      }
> >  }
> >  
> > -static int isabus_bridge_init(SysBusDevice *dev)
> > +static void isabus_bridge_realize(DeviceState *dev, Error **errp)
> >  {
> >      /* nothing */
> > -    return 0;
> > +    return;
> 
> Not needed.
> 
> >  }
> >  
> >  static void isabus_bridge_class_init(ObjectClass *klass, void *data)
> >  {
> >      DeviceClass *dc = DEVICE_CLASS(klass);
> > -    SysBusDeviceClass *k = SYS_BUS_DEVICE_CLASS(klass);
> >  
> > -    k->init = isabus_bridge_init;
> > +    dc->realize = isabus_bridge_realize;
> >      dc->fw_name = "isa";
> >      dc->no_user = 1;
> >  }
> 
> I would propose to simply drop the init function instead of turning it
> into a realize function unless you see a future use case for it.

There are many other devices using init, so simply drop it now won't
compile. One of the goals is to remove the init after all devices are
converted from init to realize.

> 
> Historically it was not possible to omit a SysBusDevice init function:
> http://git.qemu.org/?p=qemu.git;a=commit;h=4ce5dae88ecf2bafa0cd663de7e923728b1b3672
> 
> Andreas
> 
> -- 
> SUSE LINUX Products GmbH, Maxfeldstr. 5, 90409 Nürnberg, Germany
> GF: Jeff Hawn, Jennifer Guild, Felix Imendörffer; HRB 16746 AG Nürnberg

Patch hide | download patch | download mbox

diff --git a/hw/isa/isa-bus.c b/hw/isa/isa-bus.c
index 136d17e..287f941 100644
--- a/hw/isa/isa-bus.c
+++ b/hw/isa/isa-bus.c
@@ -192,18 +192,17 @@  static void isabus_dev_print(Monitor *mon, DeviceState *dev, int indent)
     }
 }
 
-static int isabus_bridge_init(SysBusDevice *dev)
+static void isabus_bridge_realize(DeviceState *dev, Error **errp)
 {
     /* nothing */
-    return 0;
+    return;
 }
 
 static void isabus_bridge_class_init(ObjectClass *klass, void *data)
 {
     DeviceClass *dc = DEVICE_CLASS(klass);
-    SysBusDeviceClass *k = SYS_BUS_DEVICE_CLASS(klass);
 
-    k->init = isabus_bridge_init;
+    dc->realize = isabus_bridge_realize;
     dc->fw_name = "isa";
     dc->no_user = 1;
 }