Re: [PATCH v1 1/6] PCI: brcmstb: Refactor max speed limit functionality

From: Bjorn Helgaas
Date: Thu Feb 06 2025 - 15:18:28 EST


On Thu, Feb 06, 2025 at 01:27:44PM -0500, Jim Quinlan wrote:
> On Thu, Feb 6, 2025 at 12:04 PM Bjorn Helgaas <helgaas@xxxxxxxxxx> wrote:
> > On Wed, Feb 05, 2025 at 02:12:01PM -0500, Jim Quinlan wrote:
> > > Make changes to the code that limits the PCIe max speed.
> ...

> And here I thought that uXX_replace_bits() was the up-and-coming
> solution to be used :-)

:) Yeah, I was kind of surprised that it isn't used more, given that
it was merged in 2017. And it *does* reduce some repetition, which is
definitely an advantage. But the fact that those functions are hard
to find with grep is a big turnoff for me.

I wasn't really a fan of GENMASK() and FIELD_PREP() at first either,
but now I'm a big fan because you don't need _SHIFT #defines and it
reduces shift/mask errors. So probably the same will happen with
uXX_replace_bits().