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 EFEBFC433EF for ; Mon, 4 Oct 2021 18:40:33 +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 0577261409 for ; Mon, 4 Oct 2021 18:40:32 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.4.1 mail.kernel.org 0577261409 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 0F79781197; Mon, 4 Oct 2021 20:40:30 +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="R5Te0/sM"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id 100D58033A; Mon, 4 Oct 2021 20:40:28 +0200 (CEST) Received: from mail-wr1-x42c.google.com (mail-wr1-x42c.google.com [IPv6:2a00:1450:4864:20::42c]) (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 709D48033A for ; Mon, 4 Oct 2021 20:40:24 +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=ilias.apalodimas@linaro.org Received: by mail-wr1-x42c.google.com with SMTP id j8so2065534wro.7 for ; Mon, 04 Oct 2021 11:40:24 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=date:from:to:cc:subject:message-id:references:mime-version :content-disposition:in-reply-to; bh=QwH7iyo5mQqyvM/OM5dkYVJ5iH9X6NJMYXIxOsmrJGE=; b=R5Te0/sMQekpz2A8kEXwkNygDPh3/hQ8BMboH+m3s598Up/Wpjg93IJQuYtNhoottA k1nhEJ/Uk4RawfZBNgDCMUxlHl14W+xXqWEzsMoXJCSRkrpgVGk16VwBdIXDMcx7kfCc fxdm8oYS+8kukahJEa5fdhuPR/054VocjEPxdBv0YV/qWG4bvLmidc0rAYEEe1nL+Ybw IVYaxQ7JwLe+kF68lJVxNyQlEFC7ITxBc1Be52G7JkWXtQ76cxgJ4rbeO6pt8Qro7tto vO8M/7/WpZJp262Hs3XIutuG4Xx6ahMZOF4u9cl1P4R2HHUKWKEBZOyJOObOe2KdAjMV 8oLw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:date:from:to:cc:subject:message-id:references :mime-version:content-disposition:in-reply-to; bh=QwH7iyo5mQqyvM/OM5dkYVJ5iH9X6NJMYXIxOsmrJGE=; b=6yxQwZTm0Wejdv8zEtarWtWZ2F6+gy/Ruwas4C6nX1aoJQhWrJQ2gxCI7AKu07UUJf BLqGMmJzve1YF4M8Lb1gpT86rKyiTiTzS6cI2I4Nuesbf4W7NTgl4Km6pDKfI5lzmDm6 y0aT5puoIFNzQt7Wurg/rh6yJprSzCPQuC/i655xND5Ae2ZjOu7V7+qo0cw5gvDRAMiv Vv5BZ+jEdhc5DHufVjvvCh1M1DDruE7GAiOVdSMjN4KvBxP2NNmBO5fUdXKk3DVVEcQj ejz0xEaU4uufdgLWCvdKMaZAqHeq4BmwubVK21kpHvgKKeSMRPxS6ZDBSY6xga4/wN6n UAMw== X-Gm-Message-State: AOAM530wevV8/q+Hg14woEDwPV4AfebG9wl9aO6IHiec42pjx6i4LqlC 0Tdx9qlJPri2yw0lqlXs1gOHyg== X-Google-Smtp-Source: ABdhPJzHka9B/h6UZL3cFWlRoof9jSR4lZnz87cfkd+wYHVWIBuArwBtf/Kw6NN6D4KgHMc8n3FYEA== X-Received: by 2002:adf:a350:: with SMTP id d16mr16620450wrb.136.1633372823973; Mon, 04 Oct 2021 11:40:23 -0700 (PDT) Received: from enceladus (ppp-94-66-220-209.home.otenet.gr. [94.66.220.209]) by smtp.gmail.com with ESMTPSA id x10sm14035378wmk.42.2021.10.04.11.40.23 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 04 Oct 2021 11:40:23 -0700 (PDT) Date: Mon, 4 Oct 2021 21:40:21 +0300 From: Ilias Apalodimas To: AKASHI Takahiro Cc: xypron.glpk@gmx.de, agraf@csgraf.de, sjg@chromium.org, u-boot@lists.denx.de Subject: Re: [resent RFC 08/22] dm: blk: add UCLASS_PARTITION Message-ID: References: <20211004034430.41355-1-takahiro.akashi@linaro.org> <20211004034430.41355-9-takahiro.akashi@linaro.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20211004034430.41355-9-takahiro.akashi@linaro.org> 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 Hi Akashi-san, > [...] > +int blk_create_partitions(struct udevice *parent) > +{ > + int part, count; > + struct blk_desc *desc = dev_get_uclass_plat(parent); > + struct disk_partition info; > + struct disk_part *part_data; > + char devname[32]; > + struct udevice *dev; > + int ret; > + > + if (!CONFIG_IS_ENABLED(PARTITIONS) || > + !CONFIG_IS_ENABLED(HAVE_BLOCK_DEVICE)) > + return 0; Would it make more sense to return an error here? > + > + /* Add devices for each partition */ > + for (count = 0, part = 1; part <= MAX_SEARCH_PARTITIONS; part++) { > + if (part_get_info(desc, part, &info)) > + continue; > + snprintf(devname, sizeof(devname), "%s:%d", parent->name, > + part); > + > + ret = device_bind_driver(parent, "blk_partition", > + strdup(devname), &dev); > + if (ret) > + return ret; > + > + part_data = dev_get_uclass_plat(dev); > + part_data->partnum = part; > + part_data->gpt_part_info = info; > + count++; > + > + device_probe(dev); Probe can fail. > + } > + debug("%s: %d partitions found in %s\n", __func__, count, parent->name); > + > + return 0; > +} > + > static int blk_post_probe(struct udevice *dev) > { > if (IS_ENABLED(CONFIG_PARTITIONS) && > @@ -713,3 +752,75 @@ UCLASS_DRIVER(blk) = { > .post_probe = blk_post_probe, > .per_device_plat_auto = sizeof(struct blk_desc), > }; [...] Regards /Ilias