From: Johan Hovold <johan@kernel.org>
To: Dan Carpenter <dan.carpenter@oracle.com>
Cc: Johan Hovold <johan@kernel.org>,
Madhumitha Prabakaran <madhumithabiw@gmail.com>,
devel@driverdev.osuosl.org, elder@kernel.org,
gregkh@linuxfoundation.org, linux-kernel@vger.kernel.org,
greybus-dev@lists.linaro.org
Subject: Re: [PATCH] Staging: greybus: Cleanup in header file control.h
Date: Mon, 15 Apr 2019 16:12:01 +0200 [thread overview]
Message-ID: <20190415141201.GD775@localhost> (raw)
In-Reply-To: <20190415133357.GP6095@kadam>
On Mon, Apr 15, 2019 at 04:33:57PM +0300, Dan Carpenter wrote:
> On Mon, Apr 15, 2019 at 03:10:02PM +0200, Johan Hovold wrote:
> > On Fri, Apr 05, 2019 at 03:14:37PM -0500, Madhumitha Prabakaran wrote:
> > > Fix a blank line after function/struct/union/enum
> > > declarations. Also, convert to_gb_control() macro into an inline
> > > function in order to maintain Linux kernel coding style based
> > > on which the inline function is preferable over the macro.
> >
> > There are about 1200 macros wrapping container_of() in the kernel, so
> > this is a common pattern which does not need to be changed (by contrast,
> > only a handful container_of are wrapped by functions).
> >
>
> A handful?
>
> $ git grep "return container_of" | wc -l
> 1856
>
> I'm like Donald Trump because I must have really small hands compared
> to the rest of y'all.
Heh, you're right, my grep-fu failed me.
Ok, so both styles are roughly as common (and a non-trivial portion of
those 1800 also are not simple wrappers).
> I would prefer to apply these sorts of patches unless it causes an
> issue... Functions *are* better than macros. It's a minor improvement,
> but this is staging and we make tons minor style changes. It's part of
> the blessing and curse of being in staging...
While I agree functions are generally preferred, container_of() is
special as it includes type checking.
And again, using container_of() like this is a common pattern in the
kernel.
Johan
next prev parent reply other threads:[~2019-04-15 14:12 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-04-05 20:14 [PATCH] Staging: greybus: Cleanup in header file control.h Madhumitha Prabakaran
2019-04-15 13:10 ` Johan Hovold
2019-04-15 13:33 ` Dan Carpenter
2019-04-15 14:12 ` Johan Hovold [this message]
2019-04-15 14:40 ` Dan Carpenter
2019-04-15 15:03 ` Johan Hovold
2019-04-15 16:04 ` Dan Carpenter
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=20190415141201.GD775@localhost \
--to=johan@kernel.org \
--cc=dan.carpenter@oracle.com \
--cc=devel@driverdev.osuosl.org \
--cc=elder@kernel.org \
--cc=gregkh@linuxfoundation.org \
--cc=greybus-dev@lists.linaro.org \
--cc=linux-kernel@vger.kernel.org \
--cc=madhumithabiw@gmail.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 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.