From patchwork Wed Nov 9 03:29:00 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Masahisa Kojima X-Patchwork-Id: 622912 Delivered-To: patch@linaro.org Received: by 2002:a17:522:c983:b0:460:3032:e3c4 with SMTP id kr3csp16560pvb; Tue, 8 Nov 2022 19:27:37 -0800 (PST) X-Google-Smtp-Source: AMsMyM7tH900Z6pKnuDlq6VMo1oBoI7uSq1Ou2WlPo44WrrWdk4kdKo2CYNOpNk/pVC1OO+MCWMv X-Received: by 2002:a17:907:60c8:b0:78d:bc8d:8457 with SMTP id hv8-20020a17090760c800b0078dbc8d8457mr53814577ejc.418.1667964457498; Tue, 08 Nov 2022 19:27:37 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1667964457; cv=none; d=google.com; s=arc-20160816; b=xVTTCm/Kj3tAezEk7isuKlxOqZNopa5i1BFXxn/5QU1s8uCVUjrAEDDcdzHwv5wUNp Se5VW+rvlwzMZ7WUXbzims85tpVNXJfYH7SgfeXgnpDEPCw1A1XPZQtgYcK6OQbcxVT/ vOrfOZq3onUV5B8ahQxjVwFPaf2GDimPfbkUXPBaj1fig52b74zd4/H/aAWiZTsZi7Iv WCGV9OP/FvHQ3GON28VGxItknjJV3o2aTISjmMaImZz24me288Uw0H1pDHV/N6qg2cJU T4D6+vdhE26ilQaW8IqtnzYHygq1L9sC/L0X6NMNc1OB8GgtCbHqsuXAn1BkK6uNjEfp Br7g== 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:references:in-reply-to :message-id:date:subject:cc:to:from:dkim-signature; bh=OMsh9Oc0CCknYUovkbuTqB+UsRMDQpThqpMPaS13aiY=; b=pm63i8jSGUQ2MQUtC6PgCRoaGgQuctgmNa54RHTgheZCZMV3UTRgFnelzlvnp3Z7cR joZGtyegUA+UZig951Hqc+rSRVcK85mYpcDZLda2Rxlu9E2AHYfiJercFfP0ymIwvbAX LI8ANUsTMWL5aPgbaozMdT6f89FiYj8mvbr9Ueb/UQiOQ1UwV0BCe3lF7D6lqojOIHBG WPisQpxPJzWvLXawZUvfn2CUOgWd/yt0/YpGwHdapNOMZZPMp/QZlqk7Dg1E+DHF+WeS DXWGh/qinWfQUp6V7ZZvEj0UKNCBNpmTUi4xfBummvUkEXoDOfO5I0Oi4XG+be1fKU87 8akQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=sA2GwzGf; 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 o7-20020a17090608c700b00730aa841c5bsi10009686eje.964.2022.11.08.19.27.36 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 08 Nov 2022 19:27:37 -0800 (PST) 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=sA2GwzGf; 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 9967284FEF; Wed, 9 Nov 2022 04:27:34 +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="sA2GwzGf"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id 150F784FD0; Wed, 9 Nov 2022 04:27:33 +0100 (CET) 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 autolearn=ham autolearn_force=no version=3.4.2 Received: from mail-pj1-x102e.google.com (mail-pj1-x102e.google.com [IPv6:2607:f8b0:4864:20::102e]) (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 4DFA784EEF for ; Wed, 9 Nov 2022 04:27:30 +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=masahisa.kojima@linaro.org Received: by mail-pj1-x102e.google.com with SMTP id h14so15541322pjv.4 for ; Tue, 08 Nov 2022 19:27:30 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=references:in-reply-to:message-id:date:subject:cc:to:from:from:to :cc:subject:date:message-id:reply-to; bh=OMsh9Oc0CCknYUovkbuTqB+UsRMDQpThqpMPaS13aiY=; b=sA2GwzGfEvyTMZyxBtVTyhhowzl7ILMklKT33+LPnGQmuGvWUOBlRrxxTkwaphXreU /9CNrpxN/VOmV3iNb6+GzKS1oMeSD3gsR1/pPCVhGk3SCXnN0Krj0d26NtztylLNpZ7U RwOakUMGXvEHdblSgimLAUrYCIomA18IUtfQLtKBbakft3/XwC9txgSj4A3nk1Ng1ykN +fkzYT+uYh4B4IfJhbWBdmeqTB//c2F2vpNnrS97uS1p4mXI9Z09rdUi6vwtMxrpCO8I IuUy1zlAF7cfza3FLH/ku01XCcwmf2B/bpvQ/DAQXQQq0z8easDvPrA6J05hcsLTKAtS cxhg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=references:in-reply-to:message-id:date:subject:cc:to:from :x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=OMsh9Oc0CCknYUovkbuTqB+UsRMDQpThqpMPaS13aiY=; b=za2OLGHZ9U/hVwSc+OZDQvXDBGQCDYg1B7riS+05+unyc+fQSulvfFQOC12MafU8Fy HEmtERPuEKRwviAbaGz8LgoHz7RKa3rxwFUUsNq/D0TGdYSykyrNu10LSICFT5alyslK DzvS/dKN4gQjgg53hPjEzYE6HXoBG+XIfArAPedxazpehI4kxJJ2cSfvqz2vhfQhb5iA uWNpEoMjARjE6qd52MsoiCLKwYmLJWmt+xgGPTyLByhWqi1oIHarRhtMviapTnRh07WF jtWE1xM78w3JL9swOyeTmCVrDsHCz0DyuTGoegH/tgoU0nPeypu6NI3oRKmrejZVQs3C cfag== X-Gm-Message-State: ACrzQf0+knQq9NLlF2A9iowz/angclkcv3Jwtyzk5EsdCPHLWJxjFLHd CF5dW/vK0c+MkEFn2PD5NIpSHRzL4BFeuQ== X-Received: by 2002:a17:902:eccd:b0:187:143f:4c3c with SMTP id a13-20020a170902eccd00b00187143f4c3cmr53444426plh.143.1667964448389; Tue, 08 Nov 2022 19:27:28 -0800 (PST) Received: from localhost.localdomain ([240d:1a:cf7:5800:82fa:5bff:fe4b:26b1]) by smtp.gmail.com with ESMTPSA id l10-20020a170903120a00b00177faf558b5sm7742103plh.250.2022.11.08.19.27.26 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 08 Nov 2022 19:27:27 -0800 (PST) From: Masahisa Kojima To: u-boot@lists.denx.de Cc: Heinrich Schuchardt , Ilias Apalodimas , Simon Glass , Takahiro Akashi , Etienne Carriere , Masahisa Kojima Subject: [PATCH v6 1/5] eficonfig: refactor eficonfig_select_file_handler() Date: Wed, 9 Nov 2022 12:29:00 +0900 Message-Id: <20221109032904.5361-2-masahisa.kojima@linaro.org> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20221109032904.5361-1-masahisa.kojima@linaro.org> References: <20221109032904.5361-1-masahisa.kojima@linaro.org> 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 eficonfig_select_file_handler() is commonly used to select the file. eficonfig_display_select_file_option() intends to add the additional menu mainly to clear the selected file information. eficonfig_display_select_file_option() is not necessary for the file selection process, so it should be outside of eficonfig_select_file_handler(). Signed-off-by: Masahisa Kojima --- No change since v2 newly created in v2 cmd/eficonfig.c | 13 +++++-------- test/py/tests/test_eficonfig/test_eficonfig.py | 1 + 2 files changed, 6 insertions(+), 8 deletions(-) diff --git a/cmd/eficonfig.c b/cmd/eficonfig.c index 2595dd9563..f6a99bd01a 100644 --- a/cmd/eficonfig.c +++ b/cmd/eficonfig.c @@ -968,7 +968,7 @@ efi_status_t eficonfig_process_clear_file_selection(void *data) } static struct eficonfig_item select_file_menu_items[] = { - {"Select File", eficonfig_process_select_file}, + {"Select File", eficonfig_select_file_handler}, {"Clear", eficonfig_process_clear_file_selection}, {"Quit", eficonfig_process_quit}, }; @@ -980,12 +980,13 @@ static struct eficonfig_item select_file_menu_items[] = { * @file_info: pointer to the file information structure * Return: status code */ -efi_status_t eficonfig_display_select_file_option(struct eficonfig_select_file_info *file_info) +efi_status_t eficonfig_display_select_file_option(void *data) { efi_status_t ret; struct efimenu *efi_menu; - select_file_menu_items[1].data = file_info; + select_file_menu_items[0].data = data; + select_file_menu_items[1].data = data; efi_menu = eficonfig_create_fixed_menu(select_file_menu_items, ARRAY_SIZE(select_file_menu_items)); if (!efi_menu) @@ -1016,10 +1017,6 @@ efi_status_t eficonfig_select_file_handler(void *data) struct eficonfig_select_file_info *tmp = NULL; struct eficonfig_select_file_info *file_info = data; - ret = eficonfig_display_select_file_option(file_info); - if (ret != EFI_SUCCESS) - return ret; - tmp = calloc(1, sizeof(struct eficonfig_select_file_info)); if (!tmp) return EFI_OUT_OF_RESOURCES; @@ -1284,7 +1281,7 @@ static efi_status_t prepare_file_selection_entry(struct efimenu *efi_menu, char utf8_utf16_strcpy(&p, devname); u16_strlcat(file_name, file_info->current_path, len); ret = create_boot_option_entry(efi_menu, title, file_name, - eficonfig_select_file_handler, file_info); + eficonfig_display_select_file_option, file_info); out: free(devname); free(file_name); diff --git a/test/py/tests/test_eficonfig/test_eficonfig.py b/test/py/tests/test_eficonfig/test_eficonfig.py index 99606d9c4b..102bfd7541 100644 --- a/test/py/tests/test_eficonfig/test_eficonfig.py +++ b/test/py/tests/test_eficonfig/test_eficonfig.py @@ -349,6 +349,7 @@ def test_efi_eficonfig(u_boot_console, efi_eficonfig_data): press_up_down_enter_and_wait(0, 1, True, 'Quit') press_up_down_enter_and_wait(0, 0, True, 'No block device found!') press_escape_key(False) + press_escape_key(False) check_current_is_maintenance_menu() # Return to U-Boot console press_escape_key(True)