Re: [U-Boot] [PATCH v2 03/17] dm: core: Add functions to find parent and OF data

2014-11-23 Thread Simon Glass
On 19 November 2014 at 02:37, Simon Glass s...@chromium.org wrote:
 Hi Masahiro,

 On 19 November 2014 08:27, Masahiro Yamada yamad...@jp.panasonic.com wrote:

 On Tue, 11 Nov 2014 10:46:19 -0700
 Simon Glass s...@chromium.org wrote:

 Add dev_get_parent() as a convenience to obtain the parent of a device.

 Signed-off-by: Simon Glass s...@chromium.org
 ---

 Changes in v2: None

  drivers/core/device.c | 5 +
  include/dm/device.h   | 8 
  2 files changed, 13 insertions(+)

 diff --git a/drivers/core/device.c b/drivers/core/device.c
 index 0d84776..76b29fd 100644
 --- a/drivers/core/device.c
 +++ b/drivers/core/device.c
 @@ -549,6 +549,11 @@ int device_find_next_child(struct udevice **devp)
   return 0;
  }

 +struct udevice *dev_get_parent(struct udevice *child)
 +{
 + return child-parent;
 +}
 +

 Why do you want this?  dev_get_parent(dev) is longer than dev-parent.

 I am not sure if this helper function is useful,
 but if really necessary, static inline or macro ??

 See my comment on the other patch.



 Perhaps,  struct udevice *dev rather than struct udevice *child
 for consistency?

 Maybe, but I feel this is clearer even if it is inconsistent. I try to
 use 'bus' instead of dev when there is a bus too, to help with
 understanding.

 Regards,
 Simon

Applied to u-boot-dm.
___
U-Boot mailing list
U-Boot@lists.denx.de
http://lists.denx.de/mailman/listinfo/u-boot


Re: [U-Boot] [PATCH v2 03/17] dm: core: Add functions to find parent and OF data

2014-11-19 Thread Masahiro Yamada

On Tue, 11 Nov 2014 10:46:19 -0700
Simon Glass s...@chromium.org wrote:

 Add dev_get_parent() as a convenience to obtain the parent of a device.
 
 Signed-off-by: Simon Glass s...@chromium.org
 ---
 
 Changes in v2: None
 
  drivers/core/device.c | 5 +
  include/dm/device.h   | 8 
  2 files changed, 13 insertions(+)
 
 diff --git a/drivers/core/device.c b/drivers/core/device.c
 index 0d84776..76b29fd 100644
 --- a/drivers/core/device.c
 +++ b/drivers/core/device.c
 @@ -549,6 +549,11 @@ int device_find_next_child(struct udevice **devp)
   return 0;
  }
  
 +struct udevice *dev_get_parent(struct udevice *child)
 +{
 + return child-parent;
 +}
 +

Why do you want this?  dev_get_parent(dev) is longer than dev-parent.

I am not sure if this helper function is useful,
but if really necessary, static inline or macro ??


Perhaps,  struct udevice *dev rather than struct udevice *child
for consistency?




Best Regards
Masahiro Yamada

___
U-Boot mailing list
U-Boot@lists.denx.de
http://lists.denx.de/mailman/listinfo/u-boot


Re: [U-Boot] [PATCH v2 03/17] dm: core: Add functions to find parent and OF data

2014-11-19 Thread Simon Glass
Hi Masahiro,

On 19 November 2014 08:27, Masahiro Yamada yamad...@jp.panasonic.com wrote:

 On Tue, 11 Nov 2014 10:46:19 -0700
 Simon Glass s...@chromium.org wrote:

 Add dev_get_parent() as a convenience to obtain the parent of a device.

 Signed-off-by: Simon Glass s...@chromium.org
 ---

 Changes in v2: None

  drivers/core/device.c | 5 +
  include/dm/device.h   | 8 
  2 files changed, 13 insertions(+)

 diff --git a/drivers/core/device.c b/drivers/core/device.c
 index 0d84776..76b29fd 100644
 --- a/drivers/core/device.c
 +++ b/drivers/core/device.c
 @@ -549,6 +549,11 @@ int device_find_next_child(struct udevice **devp)
   return 0;
  }

 +struct udevice *dev_get_parent(struct udevice *child)
 +{
 + return child-parent;
 +}
 +

 Why do you want this?  dev_get_parent(dev) is longer than dev-parent.

 I am not sure if this helper function is useful,
 but if really necessary, static inline or macro ??

See my comment on the other patch.



 Perhaps,  struct udevice *dev rather than struct udevice *child
 for consistency?

Maybe, but I feel this is clearer even if it is inconsistent. I try to
use 'bus' instead of dev when there is a bus too, to help with
understanding.

Regards,
Simon
___
U-Boot mailing list
U-Boot@lists.denx.de
http://lists.denx.de/mailman/listinfo/u-boot


Re: [U-Boot] [PATCH v2 03/17] dm: core: Add functions to find parent and OF data

2014-11-16 Thread Tom Rini
On Tue, Nov 11, 2014 at 10:46:19AM -0700, Simon Glass wrote:

 Add dev_get_parent() as a convenience to obtain the parent of a device.
 
 Signed-off-by: Simon Glass s...@chromium.org

Reviewed-by: Tom Rini tr...@ti.com

-- 
Tom


signature.asc
Description: Digital signature
___
U-Boot mailing list
U-Boot@lists.denx.de
http://lists.denx.de/mailman/listinfo/u-boot


Re: [U-Boot] [PATCH v2 03/17] dm: core: Add functions to find parent and OF data

2014-11-16 Thread Heiko Schocher

Hello Simon,

Am 11.11.2014 18:46, schrieb Simon Glass:

Add dev_get_parent() as a convenience to obtain the parent of a device.

Signed-off-by: Simon Glass s...@chromium.org
---

Changes in v2: None

  drivers/core/device.c | 5 +
  include/dm/device.h   | 8 
  2 files changed, 13 insertions(+)


Acked-by: Heiko Schocher h...@denx.de

bye,
Heiko
--
DENX Software Engineering GmbH, MD: Wolfgang Denk  Detlev Zundel
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
___
U-Boot mailing list
U-Boot@lists.denx.de
http://lists.denx.de/mailman/listinfo/u-boot


[U-Boot] [PATCH v2 03/17] dm: core: Add functions to find parent and OF data

2014-11-11 Thread Simon Glass
Add dev_get_parent() as a convenience to obtain the parent of a device.

Signed-off-by: Simon Glass s...@chromium.org
---

Changes in v2: None

 drivers/core/device.c | 5 +
 include/dm/device.h   | 8 
 2 files changed, 13 insertions(+)

diff --git a/drivers/core/device.c b/drivers/core/device.c
index 0d84776..76b29fd 100644
--- a/drivers/core/device.c
+++ b/drivers/core/device.c
@@ -549,6 +549,11 @@ int device_find_next_child(struct udevice **devp)
return 0;
 }
 
+struct udevice *dev_get_parent(struct udevice *child)
+{
+   return child-parent;
+}
+
 ulong dev_get_of_data(struct udevice *dev)
 {
return dev-of_id-data;
diff --git a/include/dm/device.h b/include/dm/device.h
index 287504c..13598a1 100644
--- a/include/dm/device.h
+++ b/include/dm/device.h
@@ -208,6 +208,14 @@ void *dev_get_parentdata(struct udevice *dev);
 void *dev_get_priv(struct udevice *dev);
 
 /**
+ * struct dev_get_parent() - Get the parent of a device
+ *
+ * @child: Child to check
+ * @return parent of child, or NULL if this is the root device
+ */
+struct udevice *dev_get_parent(struct udevice *child);
+
+/**
  * dev_get_of_data() - get the device tree data used to bind a device
  *
  * When a device is bound using a device tree node, it matches a
-- 
2.1.0.rc2.206.gedb03e5

___
U-Boot mailing list
U-Boot@lists.denx.de
http://lists.denx.de/mailman/listinfo/u-boot