Subject: Re: [PATCH v3 5/9] ethernet: ti: am65-cpts: Use generic helper function

From: Kurt Kanzenbach <[email-masked]>
Date: Fri, 31 Jul 2020 15:10:35 +0200

On Fri Jul 31 2020, Grygorii Strashko wrote:
> On 31/07/2020 14:48, Kurt Kanzenbach wrote:
>> On Thu Jul 30 2020, Arnd Bergmann wrote:
>>> On Thu, Jul 30, 2020 at 11:41 AM Kurt Kanzenbach <[email-masked]> wrote:
>>>> On Thu Jul 30 2020, Grygorii Strashko wrote:
>>>>> On 30/07/2020 11:00, Kurt Kanzenbach wrote:
>>>>>> +    msgtype = ptp_get_msgtype(hdr, ptp_class);
>>>>>> +    seqid   = be16_to_cpu(hdr->sequence_id);
>>>>>
>>>>> Is there any reason to not use "ntohs()"?
>>>>
>>>> This is just my personal preference, because I think it's more
>>>> readable. Internally ntohs() uses be16_to_cpu(). There's no technical
>>>> reason for it.
>>>
>>> I think for traditional reasons, code in net/* tends to use ntohs()
>>> while code in drivers/*  tends to use be16_to_cpu().
>>>
>>> In drivers/net/* the two are used roughly the same, though I guess
>>> one could make the argument that be16_to_cpu() would be
>>> more appropriate for data structures exchanged with hardware
>>> while ntohs() makes sense on data structures sent over the
>>> network.
>> 
>> I see, makes sense. I could simply keep it the way it was, or?
>
>   I prefer ntohs() as this packet data.

OK. I'll change it in the next iteration.

Thanks,
Kurt