From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 4860AC433F5 for ; Mon, 4 Oct 2021 03:46:49 +0000 (UTC) Received: from phobos.denx.de (phobos.denx.de [85.214.62.61]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id BED2861058 for ; Mon, 4 Oct 2021 03:46:48 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.4.1 mail.kernel.org BED2861058 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=linaro.org Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=lists.denx.de Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) by phobos.denx.de (Postfix) with ESMTP id 77B5F8340A; Mon, 4 Oct 2021 05:46:10 +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="WS55yFiX"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id 96FE383550; Mon, 4 Oct 2021 05:45:53 +0200 (CEST) Received: from mail-pj1-x1031.google.com (mail-pj1-x1031.google.com [IPv6:2607:f8b0:4864:20::1031]) (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 EF3DD8352E for ; Mon, 4 Oct 2021 05:45: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-pj1-x1031.google.com with SMTP id ls18so460943pjb.3 for ; Sun, 03 Oct 2021 20:45: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=WS55yFiXit529Za7qZNrD22CikMBIgv2i/UMgFgl0xMYTc00nXjYIMbwQoA/8Nxg7o BlSFbxp5FVPIrvgzuKf5brWqGJeaSfrsmhY5QrMGhojMJXFIQbGl3MesCqma620OG6HI vyTDxa2sDTNpDDdpo/2hYJLeV3FSCLiAGLGAI2AFrLs5QL7qfFAUMZTjq7MMg19zNZ/j mzNM407pxHOSQFIB9OaO+5Rg/Oym2q9oRZ3AtTdXPDk6iD47dn7orN3wV9Qb1gmj7YER b1FOajqfWmFDBttO1ENnT9yn0wZhx/st9UAb+GT/fW3deOpaVtqQ5fhWrDaZn4uFyLcE H7Yg== 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=CUb0GTHo6uAf21ziirrjVFCuGFYEW8wECWDWirA/DzXkznDqQBFNWNdWHYF1T8Zty7 6bKVs1bqIyQXB5CGRpoGd5LJsE2hgRRiaWrb2PdCkT6Rr9G4epI9jEIeHa4sKEiq6QlJ 9CB7tzUSDSp4iI6JzggmKMIwU7O0YVpXTvtLzWjgb1Ti7xP2sPpm9JH3Qu2s/IV9NSnV VYmteRRJHUsS7bYLXFFUdOpBUdB25VxrmrTF1HESn/54JVPZIKQMnHe15qX4wS1RYGut KmZtes+TooFPzkvRDwPp0/q91fjRukBVC9L7T26x31+x3R9RdWGalsRuXR5y2lmPBKYa gqKA== X-Gm-Message-State: AOAM531GZgb5ablp+OBXG5DW/JatGkiZMLgUy/jSRxc3E/PRTJzBHXgz iplcY1dfg8J7mnGjFmusBQ3wFw== X-Google-Smtp-Source: ABdhPJw2jc8/AHaBfefxVAM1TYi5vbV9hiM10b0VRBS31j/4A/rU4uzVnzM3U0MPTFPgTQ7Fsqo2EQ== X-Received: by 2002:a17:902:dacf:b0:13e:ab53:87dc with SMTP id q15-20020a170902dacf00b0013eab5387dcmr7471871plx.78.1633319144287; Sun, 03 Oct 2021 20:45:44 -0700 (PDT) Received: from localhost.localdomain (61-205-96-147m5.grp4.mineo.jp. [61.205.96.147]) by smtp.gmail.com with ESMTPSA id a11sm11863515pgj.75.2021.10.03.20.45.39 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 03 Oct 2021 20:45: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: [resent RFC 09/22] dm: blk: add a device-probe hook for scanning disk partitions Date: Mon, 4 Oct 2021 12:44:17 +0900 Message-Id: <20211004034430.41355-10-takahiro.akashi@linaro.org> X-Mailer: git-send-email 2.33.0 In-Reply-To: <20211004034430.41355-1-takahiro.akashi@linaro.org> References: <20211004034430.41355-1-takahiro.akashi@linaro.org> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit 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(+) 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", }; -- 2.33.0