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 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 smtp.lore.kernel.org (Postfix) with ESMTPS id DAD7EC433F5 for ; Thu, 6 Jan 2022 06:59:56 +0000 (UTC) Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) by phobos.denx.de (Postfix) with ESMTP id 29B5C83053; Thu, 6 Jan 2022 07:59:54 +0100 (CET) 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="A6RJueU4"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id 570FC83063; Thu, 6 Jan 2022 07:59:52 +0100 (CET) Received: from mail-pj1-x102a.google.com (mail-pj1-x102a.google.com [IPv6:2607:f8b0:4864:20::102a]) (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 5E12082DA1 for ; Thu, 6 Jan 2022 07:59:49 +0100 (CET) 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-x102a.google.com with SMTP id rj2-20020a17090b3e8200b001b1944bad25so2212440pjb.5 for ; Wed, 05 Jan 2022 22:59:49 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=date:from:to:cc:subject:message-id:mail-followup-to:references :mime-version:content-disposition:in-reply-to; bh=2y77JFFTr6Xp+UGWacZWsA2yYmaOPYZkIZyWrWSt0cg=; b=A6RJueU4VnOwyX2vA+wGLbr3ttDynbsqNG+xirt5r7AzM6b0HD0i/0Kg6lUZHfNLi4 2j0H+hjHeUebqLD0x1VhVNhq/bIgt8AmVPpDjkzSlYTp72PPj3Rhfgq3RGkDthh4z9Ly OH+5iDbN7EGqi3xY5zN+uiH2z+MfOzGuw4GhYIIF35aKOuvQ+BvEj4z0OsPm1sFIfgTX xMvEUx/KMS0XnCzwHOIRCvOQ8xj8nAksZ7HYjO4F2istSzny7UvdPbBsfygSPYxXRIGy w2KYwDsBaaiHv/6dWyLEm6U9YSJ91kHkwcytyzLC2ExUsr86rtgrU1gcL1ng7/CglfNn WiXQ== 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 :mail-followup-to:references:mime-version:content-disposition :in-reply-to; bh=2y77JFFTr6Xp+UGWacZWsA2yYmaOPYZkIZyWrWSt0cg=; b=c8e2nHspEZ1dO9VBsKwgowZei9OsrriTMc9nsEJtPuaNwajURg2OFWEnq/BjKA94Q9 mS03PbWif5WJxtcVYt9xPiaMnly8WkJUr44PERw/g7MX4Xab6iy4IWrH/mtKbCpDFlpQ xRRlZTVFB1KhjDTh1+VWn8XphTDbaPQ1mbk19Z0ygn7CrHlNVW3k0FmfxYXECPrSLr/1 T8Sb2uilHwhhU3uCDOtN9daF7E56qeICoOWZc95QNv27dmHBIy2fP1nIBFZnOT9Sdyhe 5zzXWeXlbZsqbaC6QYcx8XmYBU6WQOdypor5ncAKKoYVJ3tdA0dGp9xk1jB9vpgAmgDp KA0w== X-Gm-Message-State: AOAM533+EB+BBzhm5zkzxxLQHnk4N0tcM+NBrwN6mjLRcSRLuAejxHuq CePugvo29nQ3QlcdGoVxr7s7rQ== X-Google-Smtp-Source: ABdhPJxkHtCqfgI93D0r4mv5MxZxEA8sXmc6sBUtFtgqkGAPuB79EKzbn2Mo60gT6yfPdB2AKgxZTw== X-Received: by 2002:a17:90a:fd0e:: with SMTP id cv14mr3068828pjb.197.1641452387675; Wed, 05 Jan 2022 22:59:47 -0800 (PST) Received: from laputa ([2400:4050:c3e1:100:9127:7a05:487c:d781]) by smtp.gmail.com with ESMTPSA id h15sm1199066pfq.0.2022.01.05.22.59.45 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 05 Jan 2022 22:59:47 -0800 (PST) Date: Thu, 6 Jan 2022 15:59:43 +0900 From: AKASHI Takahiro To: Heinrich Schuchardt Cc: masami.hiramatsu@linaro.org, u-boot@lists.denx.de, agraf@csgraf.de, sjg@chromium.org, ilias.apalodimas@linaro.org Subject: Re: [RFC v2 19/20] efi_loader: disk: not create BLK device for BLK(IF_TYPE_EFI) devices Message-ID: <20220106065943.GD45004@laputa> Mail-Followup-To: AKASHI Takahiro , Heinrich Schuchardt , masami.hiramatsu@linaro.org, u-boot@lists.denx.de, agraf@csgraf.de, sjg@chromium.org, ilias.apalodimas@linaro.org References: <20211210064947.73361-1-takahiro.akashi@linaro.org> <20211210064947.73361-20-takahiro.akashi@linaro.org> <520fad14-8023-93dd-205c-fe0dc5f2315e@gmx.de> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <520fad14-8023-93dd-205c-fe0dc5f2315e@gmx.de> X-BeenThere: u-boot@lists.denx.de X-Mailman-Version: 2.1.38 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 On Sun, Jan 02, 2022 at 10:19:21AM +0100, Heinrich Schuchardt wrote: > On 12/10/21 07:49, AKASHI Takahiro wrote: > > 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 > > I assume this is IF_TYPE_EFI_LOADER now? Yes in v2022.01-rc4 and later. -Takahiro Akashi > Best regards > > Heinrich > > > 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 > > --- > > lib/efi_loader/efi_disk.c | 22 +++++++++++++++++----- > > 1 file changed, 17 insertions(+), 5 deletions(-) > > > > diff --git a/lib/efi_loader/efi_disk.c b/lib/efi_loader/efi_disk.c > > index 8e33af76711f..f37f8c1ab0f1 100644 > > --- a/lib/efi_loader/efi_disk.c > > +++ b/lib/efi_loader/efi_disk.c > > @@ -603,6 +603,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; > > > > @@ -616,9 +617,16 @@ static int efi_disk_probe(void *ctx, struct event *event) > > 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) { > > + ret = efi_disk_create_raw(dev); > > + if (ret) > > + return -1; > > + } > > > > device_foreach_child(child, dev) { > > ret = efi_disk_create_part(child); > > @@ -642,13 +650,17 @@ static int efi_disk_probe(void *ctx, struct event *event) > > static int efi_disk_delete_raw(struct udevice *dev) > > { > > efi_handle_t handle; > > + struct blk_desc *desc; > > struct efi_disk_obj *diskobj; > > > > if (dev_tag_get_ptr(dev, DM_TAG_EFI, (void **)&handle)) > > return -1; > > > > - diskobj = container_of(handle, struct efi_disk_obj, header); > > - efi_free_pool(diskobj->dp); > > + desc = dev_get_uclass_plat(dev); > > + if (desc->if_type != IF_TYPE_EFI) { > > + diskobj = container_of(handle, struct efi_disk_obj, header); > > + efi_free_pool(diskobj->dp); > > + } > > > > efi_delete_handle(handle); > > dev_tag_del(dev, DM_TAG_EFI); >