[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Qemu-devel] [PATCH v7 24/28] ide: add bootindex to qom property
From: |
Gonglei |
Subject: |
Re: [Qemu-devel] [PATCH v7 24/28] ide: add bootindex to qom property |
Date: |
Mon, 8 Sep 2014 20:07:10 +0800 |
> Subject: Re: [Qemu-devel] [PATCH v7 24/28] ide: add bootindex to qom property
>
> On Fri, Sep 05, 2014 at 04:37:32PM +0800, address@hidden wrote:
> > From: Gonglei <address@hidden>
> >
> > Add a qom property with the same name 'bootindex',
> > when we remove it form qdev property, things will
> > continue to work just fine, and we can use qom features
> > which are not supported by qdev property.
> >
> > Signed-off-by: Gonglei <address@hidden>
> > ---
> > hw/ide/qdev.c | 14 ++++++++++++++
> > 1 file changed, 14 insertions(+)
> >
> > diff --git a/hw/ide/qdev.c b/hw/ide/qdev.c
> > index efab95b..9e2ed40 100644
> > --- a/hw/ide/qdev.c
> > +++ b/hw/ide/qdev.c
> > @@ -191,6 +191,17 @@ static int ide_dev_initfn(IDEDevice *dev,
> IDEDriveKind kind)
> > return 0;
> > }
> >
> > +static void ide_dev_instance_init(Object *obj)
> > +{
> > + DeviceState *dev = DEVICE(obj);
> > + IDEDevice *d = DO_UPCAST(IDEDevice, qdev, dev);
> > +
> > + device_add_bootindex_property(obj, &d->conf.bootindex,
> > + "bootindex",
> > + d->unit ? "/address@hidden" :
> > "/address@hidden",
> > + &d->qdev, NULL);
> > +}
> > +
> > static int ide_hd_initfn(IDEDevice *dev)
> > {
> > return ide_dev_initfn(dev, IDE_HD);
> > @@ -238,6 +249,7 @@ static const TypeInfo ide_hd_info = {
> > .parent = TYPE_IDE_DEVICE,
> > .instance_size = sizeof(IDEDrive),
> > .class_init = ide_hd_class_init,
> > + .instance_init = ide_dev_instance_init,
> > };
> >
> > static Property ide_cd_properties[] = {
> > @@ -260,6 +272,7 @@ static const TypeInfo ide_cd_info = {
> > .parent = TYPE_IDE_DEVICE,
> > .instance_size = sizeof(IDEDrive),
> > .class_init = ide_cd_class_init,
> > + .instance_init = ide_dev_instance_init,
> > };
> >
> > static Property ide_drive_properties[] = {
> > @@ -282,6 +295,7 @@ static const TypeInfo ide_drive_info = {
> > .parent = TYPE_IDE_DEVICE,
> > .instance_size = sizeof(IDEDrive),
> > .class_init = ide_drive_class_init,
> > + .instance_init = ide_dev_instance_init,
> > };
>
> If all TYPE_IDE_DEVICE subclasses have the same instance_init, why not
> just set ide_device_type_info.instance_init = ide_dev_instance_init?
>
OK. TBH I have not noticed this way, sorry.
Great thanks for your help and reviewing, Eduardo. :)
Best regards,
-Gonglei
- [Qemu-devel] [PATCH v7 07/28] bootindex: add a setter/getter functions wrapper for bootindex property, (continued)
- [Qemu-devel] [PATCH v7 07/28] bootindex: add a setter/getter functions wrapper for bootindex property, arei.gonglei, 2014/09/05
- [Qemu-devel] [PATCH v7 03/28] bootindex: add del_boot_device_path function, arei.gonglei, 2014/09/05
- [Qemu-devel] [PATCH v7 20/28] vfio: remove bootindex property from qdev to qom, arei.gonglei, 2014/09/05
- [Qemu-devel] [PATCH v7 22/28] isa-fdc: remove bootindexA/B property from qdev to qom, arei.gonglei, 2014/09/05
- [Qemu-devel] [PATCH v7 23/28] scsi: add bootindex to qom property, arei.gonglei, 2014/09/05
- [Qemu-devel] [PATCH v7 09/28] e1000: add bootindex to qom property, arei.gonglei, 2014/09/05
- [Qemu-devel] [PATCH v7 26/28] block: remove bootindex property from qdev to qom, arei.gonglei, 2014/09/05
- [Qemu-devel] [PATCH v7 21/28] redirect: remove bootindex property from qdev to qom, arei.gonglei, 2014/09/05
- [Qemu-devel] [PATCH v7 24/28] ide: add bootindex to qom property, arei.gonglei, 2014/09/05
- [Qemu-devel] [PATCH v7 25/28] virtio-blk: add bootindex to qom property, arei.gonglei, 2014/09/05
- [Qemu-devel] [PATCH v7 28/28] bootindex: delete bootindex when device is removed, arei.gonglei, 2014/09/05
- [Qemu-devel] [PATCH v7 02/28] bootindex: add check bootindex function, arei.gonglei, 2014/09/05
- [Qemu-devel] [PATCH v7 04/28] fw_cfg: add fw_cfg_machine_reset function, arei.gonglei, 2014/09/05
- [Qemu-devel] [PATCH v7 08/28] virtio-net: add bootindex to qom property, arei.gonglei, 2014/09/05