Re: [PATCH v8 4/5] PCI: rcar-gen4: Add support for r8a779g0

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Tue, Jun 11, 2024 at 12:10:22PM +0200, Geert Uytterhoeven wrote:
> On Tue, Jun 11, 2024 at 11:21 AM Yoshihiro Shimoda
> <yoshihiro.shimoda.uh@xxxxxxxxxxx> wrote:
> > > From: Manivannan Sadhasivam, Sent: Saturday, June 8, 2024 5:25 PM
> > > On Mon, May 20, 2024 at 04:42:59PM +0900, Yoshihiro Shimoda wrote:
> > > > +static void rcar_gen4_pcie_phy_reg_update_bits(struct rcar_gen4_pcie *rcar,
> > > > +                                          u32 offset, u32 mask, u32 val)
> > > > +{
> > > > +   u32 tmp;
> > > > +
> > > > +   tmp = readl(rcar->phy_base + offset);
> > > > +   tmp &= ~mask;
> > > > +   tmp |= val;
> > >
> > > Use FIELD_* macros to avoid using the shift value.
> >
> > According to the bitfield.h,
> > ---
> > * FIELD_{GET,PREP} macros take as first parameter shifted mask
> >  * from which they extract the base mask and shift amount.
> >  * Mask must be a compilation time constant.
> > ---
> > So, since the mask is a variable here, we cannot use FIELD_* macros for this function.
> 
> Indeed.
> 

I just can't keep the constant factor in mind for some reason.

> I tried introducing non-constant field_{prep,get}() helpers[1] in series
> [2], but there were some pushbacks.
> 
> Feel free to up-vote ;-)
> 

For sure! This will be very useful, thanks.

- Mani

> [1] "[PATCH 01/17] bitfield: Add non-constant field_{prep,get}() helpers"
> https://lore.kernel.org/all/3a54a6703879d10f08cf0275a2a69297ebd2b1d4.1637592133.git.geert+renesas@xxxxxxxxx/
> 
> [2] "[PATCH 00/17] Non-const bitfield helper conversions"
> https://lore.kernel.org/all/cover.1637592133.git.geert+renesas@xxxxxxxxx/
> 
> Gr{oetje,eeting}s,
> 
>                         Geert
> 
> -- 
> Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- geert@xxxxxxxxxxxxxx
> 
> 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
> 

-- 
மணிவண்ணன் சதாசிவம்




[Index of Archives]     [Device Tree Compilter]     [Device Tree Spec]     [Linux Driver Backports]     [Video for Linux]     [Linux USB Devel]     [Linux PCI Devel]     [Linux Audio Users]     [Linux Kernel]     [Linux SCSI]     [XFree86]     [Yosemite Backpacking]


  Powered by Linux