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.

>
>>   
>> -    seqid = (__be16 *)(data + offset + OFF_PTP_SEQUENCE_ID);
>> -    *mtype_seqid = (*msgtype << AM65_CPTS_EVENT_1_MESSAGE_TYPE_SHIFT) &
>> +    *mtype_seqid  = (msgtype << AM65_CPTS_EVENT_1_MESSAGE_TYPE_SHIFT) &
>>                      AM65_CPTS_EVENT_1_MESSAGE_TYPE_MASK;
>> -    *mtype_seqid |= (ntohs(*seqid) & AM65_CPTS_EVENT_1_SEQUENCE_ID_MASK);
>> +    *mtype_seqid |= (seqid & AM65_CPTS_EVENT_1_SEQUENCE_ID_MASK);
>>   
>>      return 1;
>>   }
>> 
>
> I'll try to test it today.
> Thank you.

Thanks,
Kurt

Attachment: signature.asc
Description: PGP signature

Reply via email to