From patchwork Tue Oct 25 03:16:50 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Masahisa Kojima X-Patchwork-Id: 618106 Delivered-To: patch@linaro.org Received: by 2002:a17:522:c983:b0:460:3032:e3c4 with SMTP id kr3csp3124014pvb; Mon, 24 Oct 2022 20:16:35 -0700 (PDT) X-Google-Smtp-Source: AMsMyM6ts/Yj0TMUIA3IQPpt0q4EWlRjg7dvcKzsA6CpuJwsp32+KcPgdYKjFMAmsAsqmqMyoxXL X-Received: by 2002:a50:a44c:0:b0:45c:6451:363d with SMTP id v12-20020a50a44c000000b0045c6451363dmr33667804edb.115.1666667795171; Mon, 24 Oct 2022 20:16:35 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666667795; cv=none; d=google.com; s=arc-20160816; b=fiIldHLjRbqhWu5qyHVEzfg/9h4h/EA6laKFIPaltMjb879LHZ6Rf696rMRONycs3I H8mEFsq+qoq213sqNMp4DrJCPyELuRIycNyavoxF22spZd5rNP/FbpSbkilcSLunT/Fa pHIfv8uNBDQ3hk+3sh0pq1UqVoo/3Xtdlge9ErGjcSpWfuPR9lXBS+iKx8uT6O/XMhtY 9iE5omlfq7utVeWa//2zGlEw/cTgFTUGzJ/7A73YIK3aOCcdS4/yLZpYLCBzkXpZmpF9 H9q9W0p4aJGIcb8XRdY81pfndSRw5T04PSuTcKUrMfZ/MOw4xQDdHWLjupxkODHiKhem a7WQ== 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=eHAWJvXHmKfUiNhJp1xQ5jIhERo7iEczU8XwpeB0SJRBygbRRpVG/VEBYS9IMWj52/ mRYfLTGqMe7GnEbE/ohMkpLxeJMEAiU5J9soiV1cj/H4GeQNBf0OoORvIjxWeStexF6n /W43sOUMldsu+jYEVA4bBCrHFKXYYGRx3B/tlirhnGW3SUYWpvXj6E+LKDTHx5TWqSMi 47LE5UI8KrKeACb7zf/wBTs2KFdsrlzmX0E5Df61NrvNsR9G8srhBTClmWhCxgRP5Xdn 2O3VSct3m6Lp7gPmsHvqahhUkKbcnlXho8s4a6ZvbgQOF+TFZIpHofyZMM3IC0FdoCv6 9aqg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=ZTcLiU1l; spf=pass (google.com: domain of u-boot-bounces@lists.denx.de designates 2a01:238:438b:c500:173d:9f52:ddab:ee01 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. [2a01:238:438b:c500:173d:9f52:ddab:ee01]) by mx.google.com with ESMTPS id hq22-20020a1709073f1600b007a1d4f0e7fcsi1671963ejc.655.2022.10.24.20.16.34 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 24 Oct 2022 20:16:35 -0700 (PDT) Received-SPF: pass (google.com: domain of u-boot-bounces@lists.denx.de designates 2a01:238:438b:c500:173d:9f52:ddab:ee01 as permitted sender) client-ip=2a01:238:438b:c500:173d:9f52:ddab:ee01; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=ZTcLiU1l; spf=pass (google.com: domain of u-boot-bounces@lists.denx.de designates 2a01:238:438b:c500:173d:9f52:ddab:ee01 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 2C1AB841CD; Tue, 25 Oct 2022 05:16:29 +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="ZTcLiU1l"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id DB6C880F10; Tue, 25 Oct 2022 05:16:25 +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 autolearn=ham autolearn_force=no version=3.4.2 Received: from mail-pg1-x52b.google.com (mail-pg1-x52b.google.com [IPv6:2607:f8b0:4864:20::52b]) (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 8A61980F10 for ; Tue, 25 Oct 2022 05:16:22 +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=masahisa.kojima@linaro.org Received: by mail-pg1-x52b.google.com with SMTP id f9so5973209pgj.2 for ; Mon, 24 Oct 2022 20:16:22 -0700 (PDT) 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=ZTcLiU1l2bcdpbOxyqt8mNBBtLZBBbmbaxnxD9iPoIMO76JoPUu+4tEv+8M+Avmvzf HdJUXdk3c3tC2zzx7ImlW/ywN/aQOjGnAFhunjecxaQfPG1D5N3cAD5pFRKAivmu1ML1 Arz2Belfi+mWwuI6Vpj/gMiRDAcEH2G4d4Y2pD4v20YV8iUi/i0OfcWKveC4kuxHYsXn m8XCLtH38f+8Z474xOTYNxoEGN220zGsoZygjXoic2NLMxkXzzVGSnbzYVnyQZoRxx3Z 2udimYCyIpcVIF/zeQcRT3LP7gSmAkgj3h8wtAgkT1BldITuA0IAenjRpAZfNXveyL2p RDSA== 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=QasRT9sk5p39nCAj6Fc7/NLRJyb3YZaXSEF6F2V4JEAHxwAybhrBNQQEG7g89p28Z/ jjZ4SbnprDDae4yDG8+HGxNoEUi7x5jm94nwkqRB/FMQ/FHpb/vROh83m7imJnH8uWGD sRNStojPWO3Oz3wnJ8NqB4sAQDuKX139kkAem4oW52wEec73/D8hFj+0s5cSkC+yMvhI tBJoY/kwr0Le4d1jsfCH+8bd2jBhpfoJYuklcUxYyzcWzr/f5zyx5QWOI1SLwTBcesMa dtC52Lu+nFoyE9EA01viM1Lpw15zOS7/Fgta5YZqWdyTjwyabDdqbWn28C8HUOU3Gbo1 cyZg== X-Gm-Message-State: ACrzQf2+d1Fve1KY1ltPcQPpZkCGkJYs4fMdH6jeCpYfG+G1M0SggxEa q9BVwk2O3cki8GnLk+7rAiGv8Pm9NfeJAg== X-Received: by 2002:a65:6e47:0:b0:438:c2f0:c0eb with SMTP id be7-20020a656e47000000b00438c2f0c0ebmr30995278pgb.236.1666667780672; Mon, 24 Oct 2022 20:16:20 -0700 (PDT) Received: from localhost.localdomain ([240d:1a:cf7:5800:82fa:5bff:fe4b:26b1]) by smtp.gmail.com with ESMTPSA id w2-20020a170902e88200b00181e55d02dcsm391262plg.139.2022.10.24.20.16.18 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 24 Oct 2022 20:16:20 -0700 (PDT) From: Masahisa Kojima To: u-boot@lists.denx.de Cc: Heinrich Schuchardt , Ilias Apalodimas , Simon Glass , Takahiro Akashi , Masahisa Kojima Subject: [PATCH v5 1/5] eficonfig: refactor eficonfig_select_file_handler() Date: Tue, 25 Oct 2022 12:16:50 +0900 Message-Id: <20221025031654.22321-2-masahisa.kojima@linaro.org> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20221025031654.22321-1-masahisa.kojima@linaro.org> References: <20221025031654.22321-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)