Re: [PATCH v2 2/4] can: rcar_canfd: Update RCANFD_CFG_* macros

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

 



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.

>
>  /* 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@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