netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Jakub Kicinski <kuba@kernel.org>
To: Parthiban Veerasooran <parthiban.veerasooran@microchip.com>
Cc: <andrew@lunn.ch>, <hkallweit1@gmail.com>, <linux@armlinux.org.uk>,
	<davem@davemloft.net>, <edumazet@google.com>, <pabeni@redhat.com>,
	<ramon.nordin.rodriguez@ferroamp.se>, <netdev@vger.kernel.org>,
	<linux-kernel@vger.kernel.org>, <UNGLinuxDriver@microchip.com>,
	<Thorsten.Kummermehr@microchip.com>
Subject: Re: [PATCH net-next v3 2/7] net: phy: microchip_t1s: update new initial settings for LAN865X Rev.B0
Date: Fri, 4 Oct 2024 11:50:06 -0700	[thread overview]
Message-ID: <20241004115006.4876eed1@kernel.org> (raw)
In-Reply-To: <20241001123734.1667581-3-parthiban.veerasooran@microchip.com>

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

  reply	other threads:[~2024-10-04 18:50 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-10-01 12:37 [PATCH net-next v3 0/7] microchip_t1s: Update on Microchip 10BASE-T1S PHY driver Parthiban Veerasooran
2024-10-01 12:37 ` [PATCH net-next v3 1/7] net: phy: microchip_t1s: restructure cfg read/write functions arguments Parthiban Veerasooran
2024-10-01 12:37 ` [PATCH net-next v3 2/7] net: phy: microchip_t1s: update new initial settings for LAN865X Rev.B0 Parthiban Veerasooran
2024-10-04 18:50   ` Jakub Kicinski [this message]
2024-10-07  7:51     ` Parthiban.Veerasooran
2024-10-07 16:00       ` Jakub Kicinski
2024-10-08  5:47         ` Parthiban.Veerasooran
2024-10-01 12:37 ` [PATCH net-next v3 3/7] net: phy: microchip_t1s: add support for Microchip's LAN865X Rev.B1 Parthiban Veerasooran
2024-10-01 12:37 ` [PATCH net-next v3 4/7] net: phy: microchip_t1s: move LAN867X reset handling to a new function Parthiban Veerasooran
2024-10-01 12:37 ` [PATCH net-next v3 5/7] net: phy: microchip_t1s: add support for Microchip's LAN867X Rev.C1 Parthiban Veerasooran
2024-10-01 12:37 ` [PATCH net-next v3 6/7] net: phy: microchip_t1s: add support for Microchip's LAN867X Rev.C2 Parthiban Veerasooran
2024-10-01 12:37 ` [PATCH net-next v3 7/7] net: phy: microchip_t1s: configure collision detection based on PLCA mode Parthiban Veerasooran

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20241004115006.4876eed1@kernel.org \
    --to=kuba@kernel.org \
    --cc=Thorsten.Kummermehr@microchip.com \
    --cc=UNGLinuxDriver@microchip.com \
    --cc=andrew@lunn.ch \
    --cc=davem@davemloft.net \
    --cc=edumazet@google.com \
    --cc=hkallweit1@gmail.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux@armlinux.org.uk \
    --cc=netdev@vger.kernel.org \
    --cc=pabeni@redhat.com \
    --cc=parthiban.veerasooran@microchip.com \
    --cc=ramon.nordin.rodriguez@ferroamp.se \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).