Re: [PATCH 05/19] MIPS: asm: mips-cm: Implement mips_cm_revision

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

 



On 07/09/2015 12:09 PM, Sergei Shtylyov wrote:
> On 7/9/2015 12:40 PM, Markos Chandras wrote:
> 
>> From: Paul Burton <paul.burton@xxxxxxxxxx>
> 
>> Provide a function to trivially return the version of the CM present in
>> the system, or 0 if no CM is present. The mips_cm_revision() will be
>> used later on to determine the CM register width, so it must not use
>> the regular CM accessors to read the revision register since that will
>> lead to build failures due to recursive inlines.
> 
>> Signed-off-by: Paul Burton <paul.burton@xxxxxxxxxx>
>> Signed-off-by: Markos Chandras <markos.chandras@xxxxxxxxxx>
>> ---
>>   arch/mips/include/asm/mips-cm.h | 29 +++++++++++++++++++++++++++++
>>   1 file changed, 29 insertions(+)
> 
>> diff --git a/arch/mips/include/asm/mips-cm.h
>> b/arch/mips/include/asm/mips-cm.h
>> index edc7ee95269e..29ff74a629f6 100644
>> --- a/arch/mips/include/asm/mips-cm.h
>> +++ b/arch/mips/include/asm/mips-cm.h
>> @@ -189,6 +189,13 @@ BUILD_CM_Cx_R_(tcid_8_priority,    0x80)
>>   #define CM_GCR_REV_MINOR_SHF            0
>>   #define CM_GCR_REV_MINOR_MSK            (_ULCAST_(0xff) << 0)
>>
>> +#define CM_ENCODE_REV(major, minor) \
>> +        ((major << CM_GCR_REV_MAJOR_SHF) | \
>> +         ((minor) << CM_GCR_REV_MINOR_SHF))
> 
>    Enclosing 'minor' into parens and not enclosing 'major' doesn't look
> very consistent... :-)

Ok I will fix it

> 
> [...]
>> @@ -324,4 +331,26 @@ static inline int mips_cm_l2sync(void)
>>       return 0;
>>   }
>>
>> +/**
>> + * mips_cm_revision - return CM revision
>> + *
>> + * Returns the revision of the CM, from GCR_REV, or 0 if no CM is
>> present.
>> + * The return value should be checked against the CM_REV_* macros.
>> + */
>> +static inline int mips_cm_revision(void)
>> +{
>> +    static int mips_cm_revision_nr = -1;
> 
>    Won't this variable be allocated per source file (including this
> header)?

I will drop the static variable since the implementation changed
overtime and there is no need to call mips_cm_revision() so often anymore.


-- 
markos




[Index of Archives]     [Linux MIPS Home]     [LKML Archive]     [Linux ARM Kernel]     [Linux ARM]     [Linux]     [Git]     [Yosemite News]     [Linux SCSI]     [Linux Hams]

  Powered by Linux