From patchwork Fri Oct 1 05:02:01 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: AKASHI Takahiro X-Patchwork-Id: 514994 Delivered-To: patch@linaro.org Received: by 2002:a02:606e:0:0:0:0:0 with SMTP id d46csp452507jaf; Thu, 30 Sep 2021 22:06:15 -0700 (PDT) X-Google-Smtp-Source: ABdhPJy6TWLuGSuRhu/SKtD/On7Rf8SiLwlGJL3c3SBST4W04uGsO5WF2BkEDnv0cYKUaD0A3xFO X-Received: by 2002:a17:906:c18d:: with SMTP id g13mr3859095ejz.518.1633064775371; Thu, 30 Sep 2021 22:06:15 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1633064775; cv=none; d=google.com; s=arc-20160816; b=cRnhupBi/rvGsY/zYs2D0VJMwEHCNmU/e5kzSWqnTBTmMFVYzjbenAYTA1HSCdcBjb 8mpkV95BX9aaFWElqsk29bP+2QzrOrH/HRV7d7iHK5QIVl8hgUVYyWAFmM66Az5z8rdm 0jr0qHkAb0dOGdbffn2i1nCkdLCWCjgjm+18I6gMkVf+qFYLR3auw1wK1MUnxtTNbpdR 56O0ZVSzUJjhUlFAGw0qBJE0FpZyewKccRkf+85J1mqlZunt2aEFPW3jqoWlO4QO62gd XTz+Vzpwnz/7i4P6VSZzQAW0wPBxlkNFah7PkasyY5b0RCbCpwB5B+iCidgh4UQwddSo zXJg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:list-subscribe:list-help:list-post:list-archive :list-unsubscribe:list-id:precedence:content-transfer-encoding :mime-version:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=bmMB/nA9xkBo6ahFeLmZvwsTNZp33CmIqHJrk8Hn7OE=; b=RK4hD0Y0pUAteVF+Voo8UiPtasSRUK+EST9qehfe0wVedjHlV9lbK54zY2+yBirFoe dCpGClqd/06jaFGNmUYV2/Dggs+09UeM0Xe20lD0gywtvF1zFeyyzrp7FLDGsuX3r/08 5KzozN9IMmcLf4Nds1OKTtkKL41KwV0LNHF46GtiXudOaGgffiDOx4+8Kk8kU/leXtUa pVjkRtVMzvod6L0VBYglELdtp9ZoTWmwW79n6Du6kvV0r407MaRUAMyjWuZiTJh0O1Cv sxni9ZuauE7bKHToETbXaqBlwP0guPdMEEXRoGng/2l46Xs0QF660F15KvsPPGMrjDm3 gdRw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=X8ZRRiOF; spf=pass (google.com: domain of u-boot-bounces@lists.denx.de designates 2a01:238:438b:c500:173d:9f52:ddab:ee01 as permitted sender) smtp.mailfrom=u-boot-bounces@lists.denx.de; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from phobos.denx.de (phobos.denx.de. [2a01:238:438b:c500:173d:9f52:ddab:ee01]) by mx.google.com with ESMTPS id m11si2622407edr.329.2021.09.30.22.06.15 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 30 Sep 2021 22:06:15 -0700 (PDT) Received-SPF: pass (google.com: domain of u-boot-bounces@lists.denx.de designates 2a01:238:438b:c500:173d:9f52:ddab:ee01 as permitted sender) client-ip=2a01:238:438b:c500:173d:9f52:ddab:ee01; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=X8ZRRiOF; spf=pass (google.com: domain of u-boot-bounces@lists.denx.de designates 2a01:238:438b:c500:173d:9f52:ddab:ee01 as permitted sender) smtp.mailfrom=u-boot-bounces@lists.denx.de; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) by phobos.denx.de (Postfix) with ESMTP id 23FBC83326; Fri, 1 Oct 2021 07:04:11 +0200 (CEST) Authentication-Results: phobos.denx.de; dmarc=pass (p=none dis=none) header.from=linaro.org Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=u-boot-bounces@lists.denx.de Authentication-Results: phobos.denx.de; dkim=pass (2048-bit key; unprotected) header.d=linaro.org header.i=@linaro.org header.b="X8ZRRiOF"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id 1987A83176; Fri, 1 Oct 2021 07:03:51 +0200 (CEST) X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on phobos.denx.de X-Spam-Level: X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.2 Received: from mail-pg1-x52f.google.com (mail-pg1-x52f.google.com [IPv6:2607:f8b0:4864:20::52f]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits)) (No client certificate requested) by phobos.denx.de (Postfix) with ESMTPS id EE57A83138 for ; Fri, 1 Oct 2021 07:03:45 +0200 (CEST) Authentication-Results: phobos.denx.de; dmarc=pass (p=none dis=none) header.from=linaro.org Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=takahiro.akashi@linaro.org Received: by mail-pg1-x52f.google.com with SMTP id e7so8379529pgk.2 for ; Thu, 30 Sep 2021 22:03:45 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=bmMB/nA9xkBo6ahFeLmZvwsTNZp33CmIqHJrk8Hn7OE=; b=X8ZRRiOFWLKdauaaNTk2ybj/4Sb+69sI/xaoHXN46oG9osCII48O8zcVl7KBYj7E0G qS7Rd52zPvdA8kKG8+cdeKZnBjXY2S/Uff1vC4U00w0aZgV+/DJiytI6Wd9uaPz1ARaj dOIZimSW18We8hhabRe3AB+r7ga2yqcTQ9j4MCA+B2/S5N3C8civspz26XyqnzZi6T3O MFcAbcVHlFuN4T59SuG8gMtdmMbtYz0/Dxu+SBEhtrAjs7oMT7bYED3ml003p+TJHRkD DWhKohnblVFS9TfNrWKoDpABcpTU7ZuaFNBMSoOYLmWqkrZzWnNGHGZDmcpcgHKOjpCj inuw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=bmMB/nA9xkBo6ahFeLmZvwsTNZp33CmIqHJrk8Hn7OE=; b=MWkAx4SvMnLuBFvh/jO2z4RnJhP66HXsiUmDm1M2Vfrqwyin2g9R4vXGjZ80G2x/2P mHR72is7BWZPeqjkjtqLrxP+AG/sZ5cFXNDSKhGSuJGkRGv9dKGWWaFfAaqhRcvMuNt5 GDbnzFzDKc8ivFD4k5ZOweluPMTfTGrUPpGcqacIbVSorwdgxOCsUCMelfGlQLNHtzar IN82M4OEaJdUajiz1wq2Zz+4fyflEIKHQNzLjojixBlS1KCAUvlPNevJcZZEKHlhHANa Pbmsn/uaxRScphH+VW7xGGdu26nSYVJv9H+mvb1/NG1DIf5qIXMwpNQfYVcpoRoVFO8b Fx9w== X-Gm-Message-State: AOAM530PvfZNwkdtRvOlNnLG60i94TGk+8FmKbGXbU+DyL25FWtmKp62 mGZoxhbse0YhrDrN9+jiVyzZVw== X-Received: by 2002:a65:62d5:: with SMTP id m21mr8307754pgv.124.1633064624100; Thu, 30 Sep 2021 22:03:44 -0700 (PDT) Received: from localhost.localdomain (122-100-26-52m5.mineo.jp. [122.100.26.52]) by smtp.gmail.com with ESMTPSA id z8sm4615113pgc.53.2021.09.30.22.03.40 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 30 Sep 2021 22:03:43 -0700 (PDT) From: AKASHI Takahiro To: xypron.glpk@gmx.de, agraf@csgraf.de, sjg@chromium.org, ilias.apalodimas@linaro.org Cc: u-boot@lists.denx.de, AKASHI Takahiro Subject: [RFC 09/22] dm: blk: add a device-probe hook for scanning disk partitions Date: Fri, 1 Oct 2021 14:02:01 +0900 Message-Id: <20211001050228.55183-18-takahiro.akashi@linaro.org> X-Mailer: git-send-email 2.33.0 In-Reply-To: <20211001050228.55183-1-takahiro.akashi@linaro.org> References: <20211001050228.55183-1-takahiro.akashi@linaro.org> MIME-Version: 1.0 X-BeenThere: u-boot@lists.denx.de X-Mailman-Version: 2.1.34 Precedence: list List-Id: U-Boot discussion List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: u-boot-bounces@lists.denx.de Sender: "U-Boot" X-Virus-Scanned: clamav-milter 0.103.2 at phobos.denx.de X-Virus-Status: Clean Now that all the block device drivers have enable a probe hook, we will call blk_create_partitions() to enumerate all the partitions and create associated udevices when a block device is detected. Signed-off-by: AKASHI Takahiro --- drivers/block/blk-uclass.c | 15 +++++++++++++++ 1 file changed, 15 insertions(+) -- 2.33.0 diff --git a/drivers/block/blk-uclass.c b/drivers/block/blk-uclass.c index dd7f3c0fe31e..6ba11a8fa7f7 100644 --- a/drivers/block/blk-uclass.c +++ b/drivers/block/blk-uclass.c @@ -741,11 +741,25 @@ static int blk_post_probe(struct udevice *dev) struct blk_desc *desc = dev_get_uclass_plat(dev); part_init(desc); + + if (desc->part_type != PART_TYPE_UNKNOWN && + blk_create_partitions(dev)) + debug("*** creating partitions failed\n"); } return 0; } +static int blk_part_post_probe(struct udevice *dev) +{ + /* + * TODO: + * If we call blk_creat_partitions() here, it would allow for + * "partitions in a partition". + */ + return 0; +} + UCLASS_DRIVER(blk) = { .id = UCLASS_BLK, .name = "blk", @@ -821,6 +835,7 @@ U_BOOT_DRIVER(blk_partition) = { UCLASS_DRIVER(partition) = { .id = UCLASS_PARTITION, + .post_probe = blk_part_post_probe, .per_device_plat_auto = sizeof(struct disk_part), .name = "partition", };