--- /dev/null
+From a85cbe6159ffc973e5702f70a3bd5185f8f3c38d Mon Sep 17 00:00:00 2001
+From: Petr Vorel <petr.vorel@gmail.com>
+Date: Mon, 14 Dec 2020 19:03:21 -0800
+Subject: uapi: move constants from <linux/kernel.h> to <linux/const.h>
+
+From: Petr Vorel <petr.vorel@gmail.com>
+
+commit a85cbe6159ffc973e5702f70a3bd5185f8f3c38d upstream.
+
+and include <linux/const.h> in UAPI headers instead of <linux/kernel.h>.
+
+The reason is to avoid indirect <linux/sysinfo.h> include when using
+some network headers: <linux/netlink.h> or others -> <linux/kernel.h>
+-> <linux/sysinfo.h>.
+
+This indirect include causes on MUSL redefinition of struct sysinfo when
+included both <sys/sysinfo.h> and some of UAPI headers:
+
+ In file included from x86_64-buildroot-linux-musl/sysroot/usr/include/linux/kernel.h:5,
+ from x86_64-buildroot-linux-musl/sysroot/usr/include/linux/netlink.h:5,
+ from ../include/tst_netlink.h:14,
+ from tst_crypto.c:13:
+ x86_64-buildroot-linux-musl/sysroot/usr/include/linux/sysinfo.h:8:8: error: redefinition of `struct sysinfo'
+ struct sysinfo {
+ ^~~~~~~
+ In file included from ../include/tst_safe_macros.h:15,
+ from ../include/tst_test.h:93,
+ from tst_crypto.c:11:
+ x86_64-buildroot-linux-musl/sysroot/usr/include/sys/sysinfo.h:10:8: note: originally defined here
+
+Link: https://lkml.kernel.org/r/20201015190013.8901-1-petr.vorel@gmail.com
+Signed-off-by: Petr Vorel <petr.vorel@gmail.com>
+Suggested-by: Rich Felker <dalias@aerifal.cx>
+Acked-by: Rich Felker <dalias@libc.org>
+Cc: Peter Korsgaard <peter@korsgaard.com>
+Cc: Baruch Siach <baruch@tkos.co.il>
+Cc: Florian Weimer <fweimer@redhat.com>
+Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
+Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
+Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
+
+---
+ include/uapi/linux/const.h | 5 +++++
+ include/uapi/linux/ethtool.h | 2 +-
+ include/uapi/linux/kernel.h | 9 +--------
+ include/uapi/linux/lightnvm.h | 2 +-
+ include/uapi/linux/mroute6.h | 2 +-
+ include/uapi/linux/netfilter/x_tables.h | 2 +-
+ include/uapi/linux/netlink.h | 2 +-
+ include/uapi/linux/sysctl.h | 2 +-
+ 8 files changed, 12 insertions(+), 14 deletions(-)
+
+--- a/include/uapi/linux/const.h
++++ b/include/uapi/linux/const.h
+@@ -24,4 +24,9 @@
+ #define _BITUL(x) (_AC(1,UL) << (x))
+ #define _BITULL(x) (_AC(1,ULL) << (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 /* !(_LINUX_CONST_H) */
+--- a/include/uapi/linux/ethtool.h
++++ b/include/uapi/linux/ethtool.h
+@@ -13,7 +13,7 @@
+ #ifndef _UAPI_LINUX_ETHTOOL_H
+ #define _UAPI_LINUX_ETHTOOL_H
+
+-#include <linux/kernel.h>
++#include <linux/const.h>
+ #include <linux/types.h>
+ #include <linux/if_ether.h>
+
+--- a/include/uapi/linux/kernel.h
++++ b/include/uapi/linux/kernel.h
+@@ -2,13 +2,6 @@
+ #define _UAPI_LINUX_KERNEL_H
+
+ #include <linux/sysinfo.h>
+-
+-/*
+- * 'kernel.h' contains some often-used function prototypes etc
+- */
+-#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))
++#include <linux/const.h>
+
+ #endif /* _UAPI_LINUX_KERNEL_H */
+--- a/include/uapi/linux/lightnvm.h
++++ b/include/uapi/linux/lightnvm.h
+@@ -20,7 +20,7 @@
+ #define _UAPI_LINUX_LIGHTNVM_H
+
+ #ifdef __KERNEL__
+-#include <linux/kernel.h>
++#include <linux/const.h>
+ #include <linux/ioctl.h>
+ #else /* __KERNEL__ */
+ #include <stdio.h>
+--- a/include/uapi/linux/mroute6.h
++++ b/include/uapi/linux/mroute6.h
+@@ -1,7 +1,7 @@
+ #ifndef _UAPI__LINUX_MROUTE6_H
+ #define _UAPI__LINUX_MROUTE6_H
+
+-#include <linux/kernel.h>
++#include <linux/const.h>
+ #include <linux/types.h>
+ #include <linux/sockios.h>
+ #include <linux/in6.h> /* For struct sockaddr_in6. */
+--- a/include/uapi/linux/netfilter/x_tables.h
++++ b/include/uapi/linux/netfilter/x_tables.h
+@@ -1,6 +1,6 @@
+ #ifndef _UAPI_X_TABLES_H
+ #define _UAPI_X_TABLES_H
+-#include <linux/kernel.h>
++#include <linux/const.h>
+ #include <linux/types.h>
+
+ #define XT_FUNCTION_MAXNAMELEN 30
+--- a/include/uapi/linux/netlink.h
++++ b/include/uapi/linux/netlink.h
+@@ -1,7 +1,7 @@
+ #ifndef _UAPI__LINUX_NETLINK_H
+ #define _UAPI__LINUX_NETLINK_H
+
+-#include <linux/kernel.h>
++#include <linux/const.h>
+ #include <linux/socket.h> /* for __kernel_sa_family_t */
+ #include <linux/types.h>
+
+--- a/include/uapi/linux/sysctl.h
++++ b/include/uapi/linux/sysctl.h
+@@ -22,7 +22,7 @@
+ #ifndef _UAPI_LINUX_SYSCTL_H
+ #define _UAPI_LINUX_SYSCTL_H
+
+-#include <linux/kernel.h>
++#include <linux/const.h>
+ #include <linux/types.h>
+ #include <linux/compiler.h>
+
Reviewed-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Signed-off-by: Johan Hovold <johan@kernel.org>
Signed-off-by: Sasha Levin <sashal@kernel.org>
+Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
---
- drivers/usb/serial/digi_acceleport.c | 45 ++++++++--------------------
+ drivers/usb/serial/digi_acceleport.c | 45 ++++++++++-------------------------
1 file changed, 13 insertions(+), 32 deletions(-)
-diff --git a/drivers/usb/serial/digi_acceleport.c b/drivers/usb/serial/digi_acceleport.c
-index 7ab3235febfc9..4aa6fe834091e 100644
--- a/drivers/usb/serial/digi_acceleport.c
+++ b/drivers/usb/serial/digi_acceleport.c
@@ -23,7 +23,6 @@
/*
* Digi Write OOB Command
*
-@@ -985,6 +962,7 @@ static void digi_write_bulk_callback(struct urb *urb)
+@@ -985,6 +962,7 @@ static void digi_write_bulk_callback(str
struct digi_serial *serial_priv;
int ret = 0;
int status = urb->status;
/* port and serial sanity check */
if (port == NULL || (priv = usb_get_serial_port_data(port)) == NULL) {
-@@ -1011,6 +989,7 @@ static void digi_write_bulk_callback(struct urb *urb)
+@@ -1011,6 +989,7 @@ static void digi_write_bulk_callback(str
}
/* try to send any buffered data on this port */
spin_lock(&priv->dp_port_lock);
priv->dp_write_urb_in_use = 0;
if (priv->dp_out_buf_len > 0) {
-@@ -1026,19 +1005,18 @@ static void digi_write_bulk_callback(struct urb *urb)
+@@ -1026,19 +1005,18 @@ static void digi_write_bulk_callback(str
if (ret == 0) {
priv->dp_write_urb_in_use = 1;
priv->dp_out_buf_len = 0;
}
static int digi_write_room(struct tty_struct *tty)
-@@ -1238,7 +1216,6 @@ static int digi_port_init(struct usb_serial_port *port, unsigned port_num)
+@@ -1238,7 +1216,6 @@ static int digi_port_init(struct usb_ser
init_waitqueue_head(&priv->dp_transmit_idle_wait);
init_waitqueue_head(&priv->dp_flush_wait);
init_waitqueue_head(&priv->dp_close_wait);
priv->dp_port = port;
init_waitqueue_head(&port->write_wait);
-@@ -1524,13 +1501,14 @@ static int digi_read_oob_callback(struct urb *urb)
+@@ -1524,13 +1501,14 @@ static int digi_read_oob_callback(struct
rts = C_CRTSCTS(tty);
if (tty && opcode == DIGI_CMD_READ_INPUT_SIGNALS) {
} else {
priv->dp_modem_signals &= ~TIOCM_CTS;
/* port must be open to use tty struct */
-@@ -1549,6 +1527,9 @@ static int digi_read_oob_callback(struct urb *urb)
+@@ -1549,6 +1527,9 @@ static int digi_read_oob_callback(struct
priv->dp_modem_signals &= ~TIOCM_CD;
spin_unlock(&priv->dp_port_lock);
} else if (opcode == DIGI_CMD_TRANSMIT_IDLE) {
spin_lock(&priv->dp_port_lock);
priv->dp_transmit_idle = 1;
---
-2.27.0
-