From: Lars-Peter Clausen <lars@metafoo.de>
To: Mark Brown <broonie@kernel.org>, Jean-Francois Moine <moinejf@free.fr>
Cc: Liam Girdwood <lgirdwood@gmail.com>,
Russell King <linux@arm.linux.org.uk>,
alsa-devel@alsa-project.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH v3] ASoC: Remove 'const' from the device_node pointers
Date: Tue, 25 Nov 2014 14:36:15 +0100 [thread overview]
Message-ID: <547485CF.4050600@metafoo.de> (raw)
In-Reply-To: <20141125131351.GC7712@sirena.org.uk>
On 11/25/2014 02:13 PM, Mark Brown wrote:
> On Tue, Nov 25, 2014 at 12:14:48PM +0100, Jean-Francois Moine wrote:
>> As Russell King's explained it, there should not be pointers to
>> struct device_node:
>>
>> "struct device_node is a ref-counted structure. That means if you
>> store a reference to it, you should "get" it, and you should "put"
>> it once you've done. The act of "put"ing the pointed-to structure
>> involves writing to that structure, so it is totally unappropriate
>> to store a device_node structure as a const pointer. It forces you
>> to have to cast it back to a non-const pointer at various points
>> in time to use various OF function calls."
>
> So, we're not holding references here (we're just doing comparisons, the
> references need to be owned before we get into the core)
The core itself will only do the comparisons and it is the board drivers
responsibility to get and put the references. Making the pointers non const
allows the board driver to use them to put the reference once the card has
been unregistered rather than having to keep a separate set of pointers
around. This should probably be mentioned in the commit message though.
> I'm not seeing anything here removing casts?
This patch used to be part of a two part series where the second patch
removed the casts. This patch as already been applied though.
next prev parent reply other threads:[~2014-11-25 13:36 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2014-11-25 13:13 [PATCH v3] ASoC: Remove 'const' from the device_node pointers Mark Brown
2014-11-25 13:13 ` Mark Brown
2014-11-25 13:36 ` Lars-Peter Clausen [this message]
2014-11-25 13:49 ` Mark Brown
-- strict thread matches above, loose matches on Subject: below --
2014-11-25 22:30 Mark Brown
2014-11-25 11:14 Jean-Francois Moine
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=547485CF.4050600@metafoo.de \
--to=lars@metafoo.de \
--cc=alsa-devel@alsa-project.org \
--cc=broonie@kernel.org \
--cc=lgirdwood@gmail.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux@arm.linux.org.uk \
--cc=moinejf@free.fr \
/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.