From ae313e61bf9d63fd979f7436c6389efd98e9cafc Mon Sep 17 00:00:00 2001 From: Sasha Levin Date: Sun, 18 Feb 2024 11:39:35 -0500 Subject: [PATCH] Fixes for 5.4 Signed-off-by: Sasha Levin --- ...-deadlock-in-rt5645_jack_detect_work.patch | 39 ++ ...-for-queues-of-all-vsis-to-be-disabl.patch | 41 ++ ...clobber-to-csum_ipv6_magic-inline-as.patch | 54 ++ ...overlay-gpio-test-to-catch-gpio-hog-.patch | 507 ++++++++++++++++++ ...-fix-compile-in-the-non-dynamic-case.patch | 68 +++ queue-5.4/series | 6 + .../spi-ppc4xx-drop-write-only-variable.patch | 55 ++ 7 files changed, 770 insertions(+) create mode 100644 queue-5.4/asoc-rt5645-fix-deadlock-in-rt5645_jack_detect_work.patch create mode 100644 queue-5.4/i40e-fix-waiting-for-queues-of-all-vsis-to-be-disabl.patch create mode 100644 queue-5.4/mips-add-memory-clobber-to-csum_ipv6_magic-inline-as.patch create mode 100644 queue-5.4/of-unittest-add-overlay-gpio-test-to-catch-gpio-hog-.patch create mode 100644 queue-5.4/of-unittest-fix-compile-in-the-non-dynamic-case.patch create mode 100644 queue-5.4/spi-ppc4xx-drop-write-only-variable.patch diff --git a/queue-5.4/asoc-rt5645-fix-deadlock-in-rt5645_jack_detect_work.patch b/queue-5.4/asoc-rt5645-fix-deadlock-in-rt5645_jack_detect_work.patch new file mode 100644 index 00000000000..75cac75bbf9 --- /dev/null +++ b/queue-5.4/asoc-rt5645-fix-deadlock-in-rt5645_jack_detect_work.patch @@ -0,0 +1,39 @@ +From 9f104918dc78ce9695c816201510152948d8a709 Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Sun, 11 Feb 2024 12:58:34 +0300 +Subject: ASoC: rt5645: Fix deadlock in rt5645_jack_detect_work() + +From: Alexey Khoroshilov + +[ Upstream commit 6ef5d5b92f7117b324efaac72b3db27ae8bb3082 ] + +There is a path in rt5645_jack_detect_work(), where rt5645->jd_mutex +is left locked forever. That may lead to deadlock +when rt5645_jack_detect_work() is called for the second time. + +Found by Linux Verification Center (linuxtesting.org) with SVACE. + +Fixes: cdba4301adda ("ASoC: rt5650: add mutex to avoid the jack detection failure") +Signed-off-by: Alexey Khoroshilov +Link: https://lore.kernel.org/r/1707645514-21196-1-git-send-email-khoroshilov@ispras.ru +Signed-off-by: Mark Brown +Signed-off-by: Sasha Levin +--- + sound/soc/codecs/rt5645.c | 1 + + 1 file changed, 1 insertion(+) + +diff --git a/sound/soc/codecs/rt5645.c b/sound/soc/codecs/rt5645.c +index c9512e97c12e..88093e58dd84 100644 +--- a/sound/soc/codecs/rt5645.c ++++ b/sound/soc/codecs/rt5645.c +@@ -3276,6 +3276,7 @@ static void rt5645_jack_detect_work(struct work_struct *work) + report, SND_JACK_HEADPHONE); + snd_soc_jack_report(rt5645->mic_jack, + report, SND_JACK_MICROPHONE); ++ mutex_unlock(&rt5645->jd_mutex); + return; + case 4: + val = snd_soc_component_read32(rt5645->component, RT5645_A_JD_CTRL1) & 0x0020; +-- +2.43.0 + diff --git a/queue-5.4/i40e-fix-waiting-for-queues-of-all-vsis-to-be-disabl.patch b/queue-5.4/i40e-fix-waiting-for-queues-of-all-vsis-to-be-disabl.patch new file mode 100644 index 00000000000..6108c471f6b --- /dev/null +++ b/queue-5.4/i40e-fix-waiting-for-queues-of-all-vsis-to-be-disabl.patch @@ -0,0 +1,41 @@ +From bce4f64ad0aaaf684813e27ddcfa071196f4cf73 Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Wed, 8 Nov 2023 17:01:03 +0100 +Subject: i40e: Fix waiting for queues of all VSIs to be disabled + +From: Ivan Vecera + +[ Upstream commit c73729b64bb692186da080602cd13612783f52ac ] + +The function i40e_pf_wait_queues_disabled() iterates all PF's VSIs +up to 'pf->hw.func_caps.num_vsis' but this is incorrect because +the real number of VSIs can be up to 'pf->num_alloc_vsi' that +can be higher. Fix this loop. + +Fixes: 69129dc39fac ("i40e: Modify Tx disable wait flow in case of DCB reconfiguration") +Signed-off-by: Ivan Vecera +Reviewed-by: Jacob Keller +Reviewed-by: Wojciech Drewek +Tested-by: Pucha Himasekhar Reddy (A Contingent worker at Intel) +Signed-off-by: Tony Nguyen +Signed-off-by: Sasha Levin +--- + drivers/net/ethernet/intel/i40e/i40e_main.c | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/drivers/net/ethernet/intel/i40e/i40e_main.c b/drivers/net/ethernet/intel/i40e/i40e_main.c +index fa938281281a..f7d41ba110a7 100644 +--- a/drivers/net/ethernet/intel/i40e/i40e_main.c ++++ b/drivers/net/ethernet/intel/i40e/i40e_main.c +@@ -5065,7 +5065,7 @@ static int i40e_pf_wait_queues_disabled(struct i40e_pf *pf) + { + int v, ret = 0; + +- for (v = 0; v < pf->hw.func_caps.num_vsis; v++) { ++ for (v = 0; v < pf->num_alloc_vsi; v++) { + if (pf->vsi[v]) { + ret = i40e_vsi_wait_queues_disabled(pf->vsi[v]); + if (ret) +-- +2.43.0 + diff --git a/queue-5.4/mips-add-memory-clobber-to-csum_ipv6_magic-inline-as.patch b/queue-5.4/mips-add-memory-clobber-to-csum_ipv6_magic-inline-as.patch new file mode 100644 index 00000000000..0689de7edc2 --- /dev/null +++ b/queue-5.4/mips-add-memory-clobber-to-csum_ipv6_magic-inline-as.patch @@ -0,0 +1,54 @@ +From 4eda2b263a30ea2df68f14185e0e489250b3a42d Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Sun, 11 Feb 2024 08:08:37 -0800 +Subject: MIPS: Add 'memory' clobber to csum_ipv6_magic() inline assembler + +From: Guenter Roeck + +[ Upstream commit d55347bfe4e66dce2e1e7501e5492f4af3e315f8 ] + +After 'lib: checksum: Use aligned accesses for ip_fast_csum and +csum_ipv6_magic tests' was applied, the test_csum_ipv6_magic unit test +started failing for all mips platforms, both little and bit endian. +Oddly enough, adding debug code into test_csum_ipv6_magic() made the +problem disappear. + +The gcc manual says: + +"The "memory" clobber tells the compiler that the assembly code performs + memory reads or writes to items other than those listed in the input + and output operands (for example, accessing the memory pointed to by one + of the input parameters) +" + +This is definitely the case for csum_ipv6_magic(). Indeed, adding the +'memory' clobber fixes the problem. + +Cc: Charlie Jenkins +Cc: Palmer Dabbelt +Fixes: 1da177e4c3f4 ("Linux-2.6.12-rc2") +Signed-off-by: Guenter Roeck +Reviewed-by: Charlie Jenkins +Signed-off-by: Thomas Bogendoerfer +Signed-off-by: Sasha Levin +--- + arch/mips/include/asm/checksum.h | 3 ++- + 1 file changed, 2 insertions(+), 1 deletion(-) + +diff --git a/arch/mips/include/asm/checksum.h b/arch/mips/include/asm/checksum.h +index dcebaaf8c862..803f2a6f9960 100644 +--- a/arch/mips/include/asm/checksum.h ++++ b/arch/mips/include/asm/checksum.h +@@ -276,7 +276,8 @@ static __inline__ __sum16 csum_ipv6_magic(const struct in6_addr *saddr, + " .set pop" + : "=&r" (sum), "=&r" (tmp) + : "r" (saddr), "r" (daddr), +- "0" (htonl(len)), "r" (htonl(proto)), "r" (sum)); ++ "0" (htonl(len)), "r" (htonl(proto)), "r" (sum) ++ : "memory"); + + return csum_fold(sum); + } +-- +2.43.0 + diff --git a/queue-5.4/of-unittest-add-overlay-gpio-test-to-catch-gpio-hog-.patch b/queue-5.4/of-unittest-add-overlay-gpio-test-to-catch-gpio-hog-.patch new file mode 100644 index 00000000000..661bb79c276 --- /dev/null +++ b/queue-5.4/of-unittest-add-overlay-gpio-test-to-catch-gpio-hog-.patch @@ -0,0 +1,507 @@ +From 13755d596283c2cd558c7be2ea182544674ab498 Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Thu, 20 Feb 2020 12:40:20 -0600 +Subject: of: unittest: add overlay gpio test to catch gpio hog problem + +From: Frank Rowand + +[ Upstream commit f4056e705b2ef7f123a188f6aee23ade70e7d793 ] + +Geert reports that gpio hog nodes are not properly processed when +the gpio hog node is added via an overlay reply and provides an +RFC patch to fix the problem [1]. + +Add a unittest that shows the problem. Unittest will report "1 failed" +test before applying Geert's RFC patch and "0 failed" after applying +Geert's RFC patch. + +[1] https://lore.kernel.org/linux-devicetree/20191230133852.5890-1-geert+renesas@glider.be/ + +Signed-off-by: Frank Rowand +Signed-off-by: Rob Herring +Stable-dep-of: 607aad1e4356 ("of: unittest: Fix compile in the non-dynamic case") +Signed-off-by: Sasha Levin +--- + drivers/of/unittest-data/Makefile | 8 +- + drivers/of/unittest-data/overlay_gpio_01.dts | 23 ++ + drivers/of/unittest-data/overlay_gpio_02a.dts | 16 ++ + drivers/of/unittest-data/overlay_gpio_02b.dts | 16 ++ + drivers/of/unittest-data/overlay_gpio_03.dts | 23 ++ + drivers/of/unittest-data/overlay_gpio_04a.dts | 16 ++ + drivers/of/unittest-data/overlay_gpio_04b.dts | 16 ++ + drivers/of/unittest.c | 253 ++++++++++++++++++ + 8 files changed, 370 insertions(+), 1 deletion(-) + create mode 100644 drivers/of/unittest-data/overlay_gpio_01.dts + create mode 100644 drivers/of/unittest-data/overlay_gpio_02a.dts + create mode 100644 drivers/of/unittest-data/overlay_gpio_02b.dts + create mode 100644 drivers/of/unittest-data/overlay_gpio_03.dts + create mode 100644 drivers/of/unittest-data/overlay_gpio_04a.dts + create mode 100644 drivers/of/unittest-data/overlay_gpio_04b.dts + +diff --git a/drivers/of/unittest-data/Makefile b/drivers/of/unittest-data/Makefile +index 9b6807065827..009f4045c8e4 100644 +--- a/drivers/of/unittest-data/Makefile ++++ b/drivers/of/unittest-data/Makefile +@@ -21,7 +21,13 @@ obj-$(CONFIG_OF_OVERLAY) += overlay.dtb.o \ + overlay_bad_add_dup_prop.dtb.o \ + overlay_bad_phandle.dtb.o \ + overlay_bad_symbol.dtb.o \ +- overlay_base.dtb.o ++ overlay_base.dtb.o \ ++ overlay_gpio_01.dtb.o \ ++ overlay_gpio_02a.dtb.o \ ++ overlay_gpio_02b.dtb.o \ ++ overlay_gpio_03.dtb.o \ ++ overlay_gpio_04a.dtb.o \ ++ overlay_gpio_04b.dtb.o + + # enable creation of __symbols__ node + DTC_FLAGS_overlay += -@ +diff --git a/drivers/of/unittest-data/overlay_gpio_01.dts b/drivers/of/unittest-data/overlay_gpio_01.dts +new file mode 100644 +index 000000000000..699ff104ae10 +--- /dev/null ++++ b/drivers/of/unittest-data/overlay_gpio_01.dts +@@ -0,0 +1,23 @@ ++// SPDX-License-Identifier: GPL-2.0 ++/dts-v1/; ++/plugin/; ++ ++&unittest_test_bus { ++ #address-cells = <1>; ++ #size-cells = <0>; ++ gpio@0 { ++ compatible = "unittest-gpio"; ++ reg = <0>; ++ gpio-controller; ++ #gpio-cells = <2>; ++ ngpios = <2>; ++ gpio-line-names = "line-A", "line-B"; ++ ++ line-b { ++ gpio-hog; ++ gpios = <2 0>; ++ input; ++ line-name = "line-B-input"; ++ }; ++ }; ++}; +diff --git a/drivers/of/unittest-data/overlay_gpio_02a.dts b/drivers/of/unittest-data/overlay_gpio_02a.dts +new file mode 100644 +index 000000000000..ec59aff6ed47 +--- /dev/null ++++ b/drivers/of/unittest-data/overlay_gpio_02a.dts +@@ -0,0 +1,16 @@ ++// SPDX-License-Identifier: GPL-2.0 ++/dts-v1/; ++/plugin/; ++ ++&unittest_test_bus { ++ #address-cells = <1>; ++ #size-cells = <0>; ++ gpio@2 { ++ compatible = "unittest-gpio"; ++ reg = <2>; ++ gpio-controller; ++ #gpio-cells = <2>; ++ ngpios = <2>; ++ gpio-line-names = "line-A", "line-B"; ++ }; ++}; +diff --git a/drivers/of/unittest-data/overlay_gpio_02b.dts b/drivers/of/unittest-data/overlay_gpio_02b.dts +new file mode 100644 +index 000000000000..43ce111d41ce +--- /dev/null ++++ b/drivers/of/unittest-data/overlay_gpio_02b.dts +@@ -0,0 +1,16 @@ ++// SPDX-License-Identifier: GPL-2.0 ++/dts-v1/; ++/plugin/; ++ ++&unittest_test_bus { ++ #address-cells = <1>; ++ #size-cells = <0>; ++ gpio@2 { ++ line-a { ++ gpio-hog; ++ gpios = <1 0>; ++ input; ++ line-name = "line-A-input"; ++ }; ++ }; ++}; +diff --git a/drivers/of/unittest-data/overlay_gpio_03.dts b/drivers/of/unittest-data/overlay_gpio_03.dts +new file mode 100644 +index 000000000000..6e0312340a1b +--- /dev/null ++++ b/drivers/of/unittest-data/overlay_gpio_03.dts +@@ -0,0 +1,23 @@ ++// SPDX-License-Identifier: GPL-2.0 ++/dts-v1/; ++/plugin/; ++ ++&unittest_test_bus { ++ #address-cells = <1>; ++ #size-cells = <0>; ++ gpio@3 { ++ compatible = "unittest-gpio"; ++ reg = <3>; ++ gpio-controller; ++ #gpio-cells = <2>; ++ ngpios = <2>; ++ gpio-line-names = "line-A", "line-B", "line-C", "line-D"; ++ ++ line-d { ++ gpio-hog; ++ gpios = <4 0>; ++ input; ++ line-name = "line-D-input"; ++ }; ++ }; ++}; +diff --git a/drivers/of/unittest-data/overlay_gpio_04a.dts b/drivers/of/unittest-data/overlay_gpio_04a.dts +new file mode 100644 +index 000000000000..7b1e04ebfa7a +--- /dev/null ++++ b/drivers/of/unittest-data/overlay_gpio_04a.dts +@@ -0,0 +1,16 @@ ++// SPDX-License-Identifier: GPL-2.0 ++/dts-v1/; ++/plugin/; ++ ++&unittest_test_bus { ++ #address-cells = <1>; ++ #size-cells = <0>; ++ gpio@4 { ++ compatible = "unittest-gpio"; ++ reg = <4>; ++ gpio-controller; ++ #gpio-cells = <2>; ++ ngpios = <2>; ++ gpio-line-names = "line-A", "line-B", "line-C", "line-D"; ++ }; ++}; +diff --git a/drivers/of/unittest-data/overlay_gpio_04b.dts b/drivers/of/unittest-data/overlay_gpio_04b.dts +new file mode 100644 +index 000000000000..a14e95c6699a +--- /dev/null ++++ b/drivers/of/unittest-data/overlay_gpio_04b.dts +@@ -0,0 +1,16 @@ ++// SPDX-License-Identifier: GPL-2.0 ++/dts-v1/; ++/plugin/; ++ ++&unittest_test_bus { ++ #address-cells = <1>; ++ #size-cells = <0>; ++ gpio@4 { ++ line-c { ++ gpio-hog; ++ gpios = <3 0>; ++ input; ++ line-name = "line-C-input"; ++ }; ++ }; ++}; +diff --git a/drivers/of/unittest.c b/drivers/of/unittest.c +index 1ed470b03cd7..7585df5e3daf 100644 +--- a/drivers/of/unittest.c ++++ b/drivers/of/unittest.c +@@ -23,6 +23,7 @@ + + #include + #include ++#include + + #include + +@@ -45,6 +46,97 @@ static struct unittest_results { + failed; \ + }) + ++/* ++ * Expected message may have a message level other than KERN_INFO. ++ * Print the expected message only if the current loglevel will allow ++ * the actual message to print. ++ */ ++#define EXPECT_BEGIN(level, fmt, ...) \ ++ printk(level pr_fmt("EXPECT \\ : ") fmt, ##__VA_ARGS__) ++ ++#define EXPECT_END(level, fmt, ...) \ ++ printk(level pr_fmt("EXPECT / : ") fmt, ##__VA_ARGS__) ++ ++struct unittest_gpio_dev { ++ struct gpio_chip chip; ++}; ++ ++static int unittest_gpio_chip_request_count; ++static int unittest_gpio_probe_count; ++static int unittest_gpio_probe_pass_count; ++ ++static int unittest_gpio_chip_request(struct gpio_chip *chip, unsigned int offset) ++{ ++ unittest_gpio_chip_request_count++; ++ ++ pr_debug("%s(): %s %d %d\n", __func__, chip->label, offset, ++ unittest_gpio_chip_request_count); ++ return 0; ++} ++ ++static int unittest_gpio_probe(struct platform_device *pdev) ++{ ++ struct unittest_gpio_dev *devptr; ++ int ret; ++ ++ unittest_gpio_probe_count++; ++ ++ devptr = kzalloc(sizeof(*devptr), GFP_KERNEL); ++ if (!devptr) ++ return -ENOMEM; ++ ++ platform_set_drvdata(pdev, devptr); ++ ++ devptr->chip.of_node = pdev->dev.of_node; ++ devptr->chip.label = "of-unittest-gpio"; ++ devptr->chip.base = -1; /* dynamic allocation */ ++ devptr->chip.ngpio = 5; ++ devptr->chip.request = unittest_gpio_chip_request; ++ ++ ret = gpiochip_add_data(&devptr->chip, NULL); ++ ++ unittest(!ret, ++ "gpiochip_add_data() for node @%pOF failed, ret = %d\n", devptr->chip.of_node, ret); ++ ++ if (!ret) ++ unittest_gpio_probe_pass_count++; ++ return ret; ++} ++ ++static int unittest_gpio_remove(struct platform_device *pdev) ++{ ++ struct unittest_gpio_dev *gdev = platform_get_drvdata(pdev); ++ struct device *dev = &pdev->dev; ++ struct device_node *np = pdev->dev.of_node; ++ ++ dev_dbg(dev, "%s for node @%pOF\n", __func__, np); ++ ++ if (!gdev) ++ return -EINVAL; ++ ++ if (gdev->chip.base != -1) ++ gpiochip_remove(&gdev->chip); ++ ++ platform_set_drvdata(pdev, NULL); ++ kfree(pdev); ++ ++ return 0; ++} ++ ++static const struct of_device_id unittest_gpio_id[] = { ++ { .compatible = "unittest-gpio", }, ++ {} ++}; ++ ++static struct platform_driver unittest_gpio_driver = { ++ .probe = unittest_gpio_probe, ++ .remove = unittest_gpio_remove, ++ .driver = { ++ .name = "unittest-gpio", ++ .of_match_table = of_match_ptr(unittest_gpio_id), ++ }, ++}; ++ + static void __init of_unittest_find_node_by_name(void) + { + struct device_node *np; +@@ -2114,6 +2206,153 @@ static inline void of_unittest_overlay_i2c_15(void) { } + + #endif + ++static void __init of_unittest_overlay_gpio(void) ++{ ++ int chip_request_count; ++ int probe_pass_count; ++ int ret; ++ ++ /* ++ * tests: apply overlays before registering driver ++ * Similar to installing a driver as a module, the ++ * driver is registered after applying the overlays. ++ * ++ * - apply overlay_gpio_01 ++ * - apply overlay_gpio_02a ++ * - apply overlay_gpio_02b ++ * - register driver ++ * ++ * register driver will result in ++ * - probe and processing gpio hog for overlay_gpio_01 ++ * - probe for overlay_gpio_02a ++ * - processing gpio for overlay_gpio_02b ++ */ ++ ++ probe_pass_count = unittest_gpio_probe_pass_count; ++ chip_request_count = unittest_gpio_chip_request_count; ++ ++ /* ++ * overlay_gpio_01 contains gpio node and child gpio hog node ++ * overlay_gpio_02a contains gpio node ++ * overlay_gpio_02b contains child gpio hog node ++ */ ++ ++ unittest(overlay_data_apply("overlay_gpio_01", NULL), ++ "Adding overlay 'overlay_gpio_01' failed\n"); ++ ++ unittest(overlay_data_apply("overlay_gpio_02a", NULL), ++ "Adding overlay 'overlay_gpio_02a' failed\n"); ++ ++ unittest(overlay_data_apply("overlay_gpio_02b", NULL), ++ "Adding overlay 'overlay_gpio_02b' failed\n"); ++ ++ /* ++ * messages are the result of the probes, after the ++ * driver is registered ++ */ ++ ++ EXPECT_BEGIN(KERN_INFO, ++ "GPIO line <> (line-B-input) hogged as input\n"); ++ ++ EXPECT_BEGIN(KERN_INFO, ++ "GPIO line <> (line-A-input) hogged as input\n"); ++ ++ ret = platform_driver_register(&unittest_gpio_driver); ++ if (unittest(ret == 0, "could not register unittest gpio driver\n")) ++ return; ++ ++ EXPECT_END(KERN_INFO, ++ "GPIO line <> (line-A-input) hogged as input\n"); ++ EXPECT_END(KERN_INFO, ++ "GPIO line <> (line-B-input) hogged as input\n"); ++ ++ unittest(probe_pass_count + 2 == unittest_gpio_probe_pass_count, ++ "unittest_gpio_probe() failed or not called\n"); ++ ++ unittest(chip_request_count + 2 == unittest_gpio_chip_request_count, ++ "unittest_gpio_chip_request() called %d times (expected 1 time)\n", ++ unittest_gpio_chip_request_count - chip_request_count); ++ ++ /* ++ * tests: apply overlays after registering driver ++ * ++ * Similar to a driver built-in to the kernel, the ++ * driver is registered before applying the overlays. ++ * ++ * overlay_gpio_03 contains gpio node and child gpio hog node ++ * ++ * - apply overlay_gpio_03 ++ * ++ * apply overlay will result in ++ * - probe and processing gpio hog. ++ */ ++ ++ probe_pass_count = unittest_gpio_probe_pass_count; ++ chip_request_count = unittest_gpio_chip_request_count; ++ ++ EXPECT_BEGIN(KERN_INFO, ++ "GPIO line <> (line-D-input) hogged as input\n"); ++ ++ /* overlay_gpio_03 contains gpio node and child gpio hog node */ ++ ++ unittest(overlay_data_apply("overlay_gpio_03", NULL), ++ "Adding overlay 'overlay_gpio_03' failed\n"); ++ ++ EXPECT_END(KERN_INFO, ++ "GPIO line <> (line-D-input) hogged as input\n"); ++ ++ unittest(probe_pass_count + 1 == unittest_gpio_probe_pass_count, ++ "unittest_gpio_probe() failed or not called\n"); ++ ++ unittest(chip_request_count + 1 == unittest_gpio_chip_request_count, ++ "unittest_gpio_chip_request() called %d times (expected 1 time)\n", ++ unittest_gpio_chip_request_count - chip_request_count); ++ ++ /* ++ * overlay_gpio_04a contains gpio node ++ * ++ * - apply overlay_gpio_04a ++ * ++ * apply the overlay will result in ++ * - probe for overlay_gpio_04a ++ */ ++ ++ probe_pass_count = unittest_gpio_probe_pass_count; ++ chip_request_count = unittest_gpio_chip_request_count; ++ ++ /* overlay_gpio_04a contains gpio node */ ++ ++ unittest(overlay_data_apply("overlay_gpio_04a", NULL), ++ "Adding overlay 'overlay_gpio_04a' failed\n"); ++ ++ unittest(probe_pass_count + 1 == unittest_gpio_probe_pass_count, ++ "unittest_gpio_probe() failed or not called\n"); ++ ++ /* ++ * overlay_gpio_04b contains child gpio hog node ++ * ++ * - apply overlay_gpio_04b ++ * ++ * apply the overlay will result in ++ * - processing gpio for overlay_gpio_04b ++ */ ++ ++ EXPECT_BEGIN(KERN_INFO, ++ "GPIO line <> (line-C-input) hogged as input\n"); ++ ++ /* overlay_gpio_04b contains child gpio hog node */ ++ ++ unittest(overlay_data_apply("overlay_gpio_04b", NULL), ++ "Adding overlay 'overlay_gpio_04b' failed\n"); ++ ++ EXPECT_END(KERN_INFO, ++ "GPIO line <> (line-C-input) hogged as input\n"); ++ ++ unittest(chip_request_count + 1 == unittest_gpio_chip_request_count, ++ "unittest_gpio_chip_request() called %d times (expected 1 time)\n", ++ unittest_gpio_chip_request_count - chip_request_count); ++} ++ + static void __init of_unittest_overlay(void) + { + struct device_node *bus_np = NULL; +@@ -2173,6 +2412,8 @@ static void __init of_unittest_overlay(void) + of_unittest_overlay_i2c_cleanup(); + #endif + ++ of_unittest_overlay_gpio(); ++ + of_unittest_destroy_tracked_overlays(); + + out: +@@ -2226,6 +2467,12 @@ OVERLAY_INFO_EXTERN(overlay_11); + OVERLAY_INFO_EXTERN(overlay_12); + OVERLAY_INFO_EXTERN(overlay_13); + OVERLAY_INFO_EXTERN(overlay_15); ++OVERLAY_INFO_EXTERN(overlay_gpio_01); ++OVERLAY_INFO_EXTERN(overlay_gpio_02a); ++OVERLAY_INFO_EXTERN(overlay_gpio_02b); ++OVERLAY_INFO_EXTERN(overlay_gpio_03); ++OVERLAY_INFO_EXTERN(overlay_gpio_04a); ++OVERLAY_INFO_EXTERN(overlay_gpio_04b); + OVERLAY_INFO_EXTERN(overlay_bad_add_dup_node); + OVERLAY_INFO_EXTERN(overlay_bad_add_dup_prop); + OVERLAY_INFO_EXTERN(overlay_bad_phandle); +@@ -2250,6 +2497,12 @@ static struct overlay_info overlays[] = { + OVERLAY_INFO(overlay_12, 0), + OVERLAY_INFO(overlay_13, 0), + OVERLAY_INFO(overlay_15, 0), ++ OVERLAY_INFO(overlay_gpio_01, 0), ++ OVERLAY_INFO(overlay_gpio_02a, 0), ++ OVERLAY_INFO(overlay_gpio_02b, 0), ++ OVERLAY_INFO(overlay_gpio_03, 0), ++ OVERLAY_INFO(overlay_gpio_04a, 0), ++ OVERLAY_INFO(overlay_gpio_04b, 0), + OVERLAY_INFO(overlay_bad_add_dup_node, -EINVAL), + OVERLAY_INFO(overlay_bad_add_dup_prop, -EINVAL), + OVERLAY_INFO(overlay_bad_phandle, -EINVAL), +-- +2.43.0 + diff --git a/queue-5.4/of-unittest-fix-compile-in-the-non-dynamic-case.patch b/queue-5.4/of-unittest-fix-compile-in-the-non-dynamic-case.patch new file mode 100644 index 00000000000..c1bf16521a8 --- /dev/null +++ b/queue-5.4/of-unittest-fix-compile-in-the-non-dynamic-case.patch @@ -0,0 +1,68 @@ +From 29f18706d8f34c0df83050356dd2036f9d275314 Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Mon, 29 Jan 2024 20:25:56 +0100 +Subject: of: unittest: Fix compile in the non-dynamic case + +From: Christian A. Ehrhardt + +[ Upstream commit 607aad1e4356c210dbef9022955a3089377909b2 ] + +If CONFIG_OF_KOBJ is not set, a device_node does not contain a +kobj and attempts to access the embedded kobj via kref_read break +the compile. + +Replace affected kref_read calls with a macro that reads the +refcount if it exists and returns 1 if there is no embedded kobj. + +Reported-by: kernel test robot +Closes: https://lore.kernel.org/oe-kbuild-all/202401291740.VP219WIz-lkp@intel.com/ +Fixes: 4dde83569832 ("of: Fix double free in of_parse_phandle_with_args_map") +Signed-off-by: Christian A. Ehrhardt +Link: https://lore.kernel.org/r/20240129192556.403271-1-lk@c--e.de +Signed-off-by: Rob Herring +Signed-off-by: Sasha Levin +--- + drivers/of/unittest.c | 12 +++++++++--- + 1 file changed, 9 insertions(+), 3 deletions(-) + +diff --git a/drivers/of/unittest.c b/drivers/of/unittest.c +index 7585df5e3daf..799519872f85 100644 +--- a/drivers/of/unittest.c ++++ b/drivers/of/unittest.c +@@ -46,6 +46,12 @@ static struct unittest_results { + failed; \ + }) + ++#ifdef CONFIG_OF_KOBJ ++#define OF_KREF_READ(NODE) kref_read(&(NODE)->kobj.kref) ++#else ++#define OF_KREF_READ(NODE) 1 ++#endif ++ + /* + * Expected message may have a message level other than KERN_INFO. + * Print the expected message only if the current loglevel will allow +@@ -588,7 +594,7 @@ static void __init of_unittest_parse_phandle_with_args_map(void) + pr_err("missing testcase data\n"); + return; + } +- prefs[i] = kref_read(&p[i]->kobj.kref); ++ prefs[i] = OF_KREF_READ(p[i]); + } + + rc = of_count_phandle_with_args(np, "phandle-list", "#phandle-cells"); +@@ -690,9 +696,9 @@ static void __init of_unittest_parse_phandle_with_args_map(void) + unittest(rc == -EINVAL, "expected:%i got:%i\n", -EINVAL, rc); + + for (i = 0; i < ARRAY_SIZE(p); ++i) { +- unittest(prefs[i] == kref_read(&p[i]->kobj.kref), ++ unittest(prefs[i] == OF_KREF_READ(p[i]), + "provider%d: expected:%d got:%d\n", +- i, prefs[i], kref_read(&p[i]->kobj.kref)); ++ i, prefs[i], OF_KREF_READ(p[i])); + of_node_put(p[i]); + } + } +-- +2.43.0 + diff --git a/queue-5.4/series b/queue-5.4/series index 54dd5f8c445..edacf52767e 100644 --- a/queue-5.4/series +++ b/queue-5.4/series @@ -204,3 +204,9 @@ netfilter-nft_set_rbtree-skip-end-interval-element-from-gc.patch btrfs-forbid-creating-subvol-qgroups.patch btrfs-forbid-deleting-live-subvol-qgroup.patch btrfs-send-return-eopnotsupp-on-unknown-flags.patch +of-unittest-add-overlay-gpio-test-to-catch-gpio-hog-.patch +of-unittest-fix-compile-in-the-non-dynamic-case.patch +spi-ppc4xx-drop-write-only-variable.patch +asoc-rt5645-fix-deadlock-in-rt5645_jack_detect_work.patch +mips-add-memory-clobber-to-csum_ipv6_magic-inline-as.patch +i40e-fix-waiting-for-queues-of-all-vsis-to-be-disabl.patch diff --git a/queue-5.4/spi-ppc4xx-drop-write-only-variable.patch b/queue-5.4/spi-ppc4xx-drop-write-only-variable.patch new file mode 100644 index 00000000000..ace7167509d --- /dev/null +++ b/queue-5.4/spi-ppc4xx-drop-write-only-variable.patch @@ -0,0 +1,55 @@ +From 8c2901772aec552a1a60385d74f3e866814ca946 Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Sat, 10 Feb 2024 17:40:08 +0100 +Subject: spi: ppc4xx: Drop write-only variable +MIME-Version: 1.0 +Content-Type: text/plain; charset=UTF-8 +Content-Transfer-Encoding: 8bit + +From: Uwe Kleine-König + +[ Upstream commit b3aa619a8b4706f35cb62f780c14e68796b37f3f ] + +Since commit 24778be20f87 ("spi: convert drivers to use +bits_per_word_mask") the bits_per_word variable is only written to. The +check that was there before isn't needed any more as the spi core +ensures that only 8 bit transfers are used, so the variable can go away +together with all assignments to it. + +Fixes: 24778be20f87 ("spi: convert drivers to use bits_per_word_mask") +Signed-off-by: Uwe Kleine-König +Link: https://lore.kernel.org/r/20240210164006.208149-8-u.kleine-koenig@pengutronix.de +Signed-off-by: Mark Brown +Signed-off-by: Sasha Levin +--- + drivers/spi/spi-ppc4xx.c | 5 ----- + 1 file changed, 5 deletions(-) + +diff --git a/drivers/spi/spi-ppc4xx.c b/drivers/spi/spi-ppc4xx.c +index 0ea2d9a369d9..738a1e4e445e 100644 +--- a/drivers/spi/spi-ppc4xx.c ++++ b/drivers/spi/spi-ppc4xx.c +@@ -170,10 +170,8 @@ static int spi_ppc4xx_setupxfer(struct spi_device *spi, struct spi_transfer *t) + int scr; + u8 cdm = 0; + u32 speed; +- u8 bits_per_word; + + /* Start with the generic configuration for this device. */ +- bits_per_word = spi->bits_per_word; + speed = spi->max_speed_hz; + + /* +@@ -181,9 +179,6 @@ static int spi_ppc4xx_setupxfer(struct spi_device *spi, struct spi_transfer *t) + * the transfer to overwrite the generic configuration with zeros. + */ + if (t) { +- if (t->bits_per_word) +- bits_per_word = t->bits_per_word; +- + if (t->speed_hz) + speed = min(t->speed_hz, spi->max_speed_hz); + } +-- +2.43.0 + -- 2.47.3