From patchwork Fri Oct 1 05:02:00 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: AKASHI Takahiro X-Patchwork-Id: 514993 Delivered-To: patch@linaro.org Received: by 2002:a02:606e:0:0:0:0:0 with SMTP id d46csp452397jaf; Thu, 30 Sep 2021 22:06:04 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxXATaoF2rnYK5M0eEio9jl6swJ8shzHWawjZIcBrgdcTkQL5mUjjxWWwnFY2V34aEy7gXz X-Received: by 2002:a17:907:8693:: with SMTP id qa19mr3802090ejc.497.1633064764137; Thu, 30 Sep 2021 22:06:04 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1633064764; cv=none; d=google.com; s=arc-20160816; b=HlK06f2CIOpc7Gltyr6Q8INAqiVQQUGtnnlcmGfX0PPsilVBnbeFAj2hn1dKic7u7z 6VtBPhIn+OYAzipaoEQtCZcUJlVfLHSup1TveWqx5Beyz44mCDNLi5Ihho5z0Pz2aQv0 cIuFmS/cS1otUTa9ZXtjeHWT+3mOaHd2T3epnLw9ntZLFycgdll0DBa+k7WZdxQ95sAS JpMssUnW4w4fegVYAYSG5fT4tj33/bHT+SeRBOyiy22LYAqKGVka6ztaP7iSo+xO0KTh E5TmgqoDPzrEgEe1v+osjY0LrJOGnUVwtUCHz9liNa/R/2JNqq5Xo99FIBH0O8lyAQLS Vb8g== 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=pPEdDTlq21F5+d3q3kJvEYPmSgcoioPd7D1vRwloNlQbNUZ5AaQ8WQSJs/3e4xiF8p KY5mvzsUIw7urBtocxSbcPRdgj3FXcV/neIMmbx7i5L47EI53hR+//hu3PVRTG0qZUbJ DZ3OsStOzm+EIjOOPStghJjm01Rkor77wvPY+FtQdmKvQE+NWQ5z8wBWvLLpuPFN1ZAF N4TmYUIEIcpJUqxuqMs9wcRBcHuZkOAYgNuCanMABmO1kUwRuCCrcBbBNLKs1YHbQR/e fW+dyMcpINgNKQgiHX+3sQNmijsQJL90RZCctv+ltn9pTznpWeJw9ykuuiTWvf/9efuv 0DAw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=LZB6lNky; 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 8si5195121ejd.768.2021.09.30.22.06.03 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 30 Sep 2021 22:06:04 -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=LZB6lNky; 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 64D4583322; Fri, 1 Oct 2021 07:04:07 +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="LZB6lNky"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id 7B29A8316B; Fri, 1 Oct 2021 07:03:49 +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-pl1-x633.google.com (mail-pl1-x633.google.com [IPv6:2607:f8b0:4864:20::633]) (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 30B3383176 for ; Fri, 1 Oct 2021 07:03:42 +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-pl1-x633.google.com with SMTP id n2so5516901plk.12 for ; Thu, 30 Sep 2021 22:03:42 -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=LZB6lNkyH8jusQj8E9uPTrT+mUTiOciiwvIM5oVDuagYFahsZD/k2Z4chCaFPI8FzM wQQP1qX9YVUFnC7zk1TUEYVMvyneytnAWkKWpVq8QU3gofKioDnlqlDqfA+hYsShkfRy 0HbkfK42n8MPHVQZFtVfNaDzVAVuj8xzivS36vaBkTpW24Qxrez+aeUboe+YqJzyxTzQ 53m0EJFtegq8QmDpVq8R1mN/6pOjPNuA+DcefgDVHkT7dSYo7Dr96i2SjFDLweeoBWRr eU5HjW3QQpJvbc+c1r8iDKZEEcqEONDFwaIyXGegkiqtoqM/gA93HmxcD1uLiljV0D+j sONA== 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=s/sYE0cOem+eQs0PoEQMcLKbCWOMU8qlGPWWrgglWezKlX6pABCWvS6u8tr2VEQxHn Ncw01NeB4Di9mtzSSlfi2U7hooRdEbRMfnDPf6C3za107IUOW385VcCbDF/q7dNHmkCZ quYuGWBtyZF9pgnrxTgCmBKXf3wwKaYdHPBiPOmjXZTHu4C/efaY/hw7NqG6tLeeun+/ egEON9lw0Yoi2Gkp2wESkoPBVoIkvU9fuWnsKBiwoUBzMCFCoqsbTDBTqeJgBiMN7FCA wOrBa1p0wtCQswukRJArbhBumoqZ3Wlvor6xcHH1o+bs7EwWU4hSFVcTVLfaVPibVSll B40A== X-Gm-Message-State: AOAM531gZtbppQzQaoR1uR601a9qlm5qH5eUmwRHCQNfUfsEaoxM7RCk bpY4hKkPEkKiAYi8rVIdwoiTTQ== X-Received: by 2002:a17:90a:1a12:: with SMTP id 18mr17993483pjk.113.1633064620343; Thu, 30 Sep 2021 22:03:40 -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.37 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 30 Sep 2021 22:03:39 -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 08/22] dm: blk: add a device-probe hook for scanning disk partitions Date: Fri, 1 Oct 2021 14:02:00 +0900 Message-Id: <20211001050228.55183-17-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 Reviewed-by: Simon Glass 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", };