All of lore.kernel.org
 help / color / mirror / Atom feed
* Re: [PATCH v3] ASoC: Remove 'const' from the device_node pointers
@ 2014-11-25 13:13 ` Mark Brown
  0 siblings, 0 replies; 6+ messages in thread
From: Mark Brown @ 2014-11-25 13:13 UTC (permalink / raw)
  To: Jean-Francois Moine
  Cc: alsa-devel, Lars-Peter Clausen, Russell King, Liam Girdwood,
	linux-kernel


[-- Attachment #1.1: Type: text/plain, Size: 819 bytes --]

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) and I'm not
seeing anything here removing casts?

[-- Attachment #1.2: Digital signature --]
[-- Type: application/pgp-signature, Size: 473 bytes --]

[-- Attachment #2: Type: text/plain, Size: 0 bytes --]



^ permalink raw reply	[flat|nested] 6+ messages in thread
* Re: [PATCH v3] ASoC: Remove 'const' from the device_node pointers
@ 2014-11-25 22:30 Mark Brown
  0 siblings, 0 replies; 6+ messages in thread
From: Mark Brown @ 2014-11-25 22:30 UTC (permalink / raw)
  To: Jean-Francois Moine
  Cc: Liam Girdwood, Russell King, Lars-Peter Clausen, alsa-devel,
	linux-kernel

[-- Attachment #1: Type: text/plain, Size: 354 bytes --]

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:

OK, found a user that needs this so applying now.  Please do try to make
your changelogs clearer about why things are being done, it's often hard
to figure things out which slows everything down.

[-- Attachment #2: Digital signature --]
[-- Type: application/pgp-signature, Size: 473 bytes --]

^ permalink raw reply	[flat|nested] 6+ messages in thread
* [PATCH v3] ASoC: Remove 'const' from the device_node pointers
@ 2014-11-25 11:14 Jean-Francois Moine
  0 siblings, 0 replies; 6+ messages in thread
From: Jean-Francois Moine @ 2014-11-25 11:14 UTC (permalink / raw)
  To: Liam Girdwood, Mark Brown
  Cc: alsa-devel, Lars-Peter Clausen, Russell King, linux-kernel

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."

Signed-off-by: Jean-Francois Moine <moinejf@free.fr>
---
v3: change the patch comment (Mark Brown)
v2: remove const from the pointers instead of modifying the
    OF functions (Russell King)
---
 include/sound/soc.h | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/include/sound/soc.h b/include/sound/soc.h
index 879e2b3..13e1648 100644
--- a/include/sound/soc.h
+++ b/include/sound/soc.h
@@ -883,7 +883,7 @@ struct snd_soc_platform_driver {
 
 struct snd_soc_dai_link_component {
 	const char *name;
-	const struct device_node *of_node;
+	struct device_node *of_node;
 	const char *dai_name;
 };
 
@@ -985,7 +985,7 @@ struct snd_soc_codec_conf {
 	 * DT/OF node, but not both.
 	 */
 	const char *dev_name;
-	const struct device_node *of_node;
+	struct device_node *of_node;
 
 	/*
 	 * optional map of kcontrol, widget and path name prefixes that are
@@ -1002,7 +1002,7 @@ struct snd_soc_aux_dev {
 	 * DT/OF node, but not both.
 	 */
 	const char *codec_name;
-	const struct device_node *codec_of_node;
+	struct device_node *codec_of_node;
 
 	/* codec/machine specific init - e.g. add machine controls */
 	int (*init)(struct snd_soc_component *component);
-- 
2.1.3

^ permalink raw reply related	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2014-11-25 22:30 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
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
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

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.