RE: [PATCH v2 2/4] can: rcar_canfd: Update RCANFD_CFG_* macros
From: Biju Das
Date: Mon Sep 08 2025 - 06:38:33 EST
Hi Geert,
Thanks for the feedback.
> -----Original Message-----
> From: Geert Uytterhoeven <geert@xxxxxxxxxxxxxx>
> Sent: 01 September 2025 14:24
> Subject: Re: [PATCH v2 2/4] can: rcar_canfd: Update RCANFD_CFG_* macros
>
> Hi Biju,
>
> On Thu, 21 Aug 2025 at 16:14, Biju <biju.das.au@xxxxxxxxx> wrote:
> > From: Biju Das <biju.das.jz@xxxxxxxxxxxxxx>
> >
> > Update RCANFD_CFG_* macros to give a meaning to the magic number using
> > GENMASK macro and extract the values using FIELD_PREP macro.
> >
> > Signed-off-by: Biju Das <biju.das.jz@xxxxxxxxxxxxxx>
> > ---
> > v1->v2:
> > * Moved from patch#4 to patch#2.
> > * Updated commit header and description.
> > * Kept RCANFD_CFG* macro definitions to give a meaning to the magic
> > number using GENMASK macro and used FIELD_PREP to extract value.
>
> > --- a/drivers/net/can/rcar/rcar_canfd.c
> > +++ b/drivers/net/can/rcar/rcar_canfd.c
> > @@ -103,10 +103,10 @@
> > /* Channel register bits */
> >
> > /* RSCFDnCmCFG - Classical CAN only */
> > -#define RCANFD_CFG_SJW(x) (((x) & 0x3) << 24)
> > -#define RCANFD_CFG_TSEG2(x) (((x) & 0x7) << 20)
> > -#define RCANFD_CFG_TSEG1(x) (((x) & 0xf) << 16)
> > -#define RCANFD_CFG_BRP(x) (((x) & 0x3ff) << 0)
> > +#define RCANFD_CFG_SJW_MASK GENMASK(25, 24)
> > +#define RCANFD_CFG_TSEG2_MASK GENMASK(22, 20)
> > +#define RCANFD_CFG_TSEG1_MASK GENMASK(19, 16)
> > +#define RCANFD_CFG_BRP_MASK GENMASK(9, 0)
>
> Upon a second look, I would drop the "_MASK" suffix.
OK, will drop the "_MASK" suffix in next version.
Cheers,
Biju