]> git.ipfire.org Git - thirdparty/kernel/stable-queue.git/commitdiff
4.9-stable patches
authorGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Sat, 10 Apr 2021 11:15:43 +0000 (13:15 +0200)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Sat, 10 Apr 2021 11:15:43 +0000 (13:15 +0200)
added patches:
arm-8723-2-always-assume-the-unified-syntax-for-assembly-code.patch
iio-hid-sensor-prox-fix-scale-not-correct-issue.patch

queue-4.9/arm-8723-2-always-assume-the-unified-syntax-for-assembly-code.patch [new file with mode: 0644]
queue-4.9/iio-hid-sensor-prox-fix-scale-not-correct-issue.patch [new file with mode: 0644]
queue-4.9/series [new file with mode: 0644]

diff --git a/queue-4.9/arm-8723-2-always-assume-the-unified-syntax-for-assembly-code.patch b/queue-4.9/arm-8723-2-always-assume-the-unified-syntax-for-assembly-code.patch
new file mode 100644 (file)
index 0000000..d0250d7
--- /dev/null
@@ -0,0 +1,182 @@
+From 75fea300d73ae5b18957949a53ec770daaeb6fc2 Mon Sep 17 00:00:00 2001
+From: Nicolas Pitre <nicolas.pitre@linaro.org>
+Date: Wed, 29 Nov 2017 07:52:52 +0100
+Subject: ARM: 8723/2: always assume the "unified" syntax for assembly code
+
+From: Nicolas Pitre <nicolas.pitre@linaro.org>
+
+commit 75fea300d73ae5b18957949a53ec770daaeb6fc2 upstream.
+
+The GNU assembler has implemented the "unified syntax" parsing since
+2005. This "unified" syntax is required when the kernel is built in
+Thumb2 mode. However the "unified" syntax is a mixed bag of features,
+including not requiring a `#' prefix with immediate operands. This leads
+to situations where some code builds just fine in Thumb2 mode and fails
+to build in ARM mode if that prefix is missing. This behavior
+discrepancy makes build tests less valuable, forcing both ARM and Thumb2
+builds for proper coverage.
+
+Let's "fix" this issue by always using the "unified" syntax for both ARM
+and Thumb2 mode. Given that the documented minimum binutils version that
+properly builds the kernel is version 2.20 released in 2010, we can
+assume that any toolchain capable of building the latest kernel is also
+"unified syntax" capable.
+
+Whith this, a bunch of macros used to mask some differences between both
+syntaxes can be removed, with the side effect of making LTO easier.
+
+Suggested-by: Robin Murphy <robin.murphy@arm.com>
+Signed-off-by: Nicolas Pitre <nico@linaro.org>
+Signed-off-by: Russell King <rmk+kernel@armlinux.org.uk>
+[nathan: Resolve small conflict on 4.9 due to a lack of 494609701e06a]
+Signed-off-by: Nathan Chancellor <nathan@kernel.org>
+Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
+
+---
+ arch/arm/Kconfig               |    7 ---
+ arch/arm/Makefile              |    6 ++-
+ arch/arm/include/asm/unified.h |   77 +----------------------------------------
+ 3 files changed, 8 insertions(+), 82 deletions(-)
+
+--- a/arch/arm/Kconfig
++++ b/arch/arm/Kconfig
+@@ -1546,12 +1546,10 @@ config THUMB2_KERNEL
+       depends on (CPU_V7 || CPU_V7M) && !CPU_V6 && !CPU_V6K
+       default y if CPU_THUMBONLY
+       select AEABI
+-      select ARM_ASM_UNIFIED
+       select ARM_UNWIND
+       help
+         By enabling this option, the kernel will be compiled in
+-        Thumb-2 mode. A compiler/assembler that understand the unified
+-        ARM-Thumb syntax is needed.
++        Thumb-2 mode.
+         If unsure, say N.
+@@ -1586,9 +1584,6 @@ config THUMB2_AVOID_R_ARM_THM_JUMP11
+         Unless you are sure your tools don't have this problem, say Y.
+-config ARM_ASM_UNIFIED
+-      bool
+-
+ config ARM_PATCH_IDIV
+       bool "Runtime patch udiv/sdiv instructions into __aeabi_{u}idiv()"
+       depends on CPU_32v7 && !XIP_KERNEL
+--- a/arch/arm/Makefile
++++ b/arch/arm/Makefile
+@@ -113,9 +113,11 @@ ifeq ($(CONFIG_ARM_UNWIND),y)
+ CFLAGS_ABI    +=-funwind-tables
+ endif
++# Accept old syntax despite ".syntax unified"
++AFLAGS_NOWARN :=$(call as-option,-Wa$(comma)-mno-warn-deprecated,-Wa$(comma)-W)
++
+ ifeq ($(CONFIG_THUMB2_KERNEL),y)
+ AFLAGS_AUTOIT :=$(call as-option,-Wa$(comma)-mimplicit-it=always,-Wa$(comma)-mauto-it)
+-AFLAGS_NOWARN :=$(call as-option,-Wa$(comma)-mno-warn-deprecated,-Wa$(comma)-W)
+ CFLAGS_ISA    :=-mthumb $(AFLAGS_AUTOIT) $(AFLAGS_NOWARN)
+ AFLAGS_ISA    :=$(CFLAGS_ISA) -Wa$(comma)-mthumb
+ # Work around buggy relocation from gas if requested:
+@@ -123,7 +125,7 @@ ifeq ($(CONFIG_THUMB2_AVOID_R_ARM_THM_JU
+ CFLAGS_MODULE +=-fno-optimize-sibling-calls
+ endif
+ else
+-CFLAGS_ISA    :=$(call cc-option,-marm,)
++CFLAGS_ISA    :=$(call cc-option,-marm,) $(AFLAGS_NOWARN)
+ AFLAGS_ISA    :=$(CFLAGS_ISA)
+ endif
+--- a/arch/arm/include/asm/unified.h
++++ b/arch/arm/include/asm/unified.h
+@@ -20,8 +20,10 @@
+ #ifndef __ASM_UNIFIED_H
+ #define __ASM_UNIFIED_H
+-#if defined(__ASSEMBLY__) && defined(CONFIG_ARM_ASM_UNIFIED)
++#if defined(__ASSEMBLY__)
+       .syntax unified
++#else
++__asm__(".syntax unified");
+ #endif
+ #ifdef CONFIG_CPU_V7M
+@@ -64,77 +66,4 @@
+ #endif        /* CONFIG_THUMB2_KERNEL */
+-#ifndef CONFIG_ARM_ASM_UNIFIED
+-
+-/*
+- * If the unified assembly syntax isn't used (in ARM mode), these
+- * macros expand to an empty string
+- */
+-#ifdef __ASSEMBLY__
+-      .macro  it, cond
+-      .endm
+-      .macro  itt, cond
+-      .endm
+-      .macro  ite, cond
+-      .endm
+-      .macro  ittt, cond
+-      .endm
+-      .macro  itte, cond
+-      .endm
+-      .macro  itet, cond
+-      .endm
+-      .macro  itee, cond
+-      .endm
+-      .macro  itttt, cond
+-      .endm
+-      .macro  ittte, cond
+-      .endm
+-      .macro  ittet, cond
+-      .endm
+-      .macro  ittee, cond
+-      .endm
+-      .macro  itett, cond
+-      .endm
+-      .macro  itete, cond
+-      .endm
+-      .macro  iteet, cond
+-      .endm
+-      .macro  iteee, cond
+-      .endm
+-#else /* !__ASSEMBLY__ */
+-__asm__(
+-"     .macro  it, cond\n"
+-"     .endm\n"
+-"     .macro  itt, cond\n"
+-"     .endm\n"
+-"     .macro  ite, cond\n"
+-"     .endm\n"
+-"     .macro  ittt, cond\n"
+-"     .endm\n"
+-"     .macro  itte, cond\n"
+-"     .endm\n"
+-"     .macro  itet, cond\n"
+-"     .endm\n"
+-"     .macro  itee, cond\n"
+-"     .endm\n"
+-"     .macro  itttt, cond\n"
+-"     .endm\n"
+-"     .macro  ittte, cond\n"
+-"     .endm\n"
+-"     .macro  ittet, cond\n"
+-"     .endm\n"
+-"     .macro  ittee, cond\n"
+-"     .endm\n"
+-"     .macro  itett, cond\n"
+-"     .endm\n"
+-"     .macro  itete, cond\n"
+-"     .endm\n"
+-"     .macro  iteet, cond\n"
+-"     .endm\n"
+-"     .macro  iteee, cond\n"
+-"     .endm\n");
+-#endif        /* __ASSEMBLY__ */
+-
+-#endif        /* CONFIG_ARM_ASM_UNIFIED */
+-
+ #endif        /* !__ASM_UNIFIED_H */
diff --git a/queue-4.9/iio-hid-sensor-prox-fix-scale-not-correct-issue.patch b/queue-4.9/iio-hid-sensor-prox-fix-scale-not-correct-issue.patch
new file mode 100644 (file)
index 0000000..1a08e11
--- /dev/null
@@ -0,0 +1,63 @@
+From foo@baz Sat Apr 10 01:10:24 PM CEST 2021
+From: Ye Xiang <xiang.ye@intel.com>
+Date: Sat, 30 Jan 2021 18:25:30 +0800
+Subject: iio: hid-sensor-prox: Fix scale not correct issue
+
+From: Ye Xiang <xiang.ye@intel.com>
+
+commit d68c592e02f6f49a88e705f13dfc1883432cf300 upstream
+
+Currently, the proxy sensor scale is zero because it just return the
+exponent directly. To fix this issue, this patch use
+hid_sensor_format_scale to process the scale first then return the
+output.
+
+Fixes: 39a3a0138f61 ("iio: hid-sensors: Added Proximity Sensor Driver")
+Signed-off-by: Ye Xiang <xiang.ye@intel.com>
+Link: https://lore.kernel.org/r/20210130102530.31064-1-xiang.ye@intel.com
+Cc: <Stable@vger.kernel.org>
+Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
+[sudip: adjust context]
+Signed-off-by: Sudip Mukherjee <sudipm.mukherjee@gmail.com>
+Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
+---
+ drivers/iio/light/hid-sensor-prox.c |   14 ++++++++++++--
+ 1 file changed, 12 insertions(+), 2 deletions(-)
+
+--- a/drivers/iio/light/hid-sensor-prox.c
++++ b/drivers/iio/light/hid-sensor-prox.c
+@@ -37,6 +37,9 @@ struct prox_state {
+       struct hid_sensor_common common_attributes;
+       struct hid_sensor_hub_attribute_info prox_attr;
+       u32 human_presence;
++      int scale_pre_decml;
++      int scale_post_decml;
++      int scale_precision;
+ };
+ /* Channel definitions */
+@@ -105,8 +108,9 @@ static int prox_read_raw(struct iio_dev
+               ret_type = IIO_VAL_INT;
+               break;
+       case IIO_CHAN_INFO_SCALE:
+-              *val = prox_state->prox_attr.units;
+-              ret_type = IIO_VAL_INT;
++              *val = prox_state->scale_pre_decml;
++              *val2 = prox_state->scale_post_decml;
++              ret_type = prox_state->scale_precision;
+               break;
+       case IIO_CHAN_INFO_OFFSET:
+               *val = hid_sensor_convert_exponent(
+@@ -240,6 +244,12 @@ static int prox_parse_report(struct plat
+                       st->common_attributes.sensitivity.index,
+                       st->common_attributes.sensitivity.report_id);
+       }
++
++      st->scale_precision = hid_sensor_format_scale(
++                              hsdev->usage,
++                              &st->prox_attr,
++                              &st->scale_pre_decml, &st->scale_post_decml);
++
+       return ret;
+ }
diff --git a/queue-4.9/series b/queue-4.9/series
new file mode 100644 (file)
index 0000000..3cdf23c
--- /dev/null
@@ -0,0 +1,2 @@
+arm-8723-2-always-assume-the-unified-syntax-for-assembly-code.patch
+iio-hid-sensor-prox-fix-scale-not-correct-issue.patch