aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTom Rini <trini@konsulko.com>2022-02-03 12:12:49 -0500
committerTom Rini <trini@konsulko.com>2022-02-03 12:12:49 -0500
commitb3650c9265efac00f5be5390ea4b4b18f1270a47 (patch)
tree86ff5fbee12f43f7d700d130c92009aef12fc185
parent006fddde01da7e8b3c7cad4a35f3245edc894ab4 (diff)
parentd502210a9ce3eda828cba8e30f237a4e29a7d797 (diff)
downloadu-boot-WIP/03Feb2022.zip
u-boot-WIP/03Feb2022.tar.gz
u-boot-WIP/03Feb2022.tar.bz2
Merge branch '2022-02-03-assorted-fixes'WIP/03Feb2022
- Update CI image to have libgnutls available. - Assorted ARM and SPL bugfixe
-rw-r--r--.azure-pipelines.yml2
-rw-r--r--.gitlab-ci.yml2
-rw-r--r--arch/arm/cpu/armv8/start.S37
-rw-r--r--arch/arm/cpu/armv8/u-boot-spl.lds4
-rw-r--r--board/eets/pdu001/MAINTAINERS4
-rw-r--r--cmd/efidebug.c28
-rw-r--r--common/spl/spl_ymodem.c15
-rw-r--r--doc/develop/checkpatch.rst590
-rw-r--r--drivers/net/ti/am65-cpsw-nuss.c2
-rw-r--r--include/efi_loader.h2
-rw-r--r--include/efi_selftest.h4
-rw-r--r--lib/efi_loader/efi_bootmgr.c12
-rw-r--r--lib/efi_loader/efi_boottime.c2
-rw-r--r--lib/efi_loader/efi_capsule.c22
-rw-r--r--lib/efi_loader/efi_helper.c2
-rw-r--r--lib/efi_loader/efi_image_loader.c8
-rw-r--r--lib/efi_loader/efi_setup.c14
-rw-r--r--lib/efi_loader/efi_string.c2
-rw-r--r--lib/efi_loader/efi_tcg2.c4
-rw-r--r--lib/efi_loader/efi_var_common.c12
-rw-r--r--lib/efi_loader/efi_variable.c6
-rw-r--r--lib/efi_loader/efi_variable_tee.c2
-rw-r--r--lib/efi_loader/helloworld.c40
-rw-r--r--lib/efi_selftest/dtbdump.c82
-rw-r--r--lib/efi_selftest/efi_selftest.c2
-rw-r--r--lib/efi_selftest/efi_selftest_block_device.c6
-rw-r--r--lib/efi_selftest/efi_selftest_devicepath.c2
-rw-r--r--lib/efi_selftest/efi_selftest_exception.c2
-rw-r--r--lib/efi_selftest/efi_selftest_fdt.c6
-rw-r--r--lib/efi_selftest/efi_selftest_hii.c8
-rw-r--r--lib/efi_selftest/efi_selftest_load_file.c4
-rw-r--r--lib/efi_selftest/efi_selftest_loadimage.c4
-rw-r--r--lib/efi_selftest/efi_selftest_miniapp_exception.c4
-rw-r--r--lib/efi_selftest/efi_selftest_miniapp_exit.c8
-rw-r--r--lib/efi_selftest/efi_selftest_miniapp_return.c2
-rw-r--r--lib/efi_selftest/efi_selftest_reset.c2
-rw-r--r--lib/efi_selftest/efi_selftest_textoutput.c12
-rw-r--r--lib/efi_selftest/efi_selftest_unicode_collation.c38
-rw-r--r--lib/efi_selftest/efi_selftest_util.c106
-rw-r--r--lib/efi_selftest/efi_selftest_variables.c22
-rw-r--r--lib/efi_selftest/efi_selftest_variables_runtime.c4
-rw-r--r--lib/efi_selftest/initrddump.c60
-rw-r--r--lib/lzma/Types.h4
-rw-r--r--lib/vsprintf.c2
-rw-r--r--scripts/Makefile2
-rwxr-xr-xscripts/checkpatch.pl145
-rwxr-xr-xscripts/spdxcheck.py2
-rw-r--r--test/print_ut.c2
-rw-r--r--test/unicode_ut.c22
-rw-r--r--tools/docker/Dockerfile4
50 files changed, 951 insertions, 422 deletions
diff --git a/.azure-pipelines.yml b/.azure-pipelines.yml
index f2aa332..81ab77e 100644
--- a/.azure-pipelines.yml
+++ b/.azure-pipelines.yml
@@ -2,7 +2,7 @@ variables:
windows_vm: windows-2019
ubuntu_vm: ubuntu-18.04
macos_vm: macOS-10.15
- ci_runner_image: trini/u-boot-gitlab-ci-runner:focal-20220105-10Jan2022
+ ci_runner_image: trini/u-boot-gitlab-ci-runner:focal-20220113-03Feb2022
# Add '-u 0' options for Azure pipelines, otherwise we get "permission
# denied" error when it tries to "useradd -m -u 1001 vsts_azpcontainer",
# since our $(ci_runner_image) user is not root.
diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml
index 75ad67f..85b5296 100644
--- a/.gitlab-ci.yml
+++ b/.gitlab-ci.yml
@@ -2,7 +2,7 @@
# Grab our configured image. The source for this is found at:
# https://source.denx.de/u-boot/gitlab-ci-runner
-image: trini/u-boot-gitlab-ci-runner:focal-20220105-10Jan2022
+image: trini/u-boot-gitlab-ci-runner:focal-20220113-03Feb2022
# We run some tests in different order, to catch some failures quicker.
stages:
diff --git a/arch/arm/cpu/armv8/start.S b/arch/arm/cpu/armv8/start.S
index b3eef70..91b00a4 100644
--- a/arch/arm/cpu/armv8/start.S
+++ b/arch/arm/cpu/armv8/start.S
@@ -104,10 +104,6 @@ pie_skip_reloc:
pie_fixup_done:
#endif
-#ifdef CONFIG_SYS_RESET_SCTRL
- bl reset_sctrl
-#endif
-
#if defined(CONFIG_ARMV8_SPL_EXCEPTION_VECTORS) || !defined(CONFIG_SPL_BUILD)
.macro set_vbar, regname, reg
msr \regname, \reg
@@ -195,39 +191,6 @@ slave_cpu:
master_cpu:
bl _main
-#ifdef CONFIG_SYS_RESET_SCTRL
-reset_sctrl:
- switch_el x1, 3f, 2f, 1f
-3:
- mrs x0, sctlr_el3
- b 0f
-2:
- mrs x0, sctlr_el2
- b 0f
-1:
- mrs x0, sctlr_el1
-
-0:
- ldr x1, =0xfdfffffa
- and x0, x0, x1
-
- switch_el x1, 6f, 5f, 4f
-6:
- msr sctlr_el3, x0
- b 7f
-5:
- msr sctlr_el2, x0
- b 7f
-4:
- msr sctlr_el1, x0
-
-7:
- dsb sy
- isb
- b __asm_invalidate_tlb_all
- ret
-#endif
-
/*-----------------------------------------------------------------------*/
WEAK(apply_core_errata)
diff --git a/arch/arm/cpu/armv8/u-boot-spl.lds b/arch/arm/cpu/armv8/u-boot-spl.lds
index 9edb662..730eb93 100644
--- a/arch/arm/cpu/armv8/u-boot-spl.lds
+++ b/arch/arm/cpu/armv8/u-boot-spl.lds
@@ -84,4 +84,8 @@ SECTIONS
/DISCARD/ : { *(.plt*) }
/DISCARD/ : { *(.interp*) }
/DISCARD/ : { *(.gnu*) }
+
+#ifdef CONFIG_LINUX_KERNEL_IMAGE_HEADER
+#include "linux-kernel-image-header-vars.h"
+#endif
}
diff --git a/board/eets/pdu001/MAINTAINERS b/board/eets/pdu001/MAINTAINERS
index 95295dd..6997c8d 100644
--- a/board/eets/pdu001/MAINTAINERS
+++ b/board/eets/pdu001/MAINTAINERS
@@ -1,6 +1,8 @@
PDU001 BOARD
M: Felix Brack <fb@ltec.ch>
S: Maintained
-F: board/eets/pdu001/
+F: board/eets/
F: include/configs/pdu001.h
F: configs/am335x_pdu001_defconfig
+F: arch/arm/dts/am335x-pdu001-u-boot.dtsi
+F: arch/arm/dts/am335x-pdu001.dts
diff --git a/cmd/efidebug.c b/cmd/efidebug.c
index 66ce0fc..401d13c 100644
--- a/cmd/efidebug.c
+++ b/cmd/efidebug.c
@@ -240,7 +240,7 @@ static int do_efi_capsule_res(struct cmd_tbl *cmdtp, int flag,
guid = efi_guid_capsule_report;
if (argc == 1) {
size = sizeof(var_name16);
- ret = efi_get_variable_int(L"CapsuleLast", &guid, NULL,
+ ret = efi_get_variable_int(u"CapsuleLast", &guid, NULL,
&size, var_name16, NULL);
if (ret != EFI_SUCCESS) {
@@ -1120,7 +1120,7 @@ static int do_efi_boot_dump(struct cmd_tbl *cmdtp, int flag,
return CMD_RET_FAILURE;
}
- if (memcmp(var_name16, L"Boot", 8))
+ if (memcmp(var_name16, u"Boot", 8))
continue;
for (id = 0, i = 0; i < 4; i++) {
@@ -1156,7 +1156,7 @@ static int show_efi_boot_order(void)
efi_status_t ret;
size = 0;
- ret = EFI_CALL(efi_get_variable(L"BootOrder", &efi_global_variable_guid,
+ ret = EFI_CALL(efi_get_variable(u"BootOrder", &efi_global_variable_guid,
NULL, &size, NULL));
if (ret != EFI_BUFFER_TOO_SMALL) {
if (ret == EFI_NOT_FOUND) {
@@ -1171,7 +1171,7 @@ static int show_efi_boot_order(void)
printf("ERROR: Out of memory\n");
return CMD_RET_FAILURE;
}
- ret = EFI_CALL(efi_get_variable(L"BootOrder", &efi_global_variable_guid,
+ ret = EFI_CALL(efi_get_variable(u"BootOrder", &efi_global_variable_guid,
NULL, &size, bootorder));
if (ret != EFI_SUCCESS) {
ret = CMD_RET_FAILURE;
@@ -1260,11 +1260,11 @@ static int do_efi_boot_next(struct cmd_tbl *cmdtp, int flag,
guid = efi_global_variable_guid;
size = sizeof(u16);
- ret = efi_set_variable_int(L"BootNext", &guid,
- EFI_VARIABLE_NON_VOLATILE |
- EFI_VARIABLE_BOOTSERVICE_ACCESS |
- EFI_VARIABLE_RUNTIME_ACCESS,
- size, &bootnext, false);
+ ret = efi_set_variable_int(u"BootNext", &guid,
+ EFI_VARIABLE_NON_VOLATILE |
+ EFI_VARIABLE_BOOTSERVICE_ACCESS |
+ EFI_VARIABLE_RUNTIME_ACCESS,
+ size, &bootnext, false);
if (ret != EFI_SUCCESS) {
printf("Cannot set BootNext\n");
r = CMD_RET_FAILURE;
@@ -1321,11 +1321,11 @@ static int do_efi_boot_order(struct cmd_tbl *cmdtp, int flag,
}
guid = efi_global_variable_guid;
- ret = efi_set_variable_int(L"BootOrder", &guid,
- EFI_VARIABLE_NON_VOLATILE |
- EFI_VARIABLE_BOOTSERVICE_ACCESS |
- EFI_VARIABLE_RUNTIME_ACCESS,
- size, bootorder, true);
+ ret = efi_set_variable_int(u"BootOrder", &guid,
+ EFI_VARIABLE_NON_VOLATILE |
+ EFI_VARIABLE_BOOTSERVICE_ACCESS |
+ EFI_VARIABLE_RUNTIME_ACCESS,
+ size, bootorder, true);
if (ret != EFI_SUCCESS) {
printf("Cannot set BootOrder\n");
r = CMD_RET_FAILURE;
diff --git a/common/spl/spl_ymodem.c b/common/spl/spl_ymodem.c
index 047df74..fdd5261 100644
--- a/common/spl/spl_ymodem.c
+++ b/common/spl/spl_ymodem.c
@@ -42,6 +42,7 @@ static ulong ymodem_read_fit(struct spl_load_info *load, ulong offset,
int res, err, buf_offset;
struct ymodem_fit_info *info = load->priv;
char *buf = info->buf;
+ ulong copy_size = size;
while (info->image_read < offset) {
res = xyzModem_stream_read(buf, BUF_SIZE, &err);
@@ -57,8 +58,14 @@ static ulong ymodem_read_fit(struct spl_load_info *load, ulong offset,
buf_offset = (info->image_read % BUF_SIZE);
else
buf_offset = BUF_SIZE;
+
+ if (res > copy_size) {
+ memcpy(addr, &buf[buf_offset - res], copy_size);
+ goto done;
+ }
memcpy(addr, &buf[buf_offset - res], res);
addr = addr + res;
+ copy_size -= res;
}
while (info->image_read < offset + size) {
@@ -66,11 +73,17 @@ static ulong ymodem_read_fit(struct spl_load_info *load, ulong offset,
if (res <= 0)
break;
- memcpy(addr, buf, res);
info->image_read += res;
+ if (res > copy_size) {
+ memcpy(addr, buf, copy_size);
+ goto done;
+ }
+ memcpy(addr, buf, res);
addr += res;
+ copy_size -= res;
}
+done:
return size;
}
diff --git a/doc/develop/checkpatch.rst b/doc/develop/checkpatch.rst
index 51fed1b..b52452b 100644
--- a/doc/develop/checkpatch.rst
+++ b/doc/develop/checkpatch.rst
@@ -246,6 +246,7 @@ Allocation style
The first argument for kcalloc or kmalloc_array should be the
number of elements. sizeof() as the first argument is generally
wrong.
+
See: https://www.kernel.org/doc/html/latest/core-api/memory-allocation.html
**ALLOC_SIZEOF_STRUCT**
@@ -264,6 +265,7 @@ Allocation style
**ALLOC_WITH_MULTIPLY**
Prefer kmalloc_array/kcalloc over kmalloc/kzalloc with a
sizeof multiply.
+
See: https://www.kernel.org/doc/html/latest/core-api/memory-allocation.html
@@ -284,6 +286,7 @@ API usage
BUG() or BUG_ON() should be avoided totally.
Use WARN() and WARN_ON() instead, and handle the "impossible"
error condition as gracefully as possible.
+
See: https://www.kernel.org/doc/html/latest/process/deprecated.html#bug-and-bug-on
**CONSIDER_KSTRTO**
@@ -292,12 +295,161 @@ API usage
may lead to unexpected results in callers. The respective kstrtol(),
kstrtoll(), kstrtoul(), and kstrtoull() functions tend to be the
correct replacements.
+
See: https://www.kernel.org/doc/html/latest/process/deprecated.html#simple-strtol-simple-strtoll-simple-strtoul-simple-strtoull
+ **CONSTANT_CONVERSION**
+ Use of __constant_<foo> form is discouraged for the following functions::
+
+ __constant_cpu_to_be[x]
+ __constant_cpu_to_le[x]
+ __constant_be[x]_to_cpu
+ __constant_le[x]_to_cpu
+ __constant_htons
+ __constant_ntohs
+
+ Using any of these outside of include/uapi/ is not preferred as using the
+ function without __constant_ is identical when the argument is a
+ constant.
+
+ In big endian systems, the macros like __constant_cpu_to_be32(x) and
+ cpu_to_be32(x) expand to the same expression::
+
+ #define __constant_cpu_to_be32(x) ((__force __be32)(__u32)(x))
+ #define __cpu_to_be32(x) ((__force __be32)(__u32)(x))
+
+ In little endian systems, the macros __constant_cpu_to_be32(x) and
+ cpu_to_be32(x) expand to __constant_swab32 and __swab32. __swab32
+ has a __builtin_constant_p check::
+
+ #define __swab32(x) \
+ (__builtin_constant_p((__u32)(x)) ? \
+ ___constant_swab32(x) : \
+ __fswab32(x))
+
+ So ultimately they have a special case for constants.
+ Similar is the case with all of the macros in the list. Thus
+ using the __constant_... forms are unnecessarily verbose and
+ not preferred outside of include/uapi.
+
+ See: https://lore.kernel.org/lkml/1400106425.12666.6.camel@joe-AO725/
+
+ **DEPRECATED_API**
+ Usage of a deprecated RCU API is detected. It is recommended to replace
+ old flavourful RCU APIs by their new vanilla-RCU counterparts.
+
+ The full list of available RCU APIs can be viewed from the kernel docs.
+
+ See: https://www.kernel.org/doc/html/latest/RCU/whatisRCU.html#full-list-of-rcu-apis
+
+ **DEPRECATED_VARIABLE**
+ EXTRA_{A,C,CPP,LD}FLAGS are deprecated and should be replaced by the new
+ flags added via commit f77bf01425b1 ("kbuild: introduce ccflags-y,
+ asflags-y and ldflags-y").
+
+ The following conversion scheme maybe used::
+
+ EXTRA_AFLAGS -> asflags-y
+ EXTRA_CFLAGS -> ccflags-y
+ EXTRA_CPPFLAGS -> cppflags-y
+ EXTRA_LDFLAGS -> ldflags-y
+
+ See:
+
+ 1. https://lore.kernel.org/lkml/20070930191054.GA15876@uranus.ravnborg.org/
+ 2. https://lore.kernel.org/lkml/1313384834-24433-12-git-send-email-lacombar@gmail.com/
+ 3. https://www.kernel.org/doc/html/latest/kbuild/makefiles.html#compilation-flags
+
+ **DEVICE_ATTR_FUNCTIONS**
+ The function names used in DEVICE_ATTR is unusual.
+ Typically, the store and show functions are used with <attr>_store and
+ <attr>_show, where <attr> is a named attribute variable of the device.
+
+ Consider the following examples::
+
+ static DEVICE_ATTR(type, 0444, type_show, NULL);
+ static DEVICE_ATTR(power, 0644, power_show, power_store);
+
+ The function names should preferably follow the above pattern.
+
+ See: https://www.kernel.org/doc/html/latest/driver-api/driver-model/device.html#attributes
+
+ **DEVICE_ATTR_RO**
+ The DEVICE_ATTR_RO(name) helper macro can be used instead of
+ DEVICE_ATTR(name, 0444, name_show, NULL);
+
+ Note that the macro automatically appends _show to the named
+ attribute variable of the device for the show method.
+
+ See: https://www.kernel.org/doc/html/latest/driver-api/driver-model/device.html#attributes
+
+ **DEVICE_ATTR_RW**
+ The DEVICE_ATTR_RW(name) helper macro can be used instead of
+ DEVICE_ATTR(name, 0644, name_show, name_store);
+
+ Note that the macro automatically appends _show and _store to the
+ named attribute variable of the device for the show and store methods.
+
+ See: https://www.kernel.org/doc/html/latest/driver-api/driver-model/device.html#attributes
+
+ **DEVICE_ATTR_WO**
+ The DEVICE_AATR_WO(name) helper macro can be used instead of
+ DEVICE_ATTR(name, 0200, NULL, name_store);
+
+ Note that the macro automatically appends _store to the
+ named attribute variable of the device for the store method.
+
+ See: https://www.kernel.org/doc/html/latest/driver-api/driver-model/device.html#attributes
+
+ **DUPLICATED_SYSCTL_CONST**
+ Commit d91bff3011cf ("proc/sysctl: add shared variables for range
+ check") added some shared const variables to be used instead of a local
+ copy in each source file.
+
+ Consider replacing the sysctl range checking value with the shared
+ one in include/linux/sysctl.h. The following conversion scheme may
+ be used::
+
+ &zero -> SYSCTL_ZERO
+ &one -> SYSCTL_ONE
+ &int_max -> SYSCTL_INT_MAX
+
+ See:
+
+ 1. https://lore.kernel.org/lkml/20190430180111.10688-1-mcroce@redhat.com/
+ 2. https://lore.kernel.org/lkml/20190531131422.14970-1-mcroce@redhat.com/
+
+ **ENOSYS**
+ ENOSYS means that a nonexistent system call was called.
+ Earlier, it was wrongly used for things like invalid operations on
+ otherwise valid syscalls. This should be avoided in new code.
+
+ See: https://lore.kernel.org/lkml/5eb299021dec23c1a48fa7d9f2c8b794e967766d.1408730669.git.luto@amacapital.net/
+
+ **ENOTSUPP**
+ ENOTSUPP is not a standard error code and should be avoided in new patches.
+ EOPNOTSUPP should be used instead.
+
+ See: https://lore.kernel.org/netdev/20200510182252.GA411829@lunn.ch/
+
+ **EXPORT_SYMBOL**
+ EXPORT_SYMBOL should immediately follow the symbol to be exported.
+
+ **IN_ATOMIC**
+ in_atomic() is not for driver use so any such use is reported as an ERROR.
+ Also in_atomic() is often used to determine if sleeping is permitted,
+ but it is not reliable in this use model. Therefore its use is
+ strongly discouraged.
+
+ However, in_atomic() is ok for core kernel use.
+
+ See: https://lore.kernel.org/lkml/20080320201723.b87b3732.akpm@linux-foundation.org/
+
**LOCKDEP**
The lockdep_no_validate class was added as a temporary measure to
prevent warnings on conversion of device->sem to device->mutex.
It should not be used for any other purpose.
+
See: https://lore.kernel.org/lkml/1268959062.9440.467.camel@laptop/
**MALFORMED_INCLUDE**
@@ -308,14 +460,21 @@ API usage
**USE_LOCKDEP**
lockdep_assert_held() annotations should be preferred over
assertions based on spin_is_locked()
+
See: https://www.kernel.org/doc/html/latest/locking/lockdep-design.html#annotations
**UAPI_INCLUDE**
No #include statements in include/uapi should use a uapi/ path.
+ **USLEEP_RANGE**
+ usleep_range() should be preferred over udelay(). The proper way of
+ using usleep_range() is mentioned in the kernel docs.
+
+ See: https://www.kernel.org/doc/html/latest/timers/timers-howto.html#delays-information-on-the-various-kernel-delay-sleep-mechanisms
-Comment style
--------------
+
+Comments
+--------
**BLOCK_COMMENT_STYLE**
The comment style is incorrect. The preferred style for multi-
@@ -338,8 +497,24 @@ Comment style
**C99_COMMENTS**
C99 style single line comments (//) should not be used.
Prefer the block comment style instead.
+
See: https://www.kernel.org/doc/html/latest/process/coding-style.html#commenting
+ **DATA_RACE**
+ Applications of data_race() should have a comment so as to document the
+ reasoning behind why it was deemed safe.
+
+ See: https://lore.kernel.org/lkml/20200401101714.44781-1-elver@google.com/
+
+ **FSF_MAILING_ADDRESS**
+ Kernel maintainers reject new instances of the GPL boilerplate paragraph
+ directing people to write to the FSF for a copy of the GPL, since the
+ FSF has moved in the past and may do so again.
+ So do not write paragraphs about writing to the Free Software Foundation's
+ mailing address.
+
+ See: https://lore.kernel.org/lkml/20131006222342.GT19510@leaf/
+
Commit message
--------------
@@ -347,6 +522,7 @@ Commit message
**BAD_SIGN_OFF**
The signed-off-by line does not fall in line with the standards
specified by the community.
+
See: https://www.kernel.org/doc/html/latest/process/submitting-patches.html#developer-s-certificate-of-origin-1-1
**BAD_STABLE_ADDRESS_STYLE**
@@ -368,12 +544,33 @@ Commit message
**COMMIT_MESSAGE**
The patch is missing a commit description. A brief
description of the changes made by the patch should be added.
+
+ See: https://www.kernel.org/doc/html/latest/process/submitting-patches.html#describe-your-changes
+
+ **EMAIL_SUBJECT**
+ Naming the tool that found the issue is not very useful in the
+ subject line. A good subject line summarizes the change that
+ the patch brings.
+
See: https://www.kernel.org/doc/html/latest/process/submitting-patches.html#describe-your-changes
+ **FROM_SIGN_OFF_MISMATCH**
+ The author's email does not match with that in the Signed-off-by:
+ line(s). This can be sometimes caused due to an improperly configured
+ email client.
+
+ This message is emitted due to any of the following reasons::
+
+ - The email names do not match.
+ - The email addresses do not match.
+ - The email subaddresses do not match.
+ - The email comments do not match.
+
**MISSING_SIGN_OFF**
The patch is missing a Signed-off-by line. A signed-off-by
line should be added according to Developer's certificate of
Origin.
+
See: https://www.kernel.org/doc/html/latest/process/submitting-patches.html#sign-your-work-the-developer-s-certificate-of-origin
**NO_AUTHOR_SIGN_OFF**
@@ -382,6 +579,7 @@ Commit message
end of explanation of the patch to denote that the author has
written it or otherwise has the rights to pass it on as an open
source patch.
+
See: https://www.kernel.org/doc/html/latest/process/submitting-patches.html#sign-your-work-the-developer-s-certificate-of-origin
**DIFF_IN_COMMIT_MSG**
@@ -389,6 +587,7 @@ Commit message
This causes problems when one tries to apply a file containing both
the changelog and the diff because patch(1) tries to apply the diff
which it found in the changelog.
+
See: https://lore.kernel.org/lkml/20150611134006.9df79a893e3636019ad2759e@linux-foundation.org/
**GERRIT_CHANGE_ID**
@@ -431,6 +630,7 @@ Comparison style
**BOOL_COMPARISON**
Comparisons of A to true and false are better written
as A and !A.
+
See: https://lore.kernel.org/lkml/1365563834.27174.12.camel@joe-AO722/
**COMPARISON_TO_NULL**
@@ -442,6 +642,120 @@ Comparison style
side of the test should be avoided.
+Indentation and Line Breaks
+---------------------------
+
+ **CODE_INDENT**
+ Code indent should use tabs instead of spaces.
+ Outside of comments, documentation and Kconfig,
+ spaces are never used for indentation.
+
+ See: https://www.kernel.org/doc/html/latest/process/coding-style.html#indentation
+
+ **DEEP_INDENTATION**
+ Indentation with 6 or more tabs usually indicate overly indented
+ code.
+
+ It is suggested to refactor excessive indentation of
+ if/else/for/do/while/switch statements.
+
+ See: https://lore.kernel.org/lkml/1328311239.21255.24.camel@joe2Laptop/
+
+ **SWITCH_CASE_INDENT_LEVEL**
+ switch should be at the same indent as case.
+ Example::
+
+ switch (suffix) {
+ case 'G':
+ case 'g':
+ mem <<= 30;
+ break;
+ case 'M':
+ case 'm':
+ mem <<= 20;
+ break;
+ case 'K':
+ case 'k':
+ mem <<= 10;
+ fallthrough;
+ default:
+ break;
+ }
+
+ See: https://www.kernel.org/doc/html/latest/process/coding-style.html#indentation
+
+ **LONG_LINE**
+ The line has exceeded the specified maximum length.
+ To use a different maximum line length, the --max-line-length=n option
+ may be added while invoking checkpatch.
+
+ Earlier, the default line length was 80 columns. Commit bdc48fa11e46
+ ("checkpatch/coding-style: deprecate 80-column warning") increased the
+ limit to 100 columns. This is not a hard limit either and it's
+ preferable to stay within 80 columns whenever possible.
+
+ See: https://www.kernel.org/doc/html/latest/process/coding-style.html#breaking-long-lines-and-strings
+
+ **LONG_LINE_STRING**
+ A string starts before but extends beyond the maximum line length.
+ To use a different maximum line length, the --max-line-length=n option
+ may be added while invoking checkpatch.
+
+ See: https://www.kernel.org/doc/html/latest/process/coding-style.html#breaking-long-lines-and-strings
+
+ **LONG_LINE_COMMENT**
+ A comment starts before but extends beyond the maximum line length.
+ To use a different maximum line length, the --max-line-length=n option
+ may be added while invoking checkpatch.
+
+ See: https://www.kernel.org/doc/html/latest/process/coding-style.html#breaking-long-lines-and-strings
+
+ **SPLIT_STRING**
+ Quoted strings that appear as messages in userspace and can be
+ grepped, should not be split across multiple lines.
+
+ See: https://lore.kernel.org/lkml/20120203052727.GA15035@leaf/
+
+ **MULTILINE_DEREFERENCE**
+ A single dereferencing identifier spanned on multiple lines like::
+
+ struct_identifier->member[index].
+ member = <foo>;
+
+ is generally hard to follow. It can easily lead to typos and so makes
+ the code vulnerable to bugs.
+
+ If fixing the multiple line dereferencing leads to an 80 column
+ violation, then either rewrite the code in a more simple way or if the
+ starting part of the dereferencing identifier is the same and used at
+ multiple places then store it in a temporary variable, and use that
+ temporary variable only at all the places. For example, if there are
+ two dereferencing identifiers::
+
+ member1->member2->member3.foo1;
+ member1->member2->member3.foo2;
+
+ then store the member1->member2->member3 part in a temporary variable.
+ It not only helps to avoid the 80 column violation but also reduces
+ the program size by removing the unnecessary dereferences.
+
+ But if none of the above methods work then ignore the 80 column
+ violation because it is much easier to read a dereferencing identifier
+ on a single line.
+
+ **TRAILING_STATEMENTS**
+ Trailing statements (for example after any conditional) should be
+ on the next line.
+ Statements, such as::
+
+ if (x == y) break;
+
+ should be::
+
+ if (x == y)
+ break;
+
+
Macros, Attributes and Symbols
------------------------------
@@ -472,7 +786,7 @@ Macros, Attributes and Symbols
**BIT_MACRO**
Defines like: 1 << <digit> could be BIT(digit).
- The BIT() macro is defined in include/linux/bitops.h::
+ The BIT() macro is defined via include/linux/bits.h::
#define BIT(nr) (1UL << (nr))
@@ -492,6 +806,7 @@ Macros, Attributes and Symbols
The kernel does *not* use the ``__DATE__`` and ``__TIME__`` macros,
and enables warnings if they are used as they can lead to
non-deterministic builds.
+
See: https://www.kernel.org/doc/html/latest/kbuild/reproducible-builds.html#timestamps
**DEFINE_ARCH_HAS**
@@ -502,8 +817,12 @@ Macros, Attributes and Symbols
want architectures able to override them with optimized ones, we
should either use weak functions (appropriate for some cases), or
the symbol that protects them should be the same symbol we use.
+
See: https://lore.kernel.org/lkml/CA+55aFycQ9XJvEOsiM3txHL5bjUc8CeKWJNR_H+MiicaddB42Q@mail.gmail.com/
+ **DO_WHILE_MACRO_WITH_TRAILING_SEMICOLON**
+ do {} while(0) macros should not have a trailing semicolon.
+
**INIT_ATTRIBUTE**
Const init definitions should use __initconst instead of
__initdata.
@@ -528,6 +847,20 @@ Macros, Attributes and Symbols
...
}
+ **MISPLACED_INIT**
+ It is possible to use section markers on variables in a way
+ which gcc doesn't understand (or at least not the way the
+ developer intended)::
+
+ static struct __initdata samsung_pll_clock exynos4_plls[nr_plls] = {
+
+ does not put exynos4_plls in the .initdata section. The __initdata
+ marker can be virtually anywhere on the line, except right after
+ "struct". The preferred location is before the "=" sign if there is
+ one, or before the trailing ";" otherwise.
+
+ See: https://lore.kernel.org/lkml/1377655732.3619.19.camel@joe-AO722/
+
**MULTISTATEMENT_MACRO_USE_DO_WHILE**
Macros with multiple statements should be enclosed in a
do - while block. Same should also be the case for macros
@@ -541,6 +874,42 @@ Macros, Attributes and Symbols
See: https://www.kernel.org/doc/html/latest/process/coding-style.html#macros-enums-and-rtl
+ **PREFER_FALLTHROUGH**
+ Use the `fallthrough;` pseudo keyword instead of
+ `/* fallthrough */` like comments.
+
+ **TRAILING_SEMICOLON**
+ Macro definition should not end with a semicolon. The macro
+ invocation style should be consistent with function calls.
+ This can prevent any unexpected code paths::
+
+ #define MAC do_something;
+
+ If this macro is used within a if else statement, like::
+
+ if (some_condition)
+ MAC;
+
+ else
+ do_something;
+
+ Then there would be a compilation error, because when the macro is
+ expanded there are two trailing semicolons, so the else branch gets
+ orphaned.
+
+ See: https://lore.kernel.org/lkml/1399671106.2912.21.camel@joe-AO725/
+
+ **SINGLE_STATEMENT_DO_WHILE_MACRO**
+ For the multi-statement macros, it is necessary to use the do-while
+ loop to avoid unpredictable code paths. The do-while loop helps to
+ group the multiple statements into a single one so that a
+ function-like macro can be used as a function only.
+
+ But for the single statement macros, it is unnecessary to use the
+ do-while loop. Although the code is syntactically correct but using
+ the do-while loop is redundant. So remove the do-while loop for single
+ statement macros.
+
**WEAK_DECLARATION**
Using weak declarations like __attribute__((weak)) or __weak
can have unintended link defects. Avoid using them.
@@ -551,8 +920,51 @@ Functions and Variables
**CAMELCASE**
Avoid CamelCase Identifiers.
+
See: https://www.kernel.org/doc/html/latest/process/coding-style.html#naming
+ **CONST_CONST**
+ Using `const <type> const *` is generally meant to be
+ written `const <type> * const`.
+
+ **CONST_STRUCT**
+ Using const is generally a good idea. Checkpatch reads
+ a list of frequently used structs that are always or
+ almost always constant.
+
+ The existing structs list can be viewed from
+ `scripts/const_structs.checkpatch`.
+
+ See: https://lore.kernel.org/lkml/alpine.DEB.2.10.1608281509480.3321@hadrien/
+
+ **EMBEDDED_FUNCTION_NAME**
+ Embedded function names are less appropriate to use as
+ refactoring can cause function renaming. Prefer the use of
+ "%s", __func__ to embedded function names.
+
+ Note that this does not work with -f (--file) checkpatch option
+ as it depends on patch context providing the function name.
+
+ **FUNCTION_ARGUMENTS**
+ This warning is emitted due to any of the following reasons:
+
+ 1. Arguments for the function declaration do not follow
+ the identifier name. Example::
+
+ void foo
+ (int bar, int baz)
+
+ This should be corrected to::
+
+ void foo(int bar, int baz)
+
+ 2. Some arguments for the function definition do not
+ have an identifier name. Example::
+
+ void foo(int)
+
+ All arguments should have identifier names.
+
**FUNCTION_WITHOUT_ARGS**
Function declarations without arguments like::
@@ -573,6 +985,11 @@ Functions and Variables
Your compiler (or rather your loader) automatically does
it for you.
+ **MULTIPLE_ASSIGNMENTS**
+ Multiple assignments on a single line makes the code unnecessarily
+ complicated. So on a single line assign value to a single variable
+ only, this makes the code more readable and helps avoid typos.
+
**RETURN_PARENTHESES**
return is not a function and as such doesn't need parentheses::
@@ -583,6 +1000,45 @@ Functions and Variables
return bar;
+Permissions
+-----------
+
+ **DEVICE_ATTR_PERMS**
+ The permissions used in DEVICE_ATTR are unusual.
+ Typically only three permissions are used - 0644 (RW), 0444 (RO)
+ and 0200 (WO).
+
+ See: https://www.kernel.org/doc/html/latest/filesystems/sysfs.html#attributes
+
+ **EXECUTE_PERMISSIONS**
+ There is no reason for source files to be executable. The executable
+ bit can be removed safely.
+
+ **EXPORTED_WORLD_WRITABLE**
+ Exporting world writable sysfs/debugfs files is usually a bad thing.
+ When done arbitrarily they can introduce serious security bugs.
+ In the past, some of the debugfs vulnerabilities would seemingly allow
+ any local user to write arbitrary values into device registers - a
+ situation from which little good can be expected to emerge.
+
+ See: https://lore.kernel.org/linux-arm-kernel/cover.1296818921.git.segoon@openwall.com/
+
+ **NON_OCTAL_PERMISSIONS**
+ Permission bits should use 4 digit octal permissions (like 0700 or 0444).
+ Avoid using any other base like decimal.
+
+ **SYMBOLIC_PERMS**
+ Permission bits in the octal form are more readable and easier to
+ understand than their symbolic counterparts because many command-line
+ tools use this notation. Experienced kernel developers have been using
+ these traditional Unix permission bits for decades and so they find it
+ easier to understand the octal notation than the symbolic macros.
+ For example, it is harder to read S_IWUSR|S_IRUGO than 0644, which
+ obscures the developer's intent rather than clarifying it.
+
+ See: https://lore.kernel.org/lkml/CA+55aFw5v23T-zvDZp-MmD_EYxF8WbafwwB59934FV7g21uMGQ@mail.gmail.com/
+
+
Spacing and Brackets
--------------------
@@ -616,7 +1072,7 @@ Spacing and Brackets
1. With a type on the left::
- ;int [] a;
+ int [] a;
2. At the beginning of a line for slice initialisers::
@@ -626,12 +1082,6 @@ Spacing and Brackets
= { [0...10] = 5 }
- **CODE_INDENT**
- Code indent should use tabs instead of spaces.
- Outside of comments, documentation and Kconfig,
- spaces are never used for indentation.
- See: https://www.kernel.org/doc/html/latest/process/coding-style.html#indentation
-
**CONCATENATED_STRING**
Concatenated elements should have a space in between.
Example::
@@ -644,17 +1094,20 @@ Spacing and Brackets
**ELSE_AFTER_BRACE**
`else {` should follow the closing block `}` on the same line.
+
See: https://www.kernel.org/doc/html/latest/process/coding-style.html#placing-braces-and-spaces
**LINE_SPACING**
Vertical space is wasted given the limited number of lines an
editor window can display when multiple blank lines are used.
+
See: https://www.kernel.org/doc/html/latest/process/coding-style.html#spaces
**OPEN_BRACE**
The opening brace should be following the function definitions on the
next line. For any non-functional block it should be on the same line
as the last construct.
+
See: https://www.kernel.org/doc/html/latest/process/coding-style.html#placing-braces-and-spaces
**POINTER_LOCATION**
@@ -671,37 +1124,47 @@ Spacing and Brackets
**SPACING**
Whitespace style used in the kernel sources is described in kernel docs.
- See: https://www.kernel.org/doc/html/latest/process/coding-style.html#spaces
-
- **SWITCH_CASE_INDENT_LEVEL**
- switch should be at the same indent as case.
- Example::
- switch (suffix) {
- case 'G':
- case 'g':
- mem <<= 30;
- break;
- case 'M':
- case 'm':
- mem <<= 20;
- break;
- case 'K':
- case 'k':
- mem <<= 10;
- /* fall through */
- default:
- break;
- }
-
- See: https://www.kernel.org/doc/html/latest/process/coding-style.html#indentation
+ See: https://www.kernel.org/doc/html/latest/process/coding-style.html#spaces
**TRAILING_WHITESPACE**
Trailing whitespace should always be removed.
Some editors highlight the trailing whitespace and cause visual
distractions when editing files.
+
See: https://www.kernel.org/doc/html/latest/process/coding-style.html#spaces
+ **UNNECESSARY_PARENTHESES**
+ Parentheses are not required in the following cases:
+
+ 1. Function pointer uses::
+
+ (foo->bar)();
+
+ could be::
+
+ foo->bar();
+
+ 2. Comparisons in if::
+
+ if ((foo->bar) && (foo->baz))
+ if ((foo == bar))
+
+ could be::
+
+ if (foo->bar && foo->baz)
+ if (foo == bar)
+
+ 3. addressof/dereference single Lvalues::
+
+ &(foo->bar)
+ *(foo->bar)
+
+ could be::
+
+ &foo->bar
+ *foo->bar
+
**WHILE_AFTER_BRACE**
while should follow the closing bracket on the same line::
@@ -723,17 +1186,50 @@ Others
The patch seems to be corrupted or lines are wrapped.
Please regenerate the patch file before sending it to the maintainer.
+ **CVS_KEYWORD**
+ Since linux moved to git, the CVS markers are no longer used.
+ So, CVS style keywords ($Id$, $Revision$, $Log$) should not be
+ added.
+
+ **DEFAULT_NO_BREAK**
+ switch default case is sometimes written as "default:;". This can
+ cause new cases added below default to be defective.
+
+ A "break;" should be added after empty default statement to avoid
+ unwanted fallthrough.
+
**DOS_LINE_ENDINGS**
For DOS-formatted patches, there are extra ^M symbols at the end of
the line. These should be removed.
- **EXECUTE_PERMISSIONS**
- There is no reason for source files to be executable. The executable
- bit can be removed safely.
+ **DT_SCHEMA_BINDING_PATCH**
+ DT bindings moved to a json-schema based format instead of
+ freeform text.
- **NON_OCTAL_PERMISSIONS**
- Permission bits should use 4 digit octal permissions (like 0700 or 0444).
- Avoid using any other base like decimal.
+ See: https://www.kernel.org/doc/html/latest/devicetree/bindings/writing-schema.html
+
+ **DT_SPLIT_BINDING_PATCH**
+ Devicetree bindings should be their own patch. This is because
+ bindings are logically independent from a driver implementation,
+ they have a different maintainer (even though they often
+ are applied via the same tree), and it makes for a cleaner history in the
+ DT only tree created with git-filter-branch.
+
+ See: https://www.kernel.org/doc/html/latest/devicetree/bindings/submitting-patches.html#i-for-patch-submitters
+
+ **EMBEDDED_FILENAME**
+ Embedding the complete filename path inside the file isn't particularly
+ useful as often the path is moved around and becomes incorrect.
+
+ **FILE_PATH_CHANGES**
+ Whenever files are added, moved, or deleted, the MAINTAINERS file
+ patterns can be out of sync or outdated.
+
+ So MAINTAINERS might need updating in these cases.
+
+ **MEMSET**
+ The memset use appears to be incorrect. This may be caused due to
+ badly ordered parameters. Please recheck the usage.
**NOT_UNIFIED_DIFF**
The patch file does not appear to be in unified-diff format. Please
@@ -742,14 +1238,12 @@ Others
**PRINTF_0XDECIMAL**
Prefixing 0x with decimal output is defective and should be corrected.
- **TRAILING_STATEMENTS**
- Trailing statements (for example after any conditional) should be
- on the next line.
- Like::
+ **SPDX_LICENSE_TAG**
+ The source file is missing or has an improper SPDX identifier tag.
+ The Linux kernel requires the precise SPDX identifier in all source files,
+ and it is thoroughly documented in the kernel docs.
- if (x == y) break;
+ See: https://www.kernel.org/doc/html/latest/process/license-rules.html
- should be::
-
- if (x == y)
- break;
+ **TYPO_SPELLING**
+ Some words may have been misspelled. Consider reviewing them.
diff --git a/drivers/net/ti/am65-cpsw-nuss.c b/drivers/net/ti/am65-cpsw-nuss.c
index 454986ff15..87f51b3 100644
--- a/drivers/net/ti/am65-cpsw-nuss.c
+++ b/drivers/net/ti/am65-cpsw-nuss.c
@@ -817,5 +817,5 @@ U_BOOT_DRIVER(am65_cpsw_nuss_port) = {
.ops = &am65_cpsw_ops,
.priv_auto = sizeof(struct am65_cpsw_priv),
.plat_auto = sizeof(struct eth_pdata),
- .flags = DM_FLAG_ALLOC_PRIV_DMA,
+ .flags = DM_FLAG_ALLOC_PRIV_DMA | DM_FLAG_OS_PREPARE,
};
diff --git a/include/efi_loader.h b/include/efi_loader.h
index 4e50f2d..f4ae84d 100644
--- a/include/efi_loader.h
+++ b/include/efi_loader.h
@@ -974,7 +974,7 @@ efi_status_t efi_capsule_authenticate(const void *capsule,
efi_uintn_t capsule_size,
void **image, efi_uintn_t *image_size);
-#define EFI_CAPSULE_DIR L"\\EFI\\UpdateCapsule\\"
+#define EFI_CAPSULE_DIR u"\\EFI\\UpdateCapsule\\"
/**
* Install the ESRT system table.
diff --git a/include/efi_selftest.h b/include/efi_selftest.h
index 94ceb14..5340cef 100644
--- a/include/efi_selftest.h
+++ b/include/efi_selftest.h
@@ -16,7 +16,7 @@
#define EFI_ST_SUCCESS 0
#define EFI_ST_FAILURE 1
-#define EFI_ST_SUCCESS_STR L"SUCCESS"
+#define EFI_ST_SUCCESS_STR u"SUCCESS"
/**
* efi_st_printf() - print a message
@@ -111,7 +111,7 @@ u16 *efi_st_translate_char(u16 code);
* efi_st_translate_code() - translate a scan code to a human readable string
*
* This function translates the scan code returned by the simple text input
- * protocol to a human readable string, e.g. 0x04 is translated to L"Left".
+ * protocol to a human readable string, e.g. 0x04 is translated to u"Left".
*
* @code: scan code
* Return: Unicode string
diff --git a/lib/efi_loader/efi_bootmgr.c b/lib/efi_loader/efi_bootmgr.c
index 1fe1923..8c04ecb 100644
--- a/lib/efi_loader/efi_bootmgr.c
+++ b/lib/efi_loader/efi_bootmgr.c
@@ -46,8 +46,8 @@ static efi_status_t try_load_entry(u16 n, efi_handle_t *handle,
void **load_options)
{
struct efi_load_option lo;
- u16 varname[] = L"Boot0000";
- u16 hexmap[] = L"0123456789ABCDEF";
+ u16 varname[] = u"Boot0000";
+ u16 hexmap[] = u"0123456789ABCDEF";
void *load_option;
efi_uintn_t size;
efi_status_t ret;
@@ -83,7 +83,7 @@ static efi_status_t try_load_entry(u16 n, efi_handle_t *handle,
attributes = EFI_VARIABLE_BOOTSERVICE_ACCESS |
EFI_VARIABLE_RUNTIME_ACCESS;
- ret = efi_set_variable_int(L"BootCurrent",
+ ret = efi_set_variable_int(u"BootCurrent",
&efi_global_variable_guid,
attributes, sizeof(n), &n, false);
if (ret != EFI_SUCCESS)
@@ -149,7 +149,7 @@ efi_status_t efi_bootmgr_load(efi_handle_t *handle, void **load_options)
/* BootNext */
size = sizeof(bootnext);
- ret = efi_get_variable_int(L"BootNext",
+ ret = efi_get_variable_int(u"BootNext",
&efi_global_variable_guid,
NULL, &size, &bootnext, NULL);
if (ret == EFI_SUCCESS || ret == EFI_BUFFER_TOO_SMALL) {
@@ -158,7 +158,7 @@ efi_status_t efi_bootmgr_load(efi_handle_t *handle, void **load_options)
log_err("BootNext must be 16-bit integer\n");
/* delete BootNext */
- ret = efi_set_variable_int(L"BootNext",
+ ret = efi_set_variable_int(u"BootNext",
&efi_global_variable_guid,
0, 0, NULL, false);
@@ -178,7 +178,7 @@ efi_status_t efi_bootmgr_load(efi_handle_t *handle, void **load_options)
}
/* BootOrder */
- bootorder = efi_get_var(L"BootOrder", &efi_global_variable_guid, &size);
+ bootorder = efi_get_var(u"BootOrder", &efi_global_variable_guid, &size);
if (!bootorder) {
log_info("BootOrder not defined\n");
ret = EFI_NOT_FOUND;
diff --git a/lib/efi_loader/efi_boottime.c b/lib/efi_loader/efi_boottime.c
index 37b9c68..1ea04de 100644
--- a/lib/efi_loader/efi_boottime.c
+++ b/lib/efi_loader/efi_boottime.c
@@ -3778,7 +3778,7 @@ static struct efi_boot_services efi_boot_services = {
.create_event_ex = efi_create_event_ex,
};
-static u16 __efi_runtime_data firmware_vendor[] = L"Das U-Boot";
+static u16 __efi_runtime_data firmware_vendor[] = u"Das U-Boot";
struct efi_system_table __efi_runtime_data systab = {
.hdr = {
diff --git a/lib/efi_loader/efi_capsule.c b/lib/efi_loader/efi_capsule.c
index 4463ae0..f4519c7 100644
--- a/lib/efi_loader/efi_capsule.c
+++ b/lib/efi_loader/efi_capsule.c
@@ -56,10 +56,10 @@ static __maybe_unused unsigned int get_last_capsule(void)
int i;
size = sizeof(value16);
- ret = efi_get_variable_int(L"CapsuleLast", &efi_guid_capsule_report,
+ ret = efi_get_variable_int(u"CapsuleLast", &efi_guid_capsule_report,
NULL, &size, value16, NULL);
if (ret != EFI_SUCCESS || size != 22 ||
- u16_strncmp(value16, L"Capsule", 7))
+ u16_strncmp(value16, u"Capsule", 7))
goto err;
for (i = 0; i < 4; ++i) {
u16 c = value16[i + 7];
@@ -113,14 +113,14 @@ void set_capsule_result(int index, struct efi_capsule_header *capsule,
}
/* Variable CapsuleLast must not include terminating 0x0000 */
- ret = efi_set_variable_int(L"CapsuleLast", &efi_guid_capsule_report,
+ ret = efi_set_variable_int(u"CapsuleLast", &efi_guid_capsule_report,
EFI_VARIABLE_READ_ONLY |
EFI_VARIABLE_NON_VOLATILE |
EFI_VARIABLE_BOOTSERVICE_ACCESS |
EFI_VARIABLE_RUNTIME_ACCESS,
22, variable_name16, false);
if (ret != EFI_SUCCESS)
- log_err("Setting %ls failed\n", L"CapsuleLast");
+ log_err("Setting %ls failed\n", u"CapsuleLast");
}
#ifdef CONFIG_EFI_CAPSULE_FIRMWARE_MANAGEMENT
@@ -707,7 +707,7 @@ static efi_status_t find_boot_device(void)
/* find active boot device in BootNext */
bootnext = 0;
size = sizeof(bootnext);
- ret = efi_get_variable_int(L"BootNext",
+ ret = efi_get_variable_int(u"BootNext",
(efi_guid_t *)&efi_global_variable_guid,
NULL, &size, &bootnext, NULL);
if (ret == EFI_SUCCESS || ret == EFI_BUFFER_TOO_SMALL) {
@@ -734,7 +734,7 @@ static efi_status_t find_boot_device(void)
skip:
/* find active boot device in BootOrder */
size = 0;
- ret = efi_get_variable_int(L"BootOrder", &efi_global_variable_guid,
+ ret = efi_get_variable_int(u"BootOrder", &efi_global_variable_guid,
NULL, &size, NULL, NULL);
if (ret == EFI_BUFFER_TOO_SMALL) {
boot_order = malloc(size);
@@ -743,7 +743,7 @@ skip:
goto out;
}
- ret = efi_get_variable_int(L"BootOrder",
+ ret = efi_get_variable_int(u"BootOrder",
&efi_global_variable_guid,
NULL, &size, boot_order, NULL);
}
@@ -875,8 +875,8 @@ static efi_status_t efi_capsule_scan_dir(u16 ***files, unsigned int *num)
break;
if (!(dirent->attribute & EFI_FILE_DIRECTORY) &&
- u16_strcmp(dirent->file_name, L".") &&
- u16_strcmp(dirent->file_name, L".."))
+ u16_strcmp(dirent->file_name, u".") &&
+ u16_strcmp(dirent->file_name, u".."))
tmp_files[count++] = u16_strdup(dirent->file_name);
}
/* ignore an error */
@@ -1052,7 +1052,7 @@ static efi_status_t check_run_capsules(void)
efi_status_t r;
size = sizeof(os_indications);
- r = efi_get_variable_int(L"OsIndications", &efi_global_variable_guid,
+ r = efi_get_variable_int(u"OsIndications", &efi_global_variable_guid,
NULL, &size, &os_indications, NULL);
if (r != EFI_SUCCESS || size != sizeof(os_indications))
return EFI_NOT_FOUND;
@@ -1061,7 +1061,7 @@ static efi_status_t check_run_capsules(void)
EFI_OS_INDICATIONS_FILE_CAPSULE_DELIVERY_SUPPORTED) {
os_indications &=
~EFI_OS_INDICATIONS_FILE_CAPSULE_DELIVERY_SUPPORTED;
- r = efi_set_variable_int(L"OsIndications",
+ r = efi_set_variable_int(u"OsIndications",
&efi_global_variable_guid,
EFI_VARIABLE_NON_VOLATILE |
EFI_VARIABLE_BOOTSERVICE_ACCESS |
diff --git a/lib/efi_loader/efi_helper.c b/lib/efi_loader/efi_helper.c
index b80a6e0..802d39e 100644
--- a/lib/efi_loader/efi_helper.c
+++ b/lib/efi_loader/efi_helper.c
@@ -36,7 +36,7 @@ static efi_status_t efi_create_current_boot_var(u16 var_name[],
u16 *pos;
boot_current_size = sizeof(boot_current);
- ret = efi_get_variable_int(L"BootCurrent",
+ ret = efi_get_variable_int(u"BootCurrent",
&efi_global_variable_guid, NULL,
&boot_current_size, &boot_current, NULL);
if (ret != EFI_SUCCESS)
diff --git a/lib/efi_loader/efi_image_loader.c b/lib/efi_loader/efi_image_loader.c
index f43dfb3..f41cfa4 100644
--- a/lib/efi_loader/efi_image_loader.c
+++ b/lib/efi_loader/efi_image_loader.c
@@ -532,13 +532,13 @@ static bool efi_image_unsigned_authenticate(struct efi_image_regions *regs)
struct efi_signature_store *db = NULL, *dbx = NULL;
bool ret = false;
- dbx = efi_sigstore_parse_sigdb(L"dbx");
+ dbx = efi_sigstore_parse_sigdb(u"dbx");
if (!dbx) {
EFI_PRINT("Getting signature database(dbx) failed\n");
goto out;
}
- db = efi_sigstore_parse_sigdb(L"db");
+ db = efi_sigstore_parse_sigdb(u"db");
if (!db) {
EFI_PRINT("Getting signature database(db) failed\n");
goto out;
@@ -621,13 +621,13 @@ static bool efi_image_authenticate(void *efi, size_t efi_size)
/*
* verify signature using db and dbx
*/
- db = efi_sigstore_parse_sigdb(L"db");
+ db = efi_sigstore_parse_sigdb(u"db");
if (!db) {
EFI_PRINT("Getting signature database(db) failed\n");
goto err;
}
- dbx = efi_sigstore_parse_sigdb(L"dbx");
+ dbx = efi_sigstore_parse_sigdb(u"dbx");
if (!dbx) {
EFI_PRINT("Getting signature database(dbx) failed\n");
goto err;
diff --git a/lib/efi_loader/efi_setup.c b/lib/efi_loader/efi_setup.c
index 380adc1..eee54e4 100644
--- a/lib/efi_loader/efi_setup.c
+++ b/lib/efi_loader/efi_setup.c
@@ -43,7 +43,7 @@ static efi_status_t efi_init_platform_lang(void)
* Variable PlatformLangCodes defines the language codes that the
* machine can support.
*/
- ret = efi_set_variable_int(L"PlatformLangCodes",
+ ret = efi_set_variable_int(u"PlatformLangCodes",
&efi_global_variable_guid,
EFI_VARIABLE_BOOTSERVICE_ACCESS |
EFI_VARIABLE_RUNTIME_ACCESS |
@@ -57,7 +57,7 @@ static efi_status_t efi_init_platform_lang(void)
* Variable PlatformLang defines the language that the machine has been
* configured for.
*/
- ret = efi_get_variable_int(L"PlatformLang",
+ ret = efi_get_variable_int(u"PlatformLang",
&efi_global_variable_guid,
NULL, &data_size, &pos, NULL);
if (ret == EFI_BUFFER_TOO_SMALL) {
@@ -74,7 +74,7 @@ static efi_status_t efi_init_platform_lang(void)
if (pos)
*pos = 0;
- ret = efi_set_variable_int(L"PlatformLang",
+ ret = efi_set_variable_int(u"PlatformLang",
&efi_global_variable_guid,
EFI_VARIABLE_NON_VOLATILE |
EFI_VARIABLE_BOOTSERVICE_ACCESS |
@@ -100,7 +100,7 @@ static efi_status_t efi_init_secure_boot(void)
};
efi_status_t ret;
- ret = efi_set_variable_int(L"SignatureSupport",
+ ret = efi_set_variable_int(u"SignatureSupport",
&efi_global_variable_guid,
EFI_VARIABLE_READ_ONLY |
EFI_VARIABLE_BOOTSERVICE_ACCESS |
@@ -129,12 +129,12 @@ static efi_status_t efi_init_capsule(void)
efi_status_t ret = EFI_SUCCESS;
if (IS_ENABLED(CONFIG_EFI_HAVE_CAPSULE_UPDATE)) {
- ret = efi_set_variable_int(L"CapsuleMax",
+ ret = efi_set_variable_int(u"CapsuleMax",
&efi_guid_capsule_report,
EFI_VARIABLE_READ_ONLY |
EFI_VARIABLE_BOOTSERVICE_ACCESS |
EFI_VARIABLE_RUNTIME_ACCESS,
- 22, L"CapsuleFFFF", false);
+ 22, u"CapsuleFFFF", false);
if (ret != EFI_SUCCESS)
printf("EFI: cannot initialize CapsuleMax variable\n");
}
@@ -165,7 +165,7 @@ static efi_status_t efi_init_os_indications(void)
os_indications_supported |=
EFI_OS_INDICATIONS_FMP_CAPSULE_SUPPORTED;
- return efi_set_variable_int(L"OsIndicationsSupported",
+ return efi_set_variable_int(u"OsIndicationsSupported",
&efi_global_variable_guid,
EFI_VARIABLE_BOOTSERVICE_ACCESS |
EFI_VARIABLE_RUNTIME_ACCESS |
diff --git a/lib/efi_loader/efi_string.c b/lib/efi_loader/efi_string.c
index a3b8edf..8bf1e49 100644
--- a/lib/efi_loader/efi_string.c
+++ b/lib/efi_loader/efi_string.c
@@ -16,7 +16,7 @@
* @index: Index
*
* Create a utf-16 string with @name, appending @index.
- * For example, L"Capsule0001"
+ * For example, u"Capsule0001"
*
* The caller must ensure that the buffer has enough space for the resulting
* string including the trailing L'\0'.
diff --git a/lib/efi_loader/efi_tcg2.c b/lib/efi_loader/efi_tcg2.c
index 0ae07ef..99ec3a5 100644
--- a/lib/efi_loader/efi_tcg2.c
+++ b/lib/efi_loader/efi_tcg2.c
@@ -1916,8 +1916,8 @@ static efi_status_t tcg2_measure_boot_variable(struct udevice *dev)
{
u16 *boot_order;
u16 *boot_index;
- u16 var_name[] = L"BootOrder";
- u16 boot_name[] = L"Boot####";
+ u16 var_name[] = u"BootOrder";
+ u16 boot_name[] = u"Boot####";
u8 *bootvar;
efi_uintn_t var_data_size;
u32 count, i;
diff --git a/lib/efi_loader/efi_var_common.c b/lib/efi_loader/efi_var_common.c
index 9f1dd74..eb83702 100644
--- a/lib/efi_loader/efi_var_common.c
+++ b/lib/efi_loader/efi_var_common.c
@@ -229,26 +229,26 @@ static efi_status_t efi_set_secure_state(u8 secure_boot, u8 setup_mode,
efi_secure_boot = secure_boot;
- ret = efi_set_variable_int(L"SecureBoot", &efi_global_variable_guid,
+ ret = efi_set_variable_int(u"SecureBoot", &efi_global_variable_guid,
attributes_ro, sizeof(secure_boot),
&secure_boot, false);
if (ret != EFI_SUCCESS)
goto err;
- ret = efi_set_variable_int(L"SetupMode", &efi_global_variable_guid,
+ ret = efi_set_variable_int(u"SetupMode", &efi_global_variable_guid,
attributes_ro, sizeof(setup_mode),
&setup_mode, false);
if (ret != EFI_SUCCESS)
goto err;
- ret = efi_set_variable_int(L"AuditMode", &efi_global_variable_guid,
+ ret = efi_set_variable_int(u"AuditMode", &efi_global_variable_guid,
audit_mode || setup_mode ?
attributes_ro : attributes_rw,
sizeof(audit_mode), &audit_mode, false);
if (ret != EFI_SUCCESS)
goto err;
- ret = efi_set_variable_int(L"DeployedMode",
+ ret = efi_set_variable_int(u"DeployedMode",
&efi_global_variable_guid,
audit_mode || deployed_mode || setup_mode ?
attributes_ro : attributes_rw,
@@ -280,7 +280,7 @@ static efi_status_t efi_transfer_secure_state(enum efi_secure_mode mode)
if (ret != EFI_SUCCESS)
goto err;
} else if (mode == EFI_MODE_AUDIT) {
- ret = efi_set_variable_int(L"PK", &efi_global_variable_guid,
+ ret = efi_set_variable_int(u"PK", &efi_global_variable_guid,
EFI_VARIABLE_BOOTSERVICE_ACCESS |
EFI_VARIABLE_RUNTIME_ACCESS,
0, NULL, false);
@@ -354,7 +354,7 @@ efi_status_t efi_init_secure_state(void)
return ret;
/* As we do not provide vendor keys this variable is always 0. */
- ret = efi_set_variable_int(L"VendorKeys",
+ ret = efi_set_variable_int(u"VendorKeys",
&efi_global_variable_guid,
EFI_VARIABLE_BOOTSERVICE_ACCESS |
EFI_VARIABLE_RUNTIME_ACCESS |
diff --git a/lib/efi_loader/efi_variable.c b/lib/efi_loader/efi_variable.c
index 5adc7f8..8ca2d85 100644
--- a/lib/efi_loader/efi_variable.c
+++ b/lib/efi_loader/efi_variable.c
@@ -145,15 +145,15 @@ static efi_status_t efi_variable_authenticate(const u16 *variable,
case EFI_AUTH_VAR_PK:
case EFI_AUTH_VAR_KEK:
/* with PK */
- truststore = efi_sigstore_parse_sigdb(L"PK");
+ truststore = efi_sigstore_parse_sigdb(u"PK");
if (!truststore)
goto err;
break;
case EFI_AUTH_VAR_DB:
case EFI_AUTH_VAR_DBX:
/* with PK and KEK */
- truststore = efi_sigstore_parse_sigdb(L"KEK");
- truststore2 = efi_sigstore_parse_sigdb(L"PK");
+ truststore = efi_sigstore_parse_sigdb(u"KEK");
+ truststore2 = efi_sigstore_parse_sigdb(u"PK");
if (!truststore) {
if (!truststore2)
goto err;
diff --git a/lib/efi_loader/efi_variable_tee.c b/lib/efi_loader/efi_variable_tee.c
index a2c65e3..58931c4 100644
--- a/lib/efi_loader/efi_variable_tee.c
+++ b/lib/efi_loader/efi_variable_tee.c
@@ -588,7 +588,7 @@ efi_status_t efi_set_variable_int(const u16 *variable_name,
if (alt_ret != EFI_SUCCESS)
goto out;
- if (!u16_strcmp(variable_name, L"PK"))
+ if (!u16_strcmp(variable_name, u"PK"))
alt_ret = efi_init_secure_state();
out:
free(comm_buf);
diff --git a/lib/efi_loader/helloworld.c b/lib/efi_loader/helloworld.c
index 33e4fbc..10666dc 100644
--- a/lib/efi_loader/helloworld.c
+++ b/lib/efi_loader/helloworld.c
@@ -34,7 +34,7 @@ static struct efi_simple_text_output_protocol *con_out;
*/
static void print_uefi_revision(void)
{
- u16 rev[] = L"0.0.0";
+ u16 rev[] = u"0.0.0";
rev[0] = (systable->hdr.revision >> 16) + '0';
rev[4] = systable->hdr.revision & 0xffff;
@@ -48,9 +48,9 @@ static void print_uefi_revision(void)
else
rev[3] = 0;
- con_out->output_string(con_out, L"Running on UEFI ");
+ con_out->output_string(con_out, u"Running on UEFI ");
con_out->output_string(con_out, rev);
- con_out->output_string(con_out, L"\r\n");
+ con_out->output_string(con_out, u"\r\n");
}
/**
@@ -65,15 +65,15 @@ static void print_config_tables(void)
if (!memcmp(&systable->tables[i].guid, &fdt_guid,
sizeof(efi_guid_t)))
con_out->output_string
- (con_out, L"Have device tree\r\n");
+ (con_out, u"Have device tree\r\n");
if (!memcmp(&systable->tables[i].guid, &acpi_guid,
sizeof(efi_guid_t)))
con_out->output_string
- (con_out, L"Have ACPI 2.0 table\r\n");
+ (con_out, u"Have ACPI 2.0 table\r\n");
if (!memcmp(&systable->tables[i].guid, &smbios_guid,
sizeof(efi_guid_t)))
con_out->output_string
- (con_out, L"Have SMBIOS table\r\n");
+ (con_out, u"Have SMBIOS table\r\n");
}
}
@@ -86,13 +86,13 @@ static void print_config_tables(void)
void print_load_options(struct efi_loaded_image *loaded_image)
{
/* Output the load options */
- con_out->output_string(con_out, L"Load options: ");
+ con_out->output_string(con_out, u"Load options: ");
if (loaded_image->load_options_size && loaded_image->load_options)
con_out->output_string(con_out,
(u16 *)loaded_image->load_options);
else
- con_out->output_string(con_out, L"<none>");
- con_out->output_string(con_out, L"\r\n");
+ con_out->output_string(con_out, u"<none>");
+ con_out->output_string(con_out, u"\r\n");
}
/**
@@ -108,21 +108,21 @@ efi_status_t print_device_path(struct efi_device_path *device_path,
efi_status_t ret;
if (!device_path) {
- con_out->output_string(con_out, L"<none>\r\n");
+ con_out->output_string(con_out, u"<none>\r\n");
return EFI_SUCCESS;
}
string = dp2txt->convert_device_path_to_text(device_path, true, false);
if (!string) {
con_out->output_string
- (con_out, L"Cannot convert device path to text\r\n");
+ (con_out, u"Cannot convert device path to text\r\n");
return EFI_OUT_OF_RESOURCES;
}
con_out->output_string(con_out, string);
- con_out->output_string(con_out, L"\r\n");
+ con_out->output_string(con_out, u"\r\n");
ret = boottime->free_pool(string);
if (ret != EFI_SUCCESS) {
- con_out->output_string(con_out, L"Cannot free pool memory\r\n");
+ con_out->output_string(con_out, u"Cannot free pool memory\r\n");
return ret;
}
return EFI_SUCCESS;
@@ -148,7 +148,7 @@ efi_status_t EFIAPI efi_main(efi_handle_t handle,
con_out = systable->con_out;
/* UEFI requires CR LF */
- con_out->output_string(con_out, L"Hello, world!\r\n");
+ con_out->output_string(con_out, u"Hello, world!\r\n");
print_uefi_revision();
print_config_tables();
@@ -158,7 +158,7 @@ efi_status_t EFIAPI efi_main(efi_handle_t handle,
(void **)&loaded_image);
if (ret != EFI_SUCCESS) {
con_out->output_string
- (con_out, L"Cannot open loaded image protocol\r\n");
+ (con_out, u"Cannot open loaded image protocol\r\n");
goto out;
}
print_load_options(loaded_image);
@@ -168,12 +168,12 @@ efi_status_t EFIAPI efi_main(efi_handle_t handle,
NULL, (void **)&device_path_to_text);
if (ret != EFI_SUCCESS) {
con_out->output_string
- (con_out, L"Cannot open device path to text protocol\r\n");
+ (con_out, u"Cannot open device path to text protocol\r\n");
goto out;
}
if (!loaded_image->device_handle) {
con_out->output_string
- (con_out, L"Missing device handle\r\n");
+ (con_out, u"Missing device handle\r\n");
goto out;
}
ret = boottime->handle_protocol(loaded_image->device_handle,
@@ -181,14 +181,14 @@ efi_status_t EFIAPI efi_main(efi_handle_t handle,
(void **)&device_path);
if (ret != EFI_SUCCESS) {
con_out->output_string
- (con_out, L"Missing device path for device handle\r\n");
+ (con_out, u"Missing device path for device handle\r\n");
goto out;
}
- con_out->output_string(con_out, L"Boot device: ");
+ con_out->output_string(con_out, u"Boot device: ");
ret = print_device_path(device_path, device_path_to_text);
if (ret != EFI_SUCCESS)
goto out;
- con_out->output_string(con_out, L"File path: ");
+ con_out->output_string(con_out, u"File path: ");
ret = print_device_path(loaded_image->file_path, device_path_to_text);
if (ret != EFI_SUCCESS)
goto out;
diff --git a/lib/efi_selftest/dtbdump.c b/lib/efi_selftest/dtbdump.c
index 6e1eaa4..3ce2a07 100644
--- a/lib/efi_selftest/dtbdump.c
+++ b/lib/efi_selftest/dtbdump.c
@@ -109,7 +109,7 @@ static efi_status_t efi_input(u16 *buffer, efi_uintn_t buffer_size)
struct efi_input_key key = {0};
efi_uintn_t index;
efi_uintn_t pos = 0;
- u16 outbuf[2] = L" ";
+ u16 outbuf[2] = u" ";
efi_status_t ret;
/* Drain the console input */
@@ -124,7 +124,7 @@ static efi_status_t efi_input(u16 *buffer, efi_uintn_t buffer_size)
continue;
switch (key.scan_code) {
case 0x17: /* Escape */
- print(L"\r\nAborted\r\n");
+ print(u"\r\nAborted\r\n");
return EFI_ABORTED;
default:
break;
@@ -133,12 +133,12 @@ static efi_status_t efi_input(u16 *buffer, efi_uintn_t buffer_size)
case 0x08: /* Backspace */
if (pos) {
buffer[pos--] = 0;
- print(L"\b \b");
+ print(u"\b \b");
}
break;
case 0x0a: /* Linefeed */
case 0x0d: /* Carriage return */
- print(L"\r\n");
+ print(u"\r\n");
return EFI_SUCCESS;
default:
break;
@@ -228,9 +228,9 @@ bool starts_with(u16 *string, u16 *keyword)
*/
void do_help(void)
{
- error(L"load <dtb> - load device-tree from file\r\n");
- error(L"save <dtb> - save device-tree to file\r\n");
- error(L"exit - exit the shell\r\n");
+ error(u"load <dtb> - load device-tree from file\r\n");
+ error(u"save <dtb> - save device-tree to file\r\n");
+ error(u"exit - exit the shell\r\n");
}
/**
@@ -251,7 +251,7 @@ open_file_system(struct efi_simple_file_system_protocol **file_system)
(void **)&loaded_image, NULL, NULL,
EFI_OPEN_PROTOCOL_GET_PROTOCOL);
if (ret != EFI_SUCCESS) {
- error(L"Loaded image protocol not found\r\n");
+ error(u"Loaded image protocol not found\r\n");
return ret;
}
@@ -272,7 +272,7 @@ open_file_system(struct efi_simple_file_system_protocol **file_system)
(void **)file_system, NULL, NULL,
EFI_OPEN_PROTOCOL_GET_PROTOCOL);
if (ret != EFI_SUCCESS)
- error(L"Failed to open simple file system protocol\r\n");
+ error(u"Failed to open simple file system protocol\r\n");
if (handle)
bs->free_pool(handle_buffer);
@@ -300,7 +300,7 @@ efi_status_t do_load(u16 *filename)
ret = bs->locate_protocol(&efi_dt_fixup_protocol_guid, NULL,
(void **)&dt_fixup_prot);
if (ret != EFI_SUCCESS) {
- error(L"Device-tree fix-up protocol not found\r\n");
+ error(u"Device-tree fix-up protocol not found\r\n");
return ret;
}
@@ -313,50 +313,50 @@ efi_status_t do_load(u16 *filename)
/* Open volume */
ret = file_system->open_volume(file_system, &root);
if (ret != EFI_SUCCESS) {
- error(L"Failed to open volume\r\n");
+ error(u"Failed to open volume\r\n");
goto out;
}
/* Open file */
ret = root->open(root, &file, filename, EFI_FILE_MODE_READ, 0);
if (ret != EFI_SUCCESS) {
- error(L"File not found\r\n");
+ error(u"File not found\r\n");
goto out;
}
/* Get file size */
buffer_size = 0;
ret = file->getinfo(file, &efi_file_info_guid, &buffer_size, NULL);
if (ret != EFI_BUFFER_TOO_SMALL) {
- error(L"Can't get file info size\r\n");
+ error(u"Can't get file info size\r\n");
goto out;
}
ret = bs->allocate_pool(EFI_LOADER_DATA, buffer_size, (void **)&info);
if (ret != EFI_SUCCESS) {
- error(L"Out of memory\r\n");
+ error(u"Out of memory\r\n");
goto out;
}
ret = file->getinfo(file, &efi_file_info_guid, &buffer_size, info);
if (ret != EFI_SUCCESS) {
- error(L"Can't get file info\r\n");
+ error(u"Can't get file info\r\n");
goto out;
}
buffer_size = info->file_size;
pages = efi_size_in_pages(buffer_size);
ret = bs->free_pool(info);
if (ret != EFI_SUCCESS)
- error(L"Can't free memory pool\r\n");
+ error(u"Can't free memory pool\r\n");
/* Read file */
ret = bs->allocate_pages(EFI_ALLOCATE_ANY_PAGES,
EFI_ACPI_RECLAIM_MEMORY,
pages, &addr);
if (ret != EFI_SUCCESS) {
- error(L"Out of memory\r\n");
+ error(u"Out of memory\r\n");
goto out;
}
dtb = (struct fdt_header *)(uintptr_t)addr;
ret = file->read(file, &buffer_size, dtb);
if (ret != EFI_SUCCESS) {
- error(L"Can't read file\r\n");
+ error(u"Can't read file\r\n");
goto out;
}
/* Fixup file, expecting EFI_BUFFER_TOO_SMALL */
@@ -367,24 +367,24 @@ efi_status_t do_load(u16 *filename)
/* Read file into larger buffer */
ret = bs->free_pages(addr, pages);
if (ret != EFI_SUCCESS)
- error(L"Can't free memory pages\r\n");
+ error(u"Can't free memory pages\r\n");
pages = efi_size_in_pages(buffer_size);
ret = bs->allocate_pages(EFI_ALLOCATE_ANY_PAGES,
EFI_ACPI_RECLAIM_MEMORY,
pages, &addr);
if (ret != EFI_SUCCESS) {
- error(L"Out of memory\r\n");
+ error(u"Out of memory\r\n");
goto out;
}
dtb = (struct fdt_header *)(uintptr_t)addr;
ret = file->setpos(file, 0);
if (ret != EFI_SUCCESS) {
- error(L"Can't position file\r\n");
+ error(u"Can't position file\r\n");
goto out;
}
ret = file->read(file, &buffer_size, dtb);
if (ret != EFI_SUCCESS) {
- error(L"Can't read file\r\n");
+ error(u"Can't read file\r\n");
goto out;
}
buffer_size = pages << EFI_PAGE_SHIFT;
@@ -394,24 +394,24 @@ efi_status_t do_load(u16 *filename)
EFI_DT_INSTALL_TABLE);
}
if (ret == EFI_SUCCESS)
- print(L"device-tree installed\r\n");
+ print(u"device-tree installed\r\n");
else
- error(L"Device-tree fix-up failed\r\n");
+ error(u"Device-tree fix-up failed\r\n");
out:
if (addr) {
ret2 = bs->free_pages(addr, pages);
if (ret2 != EFI_SUCCESS)
- error(L"Can't free memory pages\r\n");
+ error(u"Can't free memory pages\r\n");
}
if (file) {
ret2 = file->close(file);
if (ret2 != EFI_SUCCESS)
- error(L"Can't close file\r\n");
+ error(u"Can't close file\r\n");
}
if (root) {
ret2 = root->close(root);
if (ret2 != EFI_SUCCESS)
- error(L"Can't close volume\r\n");
+ error(u"Can't close volume\r\n");
}
return ret;
}
@@ -432,11 +432,11 @@ efi_status_t do_save(u16 *filename)
dtb = get_dtb(systable);
if (!dtb) {
- error(L"DTB not found\r\n");
+ error(u"DTB not found\r\n");
return EFI_NOT_FOUND;
}
if (f2h(dtb->magic) != FDT_MAGIC) {
- error(L"Wrong device tree magic\r\n");
+ error(u"Wrong device tree magic\r\n");
return EFI_NOT_FOUND;
}
dtb_size = f2h(dtb->totalsize);
@@ -450,19 +450,19 @@ efi_status_t do_save(u16 *filename)
/* Open volume */
ret = file_system->open_volume(file_system, &root);
if (ret != EFI_SUCCESS) {
- error(L"Failed to open volume\r\n");
+ error(u"Failed to open volume\r\n");
return ret;
}
/* Check if file already exists */
ret = root->open(root, &file, filename, EFI_FILE_MODE_READ, 0);
if (ret == EFI_SUCCESS) {
file->close(file);
- print(L"Overwrite existing file (y/n)? ");
+ print(u"Overwrite existing file (y/n)? ");
ret = efi_input_yn();
- print(L"\r\n");
+ print(u"\r\n");
if (ret != EFI_SUCCESS) {
root->close(root);
- error(L"Aborted by user\r\n");
+ error(u"Aborted by user\r\n");
return ret;
}
}
@@ -475,16 +475,16 @@ efi_status_t do_save(u16 *filename)
/* Write file */
ret = file->write(file, &dtb_size, dtb);
if (ret != EFI_SUCCESS)
- error(L"Failed to write file\r\n");
+ error(u"Failed to write file\r\n");
file->close(file);
} else {
- error(L"Failed to open file\r\n");
+ error(u"Failed to open file\r\n");
}
root->close(root);
if (ret == EFI_SUCCESS) {
print(filename);
- print(L" written\r\n");
+ print(u" written\r\n");
}
return ret;
@@ -510,7 +510,7 @@ efi_status_t EFIAPI efi_main(efi_handle_t image_handle,
cout->set_attribute(cout, EFI_LIGHTBLUE | EFI_BACKGROUND_BLACK);
cout->clear_screen(cout);
cout->set_attribute(cout, EFI_WHITE | EFI_BACKGROUND_BLACK);
- print(L"DTB Dump\r\n========\r\n\r\n");
+ print(u"DTB Dump\r\n========\r\n\r\n");
cout->set_attribute(cout, EFI_LIGHTBLUE | EFI_BACKGROUND_BLACK);
for (;;) {
@@ -518,16 +518,16 @@ efi_status_t EFIAPI efi_main(efi_handle_t image_handle,
u16 *pos;
efi_uintn_t ret;
- print(L"=> ");
+ print(u"=> ");
ret = efi_input(command, sizeof(command));
if (ret == EFI_ABORTED)
break;
pos = skip_whitespace(command);
- if (starts_with(pos, L"exit"))
+ if (starts_with(pos, u"exit"))
break;
- else if (starts_with(pos, L"load "))
+ else if (starts_with(pos, u"load "))
do_load(pos + 5);
- else if (starts_with(pos, L"save "))
+ else if (starts_with(pos, u"save "))
do_save(pos + 5);
else
do_help();
diff --git a/lib/efi_selftest/efi_selftest.c b/lib/efi_selftest/efi_selftest.c
index 474a8b8..8e427b9 100644
--- a/lib/efi_selftest/efi_selftest.c
+++ b/lib/efi_selftest/efi_selftest.c
@@ -18,7 +18,7 @@ static const struct efi_system_table *systable;
static const struct efi_boot_services *boottime;
static const struct efi_runtime_services *runtime;
static efi_handle_t handle;
-static u16 reset_message[] = L"Selftest completed";
+static u16 reset_message[] = u"Selftest completed";
static int *setup_status;
/*
diff --git a/lib/efi_selftest/efi_selftest_block_device.c b/lib/efi_selftest/efi_selftest_block_device.c
index 62b3e04..60fa655 100644
--- a/lib/efi_selftest/efi_selftest_block_device.c
+++ b/lib/efi_selftest/efi_selftest_block_device.c
@@ -407,7 +407,7 @@ static int execute(void)
}
/* Read file */
- ret = root->open(root, &file, L"hello.txt", EFI_FILE_MODE_READ,
+ ret = root->open(root, &file, u"hello.txt", EFI_FILE_MODE_READ,
0);
if (ret != EFI_SUCCESS) {
efi_st_error("Failed to open file\n");
@@ -451,7 +451,7 @@ static int execute(void)
#ifdef CONFIG_FAT_WRITE
/* Write file */
- ret = root->open(root, &file, L"u-boot.txt", EFI_FILE_MODE_READ |
+ ret = root->open(root, &file, u"u-boot.txt", EFI_FILE_MODE_READ |
EFI_FILE_MODE_WRITE | EFI_FILE_MODE_CREATE, 0);
if (ret != EFI_SUCCESS) {
efi_st_error("Failed to open file\n");
@@ -483,7 +483,7 @@ static int execute(void)
/* Verify file */
boottime->set_mem(buf, sizeof(buf), 0);
- ret = root->open(root, &file, L"u-boot.txt", EFI_FILE_MODE_READ,
+ ret = root->open(root, &file, u"u-boot.txt", EFI_FILE_MODE_READ,
0);
if (ret != EFI_SUCCESS) {
efi_st_error("Failed to open file\n");
diff --git a/lib/efi_selftest/efi_selftest_devicepath.c b/lib/efi_selftest/efi_selftest_devicepath.c
index d87b9f7..8a22a5d 100644
--- a/lib/efi_selftest/efi_selftest_devicepath.c
+++ b/lib/efi_selftest/efi_selftest_devicepath.c
@@ -319,7 +319,7 @@ static int execute(void)
{ DEVICE_PATH_TYPE_MEDIA_DEVICE,
DEVICE_PATH_SUB_TYPE_FILE_PATH,
sizeof(struct efi_device_path) + 12},
- L"u-boot.bin",
+ u"u-boot.bin",
};
u16 *string;
efi_status_t ret;
diff --git a/lib/efi_selftest/efi_selftest_exception.c b/lib/efi_selftest/efi_selftest_exception.c
index dca7f7d..64e7b0a 100644
--- a/lib/efi_selftest/efi_selftest_exception.c
+++ b/lib/efi_selftest/efi_selftest_exception.c
@@ -31,7 +31,7 @@ static struct {
DEVICE_PATH_SUB_TYPE_FILE_PATH,
sizeof(dp.dp) + sizeof(dp.filename),
},
- L"bug.efi",
+ u"bug.efi",
{
DEVICE_PATH_TYPE_END,
DEVICE_PATH_SUB_TYPE_END,
diff --git a/lib/efi_selftest/efi_selftest_fdt.c b/lib/efi_selftest/efi_selftest_fdt.c
index 70fe06e..f4a7fcb 100644
--- a/lib/efi_selftest/efi_selftest_fdt.c
+++ b/lib/efi_selftest/efi_selftest_fdt.c
@@ -199,7 +199,7 @@ static int execute(void)
char *str;
efi_status_t ret;
- str = get_property(L"compatible", NULL);
+ str = get_property(u"compatible", NULL);
if (str) {
efi_st_printf("compatible: %s\n", str);
ret = boottime->free_pool(str);
@@ -211,7 +211,7 @@ static int execute(void)
efi_st_error("Missing property 'compatible'\n");
return EFI_ST_FAILURE;
}
- str = get_property(L"serial-number", NULL);
+ str = get_property(u"serial-number", NULL);
if (str) {
efi_st_printf("serial-number: %s\n", str);
ret = boottime->free_pool(str);
@@ -220,7 +220,7 @@ static int execute(void)
return EFI_ST_FAILURE;
}
}
- str = get_property(L"boot-hartid", L"chosen");
+ str = get_property(u"boot-hartid", u"chosen");
if (IS_ENABLED(CONFIG_RISCV)) {
if (str) {
efi_st_printf("boot-hartid: %u\n",
diff --git a/lib/efi_selftest/efi_selftest_hii.c b/lib/efi_selftest/efi_selftest_hii.c
index 66ccec1..eaf3b09 100644
--- a/lib/efi_selftest/efi_selftest_hii.c
+++ b/lib/efi_selftest/efi_selftest_hii.c
@@ -699,7 +699,7 @@ static int test_hii_string_new_string(void)
ret = hii_string_protocol->new_string(hii_string_protocol, handle,
&id, (u8 *)"en-US",
- L"Japanese", L"Japanese", NULL);
+ u"Japanese", u"Japanese", NULL);
if (ret != EFI_SUCCESS) {
efi_st_error("new_string returned %u\n",
(unsigned int)ret);
@@ -752,7 +752,7 @@ static int test_hii_string_get_string(void)
ret = hii_string_protocol->new_string(hii_string_protocol, handle,
&id, (u8 *)"en-US",
- L"Japanese", L"Japanese", NULL);
+ u"Japanese", u"Japanese", NULL);
if (ret != EFI_SUCCESS) {
efi_st_error("new_string returned %u\n",
(unsigned int)ret);
@@ -831,7 +831,7 @@ static int test_hii_string_set_string(void)
ret = hii_string_protocol->new_string(hii_string_protocol, handle,
&id, (u8 *)"en-US",
- L"Japanese", L"Japanese", NULL);
+ u"Japanese", u"Japanese", NULL);
if (ret != EFI_SUCCESS) {
efi_st_error("new_string returned %u\n",
(unsigned int)ret);
@@ -840,7 +840,7 @@ static int test_hii_string_set_string(void)
ret = hii_string_protocol->set_string(hii_string_protocol, handle,
id, (u8 *)"en-US",
- L"Nihongo", NULL);
+ u"Nihongo", NULL);
if (ret != EFI_SUCCESS) {
efi_st_error("set_string returned %u\n",
(unsigned int)ret);
diff --git a/lib/efi_selftest/efi_selftest_load_file.c b/lib/efi_selftest/efi_selftest_load_file.c
index bac0e6b..8784a76 100644
--- a/lib/efi_selftest/efi_selftest_load_file.c
+++ b/lib/efi_selftest/efi_selftest_load_file.c
@@ -101,7 +101,7 @@ static struct {
FILE_NAME_SIZE * sizeof(u16),
}
},
- L"\\lf.efi",
+ u"\\lf.efi",
{
DEVICE_PATH_TYPE_END,
DEVICE_PATH_SUB_TYPE_END,
@@ -152,7 +152,7 @@ static struct {
FILE_NAME_SIZE * sizeof(u16),
}
},
- L"\\lf2.efi",
+ u"\\lf2.efi",
{
DEVICE_PATH_TYPE_END,
DEVICE_PATH_SUB_TYPE_END,
diff --git a/lib/efi_selftest/efi_selftest_loadimage.c b/lib/efi_selftest/efi_selftest_loadimage.c
index 72c8d51..d4c76f5 100644
--- a/lib/efi_selftest/efi_selftest_loadimage.c
+++ b/lib/efi_selftest/efi_selftest_loadimage.c
@@ -20,8 +20,8 @@
/* Binary logarithm of the block size */
#define LB_BLOCK_SIZE 9
-#define FILE_NAME L"app.efi"
-#define VOLUME_NAME L"EfiDisk"
+#define FILE_NAME u"app.efi"
+#define VOLUME_NAME u"EfiDisk"
static struct efi_boot_services *boottime;
static efi_handle_t handle_image;
diff --git a/lib/efi_selftest/efi_selftest_miniapp_exception.c b/lib/efi_selftest/efi_selftest_miniapp_exception.c
index 9be0e7e..79f9a67 100644
--- a/lib/efi_selftest/efi_selftest_miniapp_exception.c
+++ b/lib/efi_selftest/efi_selftest_miniapp_exception.c
@@ -23,7 +23,7 @@ efi_status_t EFIAPI efi_main(efi_handle_t handle,
struct efi_simple_text_output_protocol *con_out = systable->con_out;
con_out->output_string(con_out,
- L"EFI application triggers exception.\n");
+ u"EFI application triggers exception.\n");
#if defined(CONFIG_ARM)
/*
@@ -38,6 +38,6 @@ efi_status_t EFIAPI efi_main(efi_handle_t handle,
#elif defined(CONFIG_X86)
asm volatile (".word 0xffff\n");
#endif
- con_out->output_string(con_out, L"Exception not triggered.\n");
+ con_out->output_string(con_out, u"Exception not triggered.\n");
return EFI_ABORTED;
}
diff --git a/lib/efi_selftest/efi_selftest_miniapp_exit.c b/lib/efi_selftest/efi_selftest_miniapp_exit.c
index 2ea19f2..1c42d6d 100644
--- a/lib/efi_selftest/efi_selftest_miniapp_exit.c
+++ b/lib/efi_selftest/efi_selftest_miniapp_exit.c
@@ -40,7 +40,7 @@ static efi_status_t EFIAPI check_loaded_image_protocol
NULL, EFI_OPEN_PROTOCOL_GET_PROTOCOL);
if (ret != EFI_SUCCESS) {
cout->output_string(cout,
- L"Could not open loaded image protocol");
+ u"Could not open loaded image protocol");
return ret;
}
if ((void *)check_loaded_image_protocol <
@@ -49,7 +49,7 @@ static efi_status_t EFIAPI check_loaded_image_protocol
loaded_image_protocol->image_base +
loaded_image_protocol->image_size) {
cout->output_string(cout,
- L"Incorrect image_base or image_size\n");
+ u"Incorrect image_base or image_size\n");
return EFI_NOT_FOUND;
}
return EFI_SUCCESS;
@@ -69,11 +69,11 @@ efi_status_t EFIAPI efi_main(efi_handle_t handle,
efi_status_t ret;
u16 text[] = EFI_ST_SUCCESS_STR;
- con_out->output_string(con_out, L"EFI application calling Exit\n");
+ con_out->output_string(con_out, u"EFI application calling Exit\n");
if (check_loaded_image_protocol(handle, systable) != EFI_SUCCESS) {
con_out->output_string(con_out,
- L"Loaded image protocol missing\n");
+ u"Loaded image protocol missing\n");
ret = EFI_NOT_FOUND;
goto out;
}
diff --git a/lib/efi_selftest/efi_selftest_miniapp_return.c b/lib/efi_selftest/efi_selftest_miniapp_return.c
index 25a2bd1..45366aa 100644
--- a/lib/efi_selftest/efi_selftest_miniapp_return.c
+++ b/lib/efi_selftest/efi_selftest_miniapp_return.c
@@ -24,7 +24,7 @@ efi_status_t EFIAPI efi_main(efi_handle_t handle,
struct efi_simple_text_output_protocol *con_out = systable->con_out;
con_out->output_string(con_out,
- L"EFI application returning w/o calling Exit\n");
+ u"EFI application returning w/o calling Exit\n");
/* The return value is checked by the calling test */
return EFI_INCOMPATIBLE_VERSION;
diff --git a/lib/efi_selftest/efi_selftest_reset.c b/lib/efi_selftest/efi_selftest_reset.c
index f888054..5dfe517 100644
--- a/lib/efi_selftest/efi_selftest_reset.c
+++ b/lib/efi_selftest/efi_selftest_reset.c
@@ -33,7 +33,7 @@ static int setup(const efi_handle_t handle,
*/
static int execute(void)
{
- u16 reset_data[] = L"Reset by selftest";
+ u16 reset_data[] = u"Reset by selftest";
runtime->reset_system(EFI_RESET_COLD, EFI_SUCCESS,
sizeof(reset_data), reset_data);
diff --git a/lib/efi_selftest/efi_selftest_textoutput.c b/lib/efi_selftest/efi_selftest_textoutput.c
index 450fe97..cc44b38 100644
--- a/lib/efi_selftest/efi_selftest_textoutput.c
+++ b/lib/efi_selftest/efi_selftest_textoutput.c
@@ -44,14 +44,14 @@ static int execute(void)
}
/* TestString */
ret = con_out->test_string(con_out,
- L" !\"#$%&'()*+,-./0-9:;<=>?@A-Z[\\]^_`a-z{|}~\n");
+ u" !\"#$%&'()*+,-./0-9:;<=>?@A-Z[\\]^_`a-z{|}~\n");
if (ret != EFI_ST_SUCCESS) {
efi_st_error("TestString failed for ANSI characters\n");
return EFI_ST_FAILURE;
}
/* OutputString */
ret = con_out->output_string(con_out,
- L"Testing cursor column update\n");
+ u"Testing cursor column update\n");
if (ret != EFI_ST_SUCCESS) {
efi_st_error("OutputString failed for ANSI characters");
return EFI_ST_FAILURE;
@@ -75,7 +75,7 @@ static int execute(void)
efi_st_error("Cursor column not 0 at beginning of line\n");
return EFI_ST_FAILURE;
}
- ret = con_out->output_string(con_out, L"123");
+ ret = con_out->output_string(con_out, u"123");
if (ret != EFI_ST_SUCCESS) {
efi_st_error("OutputString failed for ANSI characters\n");
return EFI_ST_FAILURE;
@@ -84,7 +84,7 @@ static int execute(void)
efi_st_error("Cursor column not incremented properly\n");
return EFI_ST_FAILURE;
}
- ret = con_out->output_string(con_out, L"\b");
+ ret = con_out->output_string(con_out, u"\b");
if (ret != EFI_ST_SUCCESS) {
efi_st_error("OutputString failed for backspace\n");
return EFI_ST_FAILURE;
@@ -93,7 +93,7 @@ static int execute(void)
efi_st_error("Cursor column not decremented properly\n");
return EFI_ST_FAILURE;
}
- ret = con_out->output_string(con_out, L"\b\b");
+ ret = con_out->output_string(con_out, u"\b\b");
if (ret != EFI_ST_SUCCESS) {
efi_st_error("OutputString failed for backspace\n");
return EFI_ST_FAILURE;
@@ -102,7 +102,7 @@ static int execute(void)
efi_st_error("Cursor column not decremented properly\n");
return EFI_ST_FAILURE;
}
- ret = con_out->output_string(con_out, L"\b\b");
+ ret = con_out->output_string(con_out, u"\b\b");
if (ret != EFI_ST_SUCCESS) {
efi_st_error("OutputString failed for backspace\n");
return EFI_ST_FAILURE;
diff --git a/lib/efi_selftest/efi_selftest_unicode_collation.c b/lib/efi_selftest/efi_selftest_unicode_collation.c
index 7529430..c63a1b5 100644
--- a/lib/efi_selftest/efi_selftest_unicode_collation.c
+++ b/lib/efi_selftest/efi_selftest_unicode_collation.c
@@ -44,9 +44,9 @@ static int setup(const efi_handle_t handle,
static int test_stri_coll(void)
{
efi_intn_t ret;
- u16 c1[] = L"first";
- u16 c2[] = L"FIRST";
- u16 c3[] = L"second";
+ u16 c1[] = u"first";
+ u16 c2[] = u"FIRST";
+ u16 c3[] = u"second";
ret = unicode_collation_protocol->stri_coll(unicode_collation_protocol,
c1, c2);
@@ -78,66 +78,66 @@ static int test_stri_coll(void)
static int test_metai_match(void)
{
bool ret;
- const u16 c[] = L"Das U-Boot";
+ const u16 c[] = u"Das U-Boot";
ret = unicode_collation_protocol->metai_match(
- unicode_collation_protocol, c, L"*");
+ unicode_collation_protocol, c, u"*");
if (!ret) {
efi_st_error("metai_match returned %u\n", ret);
return EFI_ST_FAILURE;
}
ret = unicode_collation_protocol->metai_match(
- unicode_collation_protocol, c, L"Da[rstu] U-Boot");
+ unicode_collation_protocol, c, u"Da[rstu] U-Boot");
if (!ret) {
efi_st_error("metai_match returned %u\n", ret);
return EFI_ST_FAILURE;
}
ret = unicode_collation_protocol->metai_match(
- unicode_collation_protocol, c, L"Da[q-v] U-Boot");
+ unicode_collation_protocol, c, u"Da[q-v] U-Boot");
if (!ret) {
efi_st_error("metai_match returned %u\n", ret);
return EFI_ST_FAILURE;
}
ret = unicode_collation_protocol->metai_match(
- unicode_collation_protocol, c, L"Da? U-Boot");
+ unicode_collation_protocol, c, u"Da? U-Boot");
if (!ret) {
efi_st_error("metai_match returned %u\n", ret);
return EFI_ST_FAILURE;
}
ret = unicode_collation_protocol->metai_match(
- unicode_collation_protocol, c, L"D*Bo*t");
+ unicode_collation_protocol, c, u"D*Bo*t");
if (!ret) {
efi_st_error("metai_match returned %u\n", ret);
return EFI_ST_FAILURE;
}
ret = unicode_collation_protocol->metai_match(
- unicode_collation_protocol, c, L"Da[xyz] U-Boot");
+ unicode_collation_protocol, c, u"Da[xyz] U-Boot");
if (ret) {
efi_st_error("metai_match returned %u\n", ret);
return EFI_ST_FAILURE;
}
ret = unicode_collation_protocol->metai_match(
- unicode_collation_protocol, c, L"Da[a-d] U-Boot");
+ unicode_collation_protocol, c, u"Da[a-d] U-Boot");
if (ret) {
efi_st_error("metai_match returned %u\n", ret);
return EFI_ST_FAILURE;
}
ret = unicode_collation_protocol->metai_match(
- unicode_collation_protocol, c, L"Da?? U-Boot");
+ unicode_collation_protocol, c, u"Da?? U-Boot");
if (ret) {
efi_st_error("metai_match returned %u\n", ret);
return EFI_ST_FAILURE;
}
ret = unicode_collation_protocol->metai_match(
- unicode_collation_protocol, c, L"D*Bo*tt");
+ unicode_collation_protocol, c, u"D*Bo*tt");
if (ret) {
efi_st_error("metai_match returned %u\n", ret);
return EFI_ST_FAILURE;
@@ -148,7 +148,7 @@ static int test_metai_match(void)
static int test_str_lwr(void)
{
- u16 c[] = L"U-Boot";
+ u16 c[] = u"U-Boot";
unicode_collation_protocol->str_lwr(unicode_collation_protocol, c);
if (efi_st_strcmp_16_8(c, "u-boot")) {
@@ -161,7 +161,7 @@ static int test_str_lwr(void)
static int test_str_upr(void)
{
- u16 c[] = L"U-Boot";
+ u16 c[] = u"U-Boot";
unicode_collation_protocol->str_upr(unicode_collation_protocol, c);
if (efi_st_strcmp_16_8(c, "U-BOOT")) {
@@ -194,16 +194,16 @@ static int test_str_to_fat(void)
boottime->set_mem(fat, sizeof(fat), 0);
ret = unicode_collation_protocol->str_to_fat(unicode_collation_protocol,
- L"U -Boo.t", 6, fat);
- if (ret || efi_st_strcmp_16_8(L"U-BOOT", fat)) {
+ u"U -Boo.t", 6, fat);
+ if (ret || efi_st_strcmp_16_8(u"U-BOOT", fat)) {
efi_st_error("str_to_fat returned %u, \"%s\"\n", ret, fat);
return EFI_ST_FAILURE;
}
boottime->set_mem(fat, 16, 0);
ret = unicode_collation_protocol->str_to_fat(unicode_collation_protocol,
- L"U\\Boot", 6, fat);
- if (!ret || efi_st_strcmp_16_8(L"U_BOOT", fat)) {
+ u"U\\Boot", 6, fat);
+ if (!ret || efi_st_strcmp_16_8(u"U_BOOT", fat)) {
efi_st_error("str_to_fat returned %u, \"%s\"\n", ret, fat);
return EFI_ST_FAILURE;
}
diff --git a/lib/efi_selftest/efi_selftest_util.c b/lib/efi_selftest/efi_selftest_util.c
index ea73c25..dba02d6 100644
--- a/lib/efi_selftest/efi_selftest_util.c
+++ b/lib/efi_selftest/efi_selftest_util.c
@@ -15,64 +15,64 @@ struct efi_st_translate {
};
static struct efi_st_translate efi_st_control_characters[] = {
- {0, L"Null"},
- {8, L"BS"},
- {9, L"TAB"},
- {10, L"LF"},
- {13, L"CR"},
+ {0, u"Null"},
+ {8, u"BS"},
+ {9, u"TAB"},
+ {10, u"LF"},
+ {13, u"CR"},
{0, NULL},
};
-static u16 efi_st_ch[] = L"' '";
-static u16 efi_st_unknown[] = L"unknown";
+static u16 efi_st_ch[] = u"' '";
+static u16 efi_st_unknown[] = u"unknown";
static struct efi_st_translate efi_st_scan_codes[] = {
- {0x00, L"Null"},
- {0x01, L"Up"},
- {0x02, L"Down"},
- {0x03, L"Right"},
- {0x04, L"Left"},
- {0x05, L"Home"},
- {0x06, L"End"},
- {0x07, L"Insert"},
- {0x08, L"Delete"},
- {0x09, L"Page Up"},
- {0x0a, L"Page Down"},
- {0x0b, L"FN 1"},
- {0x0c, L"FN 2"},
- {0x0d, L"FN 3"},
- {0x0e, L"FN 4"},
- {0x0f, L"FN 5"},
- {0x10, L"FN 6"},
- {0x11, L"FN 7"},
- {0x12, L"FN 8"},
- {0x13, L"FN 9"},
- {0x14, L"FN 10"},
- {0x15, L"FN 11"},
- {0x16, L"FN 12"},
- {0x17, L"Escape"},
- {0x68, L"FN 13"},
- {0x69, L"FN 14"},
- {0x6a, L"FN 15"},
- {0x6b, L"FN 16"},
- {0x6c, L"FN 17"},
- {0x6d, L"FN 18"},
- {0x6e, L"FN 19"},
- {0x6f, L"FN 20"},
- {0x70, L"FN 21"},
- {0x71, L"FN 22"},
- {0x72, L"FN 23"},
- {0x73, L"FN 24"},
- {0x7f, L"Mute"},
- {0x80, L"Volume Up"},
- {0x81, L"Volume Down"},
- {0x100, L"Brightness Up"},
- {0x101, L"Brightness Down"},
- {0x102, L"Suspend"},
- {0x103, L"Hibernate"},
- {0x104, L"Toggle Display"},
- {0x105, L"Recovery"},
- {0x106, L"Reject"},
+ {0x00, u"Null"},
+ {0x01, u"Up"},
+ {0x02, u"Down"},
+ {0x03, u"Right"},
+ {0x04, u"Left"},
+ {0x05, u"Home"},
+ {0x06, u"End"},
+ {0x07, u"Insert"},
+ {0x08, u"Delete"},
+ {0x09, u"Page Up"},
+ {0x0a, u"Page Down"},
+ {0x0b, u"FN 1"},
+ {0x0c, u"FN 2"},
+ {0x0d, u"FN 3"},
+ {0x0e, u"FN 4"},
+ {0x0f, u"FN 5"},
+ {0x10, u"FN 6"},
+ {0x11, u"FN 7"},
+ {0x12, u"FN 8"},
+ {0x13, u"FN 9"},
+ {0x14, u"FN 10"},
+ {0x15, u"FN 11"},
+ {0x16, u"FN 12"},
+ {0x17, u"Escape"},
+ {0x68, u"FN 13"},
+ {0x69, u"FN 14"},
+ {0x6a, u"FN 15"},
+ {0x6b, u"FN 16"},
+ {0x6c, u"FN 17"},
+ {0x6d, u"FN 18"},
+ {0x6e, u"FN 19"},
+ {0x6f, u"FN 20"},
+ {0x70, u"FN 21"},
+ {0x71, u"FN 22"},
+ {0x72, u"FN 23"},
+ {0x73, u"FN 24"},
+ {0x7f, u"Mute"},
+ {0x80, u"Volume Up"},
+ {0x81, u"Volume Down"},
+ {0x100, u"Brightness Up"},
+ {0x101, u"Brightness Down"},
+ {0x102, u"Suspend"},
+ {0x103, u"Hibernate"},
+ {0x104, u"Toggle Display"},
+ {0x105, u"Recovery"},
+ {0x106, u"Reject"},
{0x0, NULL},
};
diff --git a/lib/efi_selftest/efi_selftest_variables.c b/lib/efi_selftest/efi_selftest_variables.c
index 2c16f3d..dc1d5c8 100644
--- a/lib/efi_selftest/efi_selftest_variables.c
+++ b/lib/efi_selftest/efi_selftest_variables.c
@@ -63,7 +63,7 @@ static int execute(void)
return EFI_ST_FAILURE;
}
/* Set variable 0 */
- ret = runtime->set_variable(L"efi_st_var0", &guid_vendor0,
+ ret = runtime->set_variable(u"efi_st_var0", &guid_vendor0,
EFI_VARIABLE_BOOTSERVICE_ACCESS,
3, v + 4);
if (ret != EFI_SUCCESS) {
@@ -72,7 +72,7 @@ static int execute(void)
}
data[3] = 0xff;
len = 3;
- ret = runtime->get_variable(L"efi_st_var0", &guid_vendor0,
+ ret = runtime->get_variable(u"efi_st_var0", &guid_vendor0,
&attr, &len, data);
if (ret != EFI_SUCCESS) {
efi_st_error("GetVariable failed\n");
@@ -87,7 +87,7 @@ static int execute(void)
return EFI_ST_FAILURE;
}
/* Set variable 1 */
- ret = runtime->set_variable(L"efi_st_var1", &guid_vendor1,
+ ret = runtime->set_variable(u"efi_st_var1", &guid_vendor1,
EFI_VARIABLE_BOOTSERVICE_ACCESS,
8, v);
if (ret != EFI_SUCCESS) {
@@ -95,7 +95,7 @@ static int execute(void)
return EFI_ST_FAILURE;
}
len = EFI_ST_MAX_DATA_SIZE;
- ret = runtime->get_variable(L"efi_st_var1", &guid_vendor1,
+ ret = runtime->get_variable(u"efi_st_var1", &guid_vendor1,
&attr, &len, data);
if (ret != EFI_SUCCESS) {
efi_st_error("GetVariable failed\n");
@@ -111,7 +111,7 @@ static int execute(void)
return EFI_ST_FAILURE;
}
/* Append variable 1 */
- ret = runtime->set_variable(L"efi_st_var1", &guid_vendor1,
+ ret = runtime->set_variable(u"efi_st_var1", &guid_vendor1,
EFI_VARIABLE_BOOTSERVICE_ACCESS |
EFI_VARIABLE_APPEND_WRITE,
7, v + 8);
@@ -120,7 +120,7 @@ static int execute(void)
return EFI_ST_FAILURE;
}
len = EFI_ST_MAX_DATA_SIZE;
- ret = runtime->get_variable(L"efi_st_var1", &guid_vendor1,
+ ret = runtime->get_variable(u"efi_st_var1", &guid_vendor1,
&attr, &len, data);
if (ret != EFI_SUCCESS) {
efi_st_error("GetVariable failed\n");
@@ -132,7 +132,7 @@ static int execute(void)
if (memcmp(data, v, len))
efi_st_todo("GetVariable returned wrong value\n");
/* Append variable 2 */
- ret = runtime->set_variable(L"efi_none", &guid_vendor1,
+ ret = runtime->set_variable(u"efi_none", &guid_vendor1,
EFI_VARIABLE_BOOTSERVICE_ACCESS |
EFI_VARIABLE_APPEND_WRITE,
15, v);
@@ -173,28 +173,28 @@ static int execute(void)
return EFI_ST_FAILURE;
}
/* Delete variable 1 */
- ret = runtime->set_variable(L"efi_st_var1", &guid_vendor1,
+ ret = runtime->set_variable(u"efi_st_var1", &guid_vendor1,
0, 0, NULL);
if (ret != EFI_SUCCESS) {
efi_st_error("SetVariable failed\n");
return EFI_ST_FAILURE;
}
len = EFI_ST_MAX_DATA_SIZE;
- ret = runtime->get_variable(L"efi_st_var1", &guid_vendor1,
+ ret = runtime->get_variable(u"efi_st_var1", &guid_vendor1,
&attr, &len, data);
if (ret != EFI_NOT_FOUND) {
efi_st_error("Variable was not deleted\n");
return EFI_ST_FAILURE;
}
/* Delete variable 0 */
- ret = runtime->set_variable(L"efi_st_var0", &guid_vendor0,
+ ret = runtime->set_variable(u"efi_st_var0", &guid_vendor0,
0, 0, NULL);
if (ret != EFI_SUCCESS) {
efi_st_error("SetVariable failed\n");
return EFI_ST_FAILURE;
}
len = EFI_ST_MAX_DATA_SIZE;
- ret = runtime->get_variable(L"efi_st_var0", &guid_vendor0,
+ ret = runtime->get_variable(u"efi_st_var0", &guid_vendor0,
&attr, &len, data);
if (ret != EFI_NOT_FOUND) {
efi_st_error("Variable was not deleted\n");
diff --git a/lib/efi_selftest/efi_selftest_variables_runtime.c b/lib/efi_selftest/efi_selftest_variables_runtime.c
index 3226069..4700d94 100644
--- a/lib/efi_selftest/efi_selftest_variables_runtime.c
+++ b/lib/efi_selftest/efi_selftest_variables_runtime.c
@@ -58,7 +58,7 @@ static int execute(void)
return EFI_ST_FAILURE;
}
- ret = runtime->set_variable(L"efi_st_var0", &guid_vendor0,
+ ret = runtime->set_variable(u"efi_st_var0", &guid_vendor0,
EFI_VARIABLE_BOOTSERVICE_ACCESS |
EFI_VARIABLE_RUNTIME_ACCESS,
3, v + 4);
@@ -67,7 +67,7 @@ static int execute(void)
return EFI_ST_FAILURE;
}
len = EFI_ST_MAX_DATA_SIZE;
- ret = runtime->get_variable(L"PlatformLangCodes", &guid_vendor0,
+ ret = runtime->get_variable(u"PlatformLangCodes", &guid_vendor0,
&attr, &len, data);
if (ret != EFI_SUCCESS) {
efi_st_error("GetVariable failed\n");
diff --git a/lib/efi_selftest/initrddump.c b/lib/efi_selftest/initrddump.c
index efdcf0d..4648d54 100644
--- a/lib/efi_selftest/initrddump.c
+++ b/lib/efi_selftest/initrddump.c
@@ -150,7 +150,7 @@ static efi_status_t efi_input(u16 *buffer, efi_uintn_t buffer_size)
struct efi_input_key key = {0};
efi_uintn_t index;
efi_uintn_t pos = 0;
- u16 outbuf[2] = L" ";
+ u16 outbuf[2] = u" ";
efi_status_t ret;
/* Drain the console input */
@@ -165,7 +165,7 @@ static efi_status_t efi_input(u16 *buffer, efi_uintn_t buffer_size)
continue;
switch (key.scan_code) {
case 0x17: /* Escape */
- print(L"\r\nAborted\r\n");
+ print(u"\r\nAborted\r\n");
return EFI_ABORTED;
default:
break;
@@ -174,12 +174,12 @@ static efi_status_t efi_input(u16 *buffer, efi_uintn_t buffer_size)
case 0x08: /* Backspace */
if (pos) {
buffer[pos--] = 0;
- print(L"\b \b");
+ print(u"\b \b");
}
break;
case 0x0a: /* Linefeed */
case 0x0d: /* Carriage return */
- print(L"\r\n");
+ print(u"\r\n");
return EFI_SUCCESS;
default:
break;
@@ -231,9 +231,9 @@ static bool starts_with(u16 *string, u16 *keyword)
*/
static void do_help(void)
{
- error(L"load - show length and CRC32 of initial RAM disk\r\n");
- error(L"save <initrd> - save initial RAM disk to file\r\n");
- error(L"exit - exit the shell\r\n");
+ error(u"load - show length and CRC32 of initial RAM disk\r\n");
+ error(u"save <initrd> - save initial RAM disk to file\r\n");
+ error(u"exit - exit the shell\r\n");
}
/**
@@ -255,7 +255,7 @@ static efi_status_t get_initrd(void **initrd, efi_uintn_t *initrd_size)
*initrd_size = 0;
ret = bs->locate_device_path(&load_file2_guid, &dp, &handle);
if (ret != EFI_SUCCESS) {
- error(L"Load File2 protocol not found\r\n");
+ error(u"Load File2 protocol not found\r\n");
return ret;
}
ret = bs->handle_protocol(handle, &load_file2_guid,
@@ -263,20 +263,20 @@ static efi_status_t get_initrd(void **initrd, efi_uintn_t *initrd_size)
ret = load_file2_prot->load_file(load_file2_prot, dp, false,
initrd_size, NULL);
if (ret != EFI_BUFFER_TOO_SMALL) {
- error(L"Load File2 protocol does not provide file length\r\n");
+ error(u"Load File2 protocol does not provide file length\r\n");
return EFI_LOAD_ERROR;
}
ret = bs->allocate_pages(EFI_ALLOCATE_ANY_PAGES, EFI_LOADER_DATA,
efi_size_in_pages(*initrd_size), &buffer);
if (ret != EFI_SUCCESS) {
- error(L"Out of memory\r\n");
+ error(u"Out of memory\r\n");
return ret;
}
*initrd = (void *)(uintptr_t)buffer;
ret = load_file2_prot->load_file(load_file2_prot, dp, false,
initrd_size, *initrd);
if (ret != EFI_SUCCESS) {
- error(L"Load File2 protocol failed to provide file\r\n");
+ error(u"Load File2 protocol failed to provide file\r\n");
bs->free_pages(buffer, efi_size_in_pages(*initrd_size));
return EFI_LOAD_ERROR;
}
@@ -299,18 +299,18 @@ static efi_status_t do_load(void)
ret = get_initrd(&initrd, &initrd_size);
if (ret != EFI_SUCCESS)
return ret;
- print(L"length: 0x");
+ print(u"length: 0x");
printx(initrd_size, 1);
- print(L"\r\n");
+ print(u"\r\n");
ret = bs->calculate_crc32(initrd, initrd_size, &crc32);
if (ret != EFI_SUCCESS) {
- error(L"Calculating CRC32 failed\r\n");
+ error(u"Calculating CRC32 failed\r\n");
return EFI_LOAD_ERROR;
}
- print(L"crc32: 0x");
+ print(u"crc32: 0x");
printx(crc32, 8);
- print(L"\r\n");
+ print(u"\r\n");
return EFI_SUCCESS;
}
@@ -340,7 +340,7 @@ static efi_status_t do_save(u16 *filename)
(void **)&loaded_image, NULL, NULL,
EFI_OPEN_PROTOCOL_GET_PROTOCOL);
if (ret != EFI_SUCCESS) {
- error(L"Loaded image protocol not found\r\n");
+ error(u"Loaded image protocol not found\r\n");
goto out;
}
@@ -350,26 +350,26 @@ static efi_status_t do_save(u16 *filename)
(void **)&file_system, NULL, NULL,
EFI_OPEN_PROTOCOL_GET_PROTOCOL);
if (ret != EFI_SUCCESS) {
- error(L"Failed to open simple file system protocol\r\n");
+ error(u"Failed to open simple file system protocol\r\n");
goto out;
}
/* Open volume */
ret = file_system->open_volume(file_system, &root);
if (ret != EFI_SUCCESS) {
- error(L"Failed to open volume\r\n");
+ error(u"Failed to open volume\r\n");
goto out;
}
/* Check if file already exists */
ret = root->open(root, &file, filename, EFI_FILE_MODE_READ, 0);
if (ret == EFI_SUCCESS) {
file->close(file);
- print(L"Overwrite existing file (y/n)? ");
+ print(u"Overwrite existing file (y/n)? ");
ret = efi_input_yn();
- print(L"\r\n");
+ print(u"\r\n");
if (ret != EFI_SUCCESS) {
root->close(root);
- error(L"Aborted by user\r\n");
+ error(u"Aborted by user\r\n");
goto out;
}
}
@@ -382,14 +382,14 @@ static efi_status_t do_save(u16 *filename)
/* Write file */
ret = file->write(file, &initrd_size, initrd);
if (ret != EFI_SUCCESS) {
- error(L"Failed to write file\r\n");
+ error(u"Failed to write file\r\n");
} else {
print(filename);
- print(L" written\r\n");
+ print(u" written\r\n");
}
file->close(file);
} else {
- error(L"Failed to open file\r\n");
+ error(u"Failed to open file\r\n");
}
root->close(root);
@@ -420,7 +420,7 @@ efi_status_t EFIAPI efi_main(efi_handle_t image_handle,
cout->set_attribute(cout, EFI_LIGHTBLUE | EFI_BACKGROUND_BLACK);
cout->clear_screen(cout);
cout->set_attribute(cout, EFI_WHITE | EFI_BACKGROUND_BLACK);
- print(L"INITRD Dump\r\n========\r\n\r\n");
+ print(u"INITRD Dump\r\n========\r\n\r\n");
cout->set_attribute(cout, EFI_LIGHTBLUE | EFI_BACKGROUND_BLACK);
for (;;) {
@@ -428,16 +428,16 @@ efi_status_t EFIAPI efi_main(efi_handle_t image_handle,
u16 *pos;
efi_uintn_t ret;
- print(L"=> ");
+ print(u"=> ");
ret = efi_input(command, sizeof(command));
if (ret == EFI_ABORTED)
break;
pos = skip_whitespace(command);
- if (starts_with(pos, L"exit"))
+ if (starts_with(pos, u"exit"))
break;
- else if (starts_with(pos, L"load"))
+ else if (starts_with(pos, u"load"))
do_load();
- else if (starts_with(pos, L"save "))
+ else if (starts_with(pos, u"save "))
do_save(pos + 5);
else
do_help();
diff --git a/lib/lzma/Types.h b/lib/lzma/Types.h
index 8afcba5..04f894a 100644
--- a/lib/lzma/Types.h
+++ b/lib/lzma/Types.h
@@ -225,9 +225,9 @@ typedef struct
#else
#define CHAR_PATH_SEPARATOR '/'
-#define WCHAR_PATH_SEPARATOR L'/'
+#define WCHAR_PATH_SEPARATOR u'/'
#define STRING_PATH_SEPARATOR "/"
-#define WSTRING_PATH_SEPARATOR L"/"
+#define WSTRING_PATH_SEPARATOR u"/"
#endif
diff --git a/lib/vsprintf.c b/lib/vsprintf.c
index 2c84649..69b2f6a 100644
--- a/lib/vsprintf.c
+++ b/lib/vsprintf.c
@@ -279,7 +279,7 @@ static char *string(char *buf, char *end, const char *s, int field_width,
static __maybe_unused char *string16(char *buf, char *end, u16 *s,
int field_width, int precision, int flags)
{
- const u16 *str = s ? s : L"<NULL>";
+ const u16 *str = s ? s : u"<NULL>";
ssize_t i, len = utf16_strnlen(str, precision);
if (!(flags & LEFT))
diff --git a/scripts/Makefile b/scripts/Makefile
index cfe9fef..8731e6c 100644
--- a/scripts/Makefile
+++ b/scripts/Makefile
@@ -9,4 +9,4 @@ hostprogs-$(CONFIG_BUILD_BIN2C) += bin2c
always := $(hostprogs-y)
# Let clean descend into subdirs
-subdir- += basic kconfig
+subdir- += basic kconfig dtc
diff --git a/scripts/checkpatch.pl b/scripts/checkpatch.pl
index cf59e2b..fe13e26 100755
--- a/scripts/checkpatch.pl
+++ b/scripts/checkpatch.pl
@@ -63,6 +63,7 @@ my $min_conf_desc_length = 4;
my $spelling_file = "$D/spelling.txt";
my $codespell = 0;
my $codespellfile = "/usr/share/codespell/dictionary.txt";
+my $user_codespellfile = "";
my $conststructsfile = "$D/const_structs.checkpatch";
my $u_boot = 0;
my $docsfile = "$D/../doc/develop/checkpatch.rst";
@@ -131,7 +132,7 @@ Options:
--ignore-perl-version override checking of perl version. expect
runtime errors.
--codespell Use the codespell dictionary for spelling/typos
- (default:/usr/share/codespell/dictionary.txt)
+ (default:$codespellfile)
--codespellfile Use this codespell dictionary
--typedefsfile Read additional types from this file
--color[=WHEN] Use colors 'always', 'never', or only when output
@@ -319,7 +320,7 @@ GetOptions(
'debug=s' => \%debug,
'test-only=s' => \$tst_only,
'codespell!' => \$codespell,
- 'codespellfile=s' => \$codespellfile,
+ 'codespellfile=s' => \$user_codespellfile,
'typedefsfile=s' => \$typedefsfile,
'u-boot' => \$u_boot,
'color=s' => \$color,
@@ -328,9 +329,32 @@ GetOptions(
'kconfig-prefix=s' => \${CONFIG_},
'h|help' => \$help,
'version' => \$help
-) or help(1);
+) or $help = 2;
+
+if ($user_codespellfile) {
+ # Use the user provided codespell file unconditionally
+ $codespellfile = $user_codespellfile;
+} elsif (!(-f $codespellfile)) {
+ # If /usr/share/codespell/dictionary.txt is not present, try to find it
+ # under codespell's install directory: <codespell_root>/data/dictionary.txt
+ if (($codespell || $help) && which("codespell") ne "" && which("python") ne "") {
+ my $python_codespell_dict = << "EOF";
+
+import os.path as op
+import codespell_lib
+codespell_dir = op.dirname(codespell_lib.__file__)
+codespell_file = op.join(codespell_dir, 'data', 'dictionary.txt')
+print(codespell_file, end='')
+EOF
+
+ my $codespell_dict = `python -c "$python_codespell_dict" 2> /dev/null`;
+ $codespellfile = $codespell_dict if (-f $codespell_dict);
+ }
+}
-help(0) if ($help);
+# $help is 1 if either -h, --help or --version is passed as option - exitcode: 0
+# $help is 2 if invalid option is passed - exitcode: 1
+help($help - 1) if ($help);
die "$P: --git cannot be used with --file or --fix\n" if ($git && ($file || $fix));
die "$P: --verbose cannot be used with --terse\n" if ($verbose && $terse);
@@ -492,7 +516,8 @@ our $Attribute = qr{
____cacheline_aligned|
____cacheline_aligned_in_smp|
____cacheline_internodealigned_in_smp|
- __weak
+ __weak|
+ __alloc_size\s*\(\s*\d+\s*(?:,\s*\d+\s*)?\)
}x;
our $Modifier;
our $Inline = qr{inline|__always_inline|noinline|__inline|__inline__};
@@ -504,7 +529,7 @@ our $Binary = qr{(?i)0b[01]+$Int_type?};
our $Hex = qr{(?i)0x[0-9a-f]+$Int_type?};
our $Int = qr{[0-9]+$Int_type?};
our $Octal = qr{0[0-7]+$Int_type?};
-our $String = qr{"[X\t]*"};
+our $String = qr{(?:\b[Lu])?"[X\t]*"};
our $Float_hex = qr{(?i)0x[0-9a-f]+p-?[0-9]+[fl]?};
our $Float_dec = qr{(?i)(?:[0-9]+\.[0-9]*|[0-9]*\.[0-9]+)(?:e-?[0-9]+)?[fl]?};
our $Float_int = qr{(?i)[0-9]+e-?[0-9]+[fl]?};
@@ -1089,10 +1114,10 @@ sub is_maintained_obsolete {
sub is_SPDX_License_valid {
my ($license) = @_;
- return 1 if (!$tree || which("python") eq "" || !(-e "$root/scripts/spdxcheck.py") || !(-e "$gitroot"));
+ return 1 if (!$tree || which("python3") eq "" || !(-x "$root/scripts/spdxcheck.py") || !(-e "$gitroot"));
my $root_path = abs_path($root);
- my $status = `cd "$root_path"; echo "$license" | python scripts/spdxcheck.py -`;
+ my $status = `cd "$root_path"; echo "$license" | scripts/spdxcheck.py -`;
return 0 if ($status ne "");
return 1;
}
@@ -1186,7 +1211,8 @@ sub git_commit_info {
# git log --format='%H %s' -1 $line |
# echo "commit $(cut -c 1-12,41-)"
# done
- } elsif ($lines[0] =~ /^fatal: ambiguous argument '$commit': unknown revision or path not in the working tree\./) {
+ } elsif ($lines[0] =~ /^fatal: ambiguous argument '$commit': unknown revision or path not in the working tree\./ ||
+ $lines[0] =~ /^fatal: bad object $commit/) {
$id = undef;
} else {
$id = substr($lines[0], 0, 12);
@@ -2697,6 +2723,8 @@ sub process {
my $reported_maintainer_file = 0;
my $non_utf8_charset = 0;
+ my $last_git_commit_id_linenr = -1;
+
my $last_blank_line = 0;
my $last_coalesced_string_linenr = -1;
@@ -3019,10 +3047,10 @@ sub process {
my ($email_name, $email_comment, $email_address, $comment1) = parse_email($ctx);
my ($author_name, $author_comment, $author_address, $comment2) = parse_email($author);
- if ($email_address eq $author_address && $email_name eq $author_name) {
+ if (lc $email_address eq lc $author_address && $email_name eq $author_name) {
$author_sob = $ctx;
$authorsignoff = 2;
- } elsif ($email_address eq $author_address) {
+ } elsif (lc $email_address eq lc $author_address) {
$author_sob = $ctx;
$authorsignoff = 3;
} elsif ($email_name eq $author_name) {
@@ -3280,10 +3308,20 @@ sub process {
}
# Check for git id commit length and improperly formed commit descriptions
- if ($in_commit_log && !$commit_log_possible_stack_dump &&
+# A correctly formed commit description is:
+# commit <SHA-1 hash length 12+ chars> ("Complete commit subject")
+# with the commit subject '("' prefix and '")' suffix
+# This is a fairly compilicated block as it tests for what appears to be
+# bare SHA-1 hash with minimum length of 5. It also avoids several types of
+# possible SHA-1 matches.
+# A commit match can span multiple lines so this block attempts to find a
+# complete typical commit on a maximum of 3 lines
+ if ($perl_version_ok &&
+ $in_commit_log && !$commit_log_possible_stack_dump &&
$line !~ /^\s*(?:Link|Patchwork|http|https|BugLink|base-commit):/i &&
$line !~ /^This reverts commit [0-9a-f]{7,40}/ &&
- ($line =~ /\bcommit\s+[0-9a-f]{5,}\b/i ||
+ (($line =~ /\bcommit\s+[0-9a-f]{5,}\b/i ||
+ ($line =~ /\bcommit\s*$/i && defined($rawlines[$linenr]) && $rawlines[$linenr] =~ /^\s*[0-9a-f]{5,}\b/i)) ||
($line =~ /(?:\s|^)[0-9a-f]{12,40}(?:[\s"'\(\[]|$)/i &&
$line !~ /[\<\[][0-9a-f]{12,40}[\>\]]/i &&
$line !~ /\bfixes:\s*[0-9a-f]{12,40}/i))) {
@@ -3293,49 +3331,56 @@ sub process {
my $long = 0;
my $case = 1;
my $space = 1;
- my $hasdesc = 0;
- my $hasparens = 0;
my $id = '0123456789ab';
my $orig_desc = "commit description";
my $description = "";
+ my $herectx = $herecurr;
+ my $has_parens = 0;
+ my $has_quotes = 0;
+
+ my $input = $line;
+ if ($line =~ /(?:\bcommit\s+[0-9a-f]{5,}|\bcommit\s*$)/i) {
+ for (my $n = 0; $n < 2; $n++) {
+ if ($input =~ /\bcommit\s+[0-9a-f]{5,}\s*($balanced_parens)/i) {
+ $orig_desc = $1;
+ $has_parens = 1;
+ # Always strip leading/trailing parens then double quotes if existing
+ $orig_desc = substr($orig_desc, 1, -1);
+ if ($orig_desc =~ /^".*"$/) {
+ $orig_desc = substr($orig_desc, 1, -1);
+ $has_quotes = 1;
+ }
+ last;
+ }
+ last if ($#lines < $linenr + $n);
+ $input .= " " . trim($rawlines[$linenr + $n]);
+ $herectx .= "$rawlines[$linenr + $n]\n";
+ }
+ $herectx = $herecurr if (!$has_parens);
+ }
- if ($line =~ /\b(c)ommit\s+([0-9a-f]{5,})\b/i) {
+ if ($input =~ /\b(c)ommit\s+([0-9a-f]{5,})\b/i) {
$init_char = $1;
$orig_commit = lc($2);
- } elsif ($line =~ /\b([0-9a-f]{12,40})\b/i) {
+ $short = 0 if ($input =~ /\bcommit\s+[0-9a-f]{12,40}/i);
+ $long = 1 if ($input =~ /\bcommit\s+[0-9a-f]{41,}/i);
+ $space = 0 if ($input =~ /\bcommit [0-9a-f]/i);
+ $case = 0 if ($input =~ /\b[Cc]ommit\s+[0-9a-f]{5,40}[^A-F]/);
+ } elsif ($input =~ /\b([0-9a-f]{12,40})\b/i) {
$orig_commit = lc($1);
}
- $short = 0 if ($line =~ /\bcommit\s+[0-9a-f]{12,40}/i);
- $long = 1 if ($line =~ /\bcommit\s+[0-9a-f]{41,}/i);
- $space = 0 if ($line =~ /\bcommit [0-9a-f]/i);
- $case = 0 if ($line =~ /\b[Cc]ommit\s+[0-9a-f]{5,40}[^A-F]/);
- if ($line =~ /\bcommit\s+[0-9a-f]{5,}\s+\("([^"]+)"\)/i) {
- $orig_desc = $1;
- $hasparens = 1;
- } elsif ($line =~ /\bcommit\s+[0-9a-f]{5,}\s*$/i &&
- defined $rawlines[$linenr] &&
- $rawlines[$linenr] =~ /^\s*\("([^"]+)"\)/) {
- $orig_desc = $1;
- $hasparens = 1;
- } elsif ($line =~ /\bcommit\s+[0-9a-f]{5,}\s+\("[^"]+$/i &&
- defined $rawlines[$linenr] &&
- $rawlines[$linenr] =~ /^\s*[^"]+"\)/) {
- $line =~ /\bcommit\s+[0-9a-f]{5,}\s+\("([^"]+)$/i;
- $orig_desc = $1;
- $rawlines[$linenr] =~ /^\s*([^"]+)"\)/;
- $orig_desc .= " " . $1;
- $hasparens = 1;
- }
-
($id, $description) = git_commit_info($orig_commit,
$id, $orig_desc);
if (defined($id) &&
- ($short || $long || $space || $case || ($orig_desc ne $description) || !$hasparens)) {
+ ($short || $long || $space || $case || ($orig_desc ne $description) || !$has_quotes) &&
+ $last_git_commit_id_linenr != $linenr - 1) {
ERROR("GIT_COMMIT_ID",
- "Please use git commit description style 'commit <12+ chars of sha1> (\"<title line>\")' - ie: '${init_char}ommit $id (\"$description\")'\n" . $herecurr);
+ "Please use git commit description style 'commit <12+ chars of sha1> (\"<title line>\")' - ie: '${init_char}ommit $id (\"$description\")'\n" . $herectx);
}
+ #don't report the next line if this line ends in commit and the sha1 hash is the next line
+ $last_git_commit_id_linenr = $linenr if ($line =~ /\bcommit\s*$/i);
}
# Check for added, moved or deleted files
@@ -4542,6 +4587,7 @@ sub process {
# XXX(foo);
# EXPORT_SYMBOL(something_foo);
my $name = $1;
+ $name =~ s/^\s*($Ident).*/$1/;
if ($stat =~ /^(?:.\s*}\s*\n)?.([A-Z_]+)\s*\(\s*($Ident)/ &&
$name =~ /^${Ident}_$2/) {
#print "FOO C name<$name>\n";
@@ -5475,9 +5521,13 @@ sub process {
}
}
-#goto labels aren't indented, allow a single space however
- if ($line=~/^.\s+[A-Za-z\d_]+:(?![0-9]+)/ and
- !($line=~/^. [A-Za-z\d_]+:/) and !($line=~/^.\s+default:/)) {
+# check that goto labels aren't indented (allow a single space indentation)
+# and ignore bitfield definitions like foo:1
+# Strictly, labels can have whitespace after the identifier and before the :
+# but this is not allowed here as many ?: uses would appear to be labels
+ if ($sline =~ /^.\s+[A-Za-z_][A-Za-z\d_]*:(?!\s*\d+)/ &&
+ $sline !~ /^. [A-Za-z\d_][A-Za-z\d_]*:/ &&
+ $sline !~ /^.\s+default:/) {
if (WARN("INDENTED_LABEL",
"labels should not be indented\n" . $herecurr) &&
$fix) {
@@ -5572,7 +5622,7 @@ sub process {
# Return of what appears to be an errno should normally be negative
if ($sline =~ /\breturn(?:\s*\(+\s*|\s+)(E[A-Z]+)(?:\s*\)+\s*|\s*)[;:,]/) {
my $name = $1;
- if ($name ne 'EOF' && $name ne 'ERROR') {
+ if ($name ne 'EOF' && $name ne 'ERROR' && $name !~ /^EPOLL/) {
WARN("USE_NEGATIVE_ERRNO",
"return of an errno should typically be negative (ie: return -$1)\n" . $herecurr);
}
@@ -6242,7 +6292,8 @@ sub process {
}
# concatenated string without spaces between elements
- if ($line =~ /$String[A-Za-z0-9_]/ || $line =~ /[A-Za-z0-9_]$String/) {
+ if ($line =~ /$String[A-Z_]/ ||
+ ($line =~ /([A-Za-z0-9_]+)$String/ && $1 !~ /^[Lu]$/)) {
if (CHK("CONCATENATED_STRING",
"Concatenated strings should use spaces between elements\n" . $herecurr) &&
$fix) {
@@ -6255,7 +6306,7 @@ sub process {
}
# uncoalesced string fragments
- if ($line =~ /$String\s*"/) {
+ if ($line =~ /$String\s*[Lu]?"/) {
if (WARN("STRING_FRAGMENTS",
"Consecutive strings are generally better as a single string\n" . $herecurr) &&
$fix) {
diff --git a/scripts/spdxcheck.py b/scripts/spdxcheck.py
index 3e784cf..ebd06ae 100755
--- a/scripts/spdxcheck.py
+++ b/scripts/spdxcheck.py
@@ -44,7 +44,7 @@ def read_spdxdata(repo):
continue
exception = None
- for l in open(el.path).readlines():
+ for l in open(el.path, encoding="utf-8").readlines():
if l.startswith('Valid-License-Identifier:'):
lid = l.split(':')[1].strip().upper()
if lid in spdx.licenses:
diff --git a/test/print_ut.c b/test/print_ut.c
index 194387f..a133907 100644
--- a/test/print_ut.c
+++ b/test/print_ut.c
@@ -118,7 +118,7 @@ static int print_printf(struct unit_test_state *uts)
snprintf(str, 0, "testing none");
ut_asserteq('x', *str);
- sprintf(big_str, "_%ls_", L"foo");
+ sprintf(big_str, "_%ls_", u"foo");
ut_assertok(strcmp("_foo_", big_str));
/* Test the banner function */
diff --git a/test/unicode_ut.c b/test/unicode_ut.c
index 617eed8..f821e5a 100644
--- a/test/unicode_ut.c
+++ b/test/unicode_ut.c
@@ -299,17 +299,17 @@ static int unicode_test_utf8_utf16_strcpy(struct unit_test_state *uts)
pos = buf;
utf8_utf16_strcpy(&pos, j1);
ut_asserteq(4, pos - buf);
- ut_assert(!unicode_test_u16_strcmp(buf, L"j1?l", SIZE_MAX));
+ ut_assert(!unicode_test_u16_strcmp(buf, u"j1?l", SIZE_MAX));
pos = buf;
utf8_utf16_strcpy(&pos, j2);
ut_asserteq(4, pos - buf);
- ut_assert(!unicode_test_u16_strcmp(buf, L"j2?l", SIZE_MAX));
+ ut_assert(!unicode_test_u16_strcmp(buf, u"j2?l", SIZE_MAX));
pos = buf;
utf8_utf16_strcpy(&pos, j3);
ut_asserteq(3, pos - buf);
- ut_assert(!unicode_test_u16_strcmp(buf, L"j3?", SIZE_MAX));
+ ut_assert(!unicode_test_u16_strcmp(buf, u"j3?", SIZE_MAX));
return 0;
}
@@ -584,13 +584,13 @@ UNICODE_TEST(unicode_test_utf_to_upper);
static int unicode_test_u16_strncmp(struct unit_test_state *uts)
{
- ut_assert(u16_strncmp(L"abc", L"abc", 3) == 0);
- ut_assert(u16_strncmp(L"abcdef", L"abcghi", 3) == 0);
- ut_assert(u16_strncmp(L"abcdef", L"abcghi", 6) < 0);
- ut_assert(u16_strncmp(L"abcghi", L"abcdef", 6) > 0);
- ut_assert(u16_strcmp(L"abc", L"abc") == 0);
- ut_assert(u16_strcmp(L"abcdef", L"deghi") < 0);
- ut_assert(u16_strcmp(L"deghi", L"abcdef") > 0);
+ ut_assert(u16_strncmp(u"abc", u"abc", 3) == 0);
+ ut_assert(u16_strncmp(u"abcdef", u"abcghi", 3) == 0);
+ ut_assert(u16_strncmp(u"abcdef", u"abcghi", 6) < 0);
+ ut_assert(u16_strncmp(u"abcghi", u"abcdef", 6) > 0);
+ ut_assert(u16_strcmp(u"abc", u"abc") == 0);
+ ut_assert(u16_strcmp(u"abcdef", u"deghi") < 0);
+ ut_assert(u16_strcmp(u"deghi", u"abcdef") > 0);
return 0;
}
UNICODE_TEST(unicode_test_u16_strncmp);
@@ -713,7 +713,7 @@ UNICODE_TEST(unicode_test_utf8_to_utf32_stream);
static int unicode_test_efi_create_indexed_name(struct unit_test_state *uts)
{
u16 buf[16];
- u16 const expected[] = L"Capsule0AF9";
+ u16 const expected[] = u"Capsule0AF9";
u16 *pos;
memset(buf, 0xeb, sizeof(buf));
diff --git a/tools/docker/Dockerfile b/tools/docker/Dockerfile
index f19e618..7a3f5cb 100644
--- a/tools/docker/Dockerfile
+++ b/tools/docker/Dockerfile
@@ -2,7 +2,7 @@
# This Dockerfile is used to build an image containing basic stuff to be used
# to build U-Boot and run our test suites.
-FROM ubuntu:focal-20220105
+FROM ubuntu:focal-20220113
MAINTAINER Tom Rini <trini@konsulko.com>
LABEL Description=" This image is for building U-Boot inside a container"
@@ -67,6 +67,8 @@ RUN apt-get update && apt-get install -y \
libgit2-dev \
libjson-glib-dev \
libguestfs-tools \
+ libgnutls28-dev \
+ libgnutls30 \
liblz4-tool \
libpixman-1-dev \
libpython3-dev \