linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: "Arnd Bergmann" <arnd@arndb.de>
To: "Serge Semin" <fancer.lancer@gmail.com>
Cc: "Thomas Bogendoerfer" <tsbogend@alpha.franken.de>,
	"Jiaxun Yang" <jiaxun.yang@flygoat.com>,
	"Andrew Morton" <akpm@linux-foundation.org>,
	"Alexey Malahov" <Alexey.Malahov@baikalelectronics.ru>,
	linux-mips@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH v2 1/2] mips: cm: Convert __mips_cm_l2sync_phys_base() to weak function
Date: Mon, 26 Feb 2024 13:29:54 +0100	[thread overview]
Message-ID: <60e60313-3cc4-452f-a222-aadd7728183d@app.fastmail.com> (raw)
In-Reply-To: <simbnmm644ouv3kc3agsxiub6fzg6advihkqsbjzgmb44nmuxv@ktgkhn3kr43z>

On Mon, Feb 26, 2024, at 13:20, Serge Semin wrote:
> On Mon, Feb 26, 2024 at 01:04:33PM +0100, Arnd Bergmann wrote:
>> On Mon, Feb 26, 2024, at 12:27, Serge Semin wrote:

> I see your point now. Thanks for clarification. IMO it would be less
> readable due to the ifdef-ery and the new config, and less
> maintainable due to the conditional compilation, but would provide a
> more performant solution since the compiler will be able to inline the
> singly used static method. Basically you suggest to emulate the weak
> implementation by an additional kernel config.

I mean the kernel config that you already need here, since
the strong version of the function is already optional.

> Not sure whether it would be better than a well-known
> weak-attribute-based pattern. Anyway let's wait for the
> Thomas' opinion about your suggestion. If he thinks
> it would be better I'll update the patches.

Weak functions are not used all that much outside of a
couple of parts of the kernel. There is a lot of them
in drivers/pci/, a little bit in acpi and efi, and
then a bit in arch/*/, though most of that is in mips.

Ifdef checks in .c files are not great, but at least they
are much more common than __weak functions and self-documenting.

     Arnd

  reply	other threads:[~2024-02-26 12:30 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-02-26 10:54 [PATCH v2 0/2] MIPS: Fix missing proto and passing arg warnings Serge Semin
2024-02-26 10:54 ` [PATCH v2 1/2] mips: cm: Convert __mips_cm_l2sync_phys_base() to weak function Serge Semin
2024-02-26 11:04   ` Arnd Bergmann
2024-02-26 11:27     ` Serge Semin
2024-02-26 12:04       ` Arnd Bergmann
2024-02-26 12:20         ` Serge Semin
2024-02-26 12:29           ` Arnd Bergmann [this message]
2024-02-26 13:11             ` Serge Semin
2024-03-11 13:07               ` Thomas Bogendoerfer
2024-02-26 10:54 ` [PATCH v2 2/2] mips: cm: Convert __mips_cm_phys_base() " Serge Semin
2024-03-11 13:05 ` [PATCH v2 0/2] MIPS: Fix missing proto and passing arg warnings Thomas Bogendoerfer

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=60e60313-3cc4-452f-a222-aadd7728183d@app.fastmail.com \
    --to=arnd@arndb.de \
    --cc=Alexey.Malahov@baikalelectronics.ru \
    --cc=akpm@linux-foundation.org \
    --cc=fancer.lancer@gmail.com \
    --cc=jiaxun.yang@flygoat.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-mips@vger.kernel.org \
    --cc=tsbogend@alpha.franken.de \
    /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).