[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20150930165934.GD2627@mtj.duckdns.org>
Date: Wed, 30 Sep 2015 12:59:34 -0400
From: Tejun Heo <tj@...nel.org>
To: Felipe Balbi <balbi@...com>
Cc: Christoph Hellwig <hch@....de>, Joel Becker <jlbec@...lplan.org>,
Andrew Morton <akpm@...ux-foundation.org>,
Pratyush Anand <pratyush.anand@...il.com>,
target-devel@...r.kernel.org, cluster-devel@...hat.com,
ocfs2-devel@....oracle.com, linux-usb@...r.kernel.org,
netdev@...r.kernel.org
Subject: Re: [PATCH 02/23] usb-gadget: use per-attribute show and store
methods
On Wed, Sep 30, 2015 at 11:43:01AM -0500, Felipe Balbi wrote:
> Seems like there are *ton* of uses of container_of() wrapped within a simple
> macro. What convention are you talking about, again ?
The convention of using inline functions over macros when possible.
We don't do that all the time but that's where we wanna be in general.
> And again, what benefit is an inline function bringing in this specific
> case ? As for a technical reason, we know the macro definition will be
> copied Verbatim into the caller body. GCC might decide to not inline
> those helpers (unlikely, but could).
That's really grasping at straws. Let's not go there.
For simple stuff like container_of(), a more valid reason would be
"it's shorter and sweeter and AFAICS doesn't have any known downsides
of using macros" but this ultimately is a bike-shedding problem.
You asked where and why we said we prefer inline functions so that's
the answer (aside from individual technical advantages). It's not an
absolute rule but we're better off if we try to keep things consistent
if possible. As for this specific case, I don't know. I might do the
macro too just because it's less typing and I don't really care but at
the same time I'd just switch to inline if somebody points it out.
--
tejun
--
To unsubscribe from this list: send the line "unsubscribe netdev" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Powered by blists - more mailing lists