Re: [PATCH net-next v3 2/7] net: phy: microchip_t1s: update new initial settings for LAN865X Rev.B0

From: Jakub Kicinski
Date: Fri Oct 04 2024 - 15:56:12 EST


On Tue, 1 Oct 2024 18:07:29 +0530 Parthiban Veerasooran wrote:
> + cfg_results[0] = FIELD_PREP(GENMASK(15, 10), (9 + offsets[0]) & 0x3F) |
> + FIELD_PREP(GENMASK(15, 4), (14 + offsets[0]) & 0x3F) |
> + 0x03;
> + cfg_results[1] = FIELD_PREP(GENMASK(15, 10), (40 + offsets[1]) & 0x3F);

It's really strange to OR together FIELD_PREP()s with overlapping
fields. What's going on here? 15:10 and 15:4 ranges overlap, then
there is 0x3 hardcoded, with no fields size definition.
Could you clarify and preferably name as many of the constants
as possible?

Also why are you masking the result of the sum with 0x3f?
Can the result not fit? Is that safe or should we error out?

> + ret &= GENMASK(4, 0);
? if (ret & BIT(4))

GENMASK() is nice but naming the fields would be even nicer..
What's 3:0, what's 4:4 ?
--
pw-bot: cr