Re: RE: [PATCH v7 05/18] can: rcar_canfd: Drop RCANFD_GERFL_EEF* macros in RCANFD_GERFL_ERR

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

 



Hi Marc,

On Fri, 28 Mar 2025 at 11:20, Marc Kleine-Budde <mkl@xxxxxxxxxxxxxx> wrote:
> On 28.03.2025 09:51:43, Biju Das wrote:
> > > Yes, it starts at bit 16, but at which bit does it end?
> > >
> > > The GENMASK() helps to document the register names. Of course is works if you replace the FIELD_PREP
> > > with a left shift, but you are replacing some meaningful information about the register name, register
> > > start bit and end bit by just a start bit value. See? You just lost the register name and end bit
> > > info.
> > >
> > > FIELD_PREP() is not only about doing the correct shift but also about documenting that you are putting
> > > the value into a specific register.
> > >
> > > When reading:
> > >
> > >   FIELD_PREP(RCANFD_GERFL_EEF0_7, gpriv->channels_mask)
> > >
> > > I immediately understand that you are putting the gpriv->channels_mask value into the GERFL_EEF0_7
> > > register and I can look at the datasheet for details about that GERFL_EEF0_7 if I want to.
> >
> > Gen4 has 8 channels (GENMASK(16, 23)
> > G3E has 6 channels  (GENMASK(16, 21)
> > V4M has 4 channels  (GENMASK(16, 19)
> > V3H_2 has 3 channels (GENMASK(16,18)
> > All other SoCs has 2 channels (GENMASK(16,17)
> >
> > So you mean, I should replace RCANFD_GERFL_EEF0_7 with a
> >
> > Generic one RCANFD_GERFL_EEF(x) GENMASK(16, 16 + (x) - 1) to handle
> > this differences
> >
> > Where x is the number of supported channels(info->max_channels)
> >
> > and then use
> >
> > FIELD_PREP(RCANFD_GERFL_EEF(x), gpriv->channels_mask)
>
> The mask for FIELD_PREP must be compile time constant.
>
> Geert recently posted a series to add non constant helpers:
>
> | https://lore.kernel.org/all/1824412519cb8791ab428065116927ee7b77cf35.1738329459.git.geert+renesas@xxxxxxxxx/
>
> It seems it wasn't applied yet...

Yeah, people keep on asking for more...
#perfectistheenemyofgoodenough...

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