From patchwork Mon Oct 15 09:20:57 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Bin Meng X-Patchwork-Id: 983992 X-Patchwork-Delegate: sjg@chromium.org Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=none (mailfrom) smtp.mailfrom=lists.denx.de (client-ip=81.169.180.215; helo=lists.denx.de; envelope-from=u-boot-bounces@lists.denx.de; receiver=) Authentication-Results: ozlabs.org; dmarc=fail (p=none dis=none) header.from=gmail.com Authentication-Results: ozlabs.org; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=gmail.com header.i=@gmail.com header.b="iIO7LLMB"; dkim-atps=neutral Received: from lists.denx.de (dione.denx.de [81.169.180.215]) by ozlabs.org (Postfix) with ESMTP id 42YXrv6QFsz9s7W for ; Mon, 15 Oct 2018 20:17:19 +1100 (AEDT) Received: by lists.denx.de (Postfix, from userid 105) id 48C0AC21F02; Mon, 15 Oct 2018 09:17:17 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on lists.denx.de X-Spam-Level: X-Spam-Status: No, score=-0.0 required=5.0 tests=FREEMAIL_FROM, RCVD_IN_DNSWL_BLOCKED, RCVD_IN_MSPIKE_H3, RCVD_IN_MSPIKE_WL, T_DKIM_INVALID autolearn=unavailable autolearn_force=no version=3.4.0 Received: from lists.denx.de (localhost [IPv6:::1]) by lists.denx.de (Postfix) with ESMTP id 5CC86C21DC1; Mon, 15 Oct 2018 09:16:37 +0000 (UTC) Received: by lists.denx.de (Postfix, from userid 105) id DE0EEC21BE5; Mon, 15 Oct 2018 09:16:34 +0000 (UTC) Received: from mail-pg1-f196.google.com (mail-pg1-f196.google.com [209.85.215.196]) by lists.denx.de (Postfix) with ESMTPS id 4B8CCC21C2C for ; Mon, 15 Oct 2018 09:16:34 +0000 (UTC) Received: by mail-pg1-f196.google.com with SMTP id f18-v6so8883597pgv.3 for ; Mon, 15 Oct 2018 02:16:34 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=nIeIB1a4jNG39Eo8IH2bgmLuT7lfURDWJrtkgWFktaM=; b=iIO7LLMBdM8kShImk8a4PsYqkdREhR9TtbnjS1xCfXFlVrNGTj0EcRwqBF45Z+PG1v yDfMnQdFrJJ7hT8K5dWFxM60hLxLd2iWY6yP6+UNVOi640fef7yDWWnNFfs/sPBjHTOM BAi0dnpjiqHJXPgHWq9S/BRaEtbBtEYIcTjjUxnnk0pmefTVWhL6SDnv9OHOCszCuN5K 25V4g/Pi6SjV64P6ZTME1Sl5R3wvzH9OUp/EJQpOe7eRoTkClsJ+p+LfdYwbXr4D8uHk LsNQf7+wJtkyxPC8bhFC6CNVkZBk8X6EVKbYEHU/6fkTyxZV1g0CbFKjxE5I6T1dGetV 1Sog== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=nIeIB1a4jNG39Eo8IH2bgmLuT7lfURDWJrtkgWFktaM=; b=avi7l+LOzwjog8ZZlGnMWCyMGIhnOz+mlVxtcsikNPrXKX6ZXV/AhBRkAlNqfYdrHD kJveaGqYsvnEDfWG17Few36zqfHjtgyGnqw/fbtC1qr7BGZvRc53OwyxwelqNUWh0TlU JIsSRk0JKo/ZgCVDJXc4OYEefTS2KogfOASvpjr1SCNS8LfRQlDiPL1WpCof9vkUmmKo fslUl/YfsTIS0nicEa6yBnwf0LiBtlZHCNbnY9kpZsMBIe3+UEl+CCDzdXdfJ6HgGZdX CqbZZWb5DzGROAJ1mOu6175w4Sagt25im9qOmU47fzaPAQ10+YhJLFhRdVonce6Gj79j 1KUg== X-Gm-Message-State: ABuFfohoduPWRg5lnTpmFQjqkT0hcKaIYhZJJo88/6eAG0PuREKhKamL pA7u/qP5RARpqujgDnD+zvc= X-Google-Smtp-Source: ACcGV61X6WQlFjSNR2bKFZz2FaRz1vmWd+M2sICXqDDyzuTJIwsYFod+qwgz/NsVGE8iC68HjEdAoA== X-Received: by 2002:a63:f848:: with SMTP id v8-v6mr15133036pgj.82.1539594992928; Mon, 15 Oct 2018 02:16:32 -0700 (PDT) Received: from ala-d2121-lx1.wrs.com (unknown-156-139.windriver.com. [147.11.156.139]) by smtp.gmail.com with ESMTPSA id a11-v6sm10798256pgw.54.2018.10.15.02.16.31 (version=TLS1_1 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Mon, 15 Oct 2018 02:16:32 -0700 (PDT) From: Bin Meng To: Simon Glass , U-Boot Mailing List Date: Mon, 15 Oct 2018 02:20:57 -0700 Message-Id: <1539595287-31378-2-git-send-email-bmeng.cn@gmail.com> X-Mailer: git-send-email 1.7.9.5 In-Reply-To: <1539595287-31378-1-git-send-email-bmeng.cn@gmail.com> References: <1539595287-31378-1-git-send-email-bmeng.cn@gmail.com> Subject: [U-Boot] [PATCH v3 01/31] dm: core: Allow uclass to set up a device's child after it is probed X-BeenThere: u-boot@lists.denx.de X-Mailman-Version: 2.1.18 Precedence: list List-Id: U-Boot discussion List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Errors-To: u-boot-bounces@lists.denx.de Sender: "U-Boot" Some buses need to set up their child devices after they are probed. Support a common child_post_probe() method for the uclass. With this change, the two APIs uclass_pre_probe_device() and uclass_post_probe_device() become symmetric. Signed-off-by: Bin Meng Reviewed-by: Simon Glass Reviewed-by: Simon Glass --- Changes in v3: None Changes in v2: None drivers/core/uclass.c | 13 ++++++++++++- include/dm/uclass.h | 4 +++- 2 files changed, 15 insertions(+), 2 deletions(-) diff --git a/drivers/core/uclass.c b/drivers/core/uclass.c index 3113d6a..3c7b9cf 100644 --- a/drivers/core/uclass.c +++ b/drivers/core/uclass.c @@ -687,8 +687,19 @@ int uclass_pre_probe_device(struct udevice *dev) int uclass_post_probe_device(struct udevice *dev) { - struct uclass_driver *uc_drv = dev->uclass->uc_drv; + struct uclass_driver *uc_drv; + int ret; + + if (dev->parent) { + uc_drv = dev->parent->uclass->uc_drv; + if (uc_drv->child_post_probe) { + ret = uc_drv->child_post_probe(dev); + if (ret) + return ret; + } + } + uc_drv = dev->uclass->uc_drv; if (uc_drv->post_probe) return uc_drv->post_probe(dev); diff --git a/include/dm/uclass.h b/include/dm/uclass.h index eebf2d5..4ef0d0f 100644 --- a/include/dm/uclass.h +++ b/include/dm/uclass.h @@ -61,7 +61,8 @@ struct udevice; * @post_probe: Called after a new device is probed * @pre_remove: Called before a device is removed * @child_post_bind: Called after a child is bound to a device in this uclass - * @child_pre_probe: Called before a child is probed in this uclass + * @child_pre_probe: Called before a child in this uclass is probed + * @child_post_probe: Called after a child in this uclass is probed * @init: Called to set up the uclass * @destroy: Called to destroy the uclass * @priv_auto_alloc_size: If non-zero this is the size of the private data @@ -94,6 +95,7 @@ struct uclass_driver { int (*pre_remove)(struct udevice *dev); int (*child_post_bind)(struct udevice *dev); int (*child_pre_probe)(struct udevice *dev); + int (*child_post_probe)(struct udevice *dev); int (*init)(struct uclass *class); int (*destroy)(struct uclass *class); int priv_auto_alloc_size;