Hi Vincent, On 10/25/23 19:13, Vincent MAILHOL wrote: [snip] >> >> This looks like an endianness conversion (I can not tell if this is >> big to little or the opposite)... > > Oopsy! On second look, this is an open coded cpu to big endian > conversion. So the question I should have asked is: > > why not use the put_unaligned_be16() helper here? Because this is consistent with the existing code, though I will keep that suggestion in mind as a subsequent patch. I personally find it clearer expressed that way, but can update. > > Below comments still remain. > >>> + } >>> + ether_addr_copy(nfc->fs.h_u.ether_spec.h_dest, da); >>> + >>> + for (i = 0; i < sizeof(da) / 2; i++) { >>> + ret = bcm_phy_read_exp(phydev, >>> + BCM54XX_WOL_MASK(2 - i)); >>> + if (ret < 0) >>> + return ret; >>> + >>> + da[i * 2] = ~(ret >> 8); >>> + da[i * 2 + 1] = ~(ret & 0xff); >>> + } >>> + ether_addr_copy(nfc->fs.m_u.ether_spec.h_dest, da); >>> + >>> + ret = bcm_phy_read_exp(phydev, BCM54XX_WOL_INNER_PROTO); >>> + if (ret < 0) >>> + return ret; >>> + >>> + nfc->fs.h_u.ether_spec.h_proto = be16_to_cpu(ret); >> >> ... but here it is big endian to cpu endian? It does not look coherent. You are right, it was not consistent. >> >> Also, did you run parse to check your endianness conversions? I did, though nothing came out with C=1 or C=2, I might have to check that separately. >> >> https://www.kernel.org/doc/html/latest/dev-tools/sparse.html >> >> For example, I would have expected htons() (a.k.a. cpu_to_be16()) >> instead of be16_to_cpu(). Thanks for having taken a look. -- Florian