From: Thomas Gleixner <tglx@linutronix.de>
To: Khalid Ali <khaliidcaliy@gmail.com>
Cc: khaliidcaliy@gmail.com, linux-kernel@vger.kernel.org,
luto@kernel.org, peterz@infradead.org
Subject: Re: [PATCH] kernel/entry: Remove unneeded header "common.h"
Date: Mon, 16 Jun 2025 09:01:08 +0200 [thread overview]
Message-ID: <87plf4npaj.ffs@tglx> (raw)
In-Reply-To: <20250614194829.10832-1-khaliidcaliy@gmail.com>
On Sat, Jun 14 2025 at 19:47, Khalid Ali wrote:
>> The reason why common.h exists is that syscall_user_dispatch() is a
>> internal function, which is on purpose not exposed globally. There is no
>> reason to expose it globally, so it stays where it is.
>> Still there is no strong reason "common.h" could exist, there is no doc
>> explicitly mentions that.
>
> Why can't we just put the prototype into the source since currently it is the
> only place used is common.c, so we should put it on top of the source. Again don't
No. You need the prototype (aka. declaration) for both the usage site
_and_ the definition.
Do I really have to explain the basic C rules?
> see strong reason why entire header exist for single function, even on
> future if more local definations come we should put on top of the
> source, if there is one single source file using it. This makes
> consistent across the entire kernel codebase which mostly do what i
> mentioned.
>
> The only exception for local headers is if the source file using it is
> too large and using many structures, enums and prototypes, in that
> case it is acceptable.
So you define what's acceptable and not?
> However the decision of creation of that local header with no
> exception makes the header pointless.
>
> I didn't find any kernel doc that describes the decision, so we should
> make it consistent with other subsystems if there is no specific
> reason for that this makes the source file more organized.
I explained it to you already why this header exists and there is a
strong emphasis in some subsystems to not expose functions globaly so
that the internals of the subsystem are encapsulated. That's the only
way you can do that in C and it makes a lot of sense.
This _is_ consistent with the rest of the code and you can argue until
you're blue, this header with the declaration of that function stays.
Thanks,
tglx
prev parent reply other threads:[~2025-06-16 7:01 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-06-11 7:23 [PATCH] kernel/entry: Remove unneeded header "common.h" Khalid Ali
2025-06-13 16:12 ` Thomas Gleixner
2025-06-14 19:47 ` Khalid Ali
2025-06-16 7:01 ` Thomas Gleixner [this message]
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=87plf4npaj.ffs@tglx \
--to=tglx@linutronix.de \
--cc=khaliidcaliy@gmail.com \
--cc=linux-kernel@vger.kernel.org \
--cc=luto@kernel.org \
--cc=peterz@infradead.org \
/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