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 1B882C433FE for ; Wed, 5 Oct 2022 08:49:38 +0000 (UTC) Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) by phobos.denx.de (Postfix) with ESMTP id F350784CA9; Wed, 5 Oct 2022 10:49:36 +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="hYr5nkYI"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id ED48F84CDE; Wed, 5 Oct 2022 10:49:34 +0200 (CEST) Received: from mail-ej1-x62f.google.com (mail-ej1-x62f.google.com [IPv6:2a00:1450:4864:20::62f]) (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 7DD4C848DC for ; Wed, 5 Oct 2022 10:49:32 +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-ej1-x62f.google.com with SMTP id 13so34007138ejn.3 for ; Wed, 05 Oct 2022 01:49:32 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=in-reply-to:content-disposition:mime-version:references:message-id :subject:cc:from:date:from:to:cc:subject:date; bh=ExTMczTGqoWoLLZGDtHiCup2m7lrSUe5Tr0Pp3b4c7o=; b=hYr5nkYIxasW5yCmJ+kfNfq9xtHkXPn06a3sZ4IPPlET2eGqsGFTBhOOpkcb/RDHvp dIjT8KpGJnkwTC5Kt2Pe39unLMcD0WMRorDWWYvVhus0C5HFR1iU3se41W0jRsKGFpwT HiyhGEf+174odwYXxcp12BYWihsBa2u4Ow0ZIaiRHZPibs0lBz+Ag27xABnex8f+hQ0j SCrRT8hjXB2dCRppPBjbdKrzGS5vC3cuFjfH0ner2T5woxpu81sjwPavaISkGrurUBqb S1JoGHT0nthBBBYZcQ9WL82zNd7oUiQvkokPw/Vnb9BACf+UcTA0GQXzf1zNv/BidPgF /wDg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=in-reply-to:content-disposition:mime-version:references:message-id :subject:cc:from:date:x-gm-message-state:from:to:cc:subject:date; bh=ExTMczTGqoWoLLZGDtHiCup2m7lrSUe5Tr0Pp3b4c7o=; b=EOJBoNV1XIxAVfgvBJaF7bL0woedL4AVOq1qjB0zDH93w3wzuJhytbjzJH+sujX3Hv Z08dVlZbesv3ew9kmKQ1tB0LoeHUuyTl3qT+AEEgYMBZuUrcQpCaRfyOlfvVj4o22yqw CwWvD/lsItJ4PAq9RZW7moPckjO4nHzVthNK7TmBmOOqIe2KaodN1a1b8p7B5HBfDGNF yo8vabpnT5+N0uNEtRU/j6q2Y4h4xv1FPEYqonyUocJglARpPRMm8XIXTl3aW6Ej//QM LTcUztzRotj7GChYe63IvfqAHRPwyGGEnCx+cZedmgGIOYKLIARrvGYOrJsWtYKfk05c hWMg== X-Gm-Message-State: ACrzQf2MUKHSOtfsTKfnT3WKhdpXY3kkqdsrQqjoGnws1nY1+a46JPqc U9eASHDtGK0DT5xdl02wMeiz35VRDgf15A== X-Google-Smtp-Source: AMsMyM6N6e8AlPrhOFvPU9uLciV2VcOytrkxSPjuqg/Gb6tYErmCQJs6+sjE3ywTf3YvFETtwfceoA== X-Received: by 2002:a17:907:980b:b0:783:6e65:c0c7 with SMTP id ji11-20020a170907980b00b007836e65c0c7mr21963817ejc.355.1664959772115; Wed, 05 Oct 2022 01:49:32 -0700 (PDT) Received: from hades (ppp046103015185.access.hol.gr. [46.103.15.185]) by smtp.gmail.com with ESMTPSA id n10-20020a170906378a00b0078175601630sm8216338ejc.79.2022.10.05.01.49.31 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 05 Oct 2022 01:49:31 -0700 (PDT) Date: Wed, 5 Oct 2022 11:49:29 +0300 From: Ilias Apalodimas Cc: u-boot@lists.denx.de Subject: Re: [PATCH 1/1] efi_driver: carve out function to create block device Message-ID: References: <20221004142925.133557-1-heinrich.schuchardt@canonical.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20221004142925.133557-1-heinrich.schuchardt@canonical.com> 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.6 at phobos.denx.de X-Virus-Status: Clean Hi Heinrich, On Tue, Oct 04, 2022 at 04:29:25PM +0200, Heinrich Schuchardt wrote: > * Carve out function efi_bl_create_block_device() from efi_bl_bind(). > * Add a check for U-Boot devices to efi_bl_bind(). What the code does is obvious here, can we slightly change the commit message and explain why this is needed? Readability? > > Signed-off-by: Heinrich Schuchardt > --- > lib/efi_driver/efi_block_device.c | 32 ++++++++++++++++++++++++------- > lib/efi_driver/efi_uclass.c | 9 --------- > 2 files changed, 25 insertions(+), 16 deletions(-) > > diff --git a/lib/efi_driver/efi_block_device.c b/lib/efi_driver/efi_block_device.c > index 9ccc148590..3103040870 100644 > --- a/lib/efi_driver/efi_block_device.c > +++ b/lib/efi_driver/efi_block_device.c > @@ -114,21 +114,16 @@ static ulong efi_bl_write(struct udevice *dev, lbaint_t blknr, lbaint_t blkcnt, > * @interface: block io protocol > * Return: status code > */ > -static efi_status_t efi_bl_bind(efi_handle_t handle, void *interface) > +static efi_status_t > +efi_bl_create_block_device(efi_handle_t handle, void *interface) > { > struct udevice *bdev = NULL, *parent = dm_root(); > efi_status_t ret; > int devnum; > char *name; > - struct efi_object *obj = efi_search_obj(handle); > struct efi_block_io *io = interface; > struct efi_blk_plat *plat; > > - EFI_PRINT("%s: handle %p, interface %p\n", __func__, handle, io); > - > - if (!obj || !interface) > - return EFI_INVALID_PARAMETER; > - > devnum = blk_find_max_devnum(UCLASS_EFI_LOADER); > if (devnum == -ENODEV) > devnum = 0; > @@ -176,6 +171,29 @@ err: > return ret; > } > > +/** > + * efi_bl_bind() - bind to a block io protocol > + * > + * @handle: handle > + * @interface: block io protocol > + * Return: status code > + */ > +static efi_status_t efi_bl_bind(efi_handle_t handle, void *interface) > +{ > + efi_status_t ret; > + struct efi_object *obj = efi_search_obj(handle); > + > + EFI_PRINT("%s: handle %p, interface %p\n", __func__, handle, interface); > + > + if (!obj || !interface) > + return EFI_INVALID_PARAMETER; > + > + if (!handle->dev) > + ret = efi_bl_create_block_device(handle, interface); Keeping in mind devices should usually be bound once (unless we reinit the subsystem) should we print something here? Also ret need to be initialized on the declaration. > + > + return ret; > +} > + > /* Block device driver operators */ > static const struct blk_ops efi_blk_ops = { > .read = efi_bl_read, > -- > 2.37.2 > Thanks /Ilias