Thread (44 messages) 44 messages, 7 authors, 2020-08-06

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

From: Grygorii Strashko <grygorii.strashko@ti.com>
Date: 2020-07-31 12:56:35


On 31/07/2020 14:48, Kurt Kanzenbach wrote:
On Thu Jul 30 2020, Arnd Bergmann wrote:
quoted
On Thu, Jul 30, 2020 at 11:41 AM Kurt Kanzenbach [off-list ref] wrote:
quoted
On Thu Jul 30 2020, Grygorii Strashko wrote:
quoted
On 30/07/2020 11:00, Kurt Kanzenbach wrote:
quoted
+    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.

-- 
Best regards,
grygorii
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help