All of lore.kernel.org
 help / color / mirror / Atom feed
From: Simon Horman <horms@kernel.org>
To: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
Cc: Jonathan Corbet <corbet@lwn.net>,
	"David S. Miller" <davem@davemloft.net>,
	Eric Dumazet <edumazet@google.com>,
	Jakub Kicinski <kuba@kernel.org>, Paolo Abeni <pabeni@redhat.com>,
	Alexandre Ferrieux <alexandre.ferrieux@gmail.com>,
	netdev@vger.kernel.org, workflows@vger.kernel.org,
	linux-doc@vger.kernel.org
Subject: Re: [PATCH net] docs: netdev: Document guidance on inline functions
Date: Tue, 4 Feb 2025 11:54:10 +0000	[thread overview]
Message-ID: <20250204115410.GW234677@kernel.org> (raw)
In-Reply-To: <20250203205039.15964b2f@foz.lan>

On Mon, Feb 03, 2025 at 08:50:39PM +0100, Mauro Carvalho Chehab wrote:
> Em Mon, 03 Feb 2025 08:00:56 -0700
> Jonathan Corbet <corbet@lwn.net> escreveu:
> 
> > Simon Horman <horms@kernel.org> writes:
> > 
> > > Document preference for non inline functions in .c files.
> > > This has been the preference for as long as I can recall
> > > and I was recently surprised to discover that it is undocumented.
> > >
> > > Reported-by: Alexandre Ferrieux <alexandre.ferrieux@gmail.com>
> > > Closes: https://lore.kernel.org/all/9662e6fe-cc91-4258-aba1-ab5b016a041a@orange.com/
> > > Signed-off-by: Simon Horman <horms@kernel.org>
> > > ---
> > >  Documentation/process/maintainer-netdev.rst | 11 +++++++++++
> > >  1 file changed, 11 insertions(+)
> > >
> > > diff --git a/Documentation/process/maintainer-netdev.rst b/Documentation/process/maintainer-netdev.rst
> > > index e497729525d5..1fbb8178b8cd 100644
> > > --- a/Documentation/process/maintainer-netdev.rst
> > > +++ b/Documentation/process/maintainer-netdev.rst
> > > @@ -408,6 +408,17 @@ at a greater cost than the value of such clean-ups.
> > >  
> > >  Conversely, spelling and grammar fixes are not discouraged.
> > >  
> > > +Inline functions
> > > +----------------
> > > +
> > > +The use of static inline functions in .c file is strongly discouraged

As suggested by Andrew Lunn elsewhere in this thread I will drop
"static" from the line above.

> > > +unless there is a demonstrable reason for them, usually performance
> > > +related. Rather, it is preferred to omit the inline keyword and allow the
> > > +compiler to inline them as it sees fit.
> 
> You should probably point to chapter (12) of Documentation/process/coding-style.rst
> where it mentions that inline for function prototypes and as a way to
>static  replace macros are OK.

Thanks, perhaps something like this would help:

  Using inline in .h files is fine and is encouraged in place of macros
  [reference section 12].

> 
> > > +
> > > +This is a stricter requirement than that of the general Linux Kernel
> > > +:ref:`Coding Style<codingstyle>`  
> > 
> > I have no objection to this change, but I do wonder if it does indeed
> > belong in the central coding-style document.  I don't think anybody
> > encourages use of "inline" these days...?
> 
> Indeed IMO this belongs to the coding style. I would place it close
> to chapter (12) at Documentation/process/coding-style.rst.

Sure, thanks to you and Jonathan for the positive feedback there.
I will prepare a revised patch that updates coding-style.rst instead.

  parent reply	other threads:[~2025-02-04 11:54 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-02-03 13:59 [PATCH net] docs: netdev: Document guidance on inline functions Simon Horman
2025-02-03 15:00 ` Jonathan Corbet
2025-02-03 19:50   ` Mauro Carvalho Chehab
2025-02-03 19:53     ` Mauro Carvalho Chehab
2025-02-04 11:55       ` Simon Horman
2025-02-04 11:54     ` Simon Horman [this message]
2025-02-04 13:25       ` Andrew Lunn
2025-02-04 20:07         ` Simon Horman
2025-02-04 22:46   ` David Laight
2025-02-03 15:10 ` Andrew Lunn
2025-02-04  9:35   ` Simon Horman
2025-02-03 18:51 ` Randy Dunlap
2025-02-04 11:56   ` Simon Horman

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=20250204115410.GW234677@kernel.org \
    --to=horms@kernel.org \
    --cc=alexandre.ferrieux@gmail.com \
    --cc=corbet@lwn.net \
    --cc=davem@davemloft.net \
    --cc=edumazet@google.com \
    --cc=kuba@kernel.org \
    --cc=linux-doc@vger.kernel.org \
    --cc=mchehab+huawei@kernel.org \
    --cc=netdev@vger.kernel.org \
    --cc=pabeni@redhat.com \
    --cc=workflows@vger.kernel.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.