[PATCH drivers/perf 4/4] drivers/perf: fixing coding style issues

tiantao (H) tiantao6 at huawei.com
Fri Mar 26 00:49:33 GMT 2021


在 2021/3/25 20:30, Robin Murphy 写道:
> On 2021-03-25 07:16, Tian Tao wrote:
>>    no functional changes.
>>
>>    Fix checkpatch error:
>>    ERROR: do not use assignment in if condition
>>    #210: FILE: arm_pmu_platform.c:210:
>>    + if (node && (of_id = of_match_node(of_table, pdev->dev.of_node))) {
>>
>> Signed-off-by: Tian Tao <tiantao6 at hisilicon.com>
>> Signed-off-by: Junhao He <hejunhao2 at hisilicon.com>
>> Signed-off-by: Qi Liu <liuqi115 at huawei.com>
>> ---
>>   drivers/perf/arm_pmu_platform.c | 10 ++++++----
>>   1 file changed, 6 insertions(+), 4 deletions(-)
>>
>> diff --git a/drivers/perf/arm_pmu_platform.c 
>> b/drivers/perf/arm_pmu_platform.c
>> index 933bd84..11b47c6 100644
>> --- a/drivers/perf/arm_pmu_platform.c
>> +++ b/drivers/perf/arm_pmu_platform.c
>> @@ -191,7 +191,7 @@ int arm_pmu_device_probe(struct platform_device 
>> *pdev,
>>                const struct of_device_id *of_table,
>>                const struct pmu_probe_info *probe_table)
>>   {
>> -    const struct of_device_id *of_id;
>> +    const struct of_device_id *of_id = NULL;
>>       armpmu_init_fn init_fn;
>>       struct device_node *node = pdev->dev.of_node;
>>       struct arm_pmu *pmu;
>> @@ -207,11 +207,13 @@ int arm_pmu_device_probe(struct platform_device 
>> *pdev,
>>       if (ret)
>>           goto out_free;
>>   -    if (node && (of_id = of_match_node(of_table, 
>> pdev->dev.of_node))) {
>> +    if (node)
>> +        of_id = of_match_node(of_table, node);
>
> Looks like you could probably refactor the whole thing to use 
> of_device_get_match_data() and make it even cleaner.
Thanks for your suggestion, I'm waiting for the other three patch review 
suggestions, after that I'm deciding whether to send a patchset or send 
a patch alone to fix this problem.
>
> Robin.
>
>> +
>> +    if (of_id) {
>>           init_fn = of_id->data;
>>   -        pmu->secure_access = of_property_read_bool(pdev->dev.of_node,
>> -                               "secure-reg-access");
>> +        pmu->secure_access = of_property_read_bool(node, 
>> "secure-reg-access");
>>             /* arm64 systems boot only as non-secure */
>>           if (IS_ENABLED(CONFIG_ARM64) && pmu->secure_access) {
>>
> .
>




More information about the linux-arm-kernel mailing list