From patchwork Tue Jan 31 13:21:34 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ard Biesheuvel X-Patchwork-Id: 92990 Delivered-To: patch@linaro.org Received: by 10.140.20.99 with SMTP id 90csp1924177qgi; Tue, 31 Jan 2017 05:28:51 -0800 (PST) X-Received: by 10.99.173.14 with SMTP id g14mr30557070pgf.176.1485869331519; Tue, 31 Jan 2017 05:28:51 -0800 (PST) Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id a87si15946026pfk.200.2017.01.31.05.28.51; Tue, 31 Jan 2017 05:28:51 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-efi-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=neutral (body hash did not verify) header.i=@linaro.org; spf=pass (google.com: best guess record for domain of linux-efi-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-efi-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752098AbdAaN2h (ORCPT + 2 others); Tue, 31 Jan 2017 08:28:37 -0500 Received: from mail-wm0-f42.google.com ([74.125.82.42]:37984 "EHLO mail-wm0-f42.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752072AbdAaN0A (ORCPT ); Tue, 31 Jan 2017 08:26:00 -0500 Received: by mail-wm0-f42.google.com with SMTP id r141so79330045wmg.1 for ; Tue, 31 Jan 2017 05:25:52 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=IY2/WXGrIPW4laOYTOYTKz/gdHrEGpK1j6+9vM3e/BY=; b=dt2DPROt2Ao6L1kMD52jW1oBti9RM1O65a/FmLkE5jTvz0Ei6W3b6TmRS4yfUicCNQ gtwlLgeJ9aoCuws43SaqhtqUv9ZWn8pfkYXaMwO6p82kYR/paTWjm3QFIS335mWcQp6T JPOSnbVxxFhs6uHwhZxACpLsX4LnyJ6OvgGNg= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=IY2/WXGrIPW4laOYTOYTKz/gdHrEGpK1j6+9vM3e/BY=; b=dHukR7RS/aMS+egOthSP/EIHpMHXJH4TzgZ2xSpmQdDP8KexpCMgN5lJq/0z/9wf6P 7qSjNXNcqANFcAEmNMlNWhkn1g4wWKeC+HofGC4lV+1dk9VZXJ8r1WIEfdBrJaNTLuRo CJ8T87syW9RrR1Qm76DflC18V9x2AaPYWzOWAaFuzdifP0+QZiLby9R2dJi5vgM6+xPN tfm2h8T4UItYTB83Q2K6wBcqaUXC8pCgg9oDB1mVwQhlNVU2fdfJJcbabPzdtzR2ylOZ Lvq5mxTs/ZbPhXp/TGu/puvvekH+pbnUqi+xMFpT3AkL+Kcyz008jW9udaLSFypTfXIl 44qQ== X-Gm-Message-State: AIkVDXJGBwWUsyxXNgqCJjLZQkmpVmmRUAkhXAwDAzWLlMLAy905cjrE+8Rjs+9zDfpw1HsT X-Received: by 10.223.164.66 with SMTP id e2mr23333274wra.47.1485869151184; Tue, 31 Jan 2017 05:25:51 -0800 (PST) Received: from localhost.localdomain ([105.130.17.13]) by smtp.gmail.com with ESMTPSA id i73sm23961714wmd.11.2017.01.31.05.25.49 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Tue, 31 Jan 2017 05:25:50 -0800 (PST) From: Ard Biesheuvel To: linux-kernel@vger.kernel.org, Ingo Molnar , Thomas Gleixner , "H . Peter Anvin" Cc: Lukas Wunner , Ard Biesheuvel , linux-efi@vger.kernel.org, Matt Fleming Subject: [PATCH 02/10] x86/efi: Deduplicate efi_char16_printk() Date: Tue, 31 Jan 2017 13:21:34 +0000 Message-Id: <1485868902-20401-3-git-send-email-ard.biesheuvel@linaro.org> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1485868902-20401-1-git-send-email-ard.biesheuvel@linaro.org> References: <1485868902-20401-1-git-send-email-ard.biesheuvel@linaro.org> Sender: linux-efi-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-efi@vger.kernel.org From: Lukas Wunner Eliminate the separate 32 bit and 64 bit code paths by way of the shiny new efi_call_proto() macro. No functional change intended. Signed-off-by: Lukas Wunner Cc: Ard Biesheuvel Signed-off-by: Matt Fleming Signed-off-by: Ard Biesheuvel --- arch/x86/boot/compressed/eboot.c | 26 ++------------------------ include/linux/efi.h | 8 ++++---- 2 files changed, 6 insertions(+), 28 deletions(-) -- 2.7.4 -- To unsubscribe from this list: send the line "unsubscribe linux-efi" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html diff --git a/arch/x86/boot/compressed/eboot.c b/arch/x86/boot/compressed/eboot.c index f1cf284d631e..6d3aeabbce68 100644 --- a/arch/x86/boot/compressed/eboot.c +++ b/arch/x86/boot/compressed/eboot.c @@ -101,30 +101,8 @@ efi_open_volume(efi_system_table_t *sys_table, void *__image, void **__fh) void efi_char16_printk(efi_system_table_t *table, efi_char16_t *str) { - unsigned long output_string; - size_t offset; - - if (efi_early->is64) { - struct efi_simple_text_output_protocol_64 *out; - u64 *func; - - offset = offsetof(typeof(*out), output_string); - output_string = efi_early->text_output + offset; - out = (typeof(out))(unsigned long)efi_early->text_output; - func = (u64 *)output_string; - - efi_early->call(*func, out, str); - } else { - struct efi_simple_text_output_protocol_32 *out; - u32 *func; - - offset = offsetof(typeof(*out), output_string); - output_string = efi_early->text_output + offset; - out = (typeof(out))(unsigned long)efi_early->text_output; - func = (u32 *)output_string; - - efi_early->call(*func, out, str); - } + efi_call_proto(efi_simple_text_output_protocol, output_string, + efi_early->text_output, str); } static efi_status_t diff --git a/include/linux/efi.h b/include/linux/efi.h index 5b1af30ece55..6642c4d9d11d 100644 --- a/include/linux/efi.h +++ b/include/linux/efi.h @@ -1240,17 +1240,17 @@ struct efivar_entry { bool deleting; }; -struct efi_simple_text_output_protocol_32 { +typedef struct { u32 reset; u32 output_string; u32 test_string; -}; +} efi_simple_text_output_protocol_32_t; -struct efi_simple_text_output_protocol_64 { +typedef struct { u64 reset; u64 output_string; u64 test_string; -}; +} efi_simple_text_output_protocol_64_t; struct efi_simple_text_output_protocol { void *reset;