diff mbox

[v3,8/8] qdev: Warning about using object_class_property_add() in new code

Message ID 1477499426-9550-9-git-send-email-ehabkost@redhat.com (mailing list archive)
State New, archived
Headers show

Commit Message

Eduardo Habkost Oct. 26, 2016, 4:30 p.m. UTC
The only remaining user of object_class_property_add() is
arm_cpu_post_init(), but removing it may take some work. While we
don't change it, warn people to not use the function in new code.

Cc: Peter Maydell <peter.maydell@linaro.org>
Cc: qemu-arm@nongnu.org
Signed-off-by: Eduardo Habkost <ehabkost@redhat.com>
---
 hw/core/qdev.c | 4 ++++
 1 file changed, 4 insertions(+)

Comments

Peter Maydell Oct. 26, 2016, 4:48 p.m. UTC | #1
On 26 October 2016 at 17:30, Eduardo Habkost <ehabkost@redhat.com> wrote:
> The only remaining user of object_class_property_add() is
> arm_cpu_post_init(), but removing it may take some work. While we
> don't change it, warn people to not use the function in new code.

This is about the third time I've seen this commit
message go past, but:

  git grep object_class_property_add target-arm   => no hits

So I'm not sure what it's referring to...

thanks
-- PMM
Eduardo Habkost Oct. 26, 2016, 4:57 p.m. UTC | #2
On Wed, Oct 26, 2016 at 05:48:03PM +0100, Peter Maydell wrote:
> On 26 October 2016 at 17:30, Eduardo Habkost <ehabkost@redhat.com> wrote:
> > The only remaining user of object_class_property_add() is
> > arm_cpu_post_init(), but removing it may take some work. While we
> > don't change it, warn people to not use the function in new code.
> 
> This is about the third time I've seen this commit
> message go past, but:
> 
>   git grep object_class_property_add target-arm   => no hits

Erm. I meant qdev_property_add_static(). Sorry.

target-arm/cpu.c:        qdev_property_add_static(DEVICE(obj), &arm_cpu_reset_cbar_property,
target-arm/cpu.c:        qdev_property_add_static(DEVICE(obj), &arm_cpu_reset_hivecs_property,
target-arm/cpu.c:        qdev_property_add_static(DEVICE(obj), &arm_cpu_rvbar_property,
target-arm/cpu.c:        qdev_property_add_static(DEVICE(obj), &arm_cpu_has_el3_property,
target-arm/cpu.c:        qdev_property_add_static(DEVICE(obj), &arm_cpu_has_mpu_property,
target-arm/cpu.c:            qdev_property_add_static(DEVICE(obj),

Commit message needs to be rewritten as:

    qdev: Warning about using qdev_property_add_static() in new code
    
    The only remaining user of qdev_property_add_static() is
    arm_cpu_post_init(), but removing it may take some work. While we
    don't change it, warn people to not use the function in new code.
Peter Maydell Oct. 26, 2016, 5:57 p.m. UTC | #3
On 26 October 2016 at 17:57, Eduardo Habkost <ehabkost@redhat.com> wrote:
> On Wed, Oct 26, 2016 at 05:48:03PM +0100, Peter Maydell wrote:
>> On 26 October 2016 at 17:30, Eduardo Habkost <ehabkost@redhat.com> wrote:
>> > The only remaining user of object_class_property_add() is
>> > arm_cpu_post_init(), but removing it may take some work. While we
>> > don't change it, warn people to not use the function in new code.
>>
>> This is about the third time I've seen this commit
>> message go past, but:
>>
>>   git grep object_class_property_add target-arm   => no hits
>
> Erm. I meant qdev_property_add_static(). Sorry.
> Commit message needs to be rewritten as:
>
>     qdev: Warning about using qdev_property_add_static() in new code
>
>     The only remaining user of qdev_property_add_static() is
>     arm_cpu_post_init(), but removing it may take some work. While we
>     don't change it, warn people to not use the function in new code.

Can we say what the recommended replacement function is?

thanks
-- PMM
Eduardo Habkost Oct. 26, 2016, 7:36 p.m. UTC | #4
On Wed, Oct 26, 2016 at 06:57:12PM +0100, Peter Maydell wrote:
> On 26 October 2016 at 17:57, Eduardo Habkost <ehabkost@redhat.com> wrote:
> > On Wed, Oct 26, 2016 at 05:48:03PM +0100, Peter Maydell wrote:
> >> On 26 October 2016 at 17:30, Eduardo Habkost <ehabkost@redhat.com> wrote:
> >> > The only remaining user of object_class_property_add() is
> >> > arm_cpu_post_init(), but removing it may take some work. While we
> >> > don't change it, warn people to not use the function in new code.
> >>
> >> This is about the third time I've seen this commit
> >> message go past, but:
> >>
> >>   git grep object_class_property_add target-arm   => no hits
> >
> > Erm. I meant qdev_property_add_static(). Sorry.
> > Commit message needs to be rewritten as:
> >
> >     qdev: Warning about using qdev_property_add_static() in new code
> >
> >     The only remaining user of qdev_property_add_static() is
> >     arm_cpu_post_init(), but removing it may take some work. While we
> >     don't change it, warn people to not use the function in new code.
> 
> Can we say what the recommended replacement function is?

It's mentioned in the comment I added[1]. I assume I don't need to duplicate
the comment contents in the commit message.

[1] "Do not use this in new code. Either use qdev_class_set_props(), or
    register regular QOM properties using object_property_add() or
    object_class_property_add()."
diff mbox

Patch

diff --git a/hw/core/qdev.c b/hw/core/qdev.c
index a88753c..53cbaad 100644
--- a/hw/core/qdev.c
+++ b/hw/core/qdev.c
@@ -813,6 +813,10 @@  static void qdev_property_set_to_default(DeviceState *dev, Property *prop,
  * Add a static QOM property to @dev for qdev property @prop.
  * On error, store error in @errp.  Static properties access data in a struct.
  * The type of the QOM property is derived from prop->info.
+ *
+ * Do not use this in new code. Either use qdev_class_set_props(),
+ * or register regular QOM properties using object_property_add() or
+ * object_class_property_add().
  */
 void qdev_property_add_static(DeviceState *dev, Property *prop,
                               Error **errp)