From patchwork Mon Oct 4 03:44:17 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: AKASHI Takahiro X-Patchwork-Id: 515137 Delivered-To: patch@linaro.org Received: by 2002:ac0:890a:0:0:0:0:0 with SMTP id 10csp1062254imy; Sun, 3 Oct 2021 20:46:49 -0700 (PDT) X-Google-Smtp-Source: ABdhPJynRQzaQ0pbb16CRF1wG4LrSQt+Huk5lEiZHSL83qvpBGei9X9aoHbVfShOA2e5LZ7NvSLC X-Received: by 2002:a17:907:7284:: with SMTP id dt4mr14202680ejc.433.1633319209225; Sun, 03 Oct 2021 20:46:49 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1633319209; cv=none; d=google.com; s=arc-20160816; b=fSHXp0DOJc1mGrKsVdalA6udbxl7xynVLhzXhAPUZ/RsCkXuuOqAB0jtl+sSL35uzc A6YAvWN0U3FWetfff9eWyPDylQ8MDSl7Mv2GZjNZa0xNk7z28jCqG2EIQakSFGhCAiGg Uho1KAFld9QDotGIBCPMIPokl/L4q7tQw3iR1AjJWUE10XkNfZSPppjkjdXuRIkMg3LI mcHoymXGwIqaQmSGm8aNlHZh1wP9/RAJYDsMZy3fsdGYq/VVKyvjo20BKDUPK5qD+hQS KlTr67DJ30VciLpU73WDN5PRb1dWCv57ZRm0IZm08vnbjHzamVXUfsomgaXUw6nTRtmh JxOw== 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=FmoB+nWf0Q+cbruH2tpnj2Vy3vjhtC6bSzIKf3ZGLORtWNugfmkj3a3y4pgka/BJBr Zxb9msyTeJy2HQMVPOPD/7IpW0Uc4hJPR/L411fuPRYk1eFS3YNVhiJR3RAXGeWe2nK8 +URBUzpBxRtdxbf3wVAO0zSeYrHXFhAHBWPFf3VvMxNbMAW3lUTJEfiVzWx8IiHnR6SQ 9JU4sF8WD+Lvmagr7pQ/eY9ry7lJ0q2a3zB2GmSxD3/geUyK19936W0djzcr/cXtH1Fq /RcRJOEHUSo1Nq9ZEfJkl5QF+VeueHhswEb5PIfqc3yGJf8RrINqOQ5xofhbUm1w+yHt FvrQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=WS55yFiX; 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 j23si19358823eje.21.2021.10.03.20.46.48 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 03 Oct 2021 20:46:49 -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=WS55yFiX; 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 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) 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-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-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 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", };