* [PATCH master 00/13] Misc compile test fixes
@ 2024-10-14 11:38 Ahmad Fatoum
2024-10-14 11:39 ` [PATCH master 01/13] clk: add stub definition for of_clk_get_from_provider Ahmad Fatoum
` (13 more replies)
0 siblings, 14 replies; 15+ messages in thread
From: Ahmad Fatoum @ 2024-10-14 11:38 UTC (permalink / raw)
To: barebox
I compile tested with ARCH=sandbox make allyesconfig and these are fixes
for the errors I ran into.
Given that a number of them may also affect other architectures and that
the changes are quite limited in scope, I suggest this is taken directly
to master.
Ahmad Fatoum (13):
clk: add stub definition for of_clk_get_from_provider
tee: add missing header for BIT macro definition
tee: shm: include missing header for basprintf
net: dsa: realtek: fix CONFIG_SANDBOX build
pmdomain: imx8mp-blk-ctrl: add missing definition of ARRAY_SIZE
PWM: rockchip: fix compile testing with CONFIG_SANDBOX
watchdog: imxulp: drop unused include of asm/system.h
include: import uapi/linux/kernel.h header from Linux
usb: typec: fix compile test with CONFIG_SANDBOX
bitops: fix missing defintion for DIV_ROUND_UP definitions
mci: am654-sdhci: drop dummy redefinition of MMC_CAP2_HS200/400
hw_random: fix compilation with 64-bit size_t
optee: make OP-TEE OF fixup ARM-specific
drivers/hw_random/omap-rng.c | 2 +-
drivers/mci/am654-sdhci.c | 2 --
drivers/net/realtek-dsa/realtek-mdio.c | 1 +
drivers/net/realtek-dsa/rtl8365mb.c | 2 ++
drivers/net/realtek-dsa/rtl8366rb.c | 1 +
drivers/pmdomain/imx/imx8mp-blk-ctrl.c | 1 +
drivers/pwm/pwm-rockchip.c | 1 +
drivers/tee/optee/Kconfig | 4 +++
drivers/tee/optee/Makefile | 2 +-
drivers/tee/tee_shm.c | 1 +
drivers/usb/typec/class.c | 3 ++-
drivers/watchdog/imxulp-wdt.c | 1 -
include/linux/align.h | 8 +++---
include/linux/bitops.h | 10 ++++---
include/linux/clk.h | 6 +++++
include/linux/const.h | 24 +----------------
include/linux/math.h | 2 +-
include/linux/tee_drv.h | 1 +
include/uapi/linux/const.h | 36 ++++++++++++++++++++++++++
include/uapi/linux/kernel.h | 7 +++++
20 files changed, 78 insertions(+), 37 deletions(-)
create mode 100644 include/uapi/linux/const.h
create mode 100644 include/uapi/linux/kernel.h
--
2.39.5
^ permalink raw reply [flat|nested] 15+ messages in thread
* [PATCH master 01/13] clk: add stub definition for of_clk_get_from_provider
2024-10-14 11:38 [PATCH master 00/13] Misc compile test fixes Ahmad Fatoum
@ 2024-10-14 11:39 ` Ahmad Fatoum
2024-10-14 11:39 ` [PATCH master 02/13] tee: add missing header for BIT macro definition Ahmad Fatoum
` (12 subsequent siblings)
13 siblings, 0 replies; 15+ messages in thread
From: Ahmad Fatoum @ 2024-10-14 11:39 UTC (permalink / raw)
To: barebox; +Cc: Ahmad Fatoum
Compile testing drivers using of_clk_get_from_provider, but without
CONFIG_COMMON_CLK currently fails, so add a stub definition to fix this.
Signed-off-by: Ahmad Fatoum <a.fatoum@pengutronix.de>
---
include/linux/clk.h | 6 ++++++
1 file changed, 6 insertions(+)
diff --git a/include/linux/clk.h b/include/linux/clk.h
index ae03dcfdb2a2..7e777b67f486 100644
--- a/include/linux/clk.h
+++ b/include/linux/clk.h
@@ -846,6 +846,12 @@ static inline struct clk *of_clk_get_by_name(struct device_node *np,
{
return ERR_PTR(-ENOENT);
}
+
+static inline struct clk *of_clk_get_from_provider(struct of_phandle_args *clkspec)
+{
+ return ERR_PTR(-ENOENT);
+}
+
static inline unsigned int of_clk_get_parent_count(struct device_node *np)
{
return 0;
--
2.39.5
^ permalink raw reply [flat|nested] 15+ messages in thread
* [PATCH master 02/13] tee: add missing header for BIT macro definition
2024-10-14 11:38 [PATCH master 00/13] Misc compile test fixes Ahmad Fatoum
2024-10-14 11:39 ` [PATCH master 01/13] clk: add stub definition for of_clk_get_from_provider Ahmad Fatoum
@ 2024-10-14 11:39 ` Ahmad Fatoum
2024-10-14 11:39 ` [PATCH master 03/13] tee: shm: include missing header for basprintf Ahmad Fatoum
` (11 subsequent siblings)
13 siblings, 0 replies; 15+ messages in thread
From: Ahmad Fatoum @ 2024-10-14 11:39 UTC (permalink / raw)
To: barebox; +Cc: Abdelrahman Youssef, Ahmad Fatoum
Compile test with sandbox fails because the BIT macro isn't defined.
Include the relevant header to fix this, even if TEE is in the end not
usable on that architecture (yet?).
Reported-by: Abdelrahman Youssef <abdelrahmanyossef12@gmail.com>
Signed-off-by: Ahmad Fatoum <a.fatoum@pengutronix.de>
---
include/linux/tee_drv.h | 1 +
1 file changed, 1 insertion(+)
diff --git a/include/linux/tee_drv.h b/include/linux/tee_drv.h
index 4a5cb0f0a50f..7289c3057a67 100644
--- a/include/linux/tee_drv.h
+++ b/include/linux/tee_drv.h
@@ -6,6 +6,7 @@
#ifndef __TEE_DRV_H
#define __TEE_DRV_H
+#include <linux/bits.h>
#include <linux/device.h>
#include <linux/idr.h>
#include <linux/kref.h>
--
2.39.5
^ permalink raw reply [flat|nested] 15+ messages in thread
* [PATCH master 03/13] tee: shm: include missing header for basprintf
2024-10-14 11:38 [PATCH master 00/13] Misc compile test fixes Ahmad Fatoum
2024-10-14 11:39 ` [PATCH master 01/13] clk: add stub definition for of_clk_get_from_provider Ahmad Fatoum
2024-10-14 11:39 ` [PATCH master 02/13] tee: add missing header for BIT macro definition Ahmad Fatoum
@ 2024-10-14 11:39 ` Ahmad Fatoum
2024-10-14 11:39 ` [PATCH master 04/13] net: dsa: realtek: fix CONFIG_SANDBOX build Ahmad Fatoum
` (10 subsequent siblings)
13 siblings, 0 replies; 15+ messages in thread
From: Ahmad Fatoum @ 2024-10-14 11:39 UTC (permalink / raw)
To: barebox; +Cc: Abdelrahman Youssef, Ahmad Fatoum
Compile test under sandbox fails, because basprintf isn't defined.
Include the relevant header to fix this, even if TEE is in the end not
usable on that architecture (yet?).
Reported-by: Abdelrahman Youssef <abdelrahmanyossef12@gmail.com>
Signed-off-by: Ahmad Fatoum <a.fatoum@pengutronix.de>
---
drivers/tee/tee_shm.c | 1 +
1 file changed, 1 insertion(+)
diff --git a/drivers/tee/tee_shm.c b/drivers/tee/tee_shm.c
index ea16c9cdd2e5..9952608435f6 100644
--- a/drivers/tee/tee_shm.c
+++ b/drivers/tee/tee_shm.c
@@ -11,6 +11,7 @@
#include <linux/uaccess.h>
#include <linux/sizes.h>
#include <fcntl.h>
+#include <stdio.h>
#include "tee_private.h"
static void tee_shm_release(struct tee_device *teedev, struct tee_shm *shm)
--
2.39.5
^ permalink raw reply [flat|nested] 15+ messages in thread
* [PATCH master 04/13] net: dsa: realtek: fix CONFIG_SANDBOX build
2024-10-14 11:38 [PATCH master 00/13] Misc compile test fixes Ahmad Fatoum
` (2 preceding siblings ...)
2024-10-14 11:39 ` [PATCH master 03/13] tee: shm: include missing header for basprintf Ahmad Fatoum
@ 2024-10-14 11:39 ` Ahmad Fatoum
2024-10-14 11:39 ` [PATCH master 05/13] pmdomain: imx8mp-blk-ctrl: add missing definition of ARRAY_SIZE Ahmad Fatoum
` (9 subsequent siblings)
13 siblings, 0 replies; 15+ messages in thread
From: Ahmad Fatoum @ 2024-10-14 11:39 UTC (permalink / raw)
To: barebox; +Cc: Ahmad Fatoum
A number of errors due to missing headers pop up when compiling
this driver under sandbox. Fix them.
Signed-off-by: Ahmad Fatoum <a.fatoum@pengutronix.de>
---
drivers/net/realtek-dsa/realtek-mdio.c | 1 +
drivers/net/realtek-dsa/rtl8365mb.c | 2 ++
drivers/net/realtek-dsa/rtl8366rb.c | 1 +
3 files changed, 4 insertions(+)
diff --git a/drivers/net/realtek-dsa/realtek-mdio.c b/drivers/net/realtek-dsa/realtek-mdio.c
index 4fc2295b1b5f..d4c3fbba526f 100644
--- a/drivers/net/realtek-dsa/realtek-mdio.c
+++ b/drivers/net/realtek-dsa/realtek-mdio.c
@@ -21,6 +21,7 @@
#include <of_device.h>
#include <linux/regmap.h>
+#include <linux/slab.h>
#include <clock.h>
#include <linux/gpio/consumer.h>
#include <linux/printk.h>
diff --git a/drivers/net/realtek-dsa/rtl8365mb.c b/drivers/net/realtek-dsa/rtl8365mb.c
index 588998235827..5b5b7cb97682 100644
--- a/drivers/net/realtek-dsa/rtl8365mb.c
+++ b/drivers/net/realtek-dsa/rtl8365mb.c
@@ -90,12 +90,14 @@
* one of the simpler chips.
*/
+#include <linux/kernel.h>
#include <linux/bitfield.h>
#include <linux/bitops.h>
#include <linux/mutex.h>
#include <linux/spinlock.h>
#include <linux/printk.h>
#include <linux/export.h>
+#include <linux/math.h>
#include <linux/regmap.h>
#include <net.h>
#include <linux/if_bridge.h>
diff --git a/drivers/net/realtek-dsa/rtl8366rb.c b/drivers/net/realtek-dsa/rtl8366rb.c
index 35028d319ecd..052a7e2b3a73 100644
--- a/drivers/net/realtek-dsa/rtl8366rb.c
+++ b/drivers/net/realtek-dsa/rtl8366rb.c
@@ -13,6 +13,7 @@
*/
#include <linux/bitops.h>
+#include <linux/kernel.h>
#include <net.h>
#include <linux/if_bridge.h>
#include <linux/printk.h>
--
2.39.5
^ permalink raw reply [flat|nested] 15+ messages in thread
* [PATCH master 05/13] pmdomain: imx8mp-blk-ctrl: add missing definition of ARRAY_SIZE
2024-10-14 11:38 [PATCH master 00/13] Misc compile test fixes Ahmad Fatoum
` (3 preceding siblings ...)
2024-10-14 11:39 ` [PATCH master 04/13] net: dsa: realtek: fix CONFIG_SANDBOX build Ahmad Fatoum
@ 2024-10-14 11:39 ` Ahmad Fatoum
2024-10-14 11:39 ` [PATCH master 06/13] PWM: rockchip: fix compile testing with CONFIG_SANDBOX Ahmad Fatoum
` (8 subsequent siblings)
13 siblings, 0 replies; 15+ messages in thread
From: Ahmad Fatoum @ 2024-10-14 11:39 UTC (permalink / raw)
To: barebox; +Cc: Ahmad Fatoum
This is likely fallout from ARRAY_SIZE no longer being defined
indirectly via inclusion of <linux/list.h> transitively in other
headers.
Fix this by adding an explicit inclusion of <linux/kernel.h>.
Signed-off-by: Ahmad Fatoum <a.fatoum@pengutronix.de>
---
drivers/pmdomain/imx/imx8mp-blk-ctrl.c | 1 +
1 file changed, 1 insertion(+)
diff --git a/drivers/pmdomain/imx/imx8mp-blk-ctrl.c b/drivers/pmdomain/imx/imx8mp-blk-ctrl.c
index b71a4a793761..3d302cbde7dc 100644
--- a/drivers/pmdomain/imx/imx8mp-blk-ctrl.c
+++ b/drivers/pmdomain/imx/imx8mp-blk-ctrl.c
@@ -5,6 +5,7 @@
*/
#include <linux/bitfield.h>
+#include <linux/kernel.h>
#include <linux/clk.h>
#include <linux/clk-provider.h>
#include <linux/device.h>
--
2.39.5
^ permalink raw reply [flat|nested] 15+ messages in thread
* [PATCH master 06/13] PWM: rockchip: fix compile testing with CONFIG_SANDBOX
2024-10-14 11:38 [PATCH master 00/13] Misc compile test fixes Ahmad Fatoum
` (4 preceding siblings ...)
2024-10-14 11:39 ` [PATCH master 05/13] pmdomain: imx8mp-blk-ctrl: add missing definition of ARRAY_SIZE Ahmad Fatoum
@ 2024-10-14 11:39 ` Ahmad Fatoum
2024-10-14 11:39 ` [PATCH master 07/13] watchdog: imxulp: drop unused include of asm/system.h Ahmad Fatoum
` (7 subsequent siblings)
13 siblings, 0 replies; 15+ messages in thread
From: Ahmad Fatoum @ 2024-10-14 11:39 UTC (permalink / raw)
To: barebox; +Cc: Ahmad Fatoum
basprintf isn't defined, so include the relevant header.
Signed-off-by: Ahmad Fatoum <a.fatoum@pengutronix.de>
---
drivers/pwm/pwm-rockchip.c | 1 +
1 file changed, 1 insertion(+)
diff --git a/drivers/pwm/pwm-rockchip.c b/drivers/pwm/pwm-rockchip.c
index 960867c52066..b302a84d5f3f 100644
--- a/drivers/pwm/pwm-rockchip.c
+++ b/drivers/pwm/pwm-rockchip.c
@@ -9,6 +9,7 @@
#include <linux/clk.h>
#include <linux/io.h>
#include <module.h>
+#include <stdio.h>
#include <of.h>
#include <linux/device.h>
#include <pwm.h>
--
2.39.5
^ permalink raw reply [flat|nested] 15+ messages in thread
* [PATCH master 07/13] watchdog: imxulp: drop unused include of asm/system.h
2024-10-14 11:38 [PATCH master 00/13] Misc compile test fixes Ahmad Fatoum
` (5 preceding siblings ...)
2024-10-14 11:39 ` [PATCH master 06/13] PWM: rockchip: fix compile testing with CONFIG_SANDBOX Ahmad Fatoum
@ 2024-10-14 11:39 ` Ahmad Fatoum
2024-10-14 11:39 ` [PATCH master 08/13] include: import uapi/linux/kernel.h header from Linux Ahmad Fatoum
` (6 subsequent siblings)
13 siblings, 0 replies; 15+ messages in thread
From: Ahmad Fatoum @ 2024-10-14 11:39 UTC (permalink / raw)
To: barebox; +Cc: Ahmad Fatoum
This header is unused and breaks compile test of the driver on other
architectures, but ARM.
Signed-off-by: Ahmad Fatoum <a.fatoum@pengutronix.de>
---
drivers/watchdog/imxulp-wdt.c | 1 -
1 file changed, 1 deletion(-)
diff --git a/drivers/watchdog/imxulp-wdt.c b/drivers/watchdog/imxulp-wdt.c
index 5a8987617524..5571c32ef44f 100644
--- a/drivers/watchdog/imxulp-wdt.c
+++ b/drivers/watchdog/imxulp-wdt.c
@@ -13,7 +13,6 @@
#include <watchdog.h>
#include <reset_source.h>
#include <linux/clk.h>
-#include <asm/system.h>
struct imxulp_socdata {
bool prescaler_enable;
--
2.39.5
^ permalink raw reply [flat|nested] 15+ messages in thread
* [PATCH master 08/13] include: import uapi/linux/kernel.h header from Linux
2024-10-14 11:38 [PATCH master 00/13] Misc compile test fixes Ahmad Fatoum
` (6 preceding siblings ...)
2024-10-14 11:39 ` [PATCH master 07/13] watchdog: imxulp: drop unused include of asm/system.h Ahmad Fatoum
@ 2024-10-14 11:39 ` Ahmad Fatoum
2024-10-14 11:39 ` [PATCH master 09/13] usb: typec: fix compile test with CONFIG_SANDBOX Ahmad Fatoum
` (5 subsequent siblings)
13 siblings, 0 replies; 15+ messages in thread
From: Ahmad Fatoum @ 2024-10-14 11:39 UTC (permalink / raw)
To: barebox; +Cc: Ahmad Fatoum
The UAPI (userspace API) headers in LInux are chiefly meant for
inclusion from userspace, but they are also used from normal kernel
headers to break recursive dependencies.
In order to keep it easier to sync the kernel header code, let's adopt
the same structure in barebox.
No functional change intended.
Signed-off-by: Ahmad Fatoum <a.fatoum@pengutronix.de>
---
include/linux/align.h | 8 +++++---
include/linux/const.h | 24 +-----------------------
include/linux/math.h | 2 +-
include/uapi/linux/const.h | 36 ++++++++++++++++++++++++++++++++++++
include/uapi/linux/kernel.h | 7 +++++++
5 files changed, 50 insertions(+), 27 deletions(-)
create mode 100644 include/uapi/linux/const.h
create mode 100644 include/uapi/linux/kernel.h
diff --git a/include/linux/align.h b/include/linux/align.h
index 4b373bf73d5b..3b0c60d6e9ae 100644
--- a/include/linux/align.h
+++ b/include/linux/align.h
@@ -2,9 +2,11 @@
#ifndef _LINUX_ALIGN_H
#define _LINUX_ALIGN_H
-#define ALIGN(x, a) __ALIGN_MASK(x, (typeof(x))(a) - 1)
-#define ALIGN_DOWN(x, a) ALIGN((x) - ((a) - 1), (a))
-#define __ALIGN_MASK(x, mask) (((x) + (mask)) & ~(mask))
+#include <linux/const.h>
+
+#define ALIGN(x, a) __ALIGN_KERNEL((x), (a))
+#define ALIGN_DOWN(x, a) __ALIGN_KERNEL((x) - ((a) - 1), (a))
+#define __ALIGN_MASK(x, mask) __ALIGN_KERNEL_MASK((x), (mask))
#define PTR_ALIGN(p, a) ((typeof(p))ALIGN((unsigned long)(p), (a)))
#define PTR_ALIGN_DOWN(p, a) ((typeof(p))ALIGN_DOWN((unsigned long)(p), (a)))
#define PTR_IS_ALIGNED(x, a) IS_ALIGNED((unsigned long)(x), (a))
diff --git a/include/linux/const.h b/include/linux/const.h
index 77e4f6fd8a2a..90662deeb7ca 100644
--- a/include/linux/const.h
+++ b/include/linux/const.h
@@ -5,29 +5,7 @@
#ifndef _LINUX_CONST_H
#define _LINUX_CONST_H
-/* Some constant macros are used in both assembler and
- * C code. Therefore we cannot annotate them always with
- * 'UL' and other type specifiers unilaterally. We
- * use the following macros to deal with this.
- *
- * Similarly, _AT() will cast an expression with a type in C, but
- * leave it unchanged in asm.
- */
-
-#ifdef __ASSEMBLY__
-#define _AC(X,Y) X
-#define _AT(T,X) X
-#else
-#define __AC(X,Y) (X##Y)
-#define _AC(X,Y) __AC(X,Y)
-#define _AT(T,X) ((T)(X))
-#endif
-
-#define _UL(x) (_AC(x, UL))
-#define _ULL(x) (_AC(x, ULL))
-
-#define _BITUL(x) (_UL(1) << (x))
-#define _BITULL(x) (_ULL(1) << (x))
+#include <uapi/linux/const.h>
#define UL(x) (_UL(x))
#define ULL(x) (_ULL(x))
diff --git a/include/linux/math.h b/include/linux/math.h
index e7c47fa404ab..e09ecaeab67c 100644
--- a/include/linux/math.h
+++ b/include/linux/math.h
@@ -33,7 +33,7 @@
*/
#define round_down(x, y) ((x) & ~__round_mask(x, y))
-#define DIV_ROUND_UP(n,d) (((n) + (d) - 1) / (d))
+#define DIV_ROUND_UP __KERNEL_DIV_ROUND_UP
#define DIV_ROUND_DOWN_ULL(ll, d) \
({ unsigned long long _tmp = (ll); do_div(_tmp, d); _tmp; })
diff --git a/include/uapi/linux/const.h b/include/uapi/linux/const.h
new file mode 100644
index 000000000000..a429381e7ca5
--- /dev/null
+++ b/include/uapi/linux/const.h
@@ -0,0 +1,36 @@
+/* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */
+/* const.h: Macros for dealing with constants. */
+
+#ifndef _UAPI_LINUX_CONST_H
+#define _UAPI_LINUX_CONST_H
+
+/* Some constant macros are used in both assembler and
+ * C code. Therefore we cannot annotate them always with
+ * 'UL' and other type specifiers unilaterally. We
+ * use the following macros to deal with this.
+ *
+ * Similarly, _AT() will cast an expression with a type in C, but
+ * leave it unchanged in asm.
+ */
+
+#ifdef __ASSEMBLY__
+#define _AC(X,Y) X
+#define _AT(T,X) X
+#else
+#define __AC(X,Y) (X##Y)
+#define _AC(X,Y) __AC(X,Y)
+#define _AT(T,X) ((T)(X))
+#endif
+
+#define _UL(x) (_AC(x, UL))
+#define _ULL(x) (_AC(x, ULL))
+
+#define _BITUL(x) (_UL(1) << (x))
+#define _BITULL(x) (_ULL(1) << (x))
+
+#define __ALIGN_KERNEL(x, a) __ALIGN_KERNEL_MASK(x, (__typeof__(x))(a) - 1)
+#define __ALIGN_KERNEL_MASK(x, mask) (((x) + (mask)) & ~(mask))
+
+#define __KERNEL_DIV_ROUND_UP(n, d) (((n) + (d) - 1) / (d))
+
+#endif /* _UAPI_LINUX_CONST_H */
diff --git a/include/uapi/linux/kernel.h b/include/uapi/linux/kernel.h
new file mode 100644
index 000000000000..d3f1a684864e
--- /dev/null
+++ b/include/uapi/linux/kernel.h
@@ -0,0 +1,7 @@
+/* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */
+#ifndef _UAPI_LINUX_KERNEL_H
+#define _UAPI_LINUX_KERNEL_H
+
+#include <linux/const.h>
+
+#endif /* _UAPI_LINUX_KERNEL_H */
--
2.39.5
^ permalink raw reply [flat|nested] 15+ messages in thread
* [PATCH master 09/13] usb: typec: fix compile test with CONFIG_SANDBOX
2024-10-14 11:38 [PATCH master 00/13] Misc compile test fixes Ahmad Fatoum
` (7 preceding siblings ...)
2024-10-14 11:39 ` [PATCH master 08/13] include: import uapi/linux/kernel.h header from Linux Ahmad Fatoum
@ 2024-10-14 11:39 ` Ahmad Fatoum
2024-10-14 11:39 ` [PATCH master 10/13] bitops: fix missing defintion for DIV_ROUND_UP definitions Ahmad Fatoum
` (4 subsequent siblings)
13 siblings, 0 replies; 15+ messages in thread
From: Ahmad Fatoum @ 2024-10-14 11:39 UTC (permalink / raw)
To: barebox; +Cc: Ahmad Fatoum
Compiling the file triggers errors about kmalloc and ARRAY_SIZE being
undefined. As we don't require kmalloc's alignment here, switch it to
a normal malloc and include <linux/kernel.h> for the ARRAY_SIZE
definition.
Signed-off-by: Ahmad Fatoum <a.fatoum@pengutronix.de>
---
drivers/usb/typec/class.c | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/drivers/usb/typec/class.c b/drivers/usb/typec/class.c
index 7f498550f80e..495ac794622f 100644
--- a/drivers/usb/typec/class.c
+++ b/drivers/usb/typec/class.c
@@ -8,6 +8,7 @@
#include <module.h>
#include <driver.h>
+#include <linux/kernel.h>
#include <linux/usb/role.h>
#include <linux/usb/typec.h>
#include <linux/usb/typec_altmode.h>
@@ -141,7 +142,7 @@ struct typec_port *typec_register_port(struct device *parent,
const char *alias;
int ret;
- port = kzalloc(sizeof(*port), GFP_KERNEL);
+ port = malloc(sizeof(*port));
if (!port)
return ERR_PTR(-ENOMEM);
--
2.39.5
^ permalink raw reply [flat|nested] 15+ messages in thread
* [PATCH master 10/13] bitops: fix missing defintion for DIV_ROUND_UP definitions
2024-10-14 11:38 [PATCH master 00/13] Misc compile test fixes Ahmad Fatoum
` (8 preceding siblings ...)
2024-10-14 11:39 ` [PATCH master 09/13] usb: typec: fix compile test with CONFIG_SANDBOX Ahmad Fatoum
@ 2024-10-14 11:39 ` Ahmad Fatoum
2024-10-14 11:39 ` [PATCH master 11/13] mci: am654-sdhci: drop dummy redefinition of MMC_CAP2_HS200/400 Ahmad Fatoum
` (3 subsequent siblings)
13 siblings, 0 replies; 15+ messages in thread
From: Ahmad Fatoum @ 2024-10-14 11:39 UTC (permalink / raw)
To: barebox; +Cc: Ahmad Fatoum
Macros like BITS_TO_LONGS defined in <linux/bitops.h> expand to
DIV_ROUND_UP, which isn't defined in the same file.
We can't easily include <linux/math.h> however as this leads to a
recursive file inclusion:
In file included from ./include/asm-generic/div64.h:53,
from ./include/linux/math64.h:7,
from ./include/linux/math.h:6,
from ./include/linux/bitops.h:9,
from ./include/clock.h:7,
from ./include/console.h:15,
from ./include/stdio.h:6,
from ./include/common.h:10,
from ./common/partitions/dos.c:15:
./include/linux/log2.h: In function '__ilog2_u32':
./include/linux/log2.h:28:16: error: implicit declaration of function 'fls'
[-Wimplicit-function-declaration]
28 | return fls(n) - 1;
Fix this by doing it like Linux does and use the UAPI
__KERNEL_DIV_ROUND_UP definition instead.
Signed-off-by: Ahmad Fatoum <a.fatoum@pengutronix.de>
---
include/linux/bitops.h | 10 ++++++----
1 file changed, 6 insertions(+), 4 deletions(-)
diff --git a/include/linux/bitops.h b/include/linux/bitops.h
index 7646e1563478..44602ad5af84 100644
--- a/include/linux/bitops.h
+++ b/include/linux/bitops.h
@@ -7,12 +7,14 @@
#include <linux/const.h>
#include <linux/bits.h>
+#include <uapi/linux/kernel.h>
+
#ifdef __KERNEL__
#define BITS_PER_TYPE(type) (sizeof(type) * BITS_PER_BYTE)
-#define BITS_TO_LONGS(nr) DIV_ROUND_UP(nr, BITS_PER_TYPE(long))
-#define BITS_TO_U64(nr) DIV_ROUND_UP(nr, BITS_PER_TYPE(u64))
-#define BITS_TO_U32(nr) DIV_ROUND_UP(nr, BITS_PER_TYPE(u32))
-#define BITS_TO_BYTES(nr) DIV_ROUND_UP(nr, BITS_PER_TYPE(char))
+#define BITS_TO_LONGS(nr) __KERNEL_DIV_ROUND_UP(nr, BITS_PER_TYPE(long))
+#define BITS_TO_U64(nr) __KERNEL_DIV_ROUND_UP(nr, BITS_PER_TYPE(u64))
+#define BITS_TO_U32(nr) __KERNEL_DIV_ROUND_UP(nr, BITS_PER_TYPE(u32))
+#define BITS_TO_BYTES(nr) __KERNEL_DIV_ROUND_UP(nr, BITS_PER_TYPE(char))
#define BYTES_TO_BITS(nb) (((BITS_PER_LONG * (nb)) / sizeof(long)))
#endif
--
2.39.5
^ permalink raw reply [flat|nested] 15+ messages in thread
* [PATCH master 11/13] mci: am654-sdhci: drop dummy redefinition of MMC_CAP2_HS200/400
2024-10-14 11:38 [PATCH master 00/13] Misc compile test fixes Ahmad Fatoum
` (9 preceding siblings ...)
2024-10-14 11:39 ` [PATCH master 10/13] bitops: fix missing defintion for DIV_ROUND_UP definitions Ahmad Fatoum
@ 2024-10-14 11:39 ` Ahmad Fatoum
2024-10-14 11:39 ` [PATCH master 12/13] hw_random: fix compilation with 64-bit size_t Ahmad Fatoum
` (2 subsequent siblings)
13 siblings, 0 replies; 15+ messages in thread
From: Ahmad Fatoum @ 2024-10-14 11:39 UTC (permalink / raw)
To: barebox; +Cc: Ahmad Fatoum
These symbols are defined in <mci.h> now, so we shouldn't redefine them
locally here with dummy zero values.
Signed-off-by: Ahmad Fatoum <a.fatoum@pengutronix.de>
---
drivers/mci/am654-sdhci.c | 2 --
1 file changed, 2 deletions(-)
diff --git a/drivers/mci/am654-sdhci.c b/drivers/mci/am654-sdhci.c
index 493fa73eeb50..9787642011fc 100644
--- a/drivers/mci/am654-sdhci.c
+++ b/drivers/mci/am654-sdhci.c
@@ -83,8 +83,6 @@
#define AM654_SDHCI_MIN_FREQ 400000
#define CLOCK_TOO_SLOW_HZ 50000000
-#define MMC_CAP2_HS200 0
-#define MMC_CAP2_HS400 0
#define MMC_CAP_UHS_SDR104 0
#define MMC_CAP_UHS_SDR12 0
#define MMC_CAP_UHS_DDR50 0
--
2.39.5
^ permalink raw reply [flat|nested] 15+ messages in thread
* [PATCH master 12/13] hw_random: fix compilation with 64-bit size_t
2024-10-14 11:38 [PATCH master 00/13] Misc compile test fixes Ahmad Fatoum
` (10 preceding siblings ...)
2024-10-14 11:39 ` [PATCH master 11/13] mci: am654-sdhci: drop dummy redefinition of MMC_CAP2_HS200/400 Ahmad Fatoum
@ 2024-10-14 11:39 ` Ahmad Fatoum
2024-10-14 11:39 ` [PATCH master 13/13] optee: make OP-TEE OF fixup ARM-specific Ahmad Fatoum
2024-10-15 6:59 ` [PATCH master 00/13] Misc compile test fixes Sascha Hauer
13 siblings, 0 replies; 15+ messages in thread
From: Ahmad Fatoum @ 2024-10-14 11:39 UTC (permalink / raw)
To: barebox; +Cc: Ahmad Fatoum
max has the type size_t, while data_size is a u32.
This doesn't matter for 32-bit OMAP, but has min() trigger a compile
error when compile testing for 64-bit. Add a cast via min_t to fix this.
Signed-off-by: Ahmad Fatoum <a.fatoum@pengutronix.de>
---
drivers/hw_random/omap-rng.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/drivers/hw_random/omap-rng.c b/drivers/hw_random/omap-rng.c
index 9fa50bc8e7a9..6b69994aad0b 100644
--- a/drivers/hw_random/omap-rng.c
+++ b/drivers/hw_random/omap-rng.c
@@ -190,7 +190,7 @@ static int omap_rng_do_read(struct hwrng *rng, void *data, size_t max,
if (!present)
return 0;
- max = min(max, priv->pdata->data_size);
+ max = min_t(size_t, max, priv->pdata->data_size);
memcpy_fromio(data, priv->base + priv->pdata->regs[RNG_OUTPUT_0_REG], max);
--
2.39.5
^ permalink raw reply [flat|nested] 15+ messages in thread
* [PATCH master 13/13] optee: make OP-TEE OF fixup ARM-specific
2024-10-14 11:38 [PATCH master 00/13] Misc compile test fixes Ahmad Fatoum
` (11 preceding siblings ...)
2024-10-14 11:39 ` [PATCH master 12/13] hw_random: fix compilation with 64-bit size_t Ahmad Fatoum
@ 2024-10-14 11:39 ` Ahmad Fatoum
2024-10-15 6:59 ` [PATCH master 00/13] Misc compile test fixes Sascha Hauer
13 siblings, 0 replies; 15+ messages in thread
From: Ahmad Fatoum @ 2024-10-14 11:39 UTC (permalink / raw)
To: barebox; +Cc: Ahmad Fatoum
The file includes <asm/barebox-arm.h>, which is only provided on ARM.
Until this is made more generic, make build of the file depend
specifically on CONFIG_ARM.
Signed-off-by: Ahmad Fatoum <a.fatoum@pengutronix.de>
---
drivers/tee/optee/Kconfig | 4 ++++
drivers/tee/optee/Makefile | 2 +-
2 files changed, 5 insertions(+), 1 deletion(-)
diff --git a/drivers/tee/optee/Kconfig b/drivers/tee/optee/Kconfig
index 3c791a10c4ac..179b7c2ba8f3 100644
--- a/drivers/tee/optee/Kconfig
+++ b/drivers/tee/optee/Kconfig
@@ -27,3 +27,7 @@ config OPTEE_DEVFS
device. This are no current in-tree users of this interface,
but it's useful for compiling libteeclient + optee_tests for
use inside barebox to verify proper operation of CONFIG_OPTEE.
+
+config OF_FIXUP_OPTEE
+ def_bool y
+ depends on HAVE_OPTEE && ARM
diff --git a/drivers/tee/optee/Makefile b/drivers/tee/optee/Makefile
index 83f8e23b1183..5e71af77ee0a 100644
--- a/drivers/tee/optee/Makefile
+++ b/drivers/tee/optee/Makefile
@@ -1,5 +1,5 @@
# SPDX-License-Identifier: GPL-2.0
-obj-$(CONFIG_HAVE_OPTEE) += of_fixup.o
+obj-$(CONFIG_OF_FIXUP_OPTEE) += of_fixup.o
obj-$(CONFIG_OPTEE) += optee.o
optee-objs += core.o
optee-objs += call.o
--
2.39.5
^ permalink raw reply [flat|nested] 15+ messages in thread
* Re: [PATCH master 00/13] Misc compile test fixes
2024-10-14 11:38 [PATCH master 00/13] Misc compile test fixes Ahmad Fatoum
` (12 preceding siblings ...)
2024-10-14 11:39 ` [PATCH master 13/13] optee: make OP-TEE OF fixup ARM-specific Ahmad Fatoum
@ 2024-10-15 6:59 ` Sascha Hauer
13 siblings, 0 replies; 15+ messages in thread
From: Sascha Hauer @ 2024-10-15 6:59 UTC (permalink / raw)
To: barebox, Ahmad Fatoum
On Mon, 14 Oct 2024 13:38:59 +0200, Ahmad Fatoum wrote:
> I compile tested with ARCH=sandbox make allyesconfig and these are fixes
> for the errors I ran into.
>
> Given that a number of them may also affect other architectures and that
> the changes are quite limited in scope, I suggest this is taken directly
> to master.
>
> [...]
Applied, thanks!
[01/13] clk: add stub definition for of_clk_get_from_provider
https://git.pengutronix.de/cgit/barebox/commit/?id=2b0b0b593368 (link may not be stable)
[02/13] tee: add missing header for BIT macro definition
https://git.pengutronix.de/cgit/barebox/commit/?id=0d2f3e5c480d (link may not be stable)
[03/13] tee: shm: include missing header for basprintf
https://git.pengutronix.de/cgit/barebox/commit/?id=46ea52de7c62 (link may not be stable)
[04/13] net: dsa: realtek: fix CONFIG_SANDBOX build
https://git.pengutronix.de/cgit/barebox/commit/?id=ace93553b086 (link may not be stable)
[05/13] pmdomain: imx8mp-blk-ctrl: add missing definition of ARRAY_SIZE
https://git.pengutronix.de/cgit/barebox/commit/?id=2f5ce38ea80f (link may not be stable)
[06/13] PWM: rockchip: fix compile testing with CONFIG_SANDBOX
https://git.pengutronix.de/cgit/barebox/commit/?id=20585afc9f17 (link may not be stable)
[07/13] watchdog: imxulp: drop unused include of asm/system.h
https://git.pengutronix.de/cgit/barebox/commit/?id=b9dd2b801997 (link may not be stable)
[08/13] include: import uapi/linux/kernel.h header from Linux
https://git.pengutronix.de/cgit/barebox/commit/?id=9012d0070ba0 (link may not be stable)
[09/13] usb: typec: fix compile test with CONFIG_SANDBOX
https://git.pengutronix.de/cgit/barebox/commit/?id=d9fa8b26b60c (link may not be stable)
[10/13] bitops: fix missing defintion for DIV_ROUND_UP definitions
https://git.pengutronix.de/cgit/barebox/commit/?id=bab7529d92a0 (link may not be stable)
[11/13] mci: am654-sdhci: drop dummy redefinition of MMC_CAP2_HS200/400
https://git.pengutronix.de/cgit/barebox/commit/?id=c01345595682 (link may not be stable)
[12/13] hw_random: fix compilation with 64-bit size_t
https://git.pengutronix.de/cgit/barebox/commit/?id=55a682298bee (link may not be stable)
[13/13] optee: make OP-TEE OF fixup ARM-specific
https://git.pengutronix.de/cgit/barebox/commit/?id=56535d9cb0fc (link may not be stable)
Best regards,
--
Sascha Hauer <s.hauer@pengutronix.de>
^ permalink raw reply [flat|nested] 15+ messages in thread
end of thread, other threads:[~2024-10-15 7:03 UTC | newest]
Thread overview: 15+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2024-10-14 11:38 [PATCH master 00/13] Misc compile test fixes Ahmad Fatoum
2024-10-14 11:39 ` [PATCH master 01/13] clk: add stub definition for of_clk_get_from_provider Ahmad Fatoum
2024-10-14 11:39 ` [PATCH master 02/13] tee: add missing header for BIT macro definition Ahmad Fatoum
2024-10-14 11:39 ` [PATCH master 03/13] tee: shm: include missing header for basprintf Ahmad Fatoum
2024-10-14 11:39 ` [PATCH master 04/13] net: dsa: realtek: fix CONFIG_SANDBOX build Ahmad Fatoum
2024-10-14 11:39 ` [PATCH master 05/13] pmdomain: imx8mp-blk-ctrl: add missing definition of ARRAY_SIZE Ahmad Fatoum
2024-10-14 11:39 ` [PATCH master 06/13] PWM: rockchip: fix compile testing with CONFIG_SANDBOX Ahmad Fatoum
2024-10-14 11:39 ` [PATCH master 07/13] watchdog: imxulp: drop unused include of asm/system.h Ahmad Fatoum
2024-10-14 11:39 ` [PATCH master 08/13] include: import uapi/linux/kernel.h header from Linux Ahmad Fatoum
2024-10-14 11:39 ` [PATCH master 09/13] usb: typec: fix compile test with CONFIG_SANDBOX Ahmad Fatoum
2024-10-14 11:39 ` [PATCH master 10/13] bitops: fix missing defintion for DIV_ROUND_UP definitions Ahmad Fatoum
2024-10-14 11:39 ` [PATCH master 11/13] mci: am654-sdhci: drop dummy redefinition of MMC_CAP2_HS200/400 Ahmad Fatoum
2024-10-14 11:39 ` [PATCH master 12/13] hw_random: fix compilation with 64-bit size_t Ahmad Fatoum
2024-10-14 11:39 ` [PATCH master 13/13] optee: make OP-TEE OF fixup ARM-specific Ahmad Fatoum
2024-10-15 6:59 ` [PATCH master 00/13] Misc compile test 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