[PATCH] powerpc/64s: dt_cpu_ftrs boot time setup option
Michael Ellerman
mpe at ellerman.id.au
Tue May 30 15:29:34 AEST 2017
Balbir Singh <bsingharora at gmail.com> writes:
> On Thu, 2017-05-11 at 21:24 +1000, Nicholas Piggin wrote:
>> diff --git a/arch/powerpc/kernel/dt_cpu_ftrs.c b/arch/powerpc/kernel/dt_cpu_ftrs.c
>> index fcc7588a96d6..050925b5b451 100644
>> --- a/arch/powerpc/kernel/dt_cpu_ftrs.c
>> +++ b/arch/powerpc/kernel/dt_cpu_ftrs.c
>> @@ -671,12 +671,24 @@ static struct dt_cpu_feature_match __initdata
>> {"wait-v3", feat_enable, 0},
>> };
>>
>> -/* XXX: how to configure this? Default + boot time? */
>> -#ifdef CONFIG_PPC_CPUFEATURES_ENABLE_UNKNOWN
>> -#define CPU_FEATURE_ENABLE_UNKNOWN 1
>> -#else
>> -#define CPU_FEATURE_ENABLE_UNKNOWN 0
>> -#endif
>> +static bool __initdata using_dt_cpu_ftrs = true;
>> +static bool __initdata dt_cpu_ftrs_enable_unknown = true;
>> +
>> +static int __init dt_cpu_ftrs_parse(char *str)
>> +{
>> + if (!str)
>> + return 0;
>> +
>> + if (!strcmp(str, "off"))
>> + using_dt_cpu_ftrs = false;
>> + else if (!strcmp(str, "known"))
>> + dt_cpu_ftrs_enable_unknown = false;
>> + else
>> + return 1;
>> +
>> + return 0;
>> +}
>> +early_param("dt_cpu_ftrs", dt_cpu_ftrs_parse);
>
> I wouldn't use strcmp with user passed parameters.
Why not? Especially considering the generic code has already parsed the
string to find the = delimiter, and is just passing us the tail.
cheers
More information about the Linuxppc-dev
mailing list