Re: [PATCH 02/23] usb-gadget: use per-attribute show and store methods

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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 linux-usb" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html



[Index of Archives]     [Linux Media]     [Linux Input]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]     [Old Linux USB Devel Archive]

  Powered by Linux