From: Greg Kroah-Hartman Date: Thu, 30 Apr 2020 13:11:39 +0000 (+0200) Subject: 5.6-stable patches X-Git-Tag: v5.4.37~43 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=928109cee67a27827b942fa30bfae03a31ef0cb1;p=thirdparty%2Fkernel%2Fstable-queue.git 5.6-stable patches added patches: afs-fix-to-actually-set-afs_server_fl_have_epoch.patch afs-make-record-checking-use-task_uninterruptible-when-appropriate.patch arm-dts-bcm283x-add-cells-encoding-format-to-firmware-bus.patch arm-dts-omap3-disable-rng-on-n950-n9.patch asoc-meson-axg-card-fix-codec-to-codec-link-setup.patch asoc-q6dsp6-q6afe-dai-add-missing-channels-to-mi2s-dais.patch asoc-samsung-s3c24xx-i2s-fix-build-after-removal-of-dai-suspend-resume.patch asoc-tas571x-disable-regulators-on-failed-probe.patch asoc-wm8960-fix-wrong-clock-after-suspend-resume.patch bpf-forbid-xadd-on-spilled-pointers-for-unprivileged-users.patch counter-104-quad-8-add-lock-guards-generic-interface.patch drivers-soc-xilinx-fix-firmware-driver-kconfig-dependency.patch iio-ad7797-use-correct-attribute_group.patch iio-imu-st_lsm6dsx-fix-read-misalignment-on-untagged-fifo.patch iio-imu-st_lsm6dsx-specify-slave-odr-in-slv_odr.patch iwlwifi-actually-check-allocated-conf_tlv-pointer.patch kbuild-fix-dt-binding-schema-rule-again-to-avoid-needless-rebuilds.patch nfsd-memory-corruption-in-nfsd4_lock.patch propagate_one-mnt_set_mountpoint-needs-mount_lock.patch s390-ftrace-fix-potential-crashes-when-switching-tracers.patch usb-dwc3-gadget-do-link-recovery-for-ss-and-ssp.patch usb-gadget-udc-atmel-fix-vbus-disconnect-handling.patch usb-gadget-udc-bdc-remove-unnecessary-null-checks-in-bdc_req_complete.patch --- diff --git a/queue-5.6/afs-fix-to-actually-set-afs_server_fl_have_epoch.patch b/queue-5.6/afs-fix-to-actually-set-afs_server_fl_have_epoch.patch new file mode 100644 index 00000000000..fa8b4d67eec --- /dev/null +++ b/queue-5.6/afs-fix-to-actually-set-afs_server_fl_have_epoch.patch @@ -0,0 +1,40 @@ +From 69cf3978f3ada4e54beae4ad44868b5627864884 Mon Sep 17 00:00:00 2001 +From: David Howells +Date: Fri, 24 Apr 2020 11:21:14 +0100 +Subject: afs: Fix to actually set AFS_SERVER_FL_HAVE_EPOCH + +From: David Howells + +commit 69cf3978f3ada4e54beae4ad44868b5627864884 upstream. + +AFS keeps track of the epoch value from the rxrpc protocol to note (a) when +a fileserver appears to have restarted and (b) when different endpoints of +a fileserver do not appear to be associated with the same fileserver +(ie. all probes back from a fileserver from all of its interfaces should +carry the same epoch). + +However, the AFS_SERVER_FL_HAVE_EPOCH flag that indicates that we've +received the server's epoch is never set, though it is used. + +Fix this to set the flag when we first receive an epoch value from a probe +sent to the filesystem client from the fileserver. + +Fixes: 3bf0fb6f33dd ("afs: Probe multiple fileservers simultaneously") +Signed-off-by: David Howells +Signed-off-by: Greg Kroah-Hartman + +--- + fs/afs/cmservice.c | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +--- a/fs/afs/cmservice.c ++++ b/fs/afs/cmservice.c +@@ -169,7 +169,7 @@ static int afs_record_cm_probe(struct af + + spin_lock(&server->probe_lock); + +- if (!test_bit(AFS_SERVER_FL_HAVE_EPOCH, &server->flags)) { ++ if (!test_and_set_bit(AFS_SERVER_FL_HAVE_EPOCH, &server->flags)) { + server->cm_epoch = call->epoch; + server->probe.cm_epoch = call->epoch; + goto out; diff --git a/queue-5.6/afs-make-record-checking-use-task_uninterruptible-when-appropriate.patch b/queue-5.6/afs-make-record-checking-use-task_uninterruptible-when-appropriate.patch new file mode 100644 index 00000000000..415a08bbda0 --- /dev/null +++ b/queue-5.6/afs-make-record-checking-use-task_uninterruptible-when-appropriate.patch @@ -0,0 +1,112 @@ +From c4bfda16d1b40d1c5941c61b5aa336bdd2d9904a Mon Sep 17 00:00:00 2001 +From: David Howells +Date: Thu, 16 Apr 2020 18:17:13 +0100 +Subject: afs: Make record checking use TASK_UNINTERRUPTIBLE when appropriate + +From: David Howells + +commit c4bfda16d1b40d1c5941c61b5aa336bdd2d9904a upstream. + +When an operation is meant to be done uninterruptibly (such as +FS.StoreData), we should not be allowing volume and server record checking +to be interrupted. + +Fixes: d2ddc776a458 ("afs: Overhaul volume and server record caching and fileserver rotation") +Signed-off-by: David Howells +Signed-off-by: Greg Kroah-Hartman + +--- + fs/afs/internal.h | 2 +- + fs/afs/rotate.c | 6 +++--- + fs/afs/server.c | 7 ++----- + fs/afs/volume.c | 8 +++++--- + 4 files changed, 11 insertions(+), 12 deletions(-) + +--- a/fs/afs/internal.h ++++ b/fs/afs/internal.h +@@ -1335,7 +1335,7 @@ extern struct afs_volume *afs_create_vol + extern void afs_activate_volume(struct afs_volume *); + extern void afs_deactivate_volume(struct afs_volume *); + extern void afs_put_volume(struct afs_cell *, struct afs_volume *); +-extern int afs_check_volume_status(struct afs_volume *, struct key *); ++extern int afs_check_volume_status(struct afs_volume *, struct afs_fs_cursor *); + + /* + * write.c +--- a/fs/afs/rotate.c ++++ b/fs/afs/rotate.c +@@ -192,7 +192,7 @@ bool afs_select_fileserver(struct afs_fs + write_unlock(&vnode->volume->servers_lock); + + set_bit(AFS_VOLUME_NEEDS_UPDATE, &vnode->volume->flags); +- error = afs_check_volume_status(vnode->volume, fc->key); ++ error = afs_check_volume_status(vnode->volume, fc); + if (error < 0) + goto failed_set_error; + +@@ -281,7 +281,7 @@ bool afs_select_fileserver(struct afs_fs + + set_bit(AFS_VOLUME_WAIT, &vnode->volume->flags); + set_bit(AFS_VOLUME_NEEDS_UPDATE, &vnode->volume->flags); +- error = afs_check_volume_status(vnode->volume, fc->key); ++ error = afs_check_volume_status(vnode->volume, fc); + if (error < 0) + goto failed_set_error; + +@@ -341,7 +341,7 @@ start: + /* See if we need to do an update of the volume record. Note that the + * volume may have moved or even have been deleted. + */ +- error = afs_check_volume_status(vnode->volume, fc->key); ++ error = afs_check_volume_status(vnode->volume, fc); + if (error < 0) + goto failed_set_error; + +--- a/fs/afs/server.c ++++ b/fs/afs/server.c +@@ -594,12 +594,9 @@ retry: + } + + ret = wait_on_bit(&server->flags, AFS_SERVER_FL_UPDATING, +- TASK_INTERRUPTIBLE); ++ (fc->flags & AFS_FS_CURSOR_INTR) ? ++ TASK_INTERRUPTIBLE : TASK_UNINTERRUPTIBLE); + if (ret == -ERESTARTSYS) { +- if (!(fc->flags & AFS_FS_CURSOR_INTR) && server->addresses) { +- _leave(" = t [intr]"); +- return true; +- } + fc->error = ret; + _leave(" = f [intr]"); + return false; +--- a/fs/afs/volume.c ++++ b/fs/afs/volume.c +@@ -281,7 +281,7 @@ error: + /* + * Make sure the volume record is up to date. + */ +-int afs_check_volume_status(struct afs_volume *volume, struct key *key) ++int afs_check_volume_status(struct afs_volume *volume, struct afs_fs_cursor *fc) + { + time64_t now = ktime_get_real_seconds(); + int ret, retries = 0; +@@ -299,7 +299,7 @@ retry: + } + + if (!test_and_set_bit_lock(AFS_VOLUME_UPDATING, &volume->flags)) { +- ret = afs_update_volume_status(volume, key); ++ ret = afs_update_volume_status(volume, fc->key); + clear_bit_unlock(AFS_VOLUME_WAIT, &volume->flags); + clear_bit_unlock(AFS_VOLUME_UPDATING, &volume->flags); + wake_up_bit(&volume->flags, AFS_VOLUME_WAIT); +@@ -312,7 +312,9 @@ retry: + return 0; + } + +- ret = wait_on_bit(&volume->flags, AFS_VOLUME_WAIT, TASK_INTERRUPTIBLE); ++ ret = wait_on_bit(&volume->flags, AFS_VOLUME_WAIT, ++ (fc->flags & AFS_FS_CURSOR_INTR) ? ++ TASK_INTERRUPTIBLE : TASK_UNINTERRUPTIBLE); + if (ret == -ERESTARTSYS) { + _leave(" = %d", ret); + return ret; diff --git a/queue-5.6/arm-dts-bcm283x-add-cells-encoding-format-to-firmware-bus.patch b/queue-5.6/arm-dts-bcm283x-add-cells-encoding-format-to-firmware-bus.patch new file mode 100644 index 00000000000..ff0d0627500 --- /dev/null +++ b/queue-5.6/arm-dts-bcm283x-add-cells-encoding-format-to-firmware-bus.patch @@ -0,0 +1,42 @@ +From be08d278eb09210fefbad4c9b27d7843f1c096b2 Mon Sep 17 00:00:00 2001 +From: Nicolas Saenz Julienne +Date: Thu, 26 Mar 2020 14:44:13 +0100 +Subject: ARM: dts: bcm283x: Add cells encoding format to firmware bus + +From: Nicolas Saenz Julienne + +commit be08d278eb09210fefbad4c9b27d7843f1c096b2 upstream. + +With the introduction of 55c7c0621078 ("ARM: dts: bcm283x: Fix vc4's +firmware bus DMA limitations") the firmware bus has to comply with +/soc's DMA limitations. Ultimately linking both buses to a same +dma-ranges property. The patch (and author) missed the fact that a bus' +#address-cells and #size-cells properties are not inherited, but set to +a fixed value which, in this case, doesn't match /soc's. This, although +not breaking Linux's DMA mapping functionality, generates ugly dtc +warnings. + +Fix the issue by adding the correct address and size cells properties +under the firmware bus. + +Fixes: 55c7c0621078 ("ARM: dts: bcm283x: Fix vc4's firmware bus DMA limitations") +Signed-off-by: Nicolas Saenz Julienne +Link: https://lore.kernel.org/r/20200326134413.12298-1-nsaenzjulienne@suse.de +Signed-off-by: Greg Kroah-Hartman + +--- + arch/arm/boot/dts/bcm2835-rpi.dtsi | 3 +++ + 1 file changed, 3 insertions(+) + +--- a/arch/arm/boot/dts/bcm2835-rpi.dtsi ++++ b/arch/arm/boot/dts/bcm2835-rpi.dtsi +@@ -14,6 +14,9 @@ + soc { + firmware: firmware { + compatible = "raspberrypi,bcm2835-firmware", "simple-bus"; ++ #address-cells = <1>; ++ #size-cells = <1>; ++ + mboxes = <&mailbox>; + dma-ranges; + }; diff --git a/queue-5.6/arm-dts-omap3-disable-rng-on-n950-n9.patch b/queue-5.6/arm-dts-omap3-disable-rng-on-n950-n9.patch new file mode 100644 index 00000000000..2674cbdd65c --- /dev/null +++ b/queue-5.6/arm-dts-omap3-disable-rng-on-n950-n9.patch @@ -0,0 +1,35 @@ +From 07bdc492cff6f555538df95e9812fe72e16d154a Mon Sep 17 00:00:00 2001 +From: Aaro Koskinen +Date: Wed, 25 Mar 2020 23:21:49 +0200 +Subject: ARM: dts: OMAP3: disable RNG on N950/N9 + +From: Aaro Koskinen + +commit 07bdc492cff6f555538df95e9812fe72e16d154a upstream. + +Like on N900, we cannot access RNG directly on N950/N9. Mark it disabled in +the DTS to allow kernel to boot. + +Fixes: 308607e5545f ("ARM: dts: Configure omap3 rng") +Signed-off-by: Aaro Koskinen +Signed-off-by: Tony Lindgren +Signed-off-by: Greg Kroah-Hartman + +--- + arch/arm/boot/dts/omap3-n950-n9.dtsi | 5 +++++ + 1 file changed, 5 insertions(+) + +--- a/arch/arm/boot/dts/omap3-n950-n9.dtsi ++++ b/arch/arm/boot/dts/omap3-n950-n9.dtsi +@@ -341,6 +341,11 @@ + status = "disabled"; + }; + ++/* RNG not directly accessible on N950/N9. */ ++&rng_target { ++ status = "disabled"; ++}; ++ + &usb_otg_hs { + interface-type = <0>; + usb-phy = <&usb2_phy>; diff --git a/queue-5.6/asoc-meson-axg-card-fix-codec-to-codec-link-setup.patch b/queue-5.6/asoc-meson-axg-card-fix-codec-to-codec-link-setup.patch new file mode 100644 index 00000000000..bc0e4e0cbad --- /dev/null +++ b/queue-5.6/asoc-meson-axg-card-fix-codec-to-codec-link-setup.patch @@ -0,0 +1,60 @@ +From 1164284270779e1865cc2046a2a01b58a1e858a9 Mon Sep 17 00:00:00 2001 +From: Jerome Brunet +Date: Mon, 20 Apr 2020 13:45:10 +0200 +Subject: ASoC: meson: axg-card: fix codec-to-codec link setup + +From: Jerome Brunet + +commit 1164284270779e1865cc2046a2a01b58a1e858a9 upstream. + +Since the addition of commit 9b5db059366a ("ASoC: soc-pcm: dpcm: Only allow +playback/capture if supported"), meson-axg cards which have codec-to-codec +links fail to init and Oops: + + Unable to handle kernel NULL pointer dereference at virtual address 0000000000000128 + Internal error: Oops: 96000044 [#1] PREEMPT SMP + CPU: 3 PID: 1582 Comm: arecord Not tainted 5.7.0-rc1 + pc : invalidate_paths_ep+0x30/0xe0 + lr : snd_soc_dapm_dai_get_connected_widgets+0x170/0x1a8 + Call trace: + invalidate_paths_ep+0x30/0xe0 + snd_soc_dapm_dai_get_connected_widgets+0x170/0x1a8 + dpcm_path_get+0x38/0xd0 + dpcm_fe_dai_open+0x70/0x920 + snd_pcm_open_substream+0x564/0x840 + snd_pcm_open+0xfc/0x228 + snd_pcm_capture_open+0x4c/0x78 + snd_open+0xac/0x1a8 + ... + +While initiliazing the links, ASoC treats the codec-to-codec links of this +card type as a DPCM backend. This error eventually leads to the Oops. + +Most of the card driver code is shared between DPCM backends and +codec-to-codec links. The property "no_pcm" marking DCPM BE was left set on +codec-to-codec links, leading to this problem. This commit fixes that. + +Fixes: 0a8f1117a680 ("ASoC: meson: axg-card: add basic codec-to-codec link support") +Signed-off-by: Jerome Brunet +Link: https://lore.kernel.org/r/20200420114511.450560-2-jbrunet@baylibre.com +Signed-off-by: Mark Brown +Signed-off-by: Greg Kroah-Hartman + +--- + sound/soc/meson/axg-card.c | 4 +++- + 1 file changed, 3 insertions(+), 1 deletion(-) + +--- a/sound/soc/meson/axg-card.c ++++ b/sound/soc/meson/axg-card.c +@@ -586,8 +586,10 @@ static int axg_card_add_link(struct snd_ + + if (axg_card_cpu_is_tdm_iface(dai_link->cpus->of_node)) + ret = axg_card_parse_tdm(card, np, index); +- else if (axg_card_cpu_is_codec(dai_link->cpus->of_node)) ++ else if (axg_card_cpu_is_codec(dai_link->cpus->of_node)) { + dai_link->params = &codec_params; ++ dai_link->no_pcm = 0; /* link is not a DPCM BE */ ++ } + + return ret; + } diff --git a/queue-5.6/asoc-q6dsp6-q6afe-dai-add-missing-channels-to-mi2s-dais.patch b/queue-5.6/asoc-q6dsp6-q6afe-dai-add-missing-channels-to-mi2s-dais.patch new file mode 100644 index 00000000000..9a19c8185b2 --- /dev/null +++ b/queue-5.6/asoc-q6dsp6-q6afe-dai-add-missing-channels-to-mi2s-dais.patch @@ -0,0 +1,119 @@ +From 0c824ec094b5cda766c80d88c2036e28c24a4cb1 Mon Sep 17 00:00:00 2001 +From: Stephan Gerhold +Date: Wed, 15 Apr 2020 17:00:50 +0200 +Subject: ASoC: q6dsp6: q6afe-dai: add missing channels to MI2S DAIs + +From: Stephan Gerhold + +commit 0c824ec094b5cda766c80d88c2036e28c24a4cb1 upstream. + +For some reason, the MI2S DAIs do not have channels_min/max defined. +This means that snd_soc_dai_stream_valid() returns false, +i.e. the DAIs have neither valid playback nor capture stream. + +It's quite surprising that this ever worked correctly, +but in 5.7-rc1 this is now failing badly: :) + +Commit 0e9cf4c452ad ("ASoC: pcm: check if cpu-dai supports a given stream") +introduced a check for snd_soc_dai_stream_valid() before calling +hw_params(), which means that the q6i2s_hw_params() function +was never called, eventually resulting in: + + qcom-q6afe aprsvc:q6afe:4:4: no line is assigned + +... even though "qcom,sd-lines" is set in the device tree. + +Commit 9b5db059366a ("ASoC: soc-pcm: dpcm: Only allow playback/capture if supported") +now even avoids creating PCM devices if the stream is not supported, +which means that it is failing even earlier with e.g.: + + Primary MI2S: ASoC: no backend playback stream + +Avoid all that trouble by adding channels_min/max for the MI2S DAIs. + +Fixes: 24c4cbcfac09 ("ASoC: qdsp6: q6afe: Add q6afe dai driver") +Signed-off-by: Stephan Gerhold +Reviewed-by: Srinivas Kandagatla +Cc: Srinivas Kandagatla +Link: https://lore.kernel.org/r/20200415150050.616392-1-stephan@gerhold.net +Signed-off-by: Mark Brown +Signed-off-by: Greg Kroah-Hartman + +--- + sound/soc/qcom/qdsp6/q6afe-dai.c | 16 ++++++++++++++++ + 1 file changed, 16 insertions(+) + +--- a/sound/soc/qcom/qdsp6/q6afe-dai.c ++++ b/sound/soc/qcom/qdsp6/q6afe-dai.c +@@ -902,6 +902,8 @@ static struct snd_soc_dai_driver q6afe_d + SNDRV_PCM_RATE_16000, + .formats = SNDRV_PCM_FMTBIT_S16_LE | + SNDRV_PCM_FMTBIT_S24_LE, ++ .channels_min = 1, ++ .channels_max = 8, + .rate_min = 8000, + .rate_max = 48000, + }, +@@ -917,6 +919,8 @@ static struct snd_soc_dai_driver q6afe_d + SNDRV_PCM_RATE_16000, + .formats = SNDRV_PCM_FMTBIT_S16_LE | + SNDRV_PCM_FMTBIT_S24_LE, ++ .channels_min = 1, ++ .channels_max = 8, + .rate_min = 8000, + .rate_max = 48000, + }, +@@ -931,6 +935,8 @@ static struct snd_soc_dai_driver q6afe_d + .rates = SNDRV_PCM_RATE_48000 | SNDRV_PCM_RATE_8000 | + SNDRV_PCM_RATE_16000, + .formats = SNDRV_PCM_FMTBIT_S16_LE, ++ .channels_min = 1, ++ .channels_max = 8, + .rate_min = 8000, + .rate_max = 48000, + }, +@@ -946,6 +952,8 @@ static struct snd_soc_dai_driver q6afe_d + SNDRV_PCM_RATE_16000, + .formats = SNDRV_PCM_FMTBIT_S16_LE | + SNDRV_PCM_FMTBIT_S24_LE, ++ .channels_min = 1, ++ .channels_max = 8, + .rate_min = 8000, + .rate_max = 48000, + }, +@@ -960,6 +968,8 @@ static struct snd_soc_dai_driver q6afe_d + .rates = SNDRV_PCM_RATE_48000 | SNDRV_PCM_RATE_8000 | + SNDRV_PCM_RATE_16000, + .formats = SNDRV_PCM_FMTBIT_S16_LE, ++ .channels_min = 1, ++ .channels_max = 8, + .rate_min = 8000, + .rate_max = 48000, + }, +@@ -975,6 +985,8 @@ static struct snd_soc_dai_driver q6afe_d + SNDRV_PCM_RATE_16000, + .formats = SNDRV_PCM_FMTBIT_S16_LE | + SNDRV_PCM_FMTBIT_S24_LE, ++ .channels_min = 1, ++ .channels_max = 8, + .rate_min = 8000, + .rate_max = 48000, + }, +@@ -989,6 +1001,8 @@ static struct snd_soc_dai_driver q6afe_d + .rates = SNDRV_PCM_RATE_48000 | SNDRV_PCM_RATE_8000 | + SNDRV_PCM_RATE_16000, + .formats = SNDRV_PCM_FMTBIT_S16_LE, ++ .channels_min = 1, ++ .channels_max = 8, + .rate_min = 8000, + .rate_max = 48000, + }, +@@ -1004,6 +1018,8 @@ static struct snd_soc_dai_driver q6afe_d + SNDRV_PCM_RATE_16000, + .formats = SNDRV_PCM_FMTBIT_S16_LE | + SNDRV_PCM_FMTBIT_S24_LE, ++ .channels_min = 1, ++ .channels_max = 8, + .rate_min = 8000, + .rate_max = 48000, + }, diff --git a/queue-5.6/asoc-samsung-s3c24xx-i2s-fix-build-after-removal-of-dai-suspend-resume.patch b/queue-5.6/asoc-samsung-s3c24xx-i2s-fix-build-after-removal-of-dai-suspend-resume.patch new file mode 100644 index 00000000000..0e63d7eea9a --- /dev/null +++ b/queue-5.6/asoc-samsung-s3c24xx-i2s-fix-build-after-removal-of-dai-suspend-resume.patch @@ -0,0 +1,185 @@ +From ec21bdc6dd16d74b3674ef1fd12ae8e4e7418603 Mon Sep 17 00:00:00 2001 +From: Krzysztof Kozlowski +Date: Mon, 13 Apr 2020 14:45:48 +0200 +Subject: ASoC: samsung: s3c24xx-i2s: Fix build after removal of DAI suspend/resume +MIME-Version: 1.0 +Content-Type: text/plain; charset=UTF-8 +Content-Transfer-Encoding: 8bit + +From: Krzysztof Kozlowski + +commit ec21bdc6dd16d74b3674ef1fd12ae8e4e7418603 upstream. + +Commit 450312b640f9 ("ASoC: soc-core: remove DAI suspend/resume") +removed the DAI side suspend/resume hooks and switched entirely to +component suspend/resume. However the Samsung SoC s3c-i2s-v2 driver was +not updated. + +Move the suspend/resume hooks from s3c-i2s-v2.c to s3c2412-i2s.c while +changing dai to component which allows to keep the struct +snd_soc_component_driver const. + +This fixes build errors: + + sound/soc/samsung/s3c-i2s-v2.c: In function ‘s3c_i2sv2_register_component’: + sound/soc/samsung/s3c-i2s-v2.c:730:9: error: ‘struct snd_soc_dai_driver’ has no member named ‘suspend’ + dai_drv->suspend = s3c2412_i2s_suspend; + +Reported-by: Arnd Bergmann +Fixes: 450312b640f9 ("ASoC: soc-core: remove DAI suspend/resume") +Signed-off-by: Krzysztof Kozlowski +Signed-off-by: Greg Kroah-Hartman + +Link: https://lore.kernel.org/r/20200413124548.28197-1-krzk@kernel.org +Signed-off-by: Mark Brown + +--- + sound/soc/samsung/s3c-i2s-v2.c | 57 ---------------------------------------- + sound/soc/samsung/s3c2412-i2s.c | 56 +++++++++++++++++++++++++++++++++++++++ + 2 files changed, 56 insertions(+), 57 deletions(-) + +--- a/sound/soc/samsung/s3c-i2s-v2.c ++++ b/sound/soc/samsung/s3c-i2s-v2.c +@@ -656,60 +656,6 @@ void s3c_i2sv2_cleanup(struct snd_soc_da + } + EXPORT_SYMBOL_GPL(s3c_i2sv2_cleanup); + +-#ifdef CONFIG_PM +-static int s3c2412_i2s_suspend(struct snd_soc_dai *dai) +-{ +- struct s3c_i2sv2_info *i2s = to_info(dai); +- u32 iismod; +- +- if (dai->active) { +- i2s->suspend_iismod = readl(i2s->regs + S3C2412_IISMOD); +- i2s->suspend_iiscon = readl(i2s->regs + S3C2412_IISCON); +- i2s->suspend_iispsr = readl(i2s->regs + S3C2412_IISPSR); +- +- /* some basic suspend checks */ +- +- iismod = readl(i2s->regs + S3C2412_IISMOD); +- +- if (iismod & S3C2412_IISCON_RXDMA_ACTIVE) +- pr_warn("%s: RXDMA active?\n", __func__); +- +- if (iismod & S3C2412_IISCON_TXDMA_ACTIVE) +- pr_warn("%s: TXDMA active?\n", __func__); +- +- if (iismod & S3C2412_IISCON_IIS_ACTIVE) +- pr_warn("%s: IIS active\n", __func__); +- } +- +- return 0; +-} +- +-static int s3c2412_i2s_resume(struct snd_soc_dai *dai) +-{ +- struct s3c_i2sv2_info *i2s = to_info(dai); +- +- pr_info("dai_active %d, IISMOD %08x, IISCON %08x\n", +- dai->active, i2s->suspend_iismod, i2s->suspend_iiscon); +- +- if (dai->active) { +- writel(i2s->suspend_iiscon, i2s->regs + S3C2412_IISCON); +- writel(i2s->suspend_iismod, i2s->regs + S3C2412_IISMOD); +- writel(i2s->suspend_iispsr, i2s->regs + S3C2412_IISPSR); +- +- writel(S3C2412_IISFIC_RXFLUSH | S3C2412_IISFIC_TXFLUSH, +- i2s->regs + S3C2412_IISFIC); +- +- ndelay(250); +- writel(0x0, i2s->regs + S3C2412_IISFIC); +- } +- +- return 0; +-} +-#else +-#define s3c2412_i2s_suspend NULL +-#define s3c2412_i2s_resume NULL +-#endif +- + int s3c_i2sv2_register_component(struct device *dev, int id, + const struct snd_soc_component_driver *cmp_drv, + struct snd_soc_dai_driver *dai_drv) +@@ -727,9 +673,6 @@ int s3c_i2sv2_register_component(struct + if (!ops->delay) + ops->delay = s3c2412_i2s_delay; + +- dai_drv->suspend = s3c2412_i2s_suspend; +- dai_drv->resume = s3c2412_i2s_resume; +- + return devm_snd_soc_register_component(dev, cmp_drv, dai_drv, 1); + } + EXPORT_SYMBOL_GPL(s3c_i2sv2_register_component); +--- a/sound/soc/samsung/s3c2412-i2s.c ++++ b/sound/soc/samsung/s3c2412-i2s.c +@@ -117,6 +117,60 @@ static int s3c2412_i2s_hw_params(struct + return 0; + } + ++#ifdef CONFIG_PM ++static int s3c2412_i2s_suspend(struct snd_soc_component *component) ++{ ++ struct s3c_i2sv2_info *i2s = snd_soc_component_get_drvdata(component); ++ u32 iismod; ++ ++ if (component->active) { ++ i2s->suspend_iismod = readl(i2s->regs + S3C2412_IISMOD); ++ i2s->suspend_iiscon = readl(i2s->regs + S3C2412_IISCON); ++ i2s->suspend_iispsr = readl(i2s->regs + S3C2412_IISPSR); ++ ++ /* some basic suspend checks */ ++ ++ iismod = readl(i2s->regs + S3C2412_IISMOD); ++ ++ if (iismod & S3C2412_IISCON_RXDMA_ACTIVE) ++ pr_warn("%s: RXDMA active?\n", __func__); ++ ++ if (iismod & S3C2412_IISCON_TXDMA_ACTIVE) ++ pr_warn("%s: TXDMA active?\n", __func__); ++ ++ if (iismod & S3C2412_IISCON_IIS_ACTIVE) ++ pr_warn("%s: IIS active\n", __func__); ++ } ++ ++ return 0; ++} ++ ++static int s3c2412_i2s_resume(struct snd_soc_component *component) ++{ ++ struct s3c_i2sv2_info *i2s = snd_soc_component_get_drvdata(component); ++ ++ pr_info("component_active %d, IISMOD %08x, IISCON %08x\n", ++ component->active, i2s->suspend_iismod, i2s->suspend_iiscon); ++ ++ if (component->active) { ++ writel(i2s->suspend_iiscon, i2s->regs + S3C2412_IISCON); ++ writel(i2s->suspend_iismod, i2s->regs + S3C2412_IISMOD); ++ writel(i2s->suspend_iispsr, i2s->regs + S3C2412_IISPSR); ++ ++ writel(S3C2412_IISFIC_RXFLUSH | S3C2412_IISFIC_TXFLUSH, ++ i2s->regs + S3C2412_IISFIC); ++ ++ ndelay(250); ++ writel(0x0, i2s->regs + S3C2412_IISFIC); ++ } ++ ++ return 0; ++} ++#else ++#define s3c2412_i2s_suspend NULL ++#define s3c2412_i2s_resume NULL ++#endif ++ + #define S3C2412_I2S_RATES \ + (SNDRV_PCM_RATE_8000 | SNDRV_PCM_RATE_11025 | SNDRV_PCM_RATE_16000 | \ + SNDRV_PCM_RATE_22050 | SNDRV_PCM_RATE_32000 | SNDRV_PCM_RATE_44100 | \ +@@ -146,6 +200,8 @@ static struct snd_soc_dai_driver s3c2412 + + static const struct snd_soc_component_driver s3c2412_i2s_component = { + .name = "s3c2412-i2s", ++ .suspend = s3c2412_i2s_suspend, ++ .resume = s3c2412_i2s_resume, + }; + + static int s3c2412_iis_dev_probe(struct platform_device *pdev) diff --git a/queue-5.6/asoc-tas571x-disable-regulators-on-failed-probe.patch b/queue-5.6/asoc-tas571x-disable-regulators-on-failed-probe.patch new file mode 100644 index 00000000000..b57cb147bbd --- /dev/null +++ b/queue-5.6/asoc-tas571x-disable-regulators-on-failed-probe.patch @@ -0,0 +1,92 @@ +From 9df8ba7c63073508e5aa677dade48fcab6a6773e Mon Sep 17 00:00:00 2001 +From: Philipp Puschmann +Date: Tue, 14 Apr 2020 13:27:54 +0200 +Subject: ASoC: tas571x: disable regulators on failed probe + +From: Philipp Puschmann + +commit 9df8ba7c63073508e5aa677dade48fcab6a6773e upstream. + +If probe fails after enabling the regulators regulator_put is called for +each supply without having them disabled before. This produces some +warnings like + +WARNING: CPU: 0 PID: 90 at drivers/regulator/core.c:2044 _regulator_put.part.0+0x154/0x15c +[] (unwind_backtrace) from [] (show_stack+0x10/0x14) +[] (show_stack) from [] (__warn+0xd0/0xf4) +[] (__warn) from [] (warn_slowpath_fmt+0x64/0xc4) +[] (warn_slowpath_fmt) from [] (_regulator_put.part.0+0x154/0x15c) +[] (_regulator_put.part.0) from [] (regulator_put+0x28/0x38) +[] (regulator_put) from [] (regulator_bulk_free+0x28/0x38) +[] (regulator_bulk_free) from [] (release_nodes+0x1d0/0x22c) +[] (release_nodes) from [] (really_probe+0x108/0x34c) +[] (really_probe) from [] (driver_probe_device+0xb8/0x16c) +[] (driver_probe_device) from [] (device_driver_attach+0x58/0x60) +[] (device_driver_attach) from [] (__driver_attach+0x58/0xcc) +[] (__driver_attach) from [] (bus_for_each_dev+0x78/0xc0) +[] (bus_for_each_dev) from [] (bus_add_driver+0x188/0x1e0) +[] (bus_add_driver) from [] (driver_register+0x74/0x108) +[] (driver_register) from [] (i2c_register_driver+0x3c/0x88) +[] (i2c_register_driver) from [] (do_one_initcall+0x58/0x250) +[] (do_one_initcall) from [] (do_init_module+0x60/0x244) +[] (do_init_module) from [] (load_module+0x2180/0x2540) +[] (load_module) from [] (sys_finit_module+0xd0/0xe8) +[] (sys_finit_module) from [] (__sys_trace_return+0x0/0x20) + +Fixes: 3fd6e7d9a146 (ASoC: tas571x: New driver for TI TAS571x power amplifiers) +Signed-off-by: Philipp Puschmann +Link: https://lore.kernel.org/r/20200414112754.3365406-1-p.puschmann@pironex.de +Signed-off-by: Mark Brown +Signed-off-by: Greg Kroah-Hartman + +--- + sound/soc/codecs/tas571x.c | 20 +++++++++++++++----- + 1 file changed, 15 insertions(+), 5 deletions(-) + +--- a/sound/soc/codecs/tas571x.c ++++ b/sound/soc/codecs/tas571x.c +@@ -820,8 +820,10 @@ static int tas571x_i2c_probe(struct i2c_ + + priv->regmap = devm_regmap_init(dev, NULL, client, + priv->chip->regmap_config); +- if (IS_ERR(priv->regmap)) +- return PTR_ERR(priv->regmap); ++ if (IS_ERR(priv->regmap)) { ++ ret = PTR_ERR(priv->regmap); ++ goto disable_regs; ++ } + + priv->pdn_gpio = devm_gpiod_get_optional(dev, "pdn", GPIOD_OUT_LOW); + if (IS_ERR(priv->pdn_gpio)) { +@@ -845,7 +847,7 @@ static int tas571x_i2c_probe(struct i2c_ + + ret = regmap_write(priv->regmap, TAS571X_OSC_TRIM_REG, 0); + if (ret) +- return ret; ++ goto disable_regs; + + usleep_range(50000, 60000); + +@@ -861,12 +863,20 @@ static int tas571x_i2c_probe(struct i2c_ + */ + ret = regmap_update_bits(priv->regmap, TAS571X_MVOL_REG, 1, 0); + if (ret) +- return ret; ++ goto disable_regs; + } + +- return devm_snd_soc_register_component(&client->dev, ++ ret = devm_snd_soc_register_component(&client->dev, + &priv->component_driver, + &tas571x_dai, 1); ++ if (ret) ++ goto disable_regs; ++ ++ return ret; ++ ++disable_regs: ++ regulator_bulk_disable(priv->chip->num_supply_names, priv->supplies); ++ return ret; + } + + static int tas571x_i2c_remove(struct i2c_client *client) diff --git a/queue-5.6/asoc-wm8960-fix-wrong-clock-after-suspend-resume.patch b/queue-5.6/asoc-wm8960-fix-wrong-clock-after-suspend-resume.patch new file mode 100644 index 00000000000..ea7539c7b17 --- /dev/null +++ b/queue-5.6/asoc-wm8960-fix-wrong-clock-after-suspend-resume.patch @@ -0,0 +1,40 @@ +From 1e060a453c8604311fb45ae2f84f67ed673329b4 Mon Sep 17 00:00:00 2001 +From: Shengjiu Wang +Date: Tue, 21 Apr 2020 19:28:45 +0800 +Subject: ASoC: wm8960: Fix wrong clock after suspend & resume + +From: Shengjiu Wang + +commit 1e060a453c8604311fb45ae2f84f67ed673329b4 upstream. + +After suspend & resume, wm8960_hw_params may be called when +bias_level is not SND_SOC_BIAS_ON, then wm8960_configure_clocking +is not called. But if sample rate is changed at that time, then +the output clock rate will be not correct. + +So judgement of bias_level is SND_SOC_BIAS_ON in wm8960_hw_params +is not necessary and it causes above issue. + +Fixes: 3176bf2d7ccd ("ASoC: wm8960: update pll and clock setting function") +Signed-off-by: Shengjiu Wang +Acked-by: Charles Keepax +Link: https://lore.kernel.org/r/1587468525-27514-1-git-send-email-shengjiu.wang@nxp.com +Signed-off-by: Mark Brown +Signed-off-by: Greg Kroah-Hartman + +--- + sound/soc/codecs/wm8960.c | 3 +-- + 1 file changed, 1 insertion(+), 2 deletions(-) + +--- a/sound/soc/codecs/wm8960.c ++++ b/sound/soc/codecs/wm8960.c +@@ -860,8 +860,7 @@ static int wm8960_hw_params(struct snd_p + + wm8960->is_stream_in_use[tx] = true; + +- if (snd_soc_component_get_bias_level(component) == SND_SOC_BIAS_ON && +- !wm8960->is_stream_in_use[!tx]) ++ if (!wm8960->is_stream_in_use[!tx]) + return wm8960_configure_clocking(component); + + return 0; diff --git a/queue-5.6/bpf-forbid-xadd-on-spilled-pointers-for-unprivileged-users.patch b/queue-5.6/bpf-forbid-xadd-on-spilled-pointers-for-unprivileged-users.patch new file mode 100644 index 00000000000..47c705e10b4 --- /dev/null +++ b/queue-5.6/bpf-forbid-xadd-on-spilled-pointers-for-unprivileged-users.patch @@ -0,0 +1,139 @@ +From 6e7e63cbb023976d828cdb22422606bf77baa8a9 Mon Sep 17 00:00:00 2001 +From: Jann Horn +Date: Fri, 17 Apr 2020 02:00:06 +0200 +Subject: bpf: Forbid XADD on spilled pointers for unprivileged users + +From: Jann Horn + +commit 6e7e63cbb023976d828cdb22422606bf77baa8a9 upstream. + +When check_xadd() verifies an XADD operation on a pointer to a stack slot +containing a spilled pointer, check_stack_read() verifies that the read, +which is part of XADD, is valid. However, since the placeholder value -1 is +passed as `value_regno`, check_stack_read() can only return a binary +decision and can't return the type of the value that was read. The intent +here is to verify whether the value read from the stack slot may be used as +a SCALAR_VALUE; but since check_stack_read() doesn't check the type, and +the type information is lost when check_stack_read() returns, this is not +enforced, and a malicious user can abuse XADD to leak spilled kernel +pointers. + +Fix it by letting check_stack_read() verify that the value is usable as a +SCALAR_VALUE if no type information is passed to the caller. + +To be able to use __is_pointer_value() in check_stack_read(), move it up. + +Fix up the expected unprivileged error message for a BPF selftest that, +until now, assumed that unprivileged users can use XADD on stack-spilled +pointers. This also gives us a test for the behavior introduced in this +patch for free. + +In theory, this could also be fixed by forbidding XADD on stack spills +entirely, since XADD is a locked operation (for operations on memory with +concurrency) and there can't be any concurrency on the BPF stack; but +Alexei has said that he wants to keep XADD on stack slots working to avoid +changes to the test suite [1]. + +The following BPF program demonstrates how to leak a BPF map pointer as an +unprivileged user using this bug: + + // r7 = map_pointer + BPF_LD_MAP_FD(BPF_REG_7, small_map), + // r8 = launder(map_pointer) + BPF_STX_MEM(BPF_DW, BPF_REG_FP, BPF_REG_7, -8), + BPF_MOV64_IMM(BPF_REG_1, 0), + ((struct bpf_insn) { + .code = BPF_STX | BPF_DW | BPF_XADD, + .dst_reg = BPF_REG_FP, + .src_reg = BPF_REG_1, + .off = -8 + }), + BPF_LDX_MEM(BPF_DW, BPF_REG_8, BPF_REG_FP, -8), + + // store r8 into map + BPF_MOV64_REG(BPF_REG_ARG1, BPF_REG_7), + BPF_MOV64_REG(BPF_REG_ARG2, BPF_REG_FP), + BPF_ALU64_IMM(BPF_ADD, BPF_REG_ARG2, -4), + BPF_ST_MEM(BPF_W, BPF_REG_ARG2, 0, 0), + BPF_EMIT_CALL(BPF_FUNC_map_lookup_elem), + BPF_JMP_IMM(BPF_JNE, BPF_REG_0, 0, 1), + BPF_EXIT_INSN(), + BPF_STX_MEM(BPF_DW, BPF_REG_0, BPF_REG_8, 0), + + BPF_MOV64_IMM(BPF_REG_0, 0), + BPF_EXIT_INSN() + +[1] https://lore.kernel.org/bpf/20200416211116.qxqcza5vo2ddnkdq@ast-mbp.dhcp.thefacebook.com/ + +Fixes: 17a5267067f3 ("bpf: verifier (add verifier core)") +Signed-off-by: Jann Horn +Signed-off-by: Alexei Starovoitov +Link: https://lore.kernel.org/bpf/20200417000007.10734-1-jannh@google.com +Signed-off-by: Greg Kroah-Hartman + +--- + kernel/bpf/verifier.c | 28 ++++++++++----- + tools/testing/selftests/bpf/verifier/value_illegal_alu.c | 1 + 2 files changed, 20 insertions(+), 9 deletions(-) + +--- a/kernel/bpf/verifier.c ++++ b/kernel/bpf/verifier.c +@@ -1918,6 +1918,15 @@ static bool register_is_const(struct bpf + return reg->type == SCALAR_VALUE && tnum_is_const(reg->var_off); + } + ++static bool __is_pointer_value(bool allow_ptr_leaks, ++ const struct bpf_reg_state *reg) ++{ ++ if (allow_ptr_leaks) ++ return false; ++ ++ return reg->type != SCALAR_VALUE; ++} ++ + static void save_register_state(struct bpf_func_state *state, + int spi, struct bpf_reg_state *reg) + { +@@ -2108,6 +2117,16 @@ static int check_stack_read(struct bpf_v + * which resets stack/reg liveness for state transitions + */ + state->regs[value_regno].live |= REG_LIVE_WRITTEN; ++ } else if (__is_pointer_value(env->allow_ptr_leaks, reg)) { ++ /* If value_regno==-1, the caller is asking us whether ++ * it is acceptable to use this value as a SCALAR_VALUE ++ * (e.g. for XADD). ++ * We must not allow unprivileged callers to do that ++ * with spilled pointers. ++ */ ++ verbose(env, "leaking pointer from stack off %d\n", ++ off); ++ return -EACCES; + } + mark_reg_read(env, reg, reg->parent, REG_LIVE_READ64); + } else { +@@ -2473,15 +2492,6 @@ static int check_sock_access(struct bpf_ + return -EACCES; + } + +-static bool __is_pointer_value(bool allow_ptr_leaks, +- const struct bpf_reg_state *reg) +-{ +- if (allow_ptr_leaks) +- return false; +- +- return reg->type != SCALAR_VALUE; +-} +- + static struct bpf_reg_state *reg_state(struct bpf_verifier_env *env, int regno) + { + return cur_regs(env) + regno; +--- a/tools/testing/selftests/bpf/verifier/value_illegal_alu.c ++++ b/tools/testing/selftests/bpf/verifier/value_illegal_alu.c +@@ -88,6 +88,7 @@ + BPF_EXIT_INSN(), + }, + .fixup_map_hash_48b = { 3 }, ++ .errstr_unpriv = "leaking pointer from stack off -8", + .errstr = "R0 invalid mem access 'inv'", + .result = REJECT, + .flags = F_NEEDS_EFFICIENT_UNALIGNED_ACCESS, diff --git a/queue-5.6/counter-104-quad-8-add-lock-guards-generic-interface.patch b/queue-5.6/counter-104-quad-8-add-lock-guards-generic-interface.patch new file mode 100644 index 00000000000..c535df73841 --- /dev/null +++ b/queue-5.6/counter-104-quad-8-add-lock-guards-generic-interface.patch @@ -0,0 +1,573 @@ +From fc069262261c43ed11d639dadcf982e79bfe652b Mon Sep 17 00:00:00 2001 +From: Syed Nayyar Waris +Date: Mon, 16 Mar 2020 18:19:30 +0530 +Subject: counter: 104-quad-8: Add lock guards - generic interface + +From: Syed Nayyar Waris + +commit fc069262261c43ed11d639dadcf982e79bfe652b upstream. + +Add lock protection from race conditions to 104-quad-8 counter driver +generic interface code changes. Mutex calls used for protection. + +Fixes: f1d8a071d45b ("counter: 104-quad-8: Add Generic Counter interface support") + +Signed-off-by: Syed Nayyar Waris +Signed-off-by: William Breathitt Gray +Signed-off-by: Jonathan Cameron +Signed-off-by: Greg Kroah-Hartman + +--- + drivers/counter/104-quad-8.c | 194 +++++++++++++++++++++++++++++++++++-------- + 1 file changed, 160 insertions(+), 34 deletions(-) + +--- a/drivers/counter/104-quad-8.c ++++ b/drivers/counter/104-quad-8.c +@@ -42,6 +42,7 @@ MODULE_PARM_DESC(base, "ACCES 104-QUAD-8 + * @base: base port address of the IIO device + */ + struct quad8_iio { ++ struct mutex lock; + struct counter_device counter; + unsigned int preset[QUAD8_NUM_COUNTERS]; + unsigned int count_mode[QUAD8_NUM_COUNTERS]; +@@ -116,6 +117,8 @@ static int quad8_read_raw(struct iio_dev + /* Borrow XOR Carry effectively doubles count range */ + *val = (borrow ^ carry) << 24; + ++ mutex_lock(&priv->lock); ++ + /* Reset Byte Pointer; transfer Counter to Output Latch */ + outb(QUAD8_CTR_RLD | QUAD8_RLD_RESET_BP | QUAD8_RLD_CNTR_OUT, + base_offset + 1); +@@ -123,6 +126,8 @@ static int quad8_read_raw(struct iio_dev + for (i = 0; i < 3; i++) + *val |= (unsigned int)inb(base_offset) << (8 * i); + ++ mutex_unlock(&priv->lock); ++ + return IIO_VAL_INT; + case IIO_CHAN_INFO_ENABLE: + *val = priv->ab_enable[chan->channel]; +@@ -153,6 +158,8 @@ static int quad8_write_raw(struct iio_de + if ((unsigned int)val > 0xFFFFFF) + return -EINVAL; + ++ mutex_lock(&priv->lock); ++ + /* Reset Byte Pointer */ + outb(QUAD8_CTR_RLD | QUAD8_RLD_RESET_BP, base_offset + 1); + +@@ -176,12 +183,16 @@ static int quad8_write_raw(struct iio_de + /* Reset Error flag */ + outb(QUAD8_CTR_RLD | QUAD8_RLD_RESET_E, base_offset + 1); + ++ mutex_unlock(&priv->lock); ++ + return 0; + case IIO_CHAN_INFO_ENABLE: + /* only boolean values accepted */ + if (val < 0 || val > 1) + return -EINVAL; + ++ mutex_lock(&priv->lock); ++ + priv->ab_enable[chan->channel] = val; + + ior_cfg = val | priv->preset_enable[chan->channel] << 1; +@@ -189,11 +200,18 @@ static int quad8_write_raw(struct iio_de + /* Load I/O control configuration */ + outb(QUAD8_CTR_IOR | ior_cfg, base_offset + 1); + ++ mutex_unlock(&priv->lock); ++ + return 0; + case IIO_CHAN_INFO_SCALE: ++ mutex_lock(&priv->lock); ++ + /* Quadrature scaling only available in quadrature mode */ +- if (!priv->quadrature_mode[chan->channel] && (val2 || val != 1)) ++ if (!priv->quadrature_mode[chan->channel] && ++ (val2 || val != 1)) { ++ mutex_unlock(&priv->lock); + return -EINVAL; ++ } + + /* Only three gain states (1, 0.5, 0.25) */ + if (val == 1 && !val2) +@@ -207,11 +225,15 @@ static int quad8_write_raw(struct iio_de + priv->quadrature_scale[chan->channel] = 2; + break; + default: ++ mutex_unlock(&priv->lock); + return -EINVAL; + } +- else ++ else { ++ mutex_unlock(&priv->lock); + return -EINVAL; ++ } + ++ mutex_unlock(&priv->lock); + return 0; + } + +@@ -248,6 +270,8 @@ static ssize_t quad8_write_preset(struct + if (preset > 0xFFFFFF) + return -EINVAL; + ++ mutex_lock(&priv->lock); ++ + priv->preset[chan->channel] = preset; + + /* Reset Byte Pointer */ +@@ -257,6 +281,8 @@ static ssize_t quad8_write_preset(struct + for (i = 0; i < 3; i++) + outb(preset >> (8 * i), base_offset); + ++ mutex_unlock(&priv->lock); ++ + return len; + } + +@@ -286,6 +312,8 @@ static ssize_t quad8_write_set_to_preset + /* Preset enable is active low in Input/Output Control register */ + preset_enable = !preset_enable; + ++ mutex_lock(&priv->lock); ++ + priv->preset_enable[chan->channel] = preset_enable; + + ior_cfg = priv->ab_enable[chan->channel] | +@@ -294,6 +322,8 @@ static ssize_t quad8_write_set_to_preset + /* Load I/O control configuration to Input / Output Control Register */ + outb(QUAD8_CTR_IOR | ior_cfg, base_offset); + ++ mutex_unlock(&priv->lock); ++ + return len; + } + +@@ -351,6 +381,8 @@ static int quad8_set_count_mode(struct i + unsigned int mode_cfg = cnt_mode << 1; + const int base_offset = priv->base + 2 * chan->channel + 1; + ++ mutex_lock(&priv->lock); ++ + priv->count_mode[chan->channel] = cnt_mode; + + /* Add quadrature mode configuration */ +@@ -360,6 +392,8 @@ static int quad8_set_count_mode(struct i + /* Load mode configuration to Counter Mode Register */ + outb(QUAD8_CTR_CMR | mode_cfg, base_offset); + ++ mutex_unlock(&priv->lock); ++ + return 0; + } + +@@ -387,19 +421,26 @@ static int quad8_set_synchronous_mode(st + const struct iio_chan_spec *chan, unsigned int synchronous_mode) + { + struct quad8_iio *const priv = iio_priv(indio_dev); +- const unsigned int idr_cfg = synchronous_mode | +- priv->index_polarity[chan->channel] << 1; + const int base_offset = priv->base + 2 * chan->channel + 1; ++ unsigned int idr_cfg = synchronous_mode; ++ ++ mutex_lock(&priv->lock); ++ ++ idr_cfg |= priv->index_polarity[chan->channel] << 1; + + /* Index function must be non-synchronous in non-quadrature mode */ +- if (synchronous_mode && !priv->quadrature_mode[chan->channel]) ++ if (synchronous_mode && !priv->quadrature_mode[chan->channel]) { ++ mutex_unlock(&priv->lock); + return -EINVAL; ++ } + + priv->synchronous_mode[chan->channel] = synchronous_mode; + + /* Load Index Control configuration to Index Control Register */ + outb(QUAD8_CTR_IDR | idr_cfg, base_offset); + ++ mutex_unlock(&priv->lock); ++ + return 0; + } + +@@ -427,8 +468,12 @@ static int quad8_set_quadrature_mode(str + const struct iio_chan_spec *chan, unsigned int quadrature_mode) + { + struct quad8_iio *const priv = iio_priv(indio_dev); +- unsigned int mode_cfg = priv->count_mode[chan->channel] << 1; + const int base_offset = priv->base + 2 * chan->channel + 1; ++ unsigned int mode_cfg; ++ ++ mutex_lock(&priv->lock); ++ ++ mode_cfg = priv->count_mode[chan->channel] << 1; + + if (quadrature_mode) + mode_cfg |= (priv->quadrature_scale[chan->channel] + 1) << 3; +@@ -446,6 +491,8 @@ static int quad8_set_quadrature_mode(str + /* Load mode configuration to Counter Mode Register */ + outb(QUAD8_CTR_CMR | mode_cfg, base_offset); + ++ mutex_unlock(&priv->lock); ++ + return 0; + } + +@@ -473,15 +520,20 @@ static int quad8_set_index_polarity(stru + const struct iio_chan_spec *chan, unsigned int index_polarity) + { + struct quad8_iio *const priv = iio_priv(indio_dev); +- const unsigned int idr_cfg = priv->synchronous_mode[chan->channel] | +- index_polarity << 1; + const int base_offset = priv->base + 2 * chan->channel + 1; ++ unsigned int idr_cfg = index_polarity << 1; ++ ++ mutex_lock(&priv->lock); ++ ++ idr_cfg |= priv->synchronous_mode[chan->channel]; + + priv->index_polarity[chan->channel] = index_polarity; + + /* Load Index Control configuration to Index Control Register */ + outb(QUAD8_CTR_IDR | idr_cfg, base_offset); + ++ mutex_unlock(&priv->lock); ++ + return 0; + } + +@@ -582,7 +634,7 @@ static int quad8_signal_read(struct coun + static int quad8_count_read(struct counter_device *counter, + struct counter_count *count, unsigned long *val) + { +- const struct quad8_iio *const priv = counter->priv; ++ struct quad8_iio *const priv = counter->priv; + const int base_offset = priv->base + 2 * count->id; + unsigned int flags; + unsigned int borrow; +@@ -596,6 +648,8 @@ static int quad8_count_read(struct count + /* Borrow XOR Carry effectively doubles count range */ + *val = (unsigned long)(borrow ^ carry) << 24; + ++ mutex_lock(&priv->lock); ++ + /* Reset Byte Pointer; transfer Counter to Output Latch */ + outb(QUAD8_CTR_RLD | QUAD8_RLD_RESET_BP | QUAD8_RLD_CNTR_OUT, + base_offset + 1); +@@ -603,13 +657,15 @@ static int quad8_count_read(struct count + for (i = 0; i < 3; i++) + *val |= (unsigned long)inb(base_offset) << (8 * i); + ++ mutex_unlock(&priv->lock); ++ + return 0; + } + + static int quad8_count_write(struct counter_device *counter, + struct counter_count *count, unsigned long val) + { +- const struct quad8_iio *const priv = counter->priv; ++ struct quad8_iio *const priv = counter->priv; + const int base_offset = priv->base + 2 * count->id; + int i; + +@@ -617,6 +673,8 @@ static int quad8_count_write(struct coun + if (val > 0xFFFFFF) + return -EINVAL; + ++ mutex_lock(&priv->lock); ++ + /* Reset Byte Pointer */ + outb(QUAD8_CTR_RLD | QUAD8_RLD_RESET_BP, base_offset + 1); + +@@ -640,6 +698,8 @@ static int quad8_count_write(struct coun + /* Reset Error flag */ + outb(QUAD8_CTR_RLD | QUAD8_RLD_RESET_E, base_offset + 1); + ++ mutex_unlock(&priv->lock); ++ + return 0; + } + +@@ -660,13 +720,13 @@ static enum counter_count_function quad8 + static int quad8_function_get(struct counter_device *counter, + struct counter_count *count, size_t *function) + { +- const struct quad8_iio *const priv = counter->priv; ++ struct quad8_iio *const priv = counter->priv; + const int id = count->id; +- const unsigned int quadrature_mode = priv->quadrature_mode[id]; +- const unsigned int scale = priv->quadrature_scale[id]; + +- if (quadrature_mode) +- switch (scale) { ++ mutex_lock(&priv->lock); ++ ++ if (priv->quadrature_mode[id]) ++ switch (priv->quadrature_scale[id]) { + case 0: + *function = QUAD8_COUNT_FUNCTION_QUADRATURE_X1; + break; +@@ -680,6 +740,8 @@ static int quad8_function_get(struct cou + else + *function = QUAD8_COUNT_FUNCTION_PULSE_DIRECTION; + ++ mutex_unlock(&priv->lock); ++ + return 0; + } + +@@ -690,10 +752,15 @@ static int quad8_function_set(struct cou + const int id = count->id; + unsigned int *const quadrature_mode = priv->quadrature_mode + id; + unsigned int *const scale = priv->quadrature_scale + id; +- unsigned int mode_cfg = priv->count_mode[id] << 1; + unsigned int *const synchronous_mode = priv->synchronous_mode + id; +- const unsigned int idr_cfg = priv->index_polarity[id] << 1; + const int base_offset = priv->base + 2 * id + 1; ++ unsigned int mode_cfg; ++ unsigned int idr_cfg; ++ ++ mutex_lock(&priv->lock); ++ ++ mode_cfg = priv->count_mode[id] << 1; ++ idr_cfg = priv->index_polarity[id] << 1; + + if (function == QUAD8_COUNT_FUNCTION_PULSE_DIRECTION) { + *quadrature_mode = 0; +@@ -729,6 +796,8 @@ static int quad8_function_set(struct cou + /* Load mode configuration to Counter Mode Register */ + outb(QUAD8_CTR_CMR | mode_cfg, base_offset); + ++ mutex_unlock(&priv->lock); ++ + return 0; + } + +@@ -845,15 +914,20 @@ static int quad8_index_polarity_set(stru + { + struct quad8_iio *const priv = counter->priv; + const size_t channel_id = signal->id - 16; +- const unsigned int idr_cfg = priv->synchronous_mode[channel_id] | +- index_polarity << 1; + const int base_offset = priv->base + 2 * channel_id + 1; ++ unsigned int idr_cfg = index_polarity << 1; ++ ++ mutex_lock(&priv->lock); ++ ++ idr_cfg |= priv->synchronous_mode[channel_id]; + + priv->index_polarity[channel_id] = index_polarity; + + /* Load Index Control configuration to Index Control Register */ + outb(QUAD8_CTR_IDR | idr_cfg, base_offset); + ++ mutex_unlock(&priv->lock); ++ + return 0; + } + +@@ -880,19 +954,26 @@ static int quad8_synchronous_mode_set(st + { + struct quad8_iio *const priv = counter->priv; + const size_t channel_id = signal->id - 16; +- const unsigned int idr_cfg = synchronous_mode | +- priv->index_polarity[channel_id] << 1; + const int base_offset = priv->base + 2 * channel_id + 1; ++ unsigned int idr_cfg = synchronous_mode; ++ ++ mutex_lock(&priv->lock); ++ ++ idr_cfg |= priv->index_polarity[channel_id] << 1; + + /* Index function must be non-synchronous in non-quadrature mode */ +- if (synchronous_mode && !priv->quadrature_mode[channel_id]) ++ if (synchronous_mode && !priv->quadrature_mode[channel_id]) { ++ mutex_unlock(&priv->lock); + return -EINVAL; ++ } + + priv->synchronous_mode[channel_id] = synchronous_mode; + + /* Load Index Control configuration to Index Control Register */ + outb(QUAD8_CTR_IDR | idr_cfg, base_offset); + ++ mutex_unlock(&priv->lock); ++ + return 0; + } + +@@ -957,6 +1038,8 @@ static int quad8_count_mode_set(struct c + break; + } + ++ mutex_lock(&priv->lock); ++ + priv->count_mode[count->id] = cnt_mode; + + /* Set count mode configuration value */ +@@ -969,6 +1052,8 @@ static int quad8_count_mode_set(struct c + /* Load mode configuration to Counter Mode Register */ + outb(QUAD8_CTR_CMR | mode_cfg, base_offset); + ++ mutex_unlock(&priv->lock); ++ + return 0; + } + +@@ -1010,6 +1095,8 @@ static ssize_t quad8_count_enable_write( + if (err) + return err; + ++ mutex_lock(&priv->lock); ++ + priv->ab_enable[count->id] = ab_enable; + + ior_cfg = ab_enable | priv->preset_enable[count->id] << 1; +@@ -1017,6 +1104,8 @@ static ssize_t quad8_count_enable_write( + /* Load I/O control configuration */ + outb(QUAD8_CTR_IOR | ior_cfg, base_offset + 1); + ++ mutex_unlock(&priv->lock); ++ + return len; + } + +@@ -1045,14 +1134,28 @@ static ssize_t quad8_count_preset_read(s + return sprintf(buf, "%u\n", priv->preset[count->id]); + } + ++static void quad8_preset_register_set(struct quad8_iio *quad8iio, int id, ++ unsigned int preset) ++{ ++ const unsigned int base_offset = quad8iio->base + 2 * id; ++ int i; ++ ++ quad8iio->preset[id] = preset; ++ ++ /* Reset Byte Pointer */ ++ outb(QUAD8_CTR_RLD | QUAD8_RLD_RESET_BP, base_offset + 1); ++ ++ /* Set Preset Register */ ++ for (i = 0; i < 3; i++) ++ outb(preset >> (8 * i), base_offset); ++} ++ + static ssize_t quad8_count_preset_write(struct counter_device *counter, + struct counter_count *count, void *private, const char *buf, size_t len) + { + struct quad8_iio *const priv = counter->priv; +- const int base_offset = priv->base + 2 * count->id; + unsigned int preset; + int ret; +- int i; + + ret = kstrtouint(buf, 0, &preset); + if (ret) +@@ -1062,14 +1165,11 @@ static ssize_t quad8_count_preset_write( + if (preset > 0xFFFFFF) + return -EINVAL; + +- priv->preset[count->id] = preset; ++ mutex_lock(&priv->lock); + +- /* Reset Byte Pointer */ +- outb(QUAD8_CTR_RLD | QUAD8_RLD_RESET_BP, base_offset + 1); ++ quad8_preset_register_set(priv, count->id, preset); + +- /* Set Preset Register */ +- for (i = 0; i < 3; i++) +- outb(preset >> (8 * i), base_offset); ++ mutex_unlock(&priv->lock); + + return len; + } +@@ -1077,15 +1177,20 @@ static ssize_t quad8_count_preset_write( + static ssize_t quad8_count_ceiling_read(struct counter_device *counter, + struct counter_count *count, void *private, char *buf) + { +- const struct quad8_iio *const priv = counter->priv; ++ struct quad8_iio *const priv = counter->priv; ++ ++ mutex_lock(&priv->lock); + + /* Range Limit and Modulo-N count modes use preset value as ceiling */ + switch (priv->count_mode[count->id]) { + case 1: + case 3: +- return quad8_count_preset_read(counter, count, private, buf); ++ mutex_unlock(&priv->lock); ++ return sprintf(buf, "%u\n", priv->preset[count->id]); + } + ++ mutex_unlock(&priv->lock); ++ + /* By default 0x1FFFFFF (25 bits unsigned) is maximum count */ + return sprintf(buf, "33554431\n"); + } +@@ -1094,15 +1199,29 @@ static ssize_t quad8_count_ceiling_write + struct counter_count *count, void *private, const char *buf, size_t len) + { + struct quad8_iio *const priv = counter->priv; ++ unsigned int ceiling; ++ int ret; ++ ++ ret = kstrtouint(buf, 0, &ceiling); ++ if (ret) ++ return ret; ++ ++ /* Only 24-bit values are supported */ ++ if (ceiling > 0xFFFFFF) ++ return -EINVAL; ++ ++ mutex_lock(&priv->lock); + + /* Range Limit and Modulo-N count modes use preset value as ceiling */ + switch (priv->count_mode[count->id]) { + case 1: + case 3: +- return quad8_count_preset_write(counter, count, private, buf, +- len); ++ quad8_preset_register_set(priv, count->id, ceiling); ++ break; + } + ++ mutex_unlock(&priv->lock); ++ + return len; + } + +@@ -1130,6 +1249,8 @@ static ssize_t quad8_count_preset_enable + /* Preset enable is active low in Input/Output Control register */ + preset_enable = !preset_enable; + ++ mutex_lock(&priv->lock); ++ + priv->preset_enable[count->id] = preset_enable; + + ior_cfg = priv->ab_enable[count->id] | (unsigned int)preset_enable << 1; +@@ -1137,6 +1258,8 @@ static ssize_t quad8_count_preset_enable + /* Load I/O control configuration to Input / Output Control Register */ + outb(QUAD8_CTR_IOR | ior_cfg, base_offset); + ++ mutex_unlock(&priv->lock); ++ + return len; + } + +@@ -1307,6 +1430,9 @@ static int quad8_probe(struct device *de + quad8iio->counter.priv = quad8iio; + quad8iio->base = base[id]; + ++ /* Initialize mutex */ ++ mutex_init(&quad8iio->lock); ++ + /* Reset all counters and disable interrupt function */ + outb(QUAD8_CHAN_OP_RESET_COUNTERS, base[id] + QUAD8_REG_CHAN_OP); + /* Set initial configuration for all counters */ diff --git a/queue-5.6/drivers-soc-xilinx-fix-firmware-driver-kconfig-dependency.patch b/queue-5.6/drivers-soc-xilinx-fix-firmware-driver-kconfig-dependency.patch new file mode 100644 index 00000000000..b2804d9e02d --- /dev/null +++ b/queue-5.6/drivers-soc-xilinx-fix-firmware-driver-kconfig-dependency.patch @@ -0,0 +1,49 @@ +From d0384eedcde21276ac51f57c641f875605024b32 Mon Sep 17 00:00:00 2001 +From: Arnd Bergmann +Date: Wed, 8 Apr 2020 17:52:15 +0200 +Subject: drivers: soc: xilinx: fix firmware driver Kconfig dependency + +From: Arnd Bergmann + +commit d0384eedcde21276ac51f57c641f875605024b32 upstream. + +The firmware driver is optional, but the power driver depends on it, +which needs to be reflected in Kconfig to avoid link errors: + +aarch64-linux-ld: drivers/soc/xilinx/zynqmp_power.o: in function `zynqmp_pm_isr': +zynqmp_power.c:(.text+0x284): undefined reference to `zynqmp_pm_invoke_fn' + +The firmware driver can probably be allowed for compile-testing as +well, so it's best to drop the dependency on the ZYNQ platform +here and allow building as long as the firmware code is built-in. + +Fixes: ab272643d723 ("drivers: soc: xilinx: Add ZynqMP PM driver") +Signed-off-by: Arnd Bergmann +Link: https://lore.kernel.org/r/20200408155224.2070880-1-arnd@arndb.de +Signed-off-by: Michal Simek +Signed-off-by: Greg Kroah-Hartman + +--- + drivers/soc/xilinx/Kconfig | 4 ++-- + 1 file changed, 2 insertions(+), 2 deletions(-) + +--- a/drivers/soc/xilinx/Kconfig ++++ b/drivers/soc/xilinx/Kconfig +@@ -19,7 +19,7 @@ config XILINX_VCU + + config ZYNQMP_POWER + bool "Enable Xilinx Zynq MPSoC Power Management driver" +- depends on PM && ARCH_ZYNQMP ++ depends on PM && ZYNQMP_FIRMWARE + default y + select MAILBOX + select ZYNQMP_IPI_MBOX +@@ -35,7 +35,7 @@ config ZYNQMP_POWER + config ZYNQMP_PM_DOMAINS + bool "Enable Zynq MPSoC generic PM domains" + default y +- depends on PM && ARCH_ZYNQMP && ZYNQMP_FIRMWARE ++ depends on PM && ZYNQMP_FIRMWARE + select PM_GENERIC_DOMAINS + help + Say yes to enable device power management through PM domains diff --git a/queue-5.6/iio-ad7797-use-correct-attribute_group.patch b/queue-5.6/iio-ad7797-use-correct-attribute_group.patch new file mode 100644 index 00000000000..2b765d893e6 --- /dev/null +++ b/queue-5.6/iio-ad7797-use-correct-attribute_group.patch @@ -0,0 +1,36 @@ +From 28535877ac5b2b84f0d394fd67a5ec71c0c48b10 Mon Sep 17 00:00:00 2001 +From: YueHaibing +Date: Tue, 10 Mar 2020 22:16:54 +0800 +Subject: iio:ad7797: Use correct attribute_group + +From: YueHaibing + +commit 28535877ac5b2b84f0d394fd67a5ec71c0c48b10 upstream. + +It should use ad7797_attribute_group in ad7797_info, +according to commit ("iio:ad7793: Add support for the ad7796 and ad7797"). + +Scale is fixed for the ad7796 and not programmable, hence +should not have the scale_available attribute. + +Fixes: fd1a8b912841 ("iio:ad7793: Add support for the ad7796 and ad7797") +Signed-off-by: YueHaibing +Reviewed-by: Lars-Peter Clausen +Signed-off-by: Jonathan Cameron +Signed-off-by: Greg Kroah-Hartman + +--- + drivers/iio/adc/ad7793.c | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +--- a/drivers/iio/adc/ad7793.c ++++ b/drivers/iio/adc/ad7793.c +@@ -542,7 +542,7 @@ static const struct iio_info ad7797_info + .read_raw = &ad7793_read_raw, + .write_raw = &ad7793_write_raw, + .write_raw_get_fmt = &ad7793_write_raw_get_fmt, +- .attrs = &ad7793_attribute_group, ++ .attrs = &ad7797_attribute_group, + .validate_trigger = ad_sd_validate_trigger, + }; + diff --git a/queue-5.6/iio-imu-st_lsm6dsx-fix-read-misalignment-on-untagged-fifo.patch b/queue-5.6/iio-imu-st_lsm6dsx-fix-read-misalignment-on-untagged-fifo.patch new file mode 100644 index 00000000000..a80283ed732 --- /dev/null +++ b/queue-5.6/iio-imu-st_lsm6dsx-fix-read-misalignment-on-untagged-fifo.patch @@ -0,0 +1,116 @@ +From 7762902c89c4c78d32ec562f1ada44d02039104b Mon Sep 17 00:00:00 2001 +From: Lorenzo Bianconi +Date: Fri, 13 Mar 2020 18:54:41 +0100 +Subject: iio: imu: st_lsm6dsx: fix read misalignment on untagged FIFO + +From: Lorenzo Bianconi + +commit 7762902c89c4c78d32ec562f1ada44d02039104b upstream. + +st_lsm6dsx suffers of a read misalignment on untagged FIFO when +all 3 supported sensors (accel, gyro and ext device) are running +at different ODRs (the use-case is reported in the LSM6DSM Application +Note at pag 100). +Fix the issue taking into account decimation factor reading the FIFO +pattern. + +Fixes: e485e2a2cfd6 ("iio: imu: st_lsm6dsx: enable sensor-hub support for lsm6dsm") +Signed-off-by: Lorenzo Bianconi +Signed-off-by: Jonathan Cameron +Signed-off-by: Greg Kroah-Hartman + +--- + drivers/iio/imu/st_lsm6dsx/st_lsm6dsx.h | 2 ++ + drivers/iio/imu/st_lsm6dsx/st_lsm6dsx_buffer.c | 23 ++++++++++++++++------- + 2 files changed, 18 insertions(+), 7 deletions(-) + +--- a/drivers/iio/imu/st_lsm6dsx/st_lsm6dsx.h ++++ b/drivers/iio/imu/st_lsm6dsx/st_lsm6dsx.h +@@ -337,6 +337,7 @@ enum st_lsm6dsx_fifo_mode { + * @gain: Configured sensor sensitivity. + * @odr: Output data rate of the sensor [Hz]. + * @watermark: Sensor watermark level. ++ * @decimator: Sensor decimation factor. + * @sip: Number of samples in a given pattern. + * @ts_ref: Sensor timestamp reference for hw one. + * @ext_info: Sensor settings if it is connected to i2c controller +@@ -350,6 +351,7 @@ struct st_lsm6dsx_sensor { + u32 odr; + + u16 watermark; ++ u8 decimator; + u8 sip; + s64 ts_ref; + +--- a/drivers/iio/imu/st_lsm6dsx/st_lsm6dsx_buffer.c ++++ b/drivers/iio/imu/st_lsm6dsx/st_lsm6dsx_buffer.c +@@ -93,6 +93,7 @@ st_lsm6dsx_get_decimator_val(struct st_l + break; + } + ++ sensor->decimator = decimator; + return i == max_size ? 0 : st_lsm6dsx_decimator_table[i].val; + } + +@@ -337,7 +338,7 @@ static inline int st_lsm6dsx_read_block( + int st_lsm6dsx_read_fifo(struct st_lsm6dsx_hw *hw) + { + struct st_lsm6dsx_sensor *acc_sensor, *gyro_sensor, *ext_sensor = NULL; +- int err, acc_sip, gyro_sip, ts_sip, ext_sip, read_len, offset; ++ int err, sip, acc_sip, gyro_sip, ts_sip, ext_sip, read_len, offset; + u16 fifo_len, pattern_len = hw->sip * ST_LSM6DSX_SAMPLE_SIZE; + u16 fifo_diff_mask = hw->settings->fifo_ops.fifo_diff.mask; + u8 gyro_buff[ST_LSM6DSX_IIO_BUFF_SIZE]; +@@ -399,19 +400,20 @@ int st_lsm6dsx_read_fifo(struct st_lsm6d + acc_sip = acc_sensor->sip; + ts_sip = hw->ts_sip; + offset = 0; ++ sip = 0; + + while (acc_sip > 0 || gyro_sip > 0 || ext_sip > 0) { +- if (gyro_sip > 0) { ++ if (gyro_sip > 0 && !(sip % gyro_sensor->decimator)) { + memcpy(gyro_buff, &hw->buff[offset], + ST_LSM6DSX_SAMPLE_SIZE); + offset += ST_LSM6DSX_SAMPLE_SIZE; + } +- if (acc_sip > 0) { ++ if (acc_sip > 0 && !(sip % acc_sensor->decimator)) { + memcpy(acc_buff, &hw->buff[offset], + ST_LSM6DSX_SAMPLE_SIZE); + offset += ST_LSM6DSX_SAMPLE_SIZE; + } +- if (ext_sip > 0) { ++ if (ext_sip > 0 && !(sip % ext_sensor->decimator)) { + memcpy(ext_buff, &hw->buff[offset], + ST_LSM6DSX_SAMPLE_SIZE); + offset += ST_LSM6DSX_SAMPLE_SIZE; +@@ -441,18 +443,25 @@ int st_lsm6dsx_read_fifo(struct st_lsm6d + offset += ST_LSM6DSX_SAMPLE_SIZE; + } + +- if (gyro_sip-- > 0) ++ if (gyro_sip > 0 && !(sip % gyro_sensor->decimator)) { + iio_push_to_buffers_with_timestamp( + hw->iio_devs[ST_LSM6DSX_ID_GYRO], + gyro_buff, gyro_sensor->ts_ref + ts); +- if (acc_sip-- > 0) ++ gyro_sip--; ++ } ++ if (acc_sip > 0 && !(sip % acc_sensor->decimator)) { + iio_push_to_buffers_with_timestamp( + hw->iio_devs[ST_LSM6DSX_ID_ACC], + acc_buff, acc_sensor->ts_ref + ts); +- if (ext_sip-- > 0) ++ acc_sip--; ++ } ++ if (ext_sip > 0 && !(sip % ext_sensor->decimator)) { + iio_push_to_buffers_with_timestamp( + hw->iio_devs[ST_LSM6DSX_ID_EXT0], + ext_buff, ext_sensor->ts_ref + ts); ++ ext_sip--; ++ } ++ sip++; + } + } + diff --git a/queue-5.6/iio-imu-st_lsm6dsx-specify-slave-odr-in-slv_odr.patch b/queue-5.6/iio-imu-st_lsm6dsx-specify-slave-odr-in-slv_odr.patch new file mode 100644 index 00000000000..592f4ed7034 --- /dev/null +++ b/queue-5.6/iio-imu-st_lsm6dsx-specify-slave-odr-in-slv_odr.patch @@ -0,0 +1,106 @@ +From 76551a3c3df151750a842b003c6899e9c62e0fd2 Mon Sep 17 00:00:00 2001 +From: Lorenzo Bianconi +Date: Fri, 13 Mar 2020 18:54:42 +0100 +Subject: iio: imu: st_lsm6dsx: specify slave odr in slv_odr + +From: Lorenzo Bianconi + +commit 76551a3c3df151750a842b003c6899e9c62e0fd2 upstream. + +Introduce slv_odr in ext_info data structure in order to distinguish +between sensor hub trigger (accel sensor) odr and i2c slave odr and +properly compute samples in FIFO pattern + +Fixes: e485e2a2cfd6 ("iio: imu: st_lsm6dsx: enable sensor-hub support for lsm6dsm") +Signed-off-by: Lorenzo Bianconi +Signed-off-by: Jonathan Cameron +Signed-off-by: Greg Kroah-Hartman + +--- + drivers/iio/imu/st_lsm6dsx/st_lsm6dsx.h | 1 + drivers/iio/imu/st_lsm6dsx/st_lsm6dsx_shub.c | 29 ++++++++++++++++++++------- + 2 files changed, 23 insertions(+), 7 deletions(-) + +--- a/drivers/iio/imu/st_lsm6dsx/st_lsm6dsx.h ++++ b/drivers/iio/imu/st_lsm6dsx/st_lsm6dsx.h +@@ -357,6 +357,7 @@ struct st_lsm6dsx_sensor { + + struct { + const struct st_lsm6dsx_ext_dev_settings *settings; ++ u32 slv_odr; + u8 addr; + } ext_info; + }; +--- a/drivers/iio/imu/st_lsm6dsx/st_lsm6dsx_shub.c ++++ b/drivers/iio/imu/st_lsm6dsx/st_lsm6dsx_shub.c +@@ -421,7 +421,8 @@ int st_lsm6dsx_shub_set_enable(struct st + + settings = sensor->ext_info.settings; + if (enable) { +- err = st_lsm6dsx_shub_set_odr(sensor, sensor->odr); ++ err = st_lsm6dsx_shub_set_odr(sensor, ++ sensor->ext_info.slv_odr); + if (err < 0) + return err; + } else { +@@ -459,7 +460,7 @@ st_lsm6dsx_shub_read_oneshot(struct st_l + if (err < 0) + return err; + +- delay = 1000000000 / sensor->odr; ++ delay = 1000000000 / sensor->ext_info.slv_odr; + usleep_range(delay, 2 * delay); + + len = min_t(int, sizeof(data), ch->scan_type.realbits >> 3); +@@ -500,8 +501,8 @@ st_lsm6dsx_shub_read_raw(struct iio_dev + iio_device_release_direct_mode(iio_dev); + break; + case IIO_CHAN_INFO_SAMP_FREQ: +- *val = sensor->odr / 1000; +- *val2 = (sensor->odr % 1000) * 1000; ++ *val = sensor->ext_info.slv_odr / 1000; ++ *val2 = (sensor->ext_info.slv_odr % 1000) * 1000; + ret = IIO_VAL_INT_PLUS_MICRO; + break; + case IIO_CHAN_INFO_SCALE: +@@ -535,8 +536,20 @@ st_lsm6dsx_shub_write_raw(struct iio_dev + + val = val * 1000 + val2 / 1000; + err = st_lsm6dsx_shub_get_odr_val(sensor, val, &data); +- if (!err) +- sensor->odr = val; ++ if (!err) { ++ struct st_lsm6dsx_hw *hw = sensor->hw; ++ struct st_lsm6dsx_sensor *ref_sensor; ++ u8 odr_val; ++ int odr; ++ ++ ref_sensor = iio_priv(hw->iio_devs[ST_LSM6DSX_ID_ACC]); ++ odr = st_lsm6dsx_check_odr(ref_sensor, val, &odr_val); ++ if (odr < 0) ++ return odr; ++ ++ sensor->ext_info.slv_odr = val; ++ sensor->odr = odr; ++ } + break; + } + default: +@@ -613,6 +626,7 @@ st_lsm6dsx_shub_alloc_iiodev(struct st_l + const struct st_lsm6dsx_ext_dev_settings *info, + u8 i2c_addr, const char *name) + { ++ enum st_lsm6dsx_sensor_id ref_id = ST_LSM6DSX_ID_ACC; + struct iio_chan_spec *ext_channels; + struct st_lsm6dsx_sensor *sensor; + struct iio_dev *iio_dev; +@@ -628,7 +642,8 @@ st_lsm6dsx_shub_alloc_iiodev(struct st_l + sensor = iio_priv(iio_dev); + sensor->id = id; + sensor->hw = hw; +- sensor->odr = info->odr_table.odr_avl[0].milli_hz; ++ sensor->odr = hw->settings->odr_table[ref_id].odr_avl[0].milli_hz; ++ sensor->ext_info.slv_odr = info->odr_table.odr_avl[0].milli_hz; + sensor->gain = info->fs_table.fs_avl[0].gain; + sensor->ext_info.settings = info; + sensor->ext_info.addr = i2c_addr; diff --git a/queue-5.6/iwlwifi-actually-check-allocated-conf_tlv-pointer.patch b/queue-5.6/iwlwifi-actually-check-allocated-conf_tlv-pointer.patch new file mode 100644 index 00000000000..18b3fd00750 --- /dev/null +++ b/queue-5.6/iwlwifi-actually-check-allocated-conf_tlv-pointer.patch @@ -0,0 +1,37 @@ +From a176e114ace4cca7df0e34b4bd90c301cdc6d653 Mon Sep 17 00:00:00 2001 +From: Chris Rorvick +Date: Fri, 17 Apr 2020 09:45:58 +0200 +Subject: iwlwifi: actually check allocated conf_tlv pointer + +From: Chris Rorvick + +commit a176e114ace4cca7df0e34b4bd90c301cdc6d653 upstream. + +Commit 71bc0334a637 ("iwlwifi: check allocated pointer when allocating +conf_tlvs") attempted to fix a typoe introduced by commit 17b809c9b22e +("iwlwifi: dbg: move debug data to a struct") but does not implement the +check correctly. + +Fixes: 71bc0334a637 ("iwlwifi: check allocated pointer when allocating conf_tlvs") +Tweeted-by: @grsecurity +Signed-off-by: Chris Rorvick +Signed-off-by: Sedat Dilek +Signed-off-by: Kalle Valo +Link: https://lore.kernel.org/r/20200417074558.12316-1-sedat.dilek@gmail.com +Signed-off-by: Greg Kroah-Hartman + +--- + drivers/net/wireless/intel/iwlwifi/iwl-drv.c | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +--- a/drivers/net/wireless/intel/iwlwifi/iwl-drv.c ++++ b/drivers/net/wireless/intel/iwlwifi/iwl-drv.c +@@ -1467,7 +1467,7 @@ static void iwl_req_fw_callback(const st + kmemdup(pieces->dbg_conf_tlv[i], + pieces->dbg_conf_tlv_len[i], + GFP_KERNEL); +- if (!pieces->dbg_conf_tlv[i]) ++ if (!drv->fw.dbg.conf_tlv[i]) + goto out_free_fw; + } + } diff --git a/queue-5.6/kbuild-fix-dt-binding-schema-rule-again-to-avoid-needless-rebuilds.patch b/queue-5.6/kbuild-fix-dt-binding-schema-rule-again-to-avoid-needless-rebuilds.patch new file mode 100644 index 00000000000..284f097d952 --- /dev/null +++ b/queue-5.6/kbuild-fix-dt-binding-schema-rule-again-to-avoid-needless-rebuilds.patch @@ -0,0 +1,37 @@ +From 3d4b2238684ac919394eba7fb51bb7eeeec6ab57 Mon Sep 17 00:00:00 2001 +From: Masahiro Yamada +Date: Tue, 21 Apr 2020 12:35:28 +0900 +Subject: kbuild: fix DT binding schema rule again to avoid needless rebuilds + +From: Masahiro Yamada + +commit 3d4b2238684ac919394eba7fb51bb7eeeec6ab57 upstream. + +Since commit 7a0496056064 ("kbuild: fix DT binding schema rule to detect +command line changes"), this rule is every time re-run even if you change +nothing. + +cmd_dtc takes one additional parameter to pass to the -O option of dtc. + +We need to pass 'yaml' to if_changed_rule. Otherwise, cmd-check invoked +from if_changed_rule is false positive. + +Fixes: 7a0496056064 ("kbuild: fix DT binding schema rule to detect command line changes") +Signed-off-by: Masahiro Yamada +Signed-off-by: Greg Kroah-Hartman + +--- + scripts/Makefile.lib | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +--- a/scripts/Makefile.lib ++++ b/scripts/Makefile.lib +@@ -308,7 +308,7 @@ define rule_dtc + endef + + $(obj)/%.dt.yaml: $(src)/%.dts $(DTC) $(DT_TMP_SCHEMA) FORCE +- $(call if_changed_rule,dtc) ++ $(call if_changed_rule,dtc,yaml) + + dtc-tmp = $(subst $(comma),_,$(dot-target).dts.tmp) + diff --git a/queue-5.6/nfsd-memory-corruption-in-nfsd4_lock.patch b/queue-5.6/nfsd-memory-corruption-in-nfsd4_lock.patch new file mode 100644 index 00000000000..05f8e1598ec --- /dev/null +++ b/queue-5.6/nfsd-memory-corruption-in-nfsd4_lock.patch @@ -0,0 +1,37 @@ +From e1e8399eee72e9d5246d4d1bcacd793debe34dd3 Mon Sep 17 00:00:00 2001 +From: Vasily Averin +Date: Fri, 27 Mar 2020 07:50:40 +0300 +Subject: nfsd: memory corruption in nfsd4_lock() + +From: Vasily Averin + +commit e1e8399eee72e9d5246d4d1bcacd793debe34dd3 upstream. + +New struct nfsd4_blocked_lock allocated in find_or_allocate_block() +does not initialized nbl_list and nbl_lru. +If conflock allocation fails rollback can call list_del_init() +access uninitialized fields and corrupt memory. + +v2: just initialize nbl_list and nbl_lru right after nbl allocation. + +Fixes: 76d348fadff5 ("nfsd: have nfsd4_lock use blocking locks for v4.1+ lock") +Signed-off-by: Vasily Averin +Reviewed-by: Jeff Layton +Signed-off-by: Chuck Lever +Signed-off-by: Greg Kroah-Hartman + +--- + fs/nfsd/nfs4state.c | 2 ++ + 1 file changed, 2 insertions(+) + +--- a/fs/nfsd/nfs4state.c ++++ b/fs/nfsd/nfs4state.c +@@ -267,6 +267,8 @@ find_or_allocate_block(struct nfs4_locko + if (!nbl) { + nbl= kmalloc(sizeof(*nbl), GFP_KERNEL); + if (nbl) { ++ INIT_LIST_HEAD(&nbl->nbl_list); ++ INIT_LIST_HEAD(&nbl->nbl_lru); + fh_copy_shallow(&nbl->nbl_fh, fh); + locks_init_lock(&nbl->nbl_lock); + nfsd4_init_cb(&nbl->nbl_cb, lo->lo_owner.so_client, diff --git a/queue-5.6/propagate_one-mnt_set_mountpoint-needs-mount_lock.patch b/queue-5.6/propagate_one-mnt_set_mountpoint-needs-mount_lock.patch new file mode 100644 index 00000000000..adec60e5653 --- /dev/null +++ b/queue-5.6/propagate_one-mnt_set_mountpoint-needs-mount_lock.patch @@ -0,0 +1,45 @@ +From b0d3869ce9eeacbb1bbd541909beeef4126426d5 Mon Sep 17 00:00:00 2001 +From: Al Viro +Date: Mon, 27 Apr 2020 10:26:22 -0400 +Subject: propagate_one(): mnt_set_mountpoint() needs mount_lock + +From: Al Viro + +commit b0d3869ce9eeacbb1bbd541909beeef4126426d5 upstream. + +... to protect the modification of mp->m_count done by it. Most of +the places that modify that thing also have namespace_lock held, +but not all of them can do so, so we really need mount_lock here. +Kudos to Piotr Krysiuk , who'd spotted a related +bug in pivot_root(2) (fixed unnoticed in 5.3); search for other +similar turds has caught out this one. + +Cc: stable@kernel.org +Signed-off-by: Al Viro +Signed-off-by: Greg Kroah-Hartman + +--- + fs/pnode.c | 9 ++++----- + 1 file changed, 4 insertions(+), 5 deletions(-) + +--- a/fs/pnode.c ++++ b/fs/pnode.c +@@ -261,14 +261,13 @@ static int propagate_one(struct mount *m + child = copy_tree(last_source, last_source->mnt.mnt_root, type); + if (IS_ERR(child)) + return PTR_ERR(child); ++ read_seqlock_excl(&mount_lock); + mnt_set_mountpoint(m, mp, child); ++ if (m->mnt_master != dest_master) ++ SET_MNT_MARK(m->mnt_master); ++ read_sequnlock_excl(&mount_lock); + last_dest = m; + last_source = child; +- if (m->mnt_master != dest_master) { +- read_seqlock_excl(&mount_lock); +- SET_MNT_MARK(m->mnt_master); +- read_sequnlock_excl(&mount_lock); +- } + hlist_add_head(&child->mnt_hash, list); + return count_mounts(m->mnt_ns, child); + } diff --git a/queue-5.6/s390-ftrace-fix-potential-crashes-when-switching-tracers.patch b/queue-5.6/s390-ftrace-fix-potential-crashes-when-switching-tracers.patch new file mode 100644 index 00000000000..86d965c5a6b --- /dev/null +++ b/queue-5.6/s390-ftrace-fix-potential-crashes-when-switching-tracers.patch @@ -0,0 +1,70 @@ +From 8ebf6da9db1b2a20bb86cc1bee2552e894d03308 Mon Sep 17 00:00:00 2001 +From: Philipp Rudo +Date: Mon, 6 Apr 2020 14:47:48 +0200 +Subject: s390/ftrace: fix potential crashes when switching tracers + +From: Philipp Rudo + +commit 8ebf6da9db1b2a20bb86cc1bee2552e894d03308 upstream. + +Switching tracers include instruction patching. To prevent that a +instruction is patched while it's read the instruction patching is done +in stop_machine 'context'. This also means that any function called +during stop_machine must not be traced. Thus add 'notrace' to all +functions called within stop_machine. + +Fixes: 1ec2772e0c3c ("s390/diag: add a statistic for diagnose calls") +Fixes: 38f2c691a4b3 ("s390: improve wait logic of stop_machine") +Fixes: 4ecf0a43e729 ("processor: get rid of cpu_relax_yield") +Signed-off-by: Philipp Rudo +Signed-off-by: Vasily Gorbik +Signed-off-by: Greg Kroah-Hartman + +--- + arch/s390/kernel/diag.c | 2 +- + arch/s390/kernel/smp.c | 4 ++-- + arch/s390/kernel/trace.c | 2 +- + 3 files changed, 4 insertions(+), 4 deletions(-) + +--- a/arch/s390/kernel/diag.c ++++ b/arch/s390/kernel/diag.c +@@ -133,7 +133,7 @@ void diag_stat_inc(enum diag_stat_enum n + } + EXPORT_SYMBOL(diag_stat_inc); + +-void diag_stat_inc_norecursion(enum diag_stat_enum nr) ++void notrace diag_stat_inc_norecursion(enum diag_stat_enum nr) + { + this_cpu_inc(diag_stat.counter[nr]); + trace_s390_diagnose_norecursion(diag_map[nr].code); +--- a/arch/s390/kernel/smp.c ++++ b/arch/s390/kernel/smp.c +@@ -403,7 +403,7 @@ int smp_find_processor_id(u16 address) + return -1; + } + +-bool arch_vcpu_is_preempted(int cpu) ++bool notrace arch_vcpu_is_preempted(int cpu) + { + if (test_cpu_flag_of(CIF_ENABLED_WAIT, cpu)) + return false; +@@ -413,7 +413,7 @@ bool arch_vcpu_is_preempted(int cpu) + } + EXPORT_SYMBOL(arch_vcpu_is_preempted); + +-void smp_yield_cpu(int cpu) ++void notrace smp_yield_cpu(int cpu) + { + if (!MACHINE_HAS_DIAG9C) + return; +--- a/arch/s390/kernel/trace.c ++++ b/arch/s390/kernel/trace.c +@@ -14,7 +14,7 @@ EXPORT_TRACEPOINT_SYMBOL(s390_diagnose); + + static DEFINE_PER_CPU(unsigned int, diagnose_trace_depth); + +-void trace_s390_diagnose_norecursion(int diag_nr) ++void notrace trace_s390_diagnose_norecursion(int diag_nr) + { + unsigned long flags; + unsigned int *depth; diff --git a/queue-5.6/series b/queue-5.6/series index 82ce1951a29..9718f2fdf90 100644 --- a/queue-5.6/series +++ b/queue-5.6/series @@ -1,3 +1,26 @@ ubifs-fix-ubifs_tnc_lookup-usage-in-do_kill_orphans.patch printk-queue-wake_up_klogd-irq_work-only-if-per-cpu-areas-are-ready.patch asoc-stm32-sai-fix-sai-probe.patch +usb-dwc3-gadget-do-link-recovery-for-ss-and-ssp.patch +arm-dts-bcm283x-add-cells-encoding-format-to-firmware-bus.patch +kbuild-fix-dt-binding-schema-rule-again-to-avoid-needless-rebuilds.patch +usb-gadget-udc-bdc-remove-unnecessary-null-checks-in-bdc_req_complete.patch +usb-gadget-udc-atmel-fix-vbus-disconnect-handling.patch +afs-make-record-checking-use-task_uninterruptible-when-appropriate.patch +afs-fix-to-actually-set-afs_server_fl_have_epoch.patch +iio-ad7797-use-correct-attribute_group.patch +iio-imu-st_lsm6dsx-fix-read-misalignment-on-untagged-fifo.patch +iio-imu-st_lsm6dsx-specify-slave-odr-in-slv_odr.patch +propagate_one-mnt_set_mountpoint-needs-mount_lock.patch +counter-104-quad-8-add-lock-guards-generic-interface.patch +s390-ftrace-fix-potential-crashes-when-switching-tracers.patch +asoc-q6dsp6-q6afe-dai-add-missing-channels-to-mi2s-dais.patch +iwlwifi-actually-check-allocated-conf_tlv-pointer.patch +asoc-samsung-s3c24xx-i2s-fix-build-after-removal-of-dai-suspend-resume.patch +asoc-tas571x-disable-regulators-on-failed-probe.patch +asoc-meson-axg-card-fix-codec-to-codec-link-setup.patch +asoc-wm8960-fix-wrong-clock-after-suspend-resume.patch +drivers-soc-xilinx-fix-firmware-driver-kconfig-dependency.patch +nfsd-memory-corruption-in-nfsd4_lock.patch +arm-dts-omap3-disable-rng-on-n950-n9.patch +bpf-forbid-xadd-on-spilled-pointers-for-unprivileged-users.patch diff --git a/queue-5.6/usb-dwc3-gadget-do-link-recovery-for-ss-and-ssp.patch b/queue-5.6/usb-dwc3-gadget-do-link-recovery-for-ss-and-ssp.patch new file mode 100644 index 00000000000..fe6ec3219f8 --- /dev/null +++ b/queue-5.6/usb-dwc3-gadget-do-link-recovery-for-ss-and-ssp.patch @@ -0,0 +1,54 @@ +From d0550cd20e52558ecf6847a0f96ebd5d944c17e4 Mon Sep 17 00:00:00 2001 +From: Thinh Nguyen +Date: Fri, 31 Jan 2020 16:25:50 -0800 +Subject: usb: dwc3: gadget: Do link recovery for SS and SSP + +From: Thinh Nguyen + +commit d0550cd20e52558ecf6847a0f96ebd5d944c17e4 upstream. + +The controller always supports link recovery for device in SS and SSP. +Remove the speed limit check. Also, when the device is in RESUME or +RESET state, it means the controller received the resume/reset request. +The driver must send the link recovery to acknowledge the request. They +are valid states for the driver to send link recovery. + +Fixes: 72246da40f37 ("usb: Introduce DesignWare USB3 DRD Driver") +Fixes: ee5cd41c9117 ("usb: dwc3: Update speed checks for SuperSpeedPlus") +Signed-off-by: Thinh Nguyen +Signed-off-by: Felipe Balbi +Signed-off-by: Greg Kroah-Hartman + +--- + drivers/usb/dwc3/gadget.c | 8 ++------ + 1 file changed, 2 insertions(+), 6 deletions(-) + +--- a/drivers/usb/dwc3/gadget.c ++++ b/drivers/usb/dwc3/gadget.c +@@ -1728,7 +1728,6 @@ static int __dwc3_gadget_wakeup(struct d + u32 reg; + + u8 link_state; +- u8 speed; + + /* + * According to the Databook Remote wakeup request should +@@ -1738,16 +1737,13 @@ static int __dwc3_gadget_wakeup(struct d + */ + reg = dwc3_readl(dwc->regs, DWC3_DSTS); + +- speed = reg & DWC3_DSTS_CONNECTSPD; +- if ((speed == DWC3_DSTS_SUPERSPEED) || +- (speed == DWC3_DSTS_SUPERSPEED_PLUS)) +- return 0; +- + link_state = DWC3_DSTS_USBLNKST(reg); + + switch (link_state) { ++ case DWC3_LINK_STATE_RESET: + case DWC3_LINK_STATE_RX_DET: /* in HS, means Early Suspend */ + case DWC3_LINK_STATE_U3: /* in HS, means SUSPEND */ ++ case DWC3_LINK_STATE_RESUME: + break; + default: + return -EINVAL; diff --git a/queue-5.6/usb-gadget-udc-atmel-fix-vbus-disconnect-handling.patch b/queue-5.6/usb-gadget-udc-atmel-fix-vbus-disconnect-handling.patch new file mode 100644 index 00000000000..00fb626d310 --- /dev/null +++ b/queue-5.6/usb-gadget-udc-atmel-fix-vbus-disconnect-handling.patch @@ -0,0 +1,38 @@ +From 12b94da411f9c6d950beb067d913024fd5617a61 Mon Sep 17 00:00:00 2001 +From: Cristian Birsan +Date: Fri, 10 Apr 2020 15:14:52 +0300 +Subject: usb: gadget: udc: atmel: Fix vbus disconnect handling + +From: Cristian Birsan + +commit 12b94da411f9c6d950beb067d913024fd5617a61 upstream. + +A DMA transfer can be in progress while vbus is lost due to a cable +disconnect. For endpoints that use DMA, this condition can lead to +peripheral hang. The patch ensures that endpoints are disabled before +the clocks are stopped to prevent this issue. + +Fixes: a64ef71ddc13 ("usb: gadget: atmel_usba_udc: condition clocks to vbus state") +Signed-off-by: Cristian Birsan +Signed-off-by: Felipe Balbi +Signed-off-by: Greg Kroah-Hartman + +--- + drivers/usb/gadget/udc/atmel_usba_udc.c | 4 ++-- + 1 file changed, 2 insertions(+), 2 deletions(-) + +--- a/drivers/usb/gadget/udc/atmel_usba_udc.c ++++ b/drivers/usb/gadget/udc/atmel_usba_udc.c +@@ -1951,10 +1951,10 @@ static irqreturn_t usba_vbus_irq_thread( + usba_start(udc); + } else { + udc->suspended = false; +- usba_stop(udc); +- + if (udc->driver->disconnect) + udc->driver->disconnect(&udc->gadget); ++ ++ usba_stop(udc); + } + udc->vbus_prev = vbus; + } diff --git a/queue-5.6/usb-gadget-udc-bdc-remove-unnecessary-null-checks-in-bdc_req_complete.patch b/queue-5.6/usb-gadget-udc-bdc-remove-unnecessary-null-checks-in-bdc_req_complete.patch new file mode 100644 index 00000000000..ecd99f3602b --- /dev/null +++ b/queue-5.6/usb-gadget-udc-bdc-remove-unnecessary-null-checks-in-bdc_req_complete.patch @@ -0,0 +1,47 @@ +From 09b04abb70f096333bef6bc95fa600b662e7ee13 Mon Sep 17 00:00:00 2001 +From: Nathan Chancellor +Date: Sat, 28 Mar 2020 18:12:46 -0700 +Subject: usb: gadget: udc: bdc: Remove unnecessary NULL checks in bdc_req_complete + +From: Nathan Chancellor + +commit 09b04abb70f096333bef6bc95fa600b662e7ee13 upstream. + +When building with Clang + -Wtautological-pointer-compare: + +drivers/usb/gadget/udc/bdc/bdc_ep.c:543:28: warning: comparison of +address of 'req->queue' equal to a null pointer is always false +[-Wtautological-pointer-compare] + if (req == NULL || &req->queue == NULL || &req->usb_req == NULL) + ~~~~~^~~~~ ~~~~ +drivers/usb/gadget/udc/bdc/bdc_ep.c:543:51: warning: comparison of +address of 'req->usb_req' equal to a null pointer is always false +[-Wtautological-pointer-compare] + if (req == NULL || &req->queue == NULL || &req->usb_req == NULL) + ~~~~~^~~~~~~ ~~~~ +2 warnings generated. + +As it notes, these statements will always evaluate to false so remove +them. + +Fixes: efed421a94e6 ("usb: gadget: Add UDC driver for Broadcom USB3.0 device controller IP BDC") +Link: https://github.com/ClangBuiltLinux/linux/issues/749 +Signed-off-by: Nathan Chancellor +Signed-off-by: Felipe Balbi +Signed-off-by: Greg Kroah-Hartman + +--- + drivers/usb/gadget/udc/bdc/bdc_ep.c | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +--- a/drivers/usb/gadget/udc/bdc/bdc_ep.c ++++ b/drivers/usb/gadget/udc/bdc/bdc_ep.c +@@ -540,7 +540,7 @@ static void bdc_req_complete(struct bdc_ + { + struct bdc *bdc = ep->bdc; + +- if (req == NULL || &req->queue == NULL || &req->usb_req == NULL) ++ if (req == NULL) + return; + + dev_dbg(bdc->dev, "%s ep:%s status:%d\n", __func__, ep->name, status);