netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Geert Uytterhoeven <geert@linux-m68k.org>
To: Vincent MAILHOL <mailhol.vincent@wanadoo.fr>
Cc: Marc Kleine-Budde <mkl@pengutronix.de>,
	Wolfram Sang <wsa+renesas@sang-engineering.com>,
	 linux-can@vger.kernel.org, linux-renesas-soc@vger.kernel.org,
	 netdev@vger.kernel.org
Subject: Re: [PATCH 1/3] can: rcar_canfd: Simplify clock handling
Date: Thu, 6 Jun 2024 13:38:24 +0200	[thread overview]
Message-ID: <CAMuHMdWCAU7VK97d3yOALpgg7S9+Aa3ZKwC3VVsivUev1iA+Ag@mail.gmail.com> (raw)
In-Reply-To: <CAMZ6RqK32+i69Rd3qDDNm4cgQa3+m3ikZTbpt5jCGrkNt76+vw@mail.gmail.com>

Hi Vincent,

On Thu, Jun 6, 2024 at 1:05 PM Vincent MAILHOL
<mailhol.vincent@wanadoo.fr> wrote:
> On Thu. 6 June 2024 at 19:15, Geert Uytterhoeven <geert@linux-m68k.org> wrote:
> > On Sun, Jun 2, 2024 at 10:03 AM Vincent MAILHOL
> > <mailhol.vincent@wanadoo.fr> wrote:
> > > On Wed. 29 May 2024 at 18:12, Geert Uytterhoeven
> > > <geert+renesas@glider.be> wrote:
> > > > The main CAN clock is either the internal CANFD clock, or the external
> > > > CAN clock.  Hence replace the two-valued enum by a simple boolean flag.
> > > > Consolidate all CANFD clock handling inside a single branch.
> > >
> > > For what it is worth, your patch also saves up to 8 bytes in struct
> > > rcar_canfd_global (depends on the architecture).
> >
> > True.
> >
> > > > @@ -545,8 +539,8 @@ struct rcar_canfd_global {
> > > >         struct platform_device *pdev;   /* Respective platform device */
> > > >         struct clk *clkp;               /* Peripheral clock */
> > > >         struct clk *can_clk;            /* fCAN clock */
> > > > -       enum rcar_canfd_fcanclk fcan;   /* CANFD or Ext clock */
> > > >         unsigned long channels_mask;    /* Enabled channels mask */
> > > > +       bool extclk;                    /* CANFD or Ext clock */
> > > >         bool fdmode;                    /* CAN FD or Classical CAN only mode */
> > >
> > > Notwithstanding comment: you may consider to replace those two booleans by a:
> > >
> > >           unsigned int flags;
> > >
> > > This way, no more fields would be needed in the future if more quirks are added.
> >
> > Using "unsigned int flags" and BIT(x) flags would increase code size
> > by 8 bytes (arm/arm64).
>
> I am not sure where you derive your figure from, but looking at the pahole:

pahole shows the size of data structures.

> > Using "unsigned int foo:1" bitfields would increase code size by 16
> > (arm) or 12 (arm64) bytes.
> > So as long as we can fit more bools inside the hole, it is more
> > efficient to do so...
>
> I do not get this either. Where did you get your 16 bytes from? If I do:

I also looked at code size[*]: while storing bits takes less space than
storing bytes, processing bits may require more instructions than
processing bytes (depending on the architecture).

[*] size drivers/net/can/rcar/rcar_canfd.o

> But just to reiter my previous message, these are notwithstanding
> comments. I am fine if you keep the patch as-is ;)

So I'd like to keep the patch as-is.

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

  reply	other threads:[~2024-06-06 11:38 UTC|newest]

Thread overview: 15+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-05-29  9:12 [PATCH 0/3] can: rcar_canfd: Small improvements and cleanups Geert Uytterhoeven
2024-05-29  9:12 ` [PATCH 1/3] can: rcar_canfd: Simplify clock handling Geert Uytterhoeven
2024-06-02  8:03   ` Vincent MAILHOL
2024-06-06 10:15     ` Geert Uytterhoeven
2024-06-06 11:04       ` Vincent MAILHOL
2024-06-06 11:38         ` Geert Uytterhoeven [this message]
2024-06-21  8:36           ` Marc Kleine-Budde
2024-06-21 11:27             ` Geert Uytterhoeven
2024-06-03 10:32   ` Wolfram Sang
2024-05-29  9:12 ` [PATCH 2/3] can: rcar_canfd: Improve printing of global operational state Geert Uytterhoeven
2024-06-03 10:32   ` Wolfram Sang
2024-05-29  9:12 ` [PATCH 3/3] can: rcar_canfd: Remove superfluous parentheses in address calculations Geert Uytterhoeven
2024-06-03 10:33   ` Wolfram Sang
2024-06-02  8:04 ` [PATCH 0/3] can: rcar_canfd: Small improvements and cleanups Vincent MAILHOL
2024-06-21  8:38 ` Marc Kleine-Budde

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=CAMuHMdWCAU7VK97d3yOALpgg7S9+Aa3ZKwC3VVsivUev1iA+Ag@mail.gmail.com \
    --to=geert@linux-m68k.org \
    --cc=linux-can@vger.kernel.org \
    --cc=linux-renesas-soc@vger.kernel.org \
    --cc=mailhol.vincent@wanadoo.fr \
    --cc=mkl@pengutronix.de \
    --cc=netdev@vger.kernel.org \
    --cc=wsa+renesas@sang-engineering.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).