[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <CAMuHMdU8pyRPiS-q5N-WKXLTX+hiNQSR8oPVkoV-VoKHgOp13g@mail.gmail.com>
Date: Mon, 1 Sep 2025 15:24:22 +0200
From: Geert Uytterhoeven <geert@...ux-m68k.org>
To: Biju <biju.das.au@...il.com>
Cc: Marc Kleine-Budde <mkl@...gutronix.de>, Vincent Mailhol <mailhol.vincent@...adoo.fr>,
Magnus Damm <magnus.damm@...il.com>, Biju Das <biju.das.jz@...renesas.com>,
linux-can@...r.kernel.org, linux-renesas-soc@...r.kernel.org,
linux-kernel@...r.kernel.org,
Prabhakar Mahadev Lad <prabhakar.mahadev-lad.rj@...renesas.com>
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@...il.com> wrote:
> From: Biju Das <biju.das.jz@...renesas.com>
>
> 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@...renesas.com>
> ---
> 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.
>
> /* RSCFDnCFDCmNCFG - CAN FD only */
> #define RCANFD_NCFG_NTSEG2(gpriv, x) \
Gr{oetje,eeting}s,
Geert
--
Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- geert@...ux-m68k.org
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
Powered by blists - more mailing lists