* [PATCH master 0/8] treewide: misc fixes
@ 2025-03-20 5:16 Ahmad Fatoum
2025-03-20 5:16 ` [PATCH master 1/8] firmware: disable MISSING_FIRMWARE_ERROR for COMPILE_TEST builds Ahmad Fatoum
` (8 more replies)
0 siblings, 9 replies; 10+ messages in thread
From: Ahmad Fatoum @ 2025-03-20 5:16 UTC (permalink / raw)
To: barebox
Just a loose collection of fixes for master.
Ahmad Fatoum (8):
firmware: disable MISSING_FIRMWARE_ERROR for COMPILE_TEST builds
include: asm-generic/pointer.h: fix ASM_PTR definition for i386
sandbox: do not enable SANDBOX_LINUX_I386 in allyesconfig
Documentation: devicetree: fix Sphinx warnings
ARM: mvebu: kwb_bbu: add missing header
net: phy: fix of_get_phy_mode for XLGMII and beyond
vsprintf: fix left indentation when formatting wide string arguments
test: self: printf: add tests for formatting wide strings
.../bindings/barebox/virtual-reg.rst | 2 +-
Documentation/devicetree/index.rst | 1 +
arch/arm/mach-mvebu/kwb_bbu.c | 1 +
arch/sandbox/Kconfig | 10 ++-
drivers/of/of_net.c | 36 +-------
firmware/Kconfig | 2 +
include/asm-generic/pointer.h | 4 +-
include/linux/phy.h | 82 +++++++++++++++++++
lib/vsprintf.c | 3 +-
test/self/printf.c | 15 ++++
10 files changed, 116 insertions(+), 40 deletions(-)
--
2.39.5
^ permalink raw reply [flat|nested] 10+ messages in thread
* [PATCH master 1/8] firmware: disable MISSING_FIRMWARE_ERROR for COMPILE_TEST builds
2025-03-20 5:16 [PATCH master 0/8] treewide: misc fixes Ahmad Fatoum
@ 2025-03-20 5:16 ` Ahmad Fatoum
2025-03-20 5:16 ` [PATCH master 2/8] include: asm-generic/pointer.h: fix ASM_PTR definition for i386 Ahmad Fatoum
` (7 subsequent siblings)
8 siblings, 0 replies; 10+ messages in thread
From: Ahmad Fatoum @ 2025-03-20 5:16 UTC (permalink / raw)
To: barebox; +Cc: Ahmad Fatoum
An allyes build will enable all options possible and thus usually fail
to build, because it enables CONFIG_MISSING_FIRMWARE_ERROR along with
DRIVER_NET_FSL_FMAN, which requires firmware to function at runtime.
Fix this by disabling MISSING_FIRMWARE_ERROR if COMPILE_TEST is enabled.
This works, because Kconfig encounters COMPILE_TEST first.
Signed-off-by: Ahmad Fatoum <a.fatoum@pengutronix.de>
---
v1 -> v2:
- no change
---
firmware/Kconfig | 2 ++
1 file changed, 2 insertions(+)
diff --git a/firmware/Kconfig b/firmware/Kconfig
index ba005976c5a1..9253bc14cb0c 100644
--- a/firmware/Kconfig
+++ b/firmware/Kconfig
@@ -9,6 +9,8 @@ config EXTRA_FIRMWARE_DIR
config MISSING_FIRMWARE_ERROR
bool "Fail the build when required firmware is missing"
default y
+ # This prevents firmware errors from breaking allyesconfig builds
+ depends on !COMPILE_TEST
help
In-tree Defconfigs that enable multiple boards with different firmware
binary requirements would say y here, so you don't need unrelated firmware
--
2.39.5
^ permalink raw reply [flat|nested] 10+ messages in thread
* [PATCH master 2/8] include: asm-generic/pointer.h: fix ASM_PTR definition for i386
2025-03-20 5:16 [PATCH master 0/8] treewide: misc fixes Ahmad Fatoum
2025-03-20 5:16 ` [PATCH master 1/8] firmware: disable MISSING_FIRMWARE_ERROR for COMPILE_TEST builds Ahmad Fatoum
@ 2025-03-20 5:16 ` Ahmad Fatoum
2025-03-20 5:16 ` [PATCH master 3/8] sandbox: do not enable SANDBOX_LINUX_I386 in allyesconfig Ahmad Fatoum
` (6 subsequent siblings)
8 siblings, 0 replies; 10+ messages in thread
From: Ahmad Fatoum @ 2025-03-20 5:16 UTC (permalink / raw)
To: barebox; +Cc: Ahmad Fatoum
For GNU as on i386, a .word is 16-bit wide, unlikes ARM, where it's
32-bit. The code in asm-generic/pointer.h expects .word to be
32-bit wide though, therefore to switch to .long.
Unlike C's long, an assembly .long is always 32-bit (and thus
identical to .int).
Signed-off-by: Ahmad Fatoum <a.fatoum@pengutronix.de>
---
v1 -> v2:
- new patch to fix compile error with IMD on i386 sandbox
---
include/asm-generic/pointer.h | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/include/asm-generic/pointer.h b/include/asm-generic/pointer.h
index 89817ce59ebc..fbd1a831b8be 100644
--- a/include/asm-generic/pointer.h
+++ b/include/asm-generic/pointer.h
@@ -16,12 +16,12 @@
#endif
#elif __SIZEOF_POINTER__ == 4
#ifdef __ASSEMBLY__
-#define ASM_PTR .word
+#define ASM_PTR .long
#define ASM_SZPTR 4
#define ASM_LGPTR 2
#define ASM_LD_PTR(x) LONG(x)
#else
-#define ASM_PTR ".word"
+#define ASM_PTR ".long"
#define ASM_SZPTR "4"
#define ASM_LGPTR "2"
#endif
--
2.39.5
^ permalink raw reply [flat|nested] 10+ messages in thread
* [PATCH master 3/8] sandbox: do not enable SANDBOX_LINUX_I386 in allyesconfig
2025-03-20 5:16 [PATCH master 0/8] treewide: misc fixes Ahmad Fatoum
2025-03-20 5:16 ` [PATCH master 1/8] firmware: disable MISSING_FIRMWARE_ERROR for COMPILE_TEST builds Ahmad Fatoum
2025-03-20 5:16 ` [PATCH master 2/8] include: asm-generic/pointer.h: fix ASM_PTR definition for i386 Ahmad Fatoum
@ 2025-03-20 5:16 ` Ahmad Fatoum
2025-03-20 5:16 ` [PATCH master 4/8] Documentation: devicetree: fix Sphinx warnings Ahmad Fatoum
` (5 subsequent siblings)
8 siblings, 0 replies; 10+ messages in thread
From: Ahmad Fatoum @ 2025-03-20 5:16 UTC (permalink / raw)
To: barebox; +Cc: Ahmad Fatoum
On sandbox, CONFIG_32BIT and CONFIG_64BIT are determined by the used
compiler. As special case, building sandbox on x86_64 allows
selecting a 32-bit build via CONFIG_SANDBOX_LINUX_I386 if the compiler
supports it.
This option is disabled by default, but allyesconfig turns it on,
alongside drivers requiring host libraries like FTDI and SDL, which
are usually not required.
To make allyesconfig work out-of-the-box, restructure the config
symbols and give 64BIT a prompt only if i386 support is possible.
Signed-off-by: Ahmad Fatoum <a.fatoum@pengutronix.de>
---
v1 -> v2:
- fix typo in symbol name (32_BIT -> 32BIT)
---
arch/sandbox/Kconfig | 10 ++++++++--
1 file changed, 8 insertions(+), 2 deletions(-)
diff --git a/arch/sandbox/Kconfig b/arch/sandbox/Kconfig
index c1a51d4f021d..d4380aba0b5f 100644
--- a/arch/sandbox/Kconfig
+++ b/arch/sandbox/Kconfig
@@ -44,17 +44,23 @@ config CC_HAS_LINUX_I386_SUPPORT
config 64BIT
bool
- default n if SANDBOX_LINUX_I386
+ prompt "64-bit barebox" if CC_HAS_LINUX_I386_SUPPORT
default CC_IS_64BIT
select ARCH_DMA_ADDR_T_64BIT
select PHYS_ADDR_T_64BIT
select ARCH_HAS_ASAN_FIBER_API if ASAN
+ help
+ Say n here if you want to build a 32-bit barebox, either
+ to be more similar to a target platform or to reduce
+ memory usage when fuzzing for example.
+
+ If unsure, say y.
config 32BIT
def_bool !64BIT
config SANDBOX_LINUX_I386
- bool "32-bit x86 barebox" if CC_HAS_LINUX_I386_SUPPORT
+ def_bool 32BIT && CC_HAS_LINUX_I386_SUPPORT
config SANDBOX_REEXEC
prompt "exec(2) reset handler"
--
2.39.5
^ permalink raw reply [flat|nested] 10+ messages in thread
* [PATCH master 4/8] Documentation: devicetree: fix Sphinx warnings
2025-03-20 5:16 [PATCH master 0/8] treewide: misc fixes Ahmad Fatoum
` (2 preceding siblings ...)
2025-03-20 5:16 ` [PATCH master 3/8] sandbox: do not enable SANDBOX_LINUX_I386 in allyesconfig Ahmad Fatoum
@ 2025-03-20 5:16 ` Ahmad Fatoum
2025-03-20 5:16 ` [PATCH master 5/8] ARM: mvebu: kwb_bbu: add missing header Ahmad Fatoum
` (4 subsequent siblings)
8 siblings, 0 replies; 10+ messages in thread
From: Ahmad Fatoum @ 2025-03-20 5:16 UTC (permalink / raw)
To: barebox; +Cc: Ahmad Fatoum
Building the barebox documentation results in an number of warnings
predominantly in the autogenerated docs from command help text.
Outside of that, there is warnings only in the DT bindings:
bindings/barebox/virtual-reg.rst:25:
WARNING: Inline emphasis start-string without end-string.
bindings/barebox/virtual-reg.rst:28:
WARNING: Definition list ends without a blank line; unexpected unindent.
bindings/barebox/virtual-reg.rst:29:
WARNING: Block quote ends without a blank line; unexpected unindent.
bindings/clocks/xlnx,ps7-clkc.rst:
WARNING: document isn't included in any toctree
Fix the devicetree binding warnings.
Signed-off-by: Ahmad Fatoum <a.fatoum@pengutronix.de>
---
v1 -> v2:
- no change
---
Documentation/devicetree/bindings/barebox/virtual-reg.rst | 2 +-
Documentation/devicetree/index.rst | 1 +
2 files changed, 2 insertions(+), 1 deletion(-)
diff --git a/Documentation/devicetree/bindings/barebox/virtual-reg.rst b/Documentation/devicetree/bindings/barebox/virtual-reg.rst
index 7d576d0cef6f..a69d23144755 100644
--- a/Documentation/devicetree/bindings/barebox/virtual-reg.rst
+++ b/Documentation/devicetree/bindings/barebox/virtual-reg.rst
@@ -13,7 +13,7 @@ by subtracting ``virtual-reg`` from the first address in ``reg``.
This is normally used to map I/O memory away from the zero page, so it
can be used again to trap null pointer dereferences, while allowing
-full access to the device memory::
+full access to the device memory.
.. code-block:: none
diff --git a/Documentation/devicetree/index.rst b/Documentation/devicetree/index.rst
index cd9270da1d21..2ca8b72be1ac 100644
--- a/Documentation/devicetree/index.rst
+++ b/Documentation/devicetree/index.rst
@@ -143,6 +143,7 @@ Contents:
:maxdepth: 1
bindings/barebox/*
+ bindings/clocks/*
bindings/firmware/*
bindings/leds/*
bindings/misc/*
--
2.39.5
^ permalink raw reply [flat|nested] 10+ messages in thread
* [PATCH master 5/8] ARM: mvebu: kwb_bbu: add missing header
2025-03-20 5:16 [PATCH master 0/8] treewide: misc fixes Ahmad Fatoum
` (3 preceding siblings ...)
2025-03-20 5:16 ` [PATCH master 4/8] Documentation: devicetree: fix Sphinx warnings Ahmad Fatoum
@ 2025-03-20 5:16 ` Ahmad Fatoum
2025-03-20 5:16 ` [PATCH master 6/8] net: phy: fix of_get_phy_mode for XLGMII and beyond Ahmad Fatoum
` (3 subsequent siblings)
8 siblings, 0 replies; 10+ messages in thread
From: Ahmad Fatoum @ 2025-03-20 5:16 UTC (permalink / raw)
To: barebox; +Cc: Ahmad Fatoum
The file uses xzalloc, but it's not defined any longer in the currently
included headers.
Include the relevant header to fix this.
Signed-off-by: Ahmad Fatoum <a.fatoum@pengutronix.de>
---
v1 -> v2:
- new patch
---
arch/arm/mach-mvebu/kwb_bbu.c | 1 +
1 file changed, 1 insertion(+)
diff --git a/arch/arm/mach-mvebu/kwb_bbu.c b/arch/arm/mach-mvebu/kwb_bbu.c
index 0fde9abb5709..b706edac6dc1 100644
--- a/arch/arm/mach-mvebu/kwb_bbu.c
+++ b/arch/arm/mach-mvebu/kwb_bbu.c
@@ -1,6 +1,7 @@
// SPDX-License-Identifier: GPL-2.0-only
#include <bbu.h>
+#include <xfuncs.h>
#include <libfile.h>
#include <linux/printk.h>
--
2.39.5
^ permalink raw reply [flat|nested] 10+ messages in thread
* [PATCH master 6/8] net: phy: fix of_get_phy_mode for XLGMII and beyond
2025-03-20 5:16 [PATCH master 0/8] treewide: misc fixes Ahmad Fatoum
` (4 preceding siblings ...)
2025-03-20 5:16 ` [PATCH master 5/8] ARM: mvebu: kwb_bbu: add missing header Ahmad Fatoum
@ 2025-03-20 5:16 ` Ahmad Fatoum
2025-03-20 5:16 ` [PATCH master 7/8] vsprintf: fix left indentation when formatting wide string arguments Ahmad Fatoum
` (2 subsequent siblings)
8 siblings, 0 replies; 10+ messages in thread
From: Ahmad Fatoum @ 2025-03-20 5:16 UTC (permalink / raw)
To: barebox; +Cc: Ahmad Fatoum
The phy_modes array needs to be kept in-sync with the
enum phy_interface_t, but this was violated by the most recent sync of
the enum type with Linux.
Th addition of new enumeration constants between existing ones resulted
in phy_modes having NULL-valued gaps, which would panic when passed
to strcmp.
Fix this by replacing the current sparse array, with a function that
always returns a string value. This is what Linux currently does.
Fixes: 63eb097f6639 ("net/phy: sync phy_interface_t types with Linux")
Signed-off-by: Ahmad Fatoum <a.fatoum@pengutronix.de>
---
v1 -> v2:
- new patch
---
drivers/of/of_net.c | 36 ++------------------
include/linux/phy.h | 82 +++++++++++++++++++++++++++++++++++++++++++++
2 files changed, 84 insertions(+), 34 deletions(-)
diff --git a/drivers/of/of_net.c b/drivers/of/of_net.c
index 58b4f99da111..d66de875316d 100644
--- a/drivers/of/of_net.c
+++ b/drivers/of/of_net.c
@@ -10,38 +10,6 @@
#include <linux/phy.h>
#include <linux/nvmem-consumer.h>
-/**
- * It maps 'enum phy_interface_t' found in include/linux/phy.h
- * into the device tree binding of 'phy-mode', so that Ethernet
- * device driver can get phy interface from device tree.
- */
-static const char *phy_modes[] = {
- [PHY_INTERFACE_MODE_NA] = "",
- [PHY_INTERFACE_MODE_INTERNAL] = "internal",
- [PHY_INTERFACE_MODE_MII] = "mii",
- [PHY_INTERFACE_MODE_GMII] = "gmii",
- [PHY_INTERFACE_MODE_SGMII] = "sgmii",
- [PHY_INTERFACE_MODE_TBI] = "tbi",
- [PHY_INTERFACE_MODE_REVMII] = "rev-mii",
- [PHY_INTERFACE_MODE_RMII] = "rmii",
- [PHY_INTERFACE_MODE_REVRMII] = "rev-rmii",
- [PHY_INTERFACE_MODE_RGMII] = "rgmii",
- [PHY_INTERFACE_MODE_RGMII_ID] = "rgmii-id",
- [PHY_INTERFACE_MODE_RGMII_RXID] = "rgmii-rxid",
- [PHY_INTERFACE_MODE_RGMII_TXID] = "rgmii-txid",
- [PHY_INTERFACE_MODE_RTBI] = "rtbi",
- [PHY_INTERFACE_MODE_SMII] = "smii",
- [PHY_INTERFACE_MODE_XGMII] = "xgmii",
- [PHY_INTERFACE_MODE_MOCA] = "moca",
- [PHY_INTERFACE_MODE_QSGMII] = "qsgmii",
- [PHY_INTERFACE_MODE_TRGMII] = "trgmii",
- [PHY_INTERFACE_MODE_1000BASEX] = "1000base-x",
- [PHY_INTERFACE_MODE_2500BASEX] = "2500base-x",
- [PHY_INTERFACE_MODE_RXAUI] = "rxaui",
- [PHY_INTERFACE_MODE_XAUI] = "xaui",
- [PHY_INTERFACE_MODE_10GKR] = "10gbase-kr",
-};
-
/**
* of_get_phy_mode - Get phy mode for given device_node
* @np: Pointer to the given device_node
@@ -60,8 +28,8 @@ int of_get_phy_mode(struct device_node *np)
if (err < 0)
return err;
- for (i = 0; i < ARRAY_SIZE(phy_modes); i++)
- if (!strcmp(pm, phy_modes[i]))
+ for (i = 0; i < PHY_INTERFACE_MODE_MAX; i++)
+ if (!strcasecmp(pm, phy_modes(i)))
return i;
return -ENODEV;
diff --git a/include/linux/phy.h b/include/linux/phy.h
index d8e53d446ef5..5cbd21f91a50 100644
--- a/include/linux/phy.h
+++ b/include/linux/phy.h
@@ -115,6 +115,88 @@ typedef enum {
PHY_INTERFACE_MODE_MAX,
} phy_interface_t;
+/**
+ * phy_modes - map phy_interface_t enum to device tree binding of phy-mode
+ * @interface: enum phy_interface_t value
+ *
+ * Description: maps enum &phy_interface_t defined in this file
+ * into the device tree binding of 'phy-mode', so that Ethernet
+ * device driver can get PHY interface from device tree.
+ */
+static inline const char *phy_modes(phy_interface_t interface)
+{
+ switch (interface) {
+ case PHY_INTERFACE_MODE_NA:
+ return "";
+ case PHY_INTERFACE_MODE_INTERNAL:
+ return "internal";
+ case PHY_INTERFACE_MODE_MII:
+ return "mii";
+ case PHY_INTERFACE_MODE_GMII:
+ return "gmii";
+ case PHY_INTERFACE_MODE_SGMII:
+ return "sgmii";
+ case PHY_INTERFACE_MODE_TBI:
+ return "tbi";
+ case PHY_INTERFACE_MODE_REVMII:
+ return "rev-mii";
+ case PHY_INTERFACE_MODE_RMII:
+ return "rmii";
+ case PHY_INTERFACE_MODE_REVRMII:
+ return "rev-rmii";
+ case PHY_INTERFACE_MODE_RGMII:
+ return "rgmii";
+ case PHY_INTERFACE_MODE_RGMII_ID:
+ return "rgmii-id";
+ case PHY_INTERFACE_MODE_RGMII_RXID:
+ return "rgmii-rxid";
+ case PHY_INTERFACE_MODE_RGMII_TXID:
+ return "rgmii-txid";
+ case PHY_INTERFACE_MODE_RTBI:
+ return "rtbi";
+ case PHY_INTERFACE_MODE_SMII:
+ return "smii";
+ case PHY_INTERFACE_MODE_XGMII:
+ return "xgmii";
+ case PHY_INTERFACE_MODE_XLGMII:
+ return "xlgmii";
+ case PHY_INTERFACE_MODE_MOCA:
+ return "moca";
+ case PHY_INTERFACE_MODE_PSGMII:
+ return "psgmii";
+ case PHY_INTERFACE_MODE_QSGMII:
+ return "qsgmii";
+ case PHY_INTERFACE_MODE_TRGMII:
+ return "trgmii";
+ case PHY_INTERFACE_MODE_1000BASEX:
+ return "1000base-x";
+ case PHY_INTERFACE_MODE_1000BASEKX:
+ return "1000base-kx";
+ case PHY_INTERFACE_MODE_2500BASEX:
+ return "2500base-x";
+ case PHY_INTERFACE_MODE_5GBASER:
+ return "5gbase-r";
+ case PHY_INTERFACE_MODE_RXAUI:
+ return "rxaui";
+ case PHY_INTERFACE_MODE_XAUI:
+ return "xaui";
+ case PHY_INTERFACE_MODE_10GBASER:
+ return "10gbase-r";
+ case PHY_INTERFACE_MODE_25GBASER:
+ return "25gbase-r";
+ case PHY_INTERFACE_MODE_USXGMII:
+ return "usxgmii";
+ case PHY_INTERFACE_MODE_10GKR:
+ return "10gbase-kr";
+ case PHY_INTERFACE_MODE_100BASEX:
+ return "100base-x";
+ case PHY_INTERFACE_MODE_QUSGMII:
+ return "qusgmii";
+ default:
+ return "unknown";
+ }
+}
+
#define PHY_INIT_TIMEOUT 100000
#define PHY_FORCE_TIMEOUT 10
#define PHY_AN_TIMEOUT 10
--
2.39.5
^ permalink raw reply [flat|nested] 10+ messages in thread
* [PATCH master 7/8] vsprintf: fix left indentation when formatting wide string arguments
2025-03-20 5:16 [PATCH master 0/8] treewide: misc fixes Ahmad Fatoum
` (5 preceding siblings ...)
2025-03-20 5:16 ` [PATCH master 6/8] net: phy: fix of_get_phy_mode for XLGMII and beyond Ahmad Fatoum
@ 2025-03-20 5:16 ` Ahmad Fatoum
2025-03-20 5:16 ` [PATCH master 8/8] test: self: printf: add tests for formatting wide strings Ahmad Fatoum
2025-03-20 11:46 ` [PATCH master 0/8] treewide: misc fixes Sascha Hauer
8 siblings, 0 replies; 10+ messages in thread
From: Ahmad Fatoum @ 2025-03-20 5:16 UTC (permalink / raw)
To: barebox; +Cc: Ahmad Fatoum
leading_spaces will advance the buf pointer as needed, but currently buf
is never reassigned, breaking formatting of wchar arrays.
Signed-off-by: Ahmad Fatoum <a.fatoum@pengutronix.de>
---
v1 -> v2:
- new patch
---
lib/vsprintf.c | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/lib/vsprintf.c b/lib/vsprintf.c
index cb42caebca16..99c63fbc33c7 100644
--- a/lib/vsprintf.c
+++ b/lib/vsprintf.c
@@ -229,7 +229,8 @@ static char *wstring(char *buf, const char *end, const wchar_t *s, int field_wid
s = L"<NULL>";
len = wcsnlen(s, precision);
- leading_spaces(buf, end, len, &field_width, flags);
+
+ buf = leading_spaces(buf, end, len, &field_width, flags);
for (i = 0; i < len; ++i) {
if (buf < end)
--
2.39.5
^ permalink raw reply [flat|nested] 10+ messages in thread
* [PATCH master 8/8] test: self: printf: add tests for formatting wide strings
2025-03-20 5:16 [PATCH master 0/8] treewide: misc fixes Ahmad Fatoum
` (6 preceding siblings ...)
2025-03-20 5:16 ` [PATCH master 7/8] vsprintf: fix left indentation when formatting wide string arguments Ahmad Fatoum
@ 2025-03-20 5:16 ` Ahmad Fatoum
2025-03-20 11:46 ` [PATCH master 0/8] treewide: misc fixes Sascha Hauer
8 siblings, 0 replies; 10+ messages in thread
From: Ahmad Fatoum @ 2025-03-20 5:16 UTC (permalink / raw)
To: barebox; +Cc: Ahmad Fatoum
Let's repeat the same string tests we already have, but with wide (%ls)
strings instead of our normal ones.
Signed-off-by: Ahmad Fatoum <a.fatoum@pengutronix.de>
---
v1 -> v2:
- new patch
---
test/self/printf.c | 15 +++++++++++++++
1 file changed, 15 insertions(+)
diff --git a/test/self/printf.c b/test/self/printf.c
index eae40ed242c1..3f35b5514705 100644
--- a/test/self/printf.c
+++ b/test/self/printf.c
@@ -179,6 +179,20 @@ test_string(void)
test(" 1234", "%10.4s", "123456");
}
+static void __init
+test_wstring(void)
+{
+ if (!IS_ENABLED(CONFIG_PRINTF_WCHAR))
+ return;
+
+ test("", "%ls%.0ls", L"", L"123");
+ test("ABCD|abc|123", "%ls|%.3ls|%.*ls", L"ABCD", L"abcdef", 3, L"123456");
+ test("1 | 2|3 | 4|5 ", "%-3ls|%3ls|%-*ls|%*ls|%*ls",
+ L"1", L"2", 3, L"3", 3, L"4", -3, L"5");
+ test("1234 ", "%-10.4ls", L"123456");
+ test(" 1234", "%10.4ls", L"123456");
+}
+
#if BITS_PER_LONG == 64
#define PTR_WIDTH 16
@@ -331,6 +345,7 @@ static void __init test_printf(void)
test_basic();
test_number();
test_string();
+ test_wstring();
test_pointer();
test_hexstr();
test_jsonpath();
--
2.39.5
^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: [PATCH master 0/8] treewide: misc fixes
2025-03-20 5:16 [PATCH master 0/8] treewide: misc fixes Ahmad Fatoum
` (7 preceding siblings ...)
2025-03-20 5:16 ` [PATCH master 8/8] test: self: printf: add tests for formatting wide strings Ahmad Fatoum
@ 2025-03-20 11:46 ` Sascha Hauer
8 siblings, 0 replies; 10+ messages in thread
From: Sascha Hauer @ 2025-03-20 11:46 UTC (permalink / raw)
To: barebox, Ahmad Fatoum
On Thu, 20 Mar 2025 06:16:33 +0100, Ahmad Fatoum wrote:
> Just a loose collection of fixes for master.
>
> Ahmad Fatoum (8):
> firmware: disable MISSING_FIRMWARE_ERROR for COMPILE_TEST builds
> include: asm-generic/pointer.h: fix ASM_PTR definition for i386
> sandbox: do not enable SANDBOX_LINUX_I386 in allyesconfig
> Documentation: devicetree: fix Sphinx warnings
> ARM: mvebu: kwb_bbu: add missing header
> net: phy: fix of_get_phy_mode for XLGMII and beyond
> vsprintf: fix left indentation when formatting wide string arguments
> test: self: printf: add tests for formatting wide strings
>
> [...]
Applied, thanks!
[1/8] firmware: disable MISSING_FIRMWARE_ERROR for COMPILE_TEST builds
https://git.pengutronix.de/cgit/barebox/commit/?id=f98e851fb44a (link may not be stable)
[2/8] include: asm-generic/pointer.h: fix ASM_PTR definition for i386
https://git.pengutronix.de/cgit/barebox/commit/?id=aac256131049 (link may not be stable)
[3/8] sandbox: do not enable SANDBOX_LINUX_I386 in allyesconfig
https://git.pengutronix.de/cgit/barebox/commit/?id=3e99ee8d8daf (link may not be stable)
[4/8] Documentation: devicetree: fix Sphinx warnings
https://git.pengutronix.de/cgit/barebox/commit/?id=e6fadf774de3 (link may not be stable)
[5/8] ARM: mvebu: kwb_bbu: add missing header
https://git.pengutronix.de/cgit/barebox/commit/?id=2cb75d180cfd (link may not be stable)
[6/8] net: phy: fix of_get_phy_mode for XLGMII and beyond
https://git.pengutronix.de/cgit/barebox/commit/?id=24a20c4f0919 (link may not be stable)
[7/8] vsprintf: fix left indentation when formatting wide string arguments
https://git.pengutronix.de/cgit/barebox/commit/?id=e91b0cde02bc (link may not be stable)
[8/8] test: self: printf: add tests for formatting wide strings
https://git.pengutronix.de/cgit/barebox/commit/?id=9340a6acec7c (link may not be stable)
Best regards,
--
Sascha Hauer <s.hauer@pengutronix.de>
^ permalink raw reply [flat|nested] 10+ messages in thread
end of thread, other threads:[~2025-03-20 12:06 UTC | newest]
Thread overview: 10+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2025-03-20 5:16 [PATCH master 0/8] treewide: misc fixes Ahmad Fatoum
2025-03-20 5:16 ` [PATCH master 1/8] firmware: disable MISSING_FIRMWARE_ERROR for COMPILE_TEST builds Ahmad Fatoum
2025-03-20 5:16 ` [PATCH master 2/8] include: asm-generic/pointer.h: fix ASM_PTR definition for i386 Ahmad Fatoum
2025-03-20 5:16 ` [PATCH master 3/8] sandbox: do not enable SANDBOX_LINUX_I386 in allyesconfig Ahmad Fatoum
2025-03-20 5:16 ` [PATCH master 4/8] Documentation: devicetree: fix Sphinx warnings Ahmad Fatoum
2025-03-20 5:16 ` [PATCH master 5/8] ARM: mvebu: kwb_bbu: add missing header Ahmad Fatoum
2025-03-20 5:16 ` [PATCH master 6/8] net: phy: fix of_get_phy_mode for XLGMII and beyond Ahmad Fatoum
2025-03-20 5:16 ` [PATCH master 7/8] vsprintf: fix left indentation when formatting wide string arguments Ahmad Fatoum
2025-03-20 5:16 ` [PATCH master 8/8] test: self: printf: add tests for formatting wide strings Ahmad Fatoum
2025-03-20 11:46 ` [PATCH master 0/8] treewide: misc fixes Sascha Hauer
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox