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 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 tried introducing non-constant field_{prep,get}() helpers[1] in series
[2], but there were some pushbacks.

Feel free to up-vote ;-)

[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]     [Linux Samsung SOC]     [Linux Wireless]     [Linux Kernel]     [ATH6KL]     [Linux Bluetooth]     [Linux Netdev]     [Kernel Newbies]     [IDE]     [Security]     [Git]     [Netfilter]     [Bugtraq]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux ATA RAID]     [Samba]     [Device Mapper]

  Powered by Linux