Re: [PATCH net-next v6 01/23] asm: simd context helper API

From: Andy Lutomirski
Date: Sun Sep 30 2018 - 01:35:21 EST




> On Sep 29, 2018, at 9:20 PM, Joe Perches <joe@xxxxxxxxxxx> wrote:
>
>> On Fri, 2018-09-28 at 16:01 +0200, Jason A. Donenfeld wrote:
>> On Fri, Sep 28, 2018 at 4:00 PM Ard Biesheuvel
>> <ard.biesheuvel@xxxxxxxxxx> wrote:
>>>
>>>> On 28 September 2018 at 15:59, Jason A. Donenfeld <Jason@xxxxxxxxx> wrote:
>>>> On Fri, Sep 28, 2018 at 3:58 PM Ard Biesheuvel
>>>> <ard.biesheuvel@xxxxxxxxxx> wrote:
>>>>>
>>>>>> On 28 September 2018 at 15:47, Jason A. Donenfeld <Jason@xxxxxxxxx> wrote:
>>>>>> On Fri, Sep 28, 2018 at 10:49 AM Ard Biesheuvel
>>>>>> <ard.biesheuvel@xxxxxxxxxx> wrote:
>>>>>>>>> +typedef enum {
>>>>>>>>> + HAVE_NO_SIMD = 1 << 0,
>>>>>>>>> + HAVE_FULL_SIMD = 1 << 1,
>>>>>>>>> + HAVE_SIMD_IN_USE = 1 << 31
>>>>>>>>> +} simd_context_t;
>>>>>>>>> +
>>>>>>>
>>>>>>> Oh, and another thing (and I'm surprised checkpatch.pl didn't complain
>>>>>>> about it): the use of typedef in new code is strongly discouraged.
>>>>>>> This policy predates my involvement, so perhaps Joe can elaborate on
>>>>>>> the rationale?
>>>>>>
>>>>>> In case it matters, the motivation for making this a typedef is I
>>>>>> could imagine this at some point turning into a more complicated
>>>>>> struct on certain platforms and that would make refactoring easier. I
>>>>>> could just make it `struct simd_context` now with 1 member though...
>>>>>
>>>>> Yes that makes sense
>>>>
>>>> The rationale for it being a typedef or moving to a struct now?
>>>
>>> Yes just switch to a struct.
>>
>> Okay. No problem with that, but will wait to hear from Joe first.
>
> Why do you need to hear from me again?
>
> As far as I know, the only info about typedef avoidance are in
> Documentation/process/coding-style.rst section 5.
>
>

I personally prefer it with the typedef. If this were my code, Iâd say the coding style is silly for opaque tiny structs like this.