From patchwork Sun Oct 22 12:45:08 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Heinrich Schuchardt X-Patchwork-Id: 829039 X-Patchwork-Delegate: agraf@suse.de Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=none (mailfrom) smtp.mailfrom=lists.denx.de (client-ip=81.169.180.215; helo=lists.denx.de; envelope-from=u-boot-bounces@lists.denx.de; receiver=) Received: from lists.denx.de (dione.denx.de [81.169.180.215]) by ozlabs.org (Postfix) with ESMTP id 3yKfXt0QWxz9sRm for ; Sun, 22 Oct 2017 23:51:10 +1100 (AEDT) Received: by lists.denx.de (Postfix, from userid 105) id CB381C22011; Sun, 22 Oct 2017 12:48:57 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on lists.denx.de X-Spam-Level: X-Spam-Status: No, score=0.0 required=5.0 tests=FREEMAIL_FROM autolearn=unavailable autolearn_force=no version=3.4.0 Received: from lists.denx.de (localhost [IPv6:::1]) by lists.denx.de (Postfix) with ESMTP id 3D003C21FF2; Sun, 22 Oct 2017 12:46:23 +0000 (UTC) Received: by lists.denx.de (Postfix, from userid 105) id 09BF6C22020; Sun, 22 Oct 2017 12:46:01 +0000 (UTC) Received: from mout.gmx.net (mout.gmx.net [212.227.15.15]) by lists.denx.de (Postfix) with ESMTPS id C3E12C22025 for ; Sun, 22 Oct 2017 12:45:57 +0000 (UTC) Received: from workstation4.fritz.box ([94.114.42.150]) by mail.gmx.com (mrgmx002 [212.227.17.184]) with ESMTPSA (Nemesis) id 0MId0S-1e43m81qgK-002EyN; Sun, 22 Oct 2017 14:45:48 +0200 From: Heinrich Schuchardt To: Alexander Graf Date: Sun, 22 Oct 2017 14:45:08 +0200 Message-Id: <20171022124508.12653-10-xypron.glpk@gmx.de> X-Mailer: git-send-email 2.14.2 In-Reply-To: <20171022124508.12653-1-xypron.glpk@gmx.de> References: <20171022124508.12653-1-xypron.glpk@gmx.de> X-Provags-ID: V03:K0:TIuSGbtXk70fNqA+pst4x7Rv0+2WQUlj4HXFcbjYmtgs4yAFX4k f7tjnKyWw5mqjeNW5SXux2oZnqKCX4L9fGV4rDUzydlPn45vc2vlXKBMMs8XgNIsZg5HFHp PIz6mBR9hK5yA7squc+/VVKRwl0rQDbs01MiQYESgOwnipVOwzlpPzgIAWJE3DpbSuhsaOm JVGTouCm0WYT9kfnQptdw== X-UI-Out-Filterresults: notjunk:1; V01:K0:kxVfgCwQpiI=:HyE9+iMoZr8LWibtXP+EmP Q280FwuB9v9xU6Ek5U18pbdASA8SU3pGldMcMpBFWMAnL8hbuGbUlrkOvEMbukblVLAbXqCJd QPm7NQh0vuYuj9GzSQZf3nm7ABzUx5xhe+ddlinj4mt/GQy7nPZqtuqufsUPiwJy58zYeg1Q3 IZgzGjt9WJ8aeMAnhDB4xq/hZnW6g4+AnrQlCrNcMySPoDiXMWuhVNH0UiNjeCFq90ZVFh5V9 2gVOwHOHQvIs/u8dUZiomh77ixzNXmCKCM2ZkPD8aVtKTBYVhaUzKn2nk0Chg0X/XxaFprMPB qMdVEyGC1mGaURca07ZZ7KDrhvfIjcHcKEuUF7bkBKF56RjETbhqWpyW9lY/RpDNJVgGYuysg Z9SxRTO6TWZNX9jPHHgnt6OhyjNvvieF3OC2QPvQsuV3ZYL2GMF0spIQit56X1MTsB0jS287x TYP62Pdn1bM7pHO+71htdkSdppFK8c3aHWre+IaCW9Q1XTNAp1jzhcRSjkeMfqc5puDjxTjXj KpC06xSxKxpujFny8VJucSeIFWj7HeOfN+J0bA+jJ+9OqqHaYqwDFuJOYdreOXHI1AKHt3Mi7 IqlWkZ4SxbZAJciv/1RiLo0iDfW2lt/MDb7a7Hep+iut4bUqn/B4DoaBkLDaDu99HVromTQY1 /EeDDkJvZs6kBmiKpbcMOvCQjM48Zef0/0sgFZsMigmA/ZCTLGe431++sVgs5rgWg4rcS3tJf ViBpl+htZwWiMWBRpW3/Jzsw3t7/96EnMATHpMHZUVQ8Gsl5SW5UTOkvbK5cau6fqACbcc5jp uZLSda90WRSETRl+r3lRzbvXHiZUw== Cc: u-boot@lists.denx.de, Heinrich Schuchardt Subject: [U-Boot] [PATCH 9/9] efi_loader: rework efi_search_obj X-BeenThere: u-boot@lists.denx.de X-Mailman-Version: 2.1.18 Precedence: list List-Id: U-Boot discussion List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Errors-To: u-boot-bounces@lists.denx.de Sender: "U-Boot" EFI_HANDLEs are used both in boottime and in runtime services. efi_search_obj is a function that can be used to validate handles. So let's make it accessible via efi_loader.h. We can simplify the coding using list_for_each_entry. Signed-off-by: Heinrich Schuchardt Reviewed-by: Simon Glass --- include/efi_loader.h | 2 ++ lib/efi_loader/efi_boottime.c | 9 +++------ 2 files changed, 5 insertions(+), 6 deletions(-) diff --git a/include/efi_loader.h b/include/efi_loader.h index e3d1c35930..2bcca3dfd8 100644 --- a/include/efi_loader.h +++ b/include/efi_loader.h @@ -192,6 +192,8 @@ void efi_restore_gd(void); void efi_runtime_relocate(ulong offset, struct efi_mem_desc *map); /* Call this to set the current device name */ void efi_set_bootdev(const char *dev, const char *devnr, const char *path); +/* Call this to validate a handle and find the EFI object for it */ +struct efi_object *efi_search_obj(void *handle); /* Call this to create an event */ efi_status_t efi_create_event(uint32_t type, efi_uintn_t notify_tpl, void (EFIAPI *notify_function) ( diff --git a/lib/efi_loader/efi_boottime.c b/lib/efi_loader/efi_boottime.c index b6eebe3b14..bdbed32656 100644 --- a/lib/efi_loader/efi_boottime.c +++ b/lib/efi_loader/efi_boottime.c @@ -684,14 +684,11 @@ static efi_status_t EFIAPI efi_check_event(struct efi_event *event) * @handle handle to find * @return EFI object */ -static struct efi_object *efi_search_obj(void *handle) +struct efi_object *efi_search_obj(void *handle) { - struct list_head *lhandle; - - list_for_each(lhandle, &efi_obj_list) { - struct efi_object *efiobj; + struct efi_object *efiobj; - efiobj = list_entry(lhandle, struct efi_object, link); + list_for_each_entry(efiobj, &efi_obj_list, link) { if (efiobj->handle == handle) return efiobj; }