devicetree.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Geert Uytterhoeven <geert@linux-m68k.org>
To: Andrew Lunn <andrew@lunn.ch>
Cc: Prabhakar <prabhakar.csengg@gmail.com>,
	"Clément Léger" <clement.leger@bootlin.com>,
	"Andrew Lunn" <andrew+netdev@lunn.ch>,
	"David S. Miller" <davem@davemloft.net>,
	"Eric Dumazet" <edumazet@google.com>,
	"Jakub Kicinski" <kuba@kernel.org>,
	"Paolo Abeni" <pabeni@redhat.com>,
	"Rob Herring" <robh@kernel.org>,
	"Krzysztof Kozlowski" <krzk+dt@kernel.org>,
	"Conor Dooley" <conor+dt@kernel.org>,
	"Heiner Kallweit" <hkallweit1@gmail.com>,
	"Russell King" <linux@armlinux.org.uk>,
	"Philipp Zabel" <p.zabel@pengutronix.de>,
	"Geert Uytterhoeven" <geert+renesas@glider.be>,
	"Magnus Damm" <magnus.damm@gmail.com>,
	"Wolfram Sang" <wsa+renesas@sang-engineering.com>,
	linux-renesas-soc@vger.kernel.org, netdev@vger.kernel.org,
	devicetree@vger.kernel.org, linux-kernel@vger.kernel.org,
	"Biju Das" <biju.das.jz@bp.renesas.com>,
	"Fabrizio Castro" <fabrizio.castro.jz@renesas.com>,
	"Lad Prabhakar" <prabhakar.mahadev-lad.rj@bp.renesas.com>
Subject: Re: [PATCH net-next v2 6/9] net: pcs: rzn1-miic: Make switch mode mask SoC-specific
Date: Fri, 5 Sep 2025 09:02:35 +0200	[thread overview]
Message-ID: <CAMuHMdVnhjA0xi+wojMc40Zmv_JBZpOm04GO_ewBSzFndbtegQ@mail.gmail.com> (raw)
In-Reply-To: <021e970a-f606-4702-9f0e-b4b0576bc5d6@lunn.ch>

Hi Andrew,

On Thu, 4 Sept 2025 at 22:37, Andrew Lunn <andrew@lunn.ch> wrote:
> On Thu, Sep 04, 2025 at 12:42:00PM +0100, Prabhakar wrote:
> > From: Lad Prabhakar <prabhakar.mahadev-lad.rj@bp.renesas.com>
> >
> > Move the hardcoded switch mode mask definition into the SoC-specific
> > miic_of_data structure. This allows each SoC to define its own mask
> > value rather than relying on a single fixed constant. For RZ/N1 the
> > mask remains GENMASK(4, 0).
> >
> > This is in preparation for adding support for RZ/T2H, where the
> > switch mode mask is GENMASK(2, 0).
>
> > -#define MIIC_MODCTRL_SW_MODE         GENMASK(4, 0)
>
> >       miic_reg_writel(miic, MIIC_MODCTRL,
> > -                     FIELD_PREP(MIIC_MODCTRL_SW_MODE, cfg_mode));
> > +                     ((cfg_mode << __ffs(sw_mode_mask)) & sw_mode_mask));
>
> _ffs() should return 0 for both GENMASK(2,0) and GENMASK(4, 0). So
> this __ffs() is pointless.
>
> You might however want to add a comment that this assumption is being
> made.

I guess Prabhakar did it this way to make it easier to find
candidates for a future conversion to field_prep(), if this ever becomes
available[1].

[1] "[PATCH v3 0/4] Non-const bitfield helpers"
    https://lore.kernel.org/all/cover.1739540679.git.geert+renesas@glider.be

Gr{oetje,eeting}s,

                        Geert

-- 
Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- geert@linux-m68k.org

In personal conversations with technical people, I call myself a hacker. But
when I'm talking to journalists I just say "programmer" or something like that.
                                -- Linus Torvalds

  reply	other threads:[~2025-09-05  7:09 UTC|newest]

Thread overview: 27+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-09-04 11:41 [PATCH net-next v2 0/9] Add PCS support for Renesas RZ/{T2H,N2H} SoCs Prabhakar
2025-09-04 11:41 ` [PATCH net-next v2 1/9] dt-bindings: net: pcs: renesas,rzn1-miic: Add RZ/T2H and RZ/N2H support Prabhakar
2025-09-04 11:41 ` [PATCH net-next v2 2/9] net: pcs: rzn1-miic: Drop trailing comma from of_device_id table Prabhakar
2025-09-04 20:16   ` Andrew Lunn
2025-09-04 11:41 ` [PATCH net-next v2 3/9] net: pcs: rzn1-miic: Add missing include files Prabhakar
2025-09-04 20:16   ` Andrew Lunn
2025-09-04 11:41 ` [PATCH net-next v2 4/9] net: pcs: rzn1-miic: Move configuration data to SoC-specific struct Prabhakar
2025-09-04 11:41 ` [PATCH net-next v2 5/9] net: pcs: rzn1-miic: move port range handling into SoC data Prabhakar
2025-09-04 20:24   ` Andrew Lunn
2025-09-04 11:42 ` [PATCH net-next v2 6/9] net: pcs: rzn1-miic: Make switch mode mask SoC-specific Prabhakar
2025-09-04 20:37   ` Andrew Lunn
2025-09-05  7:02     ` Geert Uytterhoeven [this message]
2025-09-05 10:01       ` Lad, Prabhakar
2025-09-05 12:02     ` Lad, Prabhakar
2025-09-04 11:42 ` [PATCH net-next v2 7/9] net: pcs: rzn1-miic: Add support to handle resets Prabhakar
2025-09-04 20:43   ` Andrew Lunn
2025-09-04 11:42 ` [PATCH net-next v2 8/9] net: pcs: rzn1-miic: Add per-SoC control for MIIC register unlock/lock Prabhakar
2025-09-04 20:55   ` Andrew Lunn
2025-09-05 11:48     ` Lad, Prabhakar
2025-09-04 11:42 ` [PATCH net-next v2 9/9] net: pcs: rzn1-miic: Add RZ/T2H MIIC support Prabhakar
2025-09-04 20:57   ` Andrew Lunn
2025-09-05 11:49     ` Lad, Prabhakar
2025-09-04 12:41 ` [PATCH net-next v2 0/9] Add PCS support for Renesas RZ/{T2H,N2H} SoCs Simon Horman
2025-09-04 12:47   ` Lad, Prabhakar
2025-09-06 12:19 ` Wolfram Sang
2025-09-10 10:18   ` Wolfram Sang
2025-09-10 19:06     ` Lad, Prabhakar

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=CAMuHMdVnhjA0xi+wojMc40Zmv_JBZpOm04GO_ewBSzFndbtegQ@mail.gmail.com \
    --to=geert@linux-m68k.org \
    --cc=andrew+netdev@lunn.ch \
    --cc=andrew@lunn.ch \
    --cc=biju.das.jz@bp.renesas.com \
    --cc=clement.leger@bootlin.com \
    --cc=conor+dt@kernel.org \
    --cc=davem@davemloft.net \
    --cc=devicetree@vger.kernel.org \
    --cc=edumazet@google.com \
    --cc=fabrizio.castro.jz@renesas.com \
    --cc=geert+renesas@glider.be \
    --cc=hkallweit1@gmail.com \
    --cc=krzk+dt@kernel.org \
    --cc=kuba@kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-renesas-soc@vger.kernel.org \
    --cc=linux@armlinux.org.uk \
    --cc=magnus.damm@gmail.com \
    --cc=netdev@vger.kernel.org \
    --cc=p.zabel@pengutronix.de \
    --cc=pabeni@redhat.com \
    --cc=prabhakar.csengg@gmail.com \
    --cc=prabhakar.mahadev-lad.rj@bp.renesas.com \
    --cc=robh@kernel.org \
    --cc=wsa+renesas@sang-engineering.com \
    /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).