lkml.org 
[lkml]   [2015]   [Oct]   [8]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: [PATCH 2/5] irqchip/gic-v3: Make gic_enable_sre an inline function
On Fri, Oct 02, 2015 at 05:37:51PM +0100, Marc Zyngier wrote:
> +static inline bool gic_enable_sre(void)
> +{
> + u64 val;
> +
> + asm volatile("mrs_s %0, " __stringify(ICC_SRE_EL1) : "=r" (val));
> + if (val & ICC_SRE_EL1_SRE)
> + return true;
> +
> + val |= ICC_SRE_EL1_SRE;
> + asm volatile("msr_s " __stringify(ICC_SRE_EL1) ", %0" : : "r" (val));
> + isb();
> + asm volatile("mrs_s %0, " __stringify(ICC_SRE_EL1) : "=r" (val));
> +
> + return !!(val & ICC_SRE_EL1_SRE);
> +}

I don't think !! is needed ;). Apparently, from ISO C99: "When any
scalar value is converted to _Bool, the result is 0 if the value
compares equal to 0; otherwise, the result is 1."

--
Catalin


\
 
 \ /
  Last update: 2015-10-08 18:21    [W:0.063 / U:0.160 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site