qemu-arm
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Qemu-arm] [Qemu-devel] [PATCH v9 05/14] hw/arm/smmuv3: Wired IRQ an


From: Auger Eric
Subject: Re: [Qemu-arm] [Qemu-devel] [PATCH v9 05/14] hw/arm/smmuv3: Wired IRQ and GERROR helpers
Date: Fri, 9 Mar 2018 15:50:06 +0100
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:45.0) Gecko/20100101 Thunderbird/45.4.0

Hi Peter,

On 09/03/18 15:18, Peter Maydell wrote:
> On 9 March 2018 at 14:03, Auger Eric <address@hidden> wrote:
>> On 08/03/18 18:49, Peter Maydell wrote:
>>>> +#define smmuv3_eventq_irq_enabled(s)                   \
>>>> +    (FIELD_EX32(s->irq_ctrl, IRQ_CTRL, EVENTQ_IRQEN))
>>>> +#define smmuv3_gerror_irq_enabled(s)                  \
>>>> +    (FIELD_EX32(s->irq_ctrl, IRQ_CTRL, GERROR_IRQEN))
>>>
>>> These are only ever used in smmuv3.c, so you can just move them
>>> to there (and make them inline functions, ideally).
>> smmuv3-internal.h contains helpers, macros which are only used by
>> smmuv3.c . I though this could avoid putting too much code in smmuv3.c
>> and would help in the readability.
>>
>> what is the exact benefit of transforming those into inline functions
>> instead of macros. Not meaning I don't want to take this into account
>> but to improve my coding style ;-)
> 
> You get the benefit of type checking (and it self-documents that
> the macros want to be passed an SMMUv3State*). You don't have to
> worry about trying to write your macro to not evaluate arguments multiple
> times. These are one-liners so they're fairly easy to read,
> but when you get to 3 or 4 lines you end up with a lot of '\'
> lines and the inline function is I think more clearly better.
> I prefer to save macros for cases where you really need a macro
> and can't get the same effect with a function.

OK. Thank you for the explanation

Eric
> 
> thanks
> -- PMM
> 



reply via email to

[Prev in Thread] Current Thread [Next in Thread]