Re: [PATCH net-next 06/10] can: rcar_canfd: Repurpose f_dcfg base for other registers
From: Geert Uytterhoeven <geert@linux-m68k.org>
Date: 2025-06-19 10:16:16
Also in:
linux-can
Hi Vincent, Jakub, On Thu, 19 Jun 2025 at 06:43, Vincent Mailhol [off-list ref] wrote:
On Thu. 19 Jun. 2025 at 10:38, Jakub Kicinski [off-list ref] wrote:quoted
On Wed, 18 Jun 2025 11:20:00 +0200 Marc Kleine-Budde wrote:quoted
+static inline unsigned int rcar_canfd_f_dcfg(struct rcar_canfd_global *gpriv, + unsigned int ch) +{ + return gpriv->info->regs->coffset + 0x00 + 0x20 * ch; +} + +static inline unsigned int rcar_canfd_f_cfdcfg(struct rcar_canfd_global *gpriv, + unsigned int ch) +{ + return gpriv->info->regs->coffset + 0x04 + 0x20 * ch; +} + +static inline unsigned int rcar_canfd_f_cfdctr(struct rcar_canfd_global *gpriv, + unsigned int ch) +{ + return gpriv->info->regs->coffset + 0x08 + 0x20 * ch; +} + +static inline unsigned int rcar_canfd_f_cfdsts(struct rcar_canfd_global *gpriv, + unsigned int ch) +{ + return gpriv->info->regs->coffset + 0x0c + 0x20 * ch; +} + +static inline unsigned int rcar_canfd_f_cfdcrc(struct rcar_canfd_global *gpriv, + unsigned int ch) +{ + return gpriv->info->regs->coffset + 0x10 + 0x20 * ch; +}clang is no longer fooled by static inline, it identifies that 4 out of
Oh well, that explains why someone pointed to a CI log showing more unused functions in a different driver. I hope it only does that for unused functions in .c files, not in header files?
quoted
these functions are never called. I think one ends up getting used in patch 10 (just looking at warning counts), but the other 3 remain dead code. Geert, do you have a strong attachment to having all helpers defined or can we trim this, please?
I would like to keep them (or at least the information), as it serves as register documentation, just like the macros they replaced....
I had a discussion with Geert on these functions here: https://lore.kernel.org/linux-can/20250613-misty-amethyst-swine-7bd775-mkl@pengutronix.de/t/#mef5cb235313c5f0c4910d5571b052eb5e9ada92e (local) in which I made a suggestion to reword these. That suggestion would actually resolve your concerns. Geert was OK with the suggestion but we agreed to move on as-is and make those changes later on. If temporarily having those static inline functions unused is not a big blocker for you, can we just have this merged and wait for the bigger refactor which is on Geert TODO’s list?
I am still working on converting more ugly macros (while increasing functionality, and fixing bugs ^-). But given the clang warnings, I agree it would be good to fast-track the first conversion. Patch sent: "[PATCH] can: rcar_canfd: Describe channel-specific FD registers using C struct" https://lore.kernel.org/292b75b3bc8dd95f805f0223f606737071c8cf86.1750327217.git.geert+renesas@glider.be (local) Gr{oetje,eeting}s, Geert -- Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- geert@linux-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