All of lore.kernel.org
 help / color / mirror / Atom feed
From: maozy <maozhongyi@cmss.chinamobile.com>
To: "Philippe Mathieu-Daudé" <philmd@redhat.com>, qemu-devel@nongnu.org
Cc: Peter Maydell <peter.maydell@linaro.org>,
	Jan Kiszka <jan.kiszka@web.de>, Gerd Hoffmann <kraxel@redhat.com>
Subject: Re: [Qemu-devel] [PATCH v2 2/3] audio: use object link instead ofqdev property to pass wm8750 reference
Date: Fri, 12 Oct 2018 19:51:30 +0800	[thread overview]
Message-ID: <f55ae5b1-2dbf-8c6e-c787-0f088fa491a9@cmss.chinamobile.com> (raw)
In-Reply-To: <cfadc8a6-ae1c-367a-a6f1-6e711a6e79f4@redhat.com>

Hi, Philippe

On 10/12/18 5:53 PM, Philippe Mathieu-Daudé wrote:
> Hi Mao,
> 
> On 12/10/2018 10:30, Mao Zhongyi wrote:
>> According to qdev-properties.h, properties of pointer type should
>> be avoided, it seems a link type property is a good substitution.
>>
>> Cc: Jan Kiszka <jan.kiszka@web.de>
>> Cc: Peter Maydell <peter.maydell@linaro.org>
>> Cc: Gerd Hoffmann <kraxel@redhat.com>
>> To: qemu-arm@nongnu.org
>>
>> Signed-off-by: Mao Zhongyi <maozhongyi@cmss.chinamobile.com>
>> ---
>>   hw/arm/musicpal.c          |  3 ++-
>>   hw/audio/marvell_88w8618.c | 14 ++++++--------
>>   2 files changed, 8 insertions(+), 9 deletions(-)
>>
>> diff --git a/hw/arm/musicpal.c b/hw/arm/musicpal.c
>> index 3dafb41b0b..ac266f9253 100644
>> --- a/hw/arm/musicpal.c
>> +++ b/hw/arm/musicpal.c
>> @@ -1695,7 +1695,8 @@ static void musicpal_init(MachineState *machine)
>>       wm8750_dev = i2c_create_slave(i2c, TYPE_WM8750, MP_WM_ADDR);
>>       dev = qdev_create(NULL, "mv88w8618_audio");
>>       s = SYS_BUS_DEVICE(dev);
>> -    qdev_prop_set_ptr(dev, TYPE_WM8750, wm8750_dev);
>> +    object_property_set_link(OBJECT(dev), OBJECT(wm8750_dev),
>> +                             TYPE_WM8750, NULL);
>>       qdev_init_nofail(dev);
>>       sysbus_mmio_map(s, 0, MP_AUDIO_BASE);
>>       sysbus_connect_irq(s, 0, pic[MP_AUDIO_IRQ]);
>> diff --git a/hw/audio/marvell_88w8618.c b/hw/audio/marvell_88w8618.c
>> index cf6ce6979b..baab4a3d53 100644
>> --- a/hw/audio/marvell_88w8618.c
>> +++ b/hw/audio/marvell_88w8618.c
>> @@ -15,6 +15,7 @@
>>   #include "hw/i2c/i2c.h"
>>   #include "hw/audio/wm8750.h"
>>   #include "audio/audio.h"
>> +#include "qapi/error.h"
>>   
>>   #define MP_AUDIO_SIZE           0x00001000
>>   
>> @@ -252,6 +253,11 @@ static void mv88w8618_audio_init(Object *obj)
>>       memory_region_init_io(&s->iomem, obj, &mv88w8618_audio_ops, s,
>>                             "audio", MP_AUDIO_SIZE);
>>       sysbus_init_mmio(dev, &s->iomem);
>> +
>> +    object_property_add_link(OBJECT(dev), "mv88w8618", TYPE_WM8750,
>> +                             (Object **) &s->wm,
>> +                             qdev_prop_allow_set_link_before_realize,
>> +                             0, &error_abort);
>>   }
>>   
>>   static void mv88w8618_audio_realize(DeviceState *dev, Error **errp)
>> @@ -279,11 +285,6 @@ static const VMStateDescription mv88w8618_audio_vmsd = {
>>       }
>>   };
>>   
>> -static Property mv88w8618_audio_properties[] = {
>> -    DEFINE_PROP_PTR(TYPE_WM8750, mv88w8618_audio_state, wm),
>> -    {/* end of list */},
>> -};
>> -
>>   static void mv88w8618_audio_class_init(ObjectClass *klass, void *data)
>>   {
>>       DeviceClass *dc = DEVICE_CLASS(klass);
>> @@ -291,9 +292,6 @@ static void mv88w8618_audio_class_init(ObjectClass *klass, void *data)
>>       dc->realize = mv88w8618_audio_realize;
>>       dc->reset = mv88w8618_audio_reset;
>>       dc->vmsd = &mv88w8618_audio_vmsd;
>> -    dc->props = mv88w8618_audio_properties;
>> -    /* Reason: pointer property "wm8750" */
>> -    dc->user_creatable = false;
> 
> Having a link property isn't it the same restriction?

This task can found in 
https://wiki.qemu.org/Contribute/BiteSizedTasks#Device_models

Convert qdev pointer properties (defined with DEFINE_PROP_PTR) to QOM 
links. Example: commit 873b4d3.

Thanks,
Mao

> 
>>   }
>>   
>>   static const TypeInfo mv88w8618_audio_info = {
>>
> 

  reply	other threads:[~2018-10-12 11:51 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-10-12  8:30 [Qemu-devel] [PATCH v2 0/3] use object link instead of qdev property Mao Zhongyi
2018-10-12  8:30 ` [Qemu-devel] [PATCH v2 1/3] audio: use TYPE_WM8750 instead of a hardcoded string Mao Zhongyi
2018-10-12  9:50   ` Philippe Mathieu-Daudé
2018-10-12 10:14     ` [Qemu-devel] [PATCH v2 1/3] audio: use TYPE_WM8750 instead of ahardcoded string maozy
2018-10-12  8:30 ` [Qemu-devel] [PATCH v2 2/3] audio: use object link instead of qdev property to pass wm8750 reference Mao Zhongyi
2018-10-12  9:53   ` Philippe Mathieu-Daudé
2018-10-12 11:51     ` maozy [this message]
2018-10-12 12:30       ` [Qemu-devel] [PATCH v2 2/3] audio: use object link instead ofqdev " Philippe Mathieu-Daudé
2018-10-12 18:40         ` Philippe Mathieu-Daudé
2018-10-15  2:14           ` [Qemu-devel] [PATCH v2 2/3] audio: use object link instead ofqdevproperty " maozy
2018-10-12  8:30 ` [Qemu-devel] [PATCH v2 3/3] audio: use TYPE_MV88W8618_AUDIO instead of hardcoded string Mao Zhongyi
2018-10-12  9:53   ` Philippe Mathieu-Daudé
2018-10-12  9:58   ` maozy

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=f55ae5b1-2dbf-8c6e-c787-0f088fa491a9@cmss.chinamobile.com \
    --to=maozhongyi@cmss.chinamobile.com \
    --cc=jan.kiszka@web.de \
    --cc=kraxel@redhat.com \
    --cc=peter.maydell@linaro.org \
    --cc=philmd@redhat.com \
    --cc=qemu-devel@nongnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.