From patchwork Fri Apr 15 07:15:42 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: AKASHI Takahiro X-Patchwork-Id: 561943 Delivered-To: patch@linaro.org Received: by 2002:a05:7000:6886:0:0:0:0 with SMTP id m6csp115605map; Fri, 15 Apr 2022 00:17:38 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzLBWfF0iUK1ZXUwTz1k5HfqB/sGgWavgxAcXqvpJv2xhVpWtknzp/hcB9d/wuV2lqh9cd+ X-Received: by 2002:a17:907:629c:b0:6e1:6ad:5dd8 with SMTP id nd28-20020a170907629c00b006e106ad5dd8mr5145248ejc.641.1650007057847; Fri, 15 Apr 2022 00:17:37 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1650007057; cv=none; d=google.com; s=arc-20160816; b=SP/BZti0QlcXOL3RzwuFoOMtKq6hCvluHPve+xVokOG/r/f6tWqS2AqegTcfzm8jXV 7SJEBy05QQmX+hRimmNGaimZAxaJKqPwD26vqMakn56b2qB3PeSBH1W/G4lWvjECZNq6 1KVxM0NiT2s7D9SnSdQhzqxyw54Wo2zU3J1LBHyIf7yYzz4v551URzxNVSfFSDgFwTL0 K/gR5BfhJhrTutmcS7S96ZRG0e6TRITdi2YOgcNrTlOGVL7BclegKVyN3d2mhejPKef7 v9gM/obc96/N7wWzPV78C3po2L3q8H31mtdTAQnU7wzuyNgQ+3T/bNfsfyIXGk5z/h7w EegQ== 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=j/16UycWtqTLoNpUdQHYPcu4PfFK9e8OHWjqkEtJQ2g=; b=Nqrh3pb8GrmO3uAVPEpLwnoaWXpEHHRTj9wWjfx6KKxk7SSjXwz7Y5vplK+6XlkrZf +8kKFLO/XkfRmeFvrozwd8rFPiUzljv0fdeY8GXE/uhHiq/hKANrFZeP9faAdBJDvvLX u4S+UDS0zpwraiWfkGbrrCOxsWe7pTgzjdMwjEoZb2QeXjQb7/IXVO19FwXfj/A1k/dM vT3VEVfIAIm27d8TuhQJIOuwMBX+jJnM6tSKnUtP6cJIPqVg8FU0ysZvgL40ArpvfwOl Xh6pRsi+sP9xmlHWOoJPfQmf0LvcreeyMZ1z4wBOSAg8SVcI8JveVQAOywYVmvpFjcAk JdrQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=cz2WMQ7G; spf=pass (google.com: domain of u-boot-bounces@lists.denx.de designates 85.214.62.61 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. [85.214.62.61]) by mx.google.com with ESMTPS id q20-20020a170906145400b006e86c3056c2si517082ejc.33.2022.04.15.00.17.37 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 15 Apr 2022 00:17:37 -0700 (PDT) Received-SPF: pass (google.com: domain of u-boot-bounces@lists.denx.de designates 85.214.62.61 as permitted sender) client-ip=85.214.62.61; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=cz2WMQ7G; spf=pass (google.com: domain of u-boot-bounces@lists.denx.de designates 85.214.62.61 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 2EA3C83DE7; Fri, 15 Apr 2022 09:16: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=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="cz2WMQ7G"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id E19EC83C8C; Fri, 15 Apr 2022 09:16:37 +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, T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.2 Received: from mail-pg1-x52d.google.com (mail-pg1-x52d.google.com [IPv6:2607:f8b0:4864:20::52d]) (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 149C683B29 for ; Fri, 15 Apr 2022 09:16:35 +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-x52d.google.com with SMTP id k29so6692262pgm.12 for ; Fri, 15 Apr 2022 00:16:35 -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=j/16UycWtqTLoNpUdQHYPcu4PfFK9e8OHWjqkEtJQ2g=; b=cz2WMQ7GwBuvrOq7EWEJNEsMUs12fP0szm+/83UvfKLMC4AhpvFvA1PgYyDXhPKJ2I z39hwuRWCjqzFTQo+Bt2/2exEZWUT6DSVo2yda03ttJY0Bs/VqraJtL3wMj9/tqkhlAt 4VJ9JoLqg7Y6rfflWgfjMnAhUHG33UuK60QhYt9hs3KfwaZgVBsERS00JDsB9Zpi8Luh XYXIRdO82b42QiAXMMSC6BtXE2XTwyaB3r+qpl5fTqbZ6rwnKsFWMJLYDOpSG3Od4xKm 5/ibXkOsmK6ZPU7LAzkoFsln8kApgQuuH9uML7+T1r8X3csOCcyRA2XeR0inci7xQT7l tWvw== 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=j/16UycWtqTLoNpUdQHYPcu4PfFK9e8OHWjqkEtJQ2g=; b=76gDcXHQD+cQeJWd2Fyn/zNtiKsYaOnaD8B1UTZBq2ZGRMHXvYKmVUcRKP0WLIJVjM feObA4iQp0OJXkm7QcAjyNmy56lpVOIlUGo4kebAwAamE0EuZtjxB2+/0NiLMvDMFQh4 wgse99yY77I7L6xfR433P0hVBBDp7OBL0BHPf4fp/JVPSWS+NuTjAL6lbwsx1ahBbdKv zszNUC9x7lvYqSOROeX6XFTZjsZgjR/J7WHFtl8gLMXo3UXWCBnh+klMf4D+PUkDI11R 3lpwhNFgBd5ISqhuUjRMftZsRmPLtye0G3HREgZ+4dj4jvYbdnJOP/SDT2sZ/+4fJAlf D3mg== X-Gm-Message-State: AOAM532sd2175j7I+Z/Wbz0BljZ248e54mgBa46zMkDOlLPDvnNs32he 2z1dXUxZhxncNprI0YClukVzKQ== X-Received: by 2002:a05:6a00:24cf:b0:508:3278:8c21 with SMTP id d15-20020a056a0024cf00b0050832788c21mr5752180pfv.57.1650006993520; Fri, 15 Apr 2022 00:16:33 -0700 (PDT) Received: from localhost.localdomain ([2400:4050:c3e1:100:18f3:1e4:6c4:6ea3]) by smtp.gmail.com with ESMTPSA id p1-20020a17090a0e4100b001ce188720e5sm3566921pja.53.2022.04.15.00.16.31 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 15 Apr 2022 00:16:33 -0700 (PDT) From: AKASHI Takahiro To: xypron.glpk@gmx.de, sjg@chromium.org, ilias.apalodimas@linaro.org Cc: masami.hiramatsu@linaro.org, u-boot@lists.denx.de, AKASHI Takahiro Subject: [PATCH v4 08/12] efi_loader: disk: not create BLK device for BLK(IF_TYPE_EFI_LOADER) devices Date: Fri, 15 Apr 2022 16:15:42 +0900 Message-Id: <20220415071546.122475-9-takahiro.akashi@linaro.org> X-Mailer: git-send-email 2.33.0 In-Reply-To: <20220415071546.122475-1-takahiro.akashi@linaro.org> References: <20220415071546.122475-1-takahiro.akashi@linaro.org> MIME-Version: 1.0 X-BeenThere: u-boot@lists.denx.de X-Mailman-Version: 2.1.39 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.5 at phobos.denx.de X-Virus-Status: Clean When we create an efi_disk device with an UEFI application using driver binding protocol, the 'efi_driver' framework tries to create a corresponding block device(UCLASS_BLK/IF_TYPE_EFI). This will lead to calling a PROBE callback, efi_disk_probe(). In this case, however, we don't need to create another "efi_disk" device as we already have this device instance. So we should avoid recursively invoke further processing in the callback function. Signed-off-by: AKASHI Takahiro Reviewed-by: Simon Glass --- lib/efi_loader/efi_disk.c | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-) diff --git a/lib/efi_loader/efi_disk.c b/lib/efi_loader/efi_disk.c index d4a0edb458b8..037f8594a727 100644 --- a/lib/efi_loader/efi_disk.c +++ b/lib/efi_loader/efi_disk.c @@ -604,6 +604,7 @@ static int efi_disk_probe(void *ctx, struct event *event) { struct udevice *dev; enum uclass_id id; + struct blk_desc *desc; struct udevice *child; int ret; @@ -614,9 +615,16 @@ static int efi_disk_probe(void *ctx, struct event *event) if (id != UCLASS_BLK) return 0; - ret = efi_disk_create_raw(dev); - if (ret) - return -1; + /* + * avoid creating duplicated objects now that efi_driver + * has already created an efi_disk at this moment. + */ + desc = dev_get_uclass_plat(dev); + if (desc->if_type != IF_TYPE_EFI_LOADER) { + ret = efi_disk_create_raw(dev); + if (ret) + return -1; + } device_foreach_child(child, dev) { ret = efi_disk_create_part(child);