From: Lars-Peter Clausen <lars@metafoo.de>
To: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
Cc: "Hans Verkuil" <hverkuil@xs4all.nl>,
"Sergei Shtylyov" <sergei.shtylyov@cogentembedded.com>,
"Vladimir Barinov" <vladimir.barinov@cogentembedded.com>,
"Richard Röjfors" <richard.rojfors@mocean-labs.com>,
"Federico Vaga" <federico.vaga@gmail.com>,
linux-media@vger.kernel.org
Subject: Re: [PATCH v2 03/15] [media] adv7180: Use inline function instead of macro
Date: Mon, 02 Feb 2015 14:49:11 +0100 [thread overview]
Message-ID: <54CF8057.1060806@metafoo.de> (raw)
In-Reply-To: <20150202113613.07673af0@recife.lan>
On 02/02/2015 02:36 PM, Mauro Carvalho Chehab wrote:
> Em Fri, 23 Jan 2015 16:52:22 +0100
> Lars-Peter Clausen <lars@metafoo.de> escreveu:
>
>> Use a inline function instead of a macro for the container_of helper for
>> getting the driver's state struct from a control. A inline function has the
>> advantage that it is more typesafe and nicer in general.
>
> I don't see any advantage on this.
>
> See: container_of is already a macro, and it is written in a way that, if
> you use it with inconsistent values, the compilation will break.
Yes, container_of is a macro, because it needs to be a macro. Compilation
will also not always break if you pass in a incorrect type, it might succeed
with even generating a warning. Furthermore if compilation breaks the error
message is completely incomprehensible. Using a function instead makes sure
that the error message you get is in the style of "passing argument of wrong
type to function, expected typeX, got typeY".
>
> Also, there's the risk that, for whatever reason, gcc to decide to not
> inline this.
If the compiler does not inline this it probably has a good reason to do so.
Not inlining this will not break the functionality, so it is not a problem.
- Lars
next prev parent reply other threads:[~2015-02-02 13:49 UTC|newest]
Thread overview: 20+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-01-23 15:52 [PATCH v2 00/15] [media] adv7180: Add support for more chip variants Lars-Peter Clausen
2015-01-23 15:52 ` [PATCH v2 01/15] [media] adv7180: Do not request the IRQ again during resume Lars-Peter Clausen
2015-01-23 15:52 ` [PATCH v2 02/15] [media] adv7180: Pass correct flags to request_threaded_irq() Lars-Peter Clausen
2015-01-23 15:52 ` [PATCH v2 03/15] [media] adv7180: Use inline function instead of macro Lars-Peter Clausen
2015-02-02 13:36 ` Mauro Carvalho Chehab
2015-02-02 13:42 ` Hans Verkuil
2015-02-02 13:49 ` Lars-Peter Clausen [this message]
2015-01-23 15:52 ` [PATCH v2 04/15] [media] adv7180: Cleanup register define naming Lars-Peter Clausen
2015-01-23 15:52 ` [PATCH v2 05/15] [media] adv7180: Do implicit register paging Lars-Peter Clausen
2015-01-23 15:52 ` [PATCH v2 06/15] [media] adv7180: Reset the device before initialization Lars-Peter Clausen
2015-01-23 15:52 ` [PATCH v2 07/15] [media] adv7180: Add media controller support Lars-Peter Clausen
2015-01-23 15:52 ` [PATCH v2 08/15] [media] adv7180: Consolidate video mode setting Lars-Peter Clausen
2015-01-23 15:52 ` [PATCH v2 09/15] [media] adv7180: Prepare for multi-chip support Lars-Peter Clausen
2015-01-23 15:52 ` [PATCH v2 10/15] [media] adv7180: Add support for the adv7182 Lars-Peter Clausen
2015-01-23 15:52 ` [PATCH v2 11/15] [media] adv7180: Add support for the adv7280/adv7281/adv7282 Lars-Peter Clausen
2015-01-23 15:52 ` [PATCH v2 12/15] [media] adv7180: Add support for the adv7280-m/adv7281-m/adv7281-ma/adv7282-m Lars-Peter Clausen
2015-01-23 15:52 ` [PATCH v2 13/15] [media] adv7180: Add I2P support Lars-Peter Clausen
2015-01-23 15:52 ` [PATCH v2 14/15] [media] adv7180: Add fast switch support Lars-Peter Clausen
2015-01-23 15:52 ` [PATCH v2 15/15] [media] Add MAINTAINERS entry for the adv7180 Lars-Peter Clausen
2015-01-25 17:34 ` [PATCH v2 00/15] [media] adv7180: Add support for more chip variants Federico Vaga
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=54CF8057.1060806@metafoo.de \
--to=lars@metafoo.de \
--cc=federico.vaga@gmail.com \
--cc=hverkuil@xs4all.nl \
--cc=linux-media@vger.kernel.org \
--cc=mchehab@osg.samsung.com \
--cc=richard.rojfors@mocean-labs.com \
--cc=sergei.shtylyov@cogentembedded.com \
--cc=vladimir.barinov@cogentembedded.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).