diff mbox

[v6,1/5] hw/ptimer: add VMSTATE_PTIMER_ARRAY

Message ID 1385540635-26977-2-git-send-email-lig.fnst@cn.fujitsu.com
State New
Headers show

Commit Message

liguang Nov. 27, 2013, 8:23 a.m. UTC
Signed-off-by: liguang <lig.fnst@cn.fujitsu.com>
---
 include/hw/ptimer.h |    3 +++
 1 files changed, 3 insertions(+), 0 deletions(-)

Comments

Peter Maydell Nov. 29, 2013, 11:01 a.m. UTC | #1
On 27 November 2013 08:23, liguang <lig.fnst@cn.fujitsu.com> wrote:
> Signed-off-by: liguang <lig.fnst@cn.fujitsu.com>
> ---
>  include/hw/ptimer.h |    3 +++
>  1 files changed, 3 insertions(+), 0 deletions(-)
>
> diff --git a/include/hw/ptimer.h b/include/hw/ptimer.h
> index 28fcaf1..a9b8f1d 100644
> --- a/include/hw/ptimer.h
> +++ b/include/hw/ptimer.h
> @@ -27,6 +27,9 @@ void ptimer_stop(ptimer_state *s);
>
>  extern const VMStateDescription vmstate_ptimer;
>
> +#define VMSTATE_PTIMER_ARRAY(_f, _s, _n) \
> +    VMSTATE_STRUCT_ARRAY(_f, _s, _n, 0, vmstate_ptimer, ptimer_state*)

The final parameter here should just be the struct type
("ptimer_state"), not a pointer-to-it.

thanks
-- PMM
Peter Maydell Nov. 29, 2013, 11:11 a.m. UTC | #2
On 29 November 2013 11:01, Peter Maydell <peter.maydell@linaro.org> wrote:
> On 27 November 2013 08:23, liguang <lig.fnst@cn.fujitsu.com> wrote:
>> Signed-off-by: liguang <lig.fnst@cn.fujitsu.com>
>> ---
>>  include/hw/ptimer.h |    3 +++
>>  1 files changed, 3 insertions(+), 0 deletions(-)
>>
>> diff --git a/include/hw/ptimer.h b/include/hw/ptimer.h
>> index 28fcaf1..a9b8f1d 100644
>> --- a/include/hw/ptimer.h
>> +++ b/include/hw/ptimer.h
>> @@ -27,6 +27,9 @@ void ptimer_stop(ptimer_state *s);
>>
>>  extern const VMStateDescription vmstate_ptimer;
>>
>> +#define VMSTATE_PTIMER_ARRAY(_f, _s, _n) \
>> +    VMSTATE_STRUCT_ARRAY(_f, _s, _n, 0, vmstate_ptimer, ptimer_state*)
>
> The final parameter here should just be the struct type
> ("ptimer_state"), not a pointer-to-it.

Actually, looking at the patch where you've used this,
you do actually want to deal with an
array-of-pointers-to-ptimers. For that you need

#define VMSTATE_PTIMER_ARRAY(_f, _s, _n) \
    VMSTATE_ARRAY_OF_POINTER(_f, _s, _n, 0, vmstate_ptimer, ptimer_state *)

(compare VMSTATE_TIMER_ARRAY in vmstate.h)

thanks
-- PMM
liguang Dec. 2, 2013, 4:28 a.m. UTC | #3
Peter Maydell wrote:
> On 29 November 2013 11:01, Peter Maydell<peter.maydell@linaro.org>  wrote:
>    
>> On 27 November 2013 08:23, liguang<lig.fnst@cn.fujitsu.com>  wrote:
>>      
>>> Signed-off-by: liguang<lig.fnst@cn.fujitsu.com>
>>> ---
>>>   include/hw/ptimer.h |    3 +++
>>>   1 files changed, 3 insertions(+), 0 deletions(-)
>>>
>>> diff --git a/include/hw/ptimer.h b/include/hw/ptimer.h
>>> index 28fcaf1..a9b8f1d 100644
>>> --- a/include/hw/ptimer.h
>>> +++ b/include/hw/ptimer.h
>>> @@ -27,6 +27,9 @@ void ptimer_stop(ptimer_state *s);
>>>
>>>   extern const VMStateDescription vmstate_ptimer;
>>>
>>> +#define VMSTATE_PTIMER_ARRAY(_f, _s, _n) \
>>> +    VMSTATE_STRUCT_ARRAY(_f, _s, _n, 0, vmstate_ptimer, ptimer_state*)
>>>        
>> The final parameter here should just be the struct type
>> ("ptimer_state"), not a pointer-to-it.
>>      
> Actually, looking at the patch where you've used this,
> you do actually want to deal with an
> array-of-pointers-to-ptimers. For that you need
>
> #define VMSTATE_PTIMER_ARRAY(_f, _s, _n) \
>      VMSTATE_ARRAY_OF_POINTER(_f, _s, _n, 0, vmstate_ptimer, ptimer_state *)
>
> (compare VMSTATE_TIMER_ARRAY in vmstate.h)
>
>
>    

OK, thanks!
diff mbox

Patch

diff --git a/include/hw/ptimer.h b/include/hw/ptimer.h
index 28fcaf1..a9b8f1d 100644
--- a/include/hw/ptimer.h
+++ b/include/hw/ptimer.h
@@ -27,6 +27,9 @@  void ptimer_stop(ptimer_state *s);
 
 extern const VMStateDescription vmstate_ptimer;
 
+#define VMSTATE_PTIMER_ARRAY(_f, _s, _n) \
+    VMSTATE_STRUCT_ARRAY(_f, _s, _n, 0, vmstate_ptimer, ptimer_state*)
+
 #define VMSTATE_PTIMER(_field, _state) {                             \
     .name       = (stringify(_field)),                               \
     .version_id = (1),                                               \