From: Masahiro Yamada Date: Wed, 19 Nov 2014 17:27:24 +0900 Subject: [U-Boot] [PATCH v2 03/17] dm: core: Add functions to find parent and OF data In-Reply-To: <1415727993-22032-4-git-send-email-sjg@chromium.org> References: <1415727993-22032-1-git-send-email-sjg@chromium.org> <1415727993-22032-4-git-send-email-sjg@chromium.org> Message-ID: <20141119172724.93F3.AA925319@jp.panasonic.com> List-Id: MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit To: u-boot@lists.denx.de On Tue, 11 Nov 2014 10:46:19 -0700 Simon Glass wrote: > Add dev_get_parent() as a convenience to obtain the parent of a device. > > Signed-off-by: Simon Glass > --- > > 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