Hi Simon,


On Mon, 19 Jan 2015 20:12:43 -0700
Simon Glass <s...@chromium.org> wrote:

> For buses, after a child is bound, allow the uclass to perform some
> processing. This can be used to figure out the address of the child (e.g.
> the chip select for SPI slaves) so that it is ready to be probed.
> 
> This avoids bus drivers having to repeat the same process, which really
> should be done by the uclass, since it is common.
> 
> Signed-off-by: Simon Glass <s...@chromium.org>
> ---
> 
> Changes in v2: None
> 
>  drivers/core/uclass.c | 21 ++++++++++++++++-----
>  include/dm/uclass.h   |  2 ++
>  test/dm/bus.c         | 26 ++++++++++++++++++++++++++
>  3 files changed, 44 insertions(+), 5 deletions(-)
> 
> diff --git a/drivers/core/uclass.c b/drivers/core/uclass.c
> index 901b06e..29811be 100644
> --- a/drivers/core/uclass.c
> +++ b/drivers/core/uclass.c
> @@ -319,18 +319,29 @@ int uclass_bind_device(struct udevice *dev)
>       int ret;
>  
>       uc = dev->uclass;
> -
>       list_add_tail(&dev->uclass_node, &uc->dev_head);
>  
> +     if (dev->parent) {
> +             struct uclass_driver *parent_drv = dev->parent->uclass->uc_drv;
> +
> +             if (parent_drv->child_post_bind) {
> +                     ret = parent_drv->child_post_bind(dev);
> +                     if (ret)
> +                             goto err;
> +             }
> +     }


Perhaps, "parent_uc_drv" or "uc_drv" is better than "parent_drv"?



The code looks good, so,

Reviewed-by: Masahiro Yamada <yamad...@jp.panasonic.com>

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

Reply via email to