[PATCH 27/30] leon, gptimer: fixed probing separate interrupts

Joel Sherrill joel at rtems.org
Fri Apr 14 17:36:06 UTC 2017


On Apr 14, 2017 3:48 AM, "Gedare Bloom" <gedare at rtems.org> wrote:

On Thu, Apr 13, 2017 at 11:19 PM, Chris Johns <chrisj at rtems.org> wrote:
> On 14/4/17 5:31 am, Daniel Hellstrom wrote:
>> From: Martin Aberg <maberg at gaisler.com>
>>
>> Probing of separate interrupts was done by storing the GPTIMER_CFG_SI
bit. But
>> it was never actually stored since it is bit 8 and the datatype is
8-bit. Now
>> store the AND result as boolean value instead.
>> ---
>>  c/src/lib/libbsp/sparc/shared/timer/gptimer.c | 2 +-
>>  1 file changed, 1 insertion(+), 1 deletion(-)
>>
>> diff --git a/c/src/lib/libbsp/sparc/shared/timer/gptimer.c
b/c/src/lib/libbsp/sparc/shared/timer/gptimer.c
>> index e701211..d26d007 100644
>> --- a/c/src/lib/libbsp/sparc/shared/timer/gptimer.c
>> +++ b/c/src/lib/libbsp/sparc/shared/timer/gptimer.c
>> @@ -293,7 +293,7 @@ int gptimer_init1(struct drvmgr_dev *dev)
>>        *  B. Each Timer have an individual IRQ. The number is:
>>        *        BASE_IRQ + timer_index
>>        */
>> -     priv->separate_interrupt = regs->cfg & GPTIMER_CFG_SI;
>> +     priv->separate_interrupt = !!(regs->cfg & GPTIMER_CFG_SI);
>
> Is this suppose to be not not?
>
The !! is a C pattern to check for a non-zero value.

Generally it is the same as
(regs->cfg & GPTIMER_CFG_SI) != 0;

I would also prefer the more explicit form, since we don't use the !!
pattern in RTEMS it is a bit confusing for someone to see and
understand.


With Sebastian on holiday, I get the chance to ask...

Is this rule written down in the Coding Style? :)

Please add it. I usually get busted on this. Nice to be on the other side
for once. :)



> I prefer to see `(regs->cfg & GPTIMER_CFG_SI) == 0`.
>
> Chris
> _______________________________________________
> devel mailing list
> devel at rtems.org
> http://lists.rtems.org/mailman/listinfo/devel
_______________________________________________
devel mailing list
devel at rtems.org
http://lists.rtems.org/mailman/listinfo/devel
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.rtems.org/pipermail/devel/attachments/20170414/c4ca4d4c/attachment-0002.html>


More information about the devel mailing list