From patchwork Tue Apr 19 01:05:13 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: AKASHI Takahiro X-Patchwork-Id: 563300 Delivered-To: patch@linaro.org Received: by 2002:a05:7000:6886:0:0:0:0 with SMTP id m6csp2860713map; Mon, 18 Apr 2022 18:06:58 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwUeV2D7XwNZLnFM1qXuDYTZC4fByg31pzZgP7auKDCdW7JmUBXGvJjIC9I9JbTWaKhOEAa X-Received: by 2002:a17:907:a0c8:b0:6e8:b135:c864 with SMTP id hw8-20020a170907a0c800b006e8b135c864mr11181649ejc.233.1650330418286; Mon, 18 Apr 2022 18:06:58 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1650330418; cv=none; d=google.com; s=arc-20160816; b=u9WTe2nrXGPHpL9RK54D8YcMEyxwqizDlTQYpD/YyrF63VOIP20b2kf3ol1yEJrecz AojZ/vFEB1Vu/2JGek0bApPezB7aAM9Ftp8auzMoyZdPebkOUKGPdfWf/aBqZbt+dQWO JXyz2xVWO/Z3N6x/jcP8fEaeBw88tylfhE6QacFPrtrlCkzwLDgp/ywrHes/jJfuNuYU m6P0gz+QTm0wh/dlv1WnWbDlWEnOn0T4SBlPW5StFod0opzS7UMN1fcsCEvS1AsNAsYn q1jAQKRrdDLAeAWh9qrD/S1QIpupJgNj9zH41rMxmdTppvq7xPdU6QWLNT54kKBdyVZl zJ6w== 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=Nt/Gx/asliM1fmAmHe7XOSmmirkMPeFtf3dIXg04b5BLGmZ+9G4TdFmJOCPzCAm1xT hxNWQPjq1cCtSE1pPUeavhIjTU8+BSXC1/zZj4V2jW4W/dNjcb2kFjaiIJ/kXHO68tjx cG08XlqDttmGK90ZaNMFWdBKcCQPxvP9+U4cMkUUNAN7XivrFV3g80/HLr3uqtqRt7Vz 4WYvRhaXJhoqyvzSL+Q5dRAvf4RtP9wyrdOLGthAyulvOENaQxVCSLg84jbZWYMIcVZD vJ8gmZdkKdNPEaBUaCwVW9r5N/xo+8uEwAzdG9bPClDm7IEPBvuhswJkCU41ScbCHg4R etLw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=znSPGsk3; 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 bl2-20020a170906c24200b006e86bbe41a9si7359080ejb.112.2022.04.18.18.06.58 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 18 Apr 2022 18:06:58 -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=znSPGsk3; 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 67EDB83B3D; Tue, 19 Apr 2022 03:06:40 +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="znSPGsk3"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id 11A5183C7B; Tue, 19 Apr 2022 03:06:10 +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-pl1-x62e.google.com (mail-pl1-x62e.google.com [IPv6:2607:f8b0:4864:20::62e]) (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 EF3DA83B4E for ; Tue, 19 Apr 2022 03:05:58 +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-x62e.google.com with SMTP id v12so13738143plv.4 for ; Mon, 18 Apr 2022 18:05:58 -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=znSPGsk3hLRPEkvKTl9juCveLElJTDYj1gimMfREzD7fIsJJiGXJHvy6/jA2GcXQrR qW/JUCe3jEG+D7nLwOV8qXeKsaWqAaBbL1UO2nAFI1Q3KIKwy7WMb4vKpa6s0BGuoeko 8Wau1Q0buFFfuslZD/vPQDaO3c4mYvzI5RO9MWYa3omeQ6i+NCaeJNnTwWHhZikSUA3r QMQxKxiv8PBB9mCHDs3bwW/snOJT1AiPA3C4c3ynZFQP/mnuItJvPyvJw/OhABmkDrke mCjjIySkPgGYtfzHZipVyzC79P9+Zq4R9SaEb+5w9h8jlLNz4zwZe0E4FHNu+Ev9PGuz ZvMA== 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=Y3FR3bmILkh05PX5KklK3FcEauchIJFrbjENG9P68/PuW4k+jZMjyTNAmpsNVHXIRy nCuhtyXCmPjGmlG7ssH+mJc41MmjYF2iwPG9871LpCdbCnJI56wvYBiGPOFEXS5iVY8s N3n9epxYrGO0MOdYs7uuykssMk5R9yBnGvFTAQtRjbXZ8+RRybT8loi/5dgw54HrACKK yPMSy/dP3lzWBTNdGZhpvUd6bApH7K05is8iaJorSoJAfoW3Hlzo4XbS7Lmek6Nous1y jeleHj0pjQgkuq0X7zkBD+BquoSd48Camjuarcp6cxGSVE/v6vpSBQBIZtWolRHOGzAi QZ+Q== X-Gm-Message-State: AOAM533TJkl+HDq+AahT9D1sV19PMF5vCx5i6wiphNeEj+7V4p7TJNsu t6puArMldg9wgGeVttn1oUWw+VukqYAVQA== X-Received: by 2002:a17:902:e8c6:b0:158:f809:311f with SMTP id v6-20020a170902e8c600b00158f809311fmr8934625plg.4.1650330357340; Mon, 18 Apr 2022 18:05:57 -0700 (PDT) Received: from localhost.localdomain ([2400:4050:c3e1:100:5858:d3a6:5cad:ceeb]) by smtp.gmail.com with ESMTPSA id k137-20020a633d8f000000b0039800918b00sm14043756pga.77.2022.04.18.18.05.55 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 18 Apr 2022 18:05:57 -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 v5 08/12] efi_loader: disk: not create BLK device for BLK(IF_TYPE_EFI_LOADER) devices Date: Tue, 19 Apr 2022 10:05:13 +0900 Message-Id: <20220419010517.47175-9-takahiro.akashi@linaro.org> X-Mailer: git-send-email 2.33.0 In-Reply-To: <20220419010517.47175-1-takahiro.akashi@linaro.org> References: <20220419010517.47175-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);