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 X-Spam-Level: X-Spam-Status: No, score=-15.7 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER, INCLUDES_PATCH,MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 5CFB3C433EF for ; Mon, 13 Sep 2021 09:50:57 +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 8EF6361056 for ; Mon, 13 Sep 2021 09:50:56 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.4.1 mail.kernel.org 8EF6361056 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 6657283A44; Mon, 13 Sep 2021 11:50:54 +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="B9lqrGtx"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id 3ED4883A44; Mon, 13 Sep 2021 11:50:52 +0200 (CEST) Received: from mail-pg1-x534.google.com (mail-pg1-x534.google.com [IPv6:2607:f8b0:4864:20::534]) (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 3B23783365 for ; Mon, 13 Sep 2021 11:50:48 +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-x534.google.com with SMTP id r2so8922329pgl.10 for ; Mon, 13 Sep 2021 02:50:48 -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:mail-followup-to:references :mime-version:content-disposition:in-reply-to; bh=u0sv16VwF0+JiT/m8ceuATxp/pqUAuaGThQZhRZp8e8=; b=B9lqrGtx268uaj2h7YlQ1UKpYDnbRJ1EVhI9KQvhihspVwIvemCVfMdprXRgzuD6uU x9CmgPVrzllUsnUes4yM01Che3o9SoMwyh0YcTJmtLUcra6FpEpA8VrRnW/VkpndGuu3 sAP4BwYkkEOF/S/op4/Rn+f1ovw3MVCP7Ug3OD6PDEGczelX5hLSkv374cuXVkzFemVW adrMgTv8e1sTEv3cg8/a38n11jUS8TBJ21N3OJ5uBrQ0RSV4vNc/M9g8cHlyEnqPeFUd AUUeGw7DGI0WLYjSbWezWsWeWXv8VDNxTE8vrngxdsksPE1VfGwDCPjTLYUnYa+UxceQ VevA== 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=u0sv16VwF0+JiT/m8ceuATxp/pqUAuaGThQZhRZp8e8=; b=UFMR/pfYUNo1Qy6aYRWDG2yu/2vfowooF55Y+xIkdNeTMlvIN3rgG+ZSdxeV0pf1zI 37/Ak3XUlzBYq1SqhTehvfNBSimrADBBPeG27yUXzfbXzHgeoaU4W6FWrOFHS5pd7b99 zfmeQNPdu/4tceuatqic3F5246Gp+eiN29NvAOBrWghNL8sMuDFrPw/FVS3aqR0OM66J occ4v5K5NQTG2wHEAULgXJokJJ383K6h6YkB3OTx2/rmvHJASrlDCwoFwwkZpJFM2ylQ 71A+nAm9fytjEu7t39fofCp61dLby8ZKwgeleXJJsdtLVhMQqAuQHjHVeT0SbrhYH+ce kukw== X-Gm-Message-State: AOAM5301mQfHKgSdVymG7Gp5mjUE/ICANWF2zAlQQevuiv49VaUZaJSv ZlBzfRT4UDZyiSAVo7r8AJ1pKQ== X-Google-Smtp-Source: ABdhPJz893gzey52C7bY649OCNkZjPJxzeIO7qCg+MaX05FllEUH56idAgF2vjC+0RZqGtrKPTVNKw== X-Received: by 2002:a05:6a00:174a:b0:433:9589:bdb5 with SMTP id j10-20020a056a00174a00b004339589bdb5mr10463598pfc.5.1631526646213; Mon, 13 Sep 2021 02:50:46 -0700 (PDT) Received: from laputa (p6e421539.tkyea130.ap.so-net.ne.jp. [110.66.21.57]) by smtp.gmail.com with ESMTPSA id g16sm6820402pfj.19.2021.09.13.02.50.44 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 13 Sep 2021 02:50:45 -0700 (PDT) Date: Mon, 13 Sep 2021 18:50:42 +0900 From: AKASHI Takahiro To: Heinrich Schuchardt Cc: u-boot@lists.denx.de, agraf@csgraf.de, Simon Glass Subject: Re: [PATCH] efi_driver: simplify efi_bl_bind() Message-ID: <20210913095042.GA24512@laputa> Mail-Followup-To: AKASHI Takahiro , Heinrich Schuchardt , u-boot@lists.denx.de, agraf@csgraf.de, Simon Glass References: <20210913060147.18761-1-takahiro.akashi@linaro.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: 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 On Mon, Sep 13, 2021 at 11:19:22AM +0200, Heinrich Schuchardt wrote: > On 9/13/21 8:01 AM, AKASHI Takahiro wrote: > > blk_create_devicef() is what blk_create_device() + > > device_set_name_alloced() really does. > > The resultant name will be a bit changed. > > without the patch after a device has been generated by the UEFI subsystem: > > => dm tree > > Class Index Probed Driver Name > > ----------------------------------------- > root 0 [ + ] root_driver root_driver > mmc 2 [ + ] mmc_sandbox |-- mmc0 > > blk 2 [ + ] mmc_blk | `-- mmc0.blk > blk 3 [ + ] efi_blk `-- efiblk#0 > > with the patch: > > => dm tree > > Class Index Probed Driver Name > > --------------------------------------------------------- > > root 0 [ + ] root_driver root_driver > mmc 2 [ + ] mmc_sandbox |-- mmc0 > > blk 2 [ + ] mmc_blk | `-- mmc0.blk > blk 3 [ + ] efi_blk `-- root_driver.efiblk#0 > > Prepending 'root_driver.' to the name seems to not match the rest of the > tree. Is there anything wrong with the new "name"? blk_create_devicef() creates a name with the parent's name + '.' + a given name. In this case, you specifies the dm root object as the device's parent. So "root_driver.efiblk#0" is a natural name like mmc0.blk and others. Another block device example: root 0 [ + ] root_driver root_driver pci 0 [ + ] pci_generic_ecam |-- pcie@10000000 pci_generi 0 [ ] pci_generic_drv | |-- pci_0:0.0 virtio 32 [ + ] virtio-pci.l | |-- virtio-pci.l#0 ethernet 0 [ + ] virtio-net | | `-- virtio-net#32 ahci 0 [ + ] ahci_pci | `-- ahci_pci scsi 0 [ + ] ahci_scsi | `-- ahci_scsi blk 0 [ ] scsi_blk | |-- ahci_scsi.id0lun0 blk 1 [ ] scsi_blk | `-- ahci_scsi.id1lun0 If you really don't like "root_driver." prefix, you can create the "efi" object as the generic parent for EFI devices, and then you will see "efi.blk#0". (This is also the way[1] that I took in my previous integration patch. But in either way, it's just a name. Who cares. -Takahiro Akashi [1] https://lists.denx.de/pipermail/u-boot/2019-February/357929.html > Best regards > > Heinrich > > > > > Signed-off-by: AKASHI Takahiro > > --- > > lib/efi_driver/efi_block_device.c | 10 +++------- > > 1 file changed, 3 insertions(+), 7 deletions(-) > > > > diff --git a/lib/efi_driver/efi_block_device.c b/lib/efi_driver/efi_block_device.c > > index 0937e3595a43..b81c75868eb4 100644 > > --- a/lib/efi_driver/efi_block_device.c > > +++ b/lib/efi_driver/efi_block_device.c > > @@ -159,15 +159,11 @@ static int efi_bl_bind(efi_handle_t handle, void *interface) > > sprintf(name, "efiblk#%d", devnum); > > > > /* Create driver model udevice for the EFI block io device */ > > - ret = blk_create_device(parent, "efi_blk", name, IF_TYPE_EFI, devnum, > > - io->media->block_size, > > - (lbaint_t)io->media->last_block, &bdev); > > + ret = blk_create_devicef(parent, "efi_blk", name, IF_TYPE_EFI, devnum, > > + io->media->block_size, > > + (lbaint_t)io->media->last_block, &bdev); > > if (ret) > > return ret; > > - if (!bdev) > > - return -ENOENT; > > - /* Set the DM_FLAG_NAME_ALLOCED flag to avoid a memory leak */ > > - device_set_name_alloced(bdev); > > > > plat = dev_get_plat(bdev); > > plat->handle = handle; > > >