From 413cd9de55316b365383a62300c69d3df10ea53a Mon Sep 17 00:00:00 2001 From: Greg Kroah-Hartman Date: Fri, 17 Jan 2020 00:05:35 +0100 Subject: [PATCH] 4.14-stable patches added patches: af_unix-add-compat_ioctl-support.patch arm64-dts-apq8096-db820c-increase-load-on-l21-for-sdcard.patch compat_ioctl-handle-siocoutqnsd.patch f2fs-fix-potential-overflow.patch media-exynos4-is-fix-recursive-locking-in-isp_video_release.patch media-ov6650-fix-.get_fmt-v4l2_subdev_format_try-support.patch media-ov6650-fix-incorrect-use-of-jpeg-colorspace.patch media-ov6650-fix-some-format-attributes-not-under-control.patch mtd-spi-nor-fix-silent-truncation-in-spi_nor_read.patch mtd-spi-nor-fix-silent-truncation-in-spi_nor_read_raw.patch pci-ptm-remove-spurious-d-from-granularity-message.patch powerpc-powernv-disable-native-pcie-port-management.patch rtc-msm6242-fix-reading-of-10-hour-digit.patch rtlwifi-remove-unnecessary-null-check-in-rtl_regd_init.patch scsi-sd-enable-compat-ioctls-for-sed-opal.patch spi-atmel-fix-handling-of-cs_change-set-on-non-last-xfer.patch tty-serial-imx-use-the-sg-count-from-dma_map_sg.patch tty-serial-pch_uart-correct-usage-of-dma_unmap_sg.patch --- .../af_unix-add-compat_ioctl-support.patch | 85 ++++++++++++ ...820c-increase-load-on-l21-for-sdcard.patch | 35 +++++ .../compat_ioctl-handle-siocoutqnsd.patch | 34 +++++ queue-4.14/f2fs-fix-potential-overflow.patch | 48 +++++++ ...cursive-locking-in-isp_video_release.patch | 36 +++++ ...t_fmt-v4l2_subdev_format_try-support.patch | 52 +++++++ ...fix-incorrect-use-of-jpeg-colorspace.patch | 94 +++++++++++++ ...-format-attributes-not-under-control.patch | 128 ++++++++++++++++++ ...ix-silent-truncation-in-spi_nor_read.patch | 34 +++++ ...ilent-truncation-in-spi_nor_read_raw.patch | 34 +++++ ...-spurious-d-from-granularity-message.patch | 37 +++++ ...-disable-native-pcie-port-management.patch | 76 +++++++++++ ...msm6242-fix-reading-of-10-hour-digit.patch | 40 ++++++ ...ecessary-null-check-in-rtl_regd_init.patch | 51 +++++++ ...sd-enable-compat-ioctls-for-sed-opal.patch | 61 +++++++++ queue-4.14/series | 18 +++ ...ng-of-cs_change-set-on-non-last-xfer.patch | 63 +++++++++ ...imx-use-the-sg-count-from-dma_map_sg.patch | 33 +++++ ...h_uart-correct-usage-of-dma_unmap_sg.patch | 65 +++++++++ 19 files changed, 1024 insertions(+) create mode 100644 queue-4.14/af_unix-add-compat_ioctl-support.patch create mode 100644 queue-4.14/arm64-dts-apq8096-db820c-increase-load-on-l21-for-sdcard.patch create mode 100644 queue-4.14/compat_ioctl-handle-siocoutqnsd.patch create mode 100644 queue-4.14/f2fs-fix-potential-overflow.patch create mode 100644 queue-4.14/media-exynos4-is-fix-recursive-locking-in-isp_video_release.patch create mode 100644 queue-4.14/media-ov6650-fix-.get_fmt-v4l2_subdev_format_try-support.patch create mode 100644 queue-4.14/media-ov6650-fix-incorrect-use-of-jpeg-colorspace.patch create mode 100644 queue-4.14/media-ov6650-fix-some-format-attributes-not-under-control.patch create mode 100644 queue-4.14/mtd-spi-nor-fix-silent-truncation-in-spi_nor_read.patch create mode 100644 queue-4.14/mtd-spi-nor-fix-silent-truncation-in-spi_nor_read_raw.patch create mode 100644 queue-4.14/pci-ptm-remove-spurious-d-from-granularity-message.patch create mode 100644 queue-4.14/powerpc-powernv-disable-native-pcie-port-management.patch create mode 100644 queue-4.14/rtc-msm6242-fix-reading-of-10-hour-digit.patch create mode 100644 queue-4.14/rtlwifi-remove-unnecessary-null-check-in-rtl_regd_init.patch create mode 100644 queue-4.14/scsi-sd-enable-compat-ioctls-for-sed-opal.patch create mode 100644 queue-4.14/spi-atmel-fix-handling-of-cs_change-set-on-non-last-xfer.patch create mode 100644 queue-4.14/tty-serial-imx-use-the-sg-count-from-dma_map_sg.patch create mode 100644 queue-4.14/tty-serial-pch_uart-correct-usage-of-dma_unmap_sg.patch diff --git a/queue-4.14/af_unix-add-compat_ioctl-support.patch b/queue-4.14/af_unix-add-compat_ioctl-support.patch new file mode 100644 index 00000000000..ad3c19ec7a8 --- /dev/null +++ b/queue-4.14/af_unix-add-compat_ioctl-support.patch @@ -0,0 +1,85 @@ +From 5f6beb9e0f633f3cc845cdd67973c506372931b4 Mon Sep 17 00:00:00 2001 +From: Arnd Bergmann +Date: Mon, 3 Jun 2019 22:03:44 +0200 +Subject: af_unix: add compat_ioctl support + +From: Arnd Bergmann + +commit 5f6beb9e0f633f3cc845cdd67973c506372931b4 upstream. + +The af_unix protocol family has a custom ioctl command (inexplicibly +based on SIOCPROTOPRIVATE), but never had a compat_ioctl handler for +32-bit applications. + +Since all commands are compatible here, add a trivial wrapper that +performs the compat_ptr() conversion for SIOCOUTQ/SIOCINQ. SIOCUNIXFILE +does not use the argument, but it doesn't hurt to also use compat_ptr() +here. + +Fixes: ba94f3088b79 ("unix: add ioctl to open a unix socket file with O_PATH") +Cc: netdev@vger.kernel.org +Cc: "David S. Miller" +Cc: Eric Dumazet +Signed-off-by: Arnd Bergmann +Signed-off-by: Greg Kroah-Hartman + +--- + net/unix/af_unix.c | 19 +++++++++++++++++++ + 1 file changed, 19 insertions(+) + +--- a/net/unix/af_unix.c ++++ b/net/unix/af_unix.c +@@ -644,6 +644,9 @@ static unsigned int unix_poll(struct fil + static unsigned int unix_dgram_poll(struct file *, struct socket *, + poll_table *); + static int unix_ioctl(struct socket *, unsigned int, unsigned long); ++#ifdef CONFIG_COMPAT ++static int unix_compat_ioctl(struct socket *sock, unsigned int cmd, unsigned long arg); ++#endif + static int unix_shutdown(struct socket *, int); + static int unix_stream_sendmsg(struct socket *, struct msghdr *, size_t); + static int unix_stream_recvmsg(struct socket *, struct msghdr *, size_t, int); +@@ -685,6 +688,9 @@ static const struct proto_ops unix_strea + .getname = unix_getname, + .poll = unix_poll, + .ioctl = unix_ioctl, ++#ifdef CONFIG_COMPAT ++ .compat_ioctl = unix_compat_ioctl, ++#endif + .listen = unix_listen, + .shutdown = unix_shutdown, + .setsockopt = sock_no_setsockopt, +@@ -708,6 +714,9 @@ static const struct proto_ops unix_dgram + .getname = unix_getname, + .poll = unix_dgram_poll, + .ioctl = unix_ioctl, ++#ifdef CONFIG_COMPAT ++ .compat_ioctl = unix_compat_ioctl, ++#endif + .listen = sock_no_listen, + .shutdown = unix_shutdown, + .setsockopt = sock_no_setsockopt, +@@ -730,6 +739,9 @@ static const struct proto_ops unix_seqpa + .getname = unix_getname, + .poll = unix_dgram_poll, + .ioctl = unix_ioctl, ++#ifdef CONFIG_COMPAT ++ .compat_ioctl = unix_compat_ioctl, ++#endif + .listen = unix_listen, + .shutdown = unix_shutdown, + .setsockopt = sock_no_setsockopt, +@@ -2650,6 +2662,13 @@ static int unix_ioctl(struct socket *soc + return err; + } + ++#ifdef CONFIG_COMPAT ++static int unix_compat_ioctl(struct socket *sock, unsigned int cmd, unsigned long arg) ++{ ++ return unix_ioctl(sock, cmd, (unsigned long)compat_ptr(arg)); ++} ++#endif ++ + static unsigned int unix_poll(struct file *file, struct socket *sock, poll_table *wait) + { + struct sock *sk = sock->sk; diff --git a/queue-4.14/arm64-dts-apq8096-db820c-increase-load-on-l21-for-sdcard.patch b/queue-4.14/arm64-dts-apq8096-db820c-increase-load-on-l21-for-sdcard.patch new file mode 100644 index 00000000000..0c46ed707d7 --- /dev/null +++ b/queue-4.14/arm64-dts-apq8096-db820c-increase-load-on-l21-for-sdcard.patch @@ -0,0 +1,35 @@ +From e38161bd325ea541ef2f258d8e28281077dde524 Mon Sep 17 00:00:00 2001 +From: Loic Poulain +Date: Wed, 12 Dec 2018 18:13:26 +0100 +Subject: arm64: dts: apq8096-db820c: Increase load on l21 for SDCARD + +From: Loic Poulain + +commit e38161bd325ea541ef2f258d8e28281077dde524 upstream. + +In the same way as for msm8974-hammerhead, l21 load, used for SDCARD +VMMC, needs to be increased in order to prevent any voltage drop issues +(due to limited current) happening with some SDCARDS or during specific +operations (e.g. write). + +Reviewed-by: Bjorn Andersson +Fixes: 660a9763c6a9 (arm64: dts: qcom: db820c: Add pm8994 regulator node) +Signed-off-by: Loic Poulain +Signed-off-by: Bjorn Andersson +Signed-off-by: Greg Kroah-Hartman + +--- + arch/arm64/boot/dts/qcom/apq8096-db820c.dtsi | 2 ++ + 1 file changed, 2 insertions(+) + +--- a/arch/arm64/boot/dts/qcom/apq8096-db820c.dtsi ++++ b/arch/arm64/boot/dts/qcom/apq8096-db820c.dtsi +@@ -262,6 +262,8 @@ + l21 { + regulator-min-microvolt = <2950000>; + regulator-max-microvolt = <2950000>; ++ regulator-allow-set-load; ++ regulator-system-load = <200000>; + }; + l22 { + regulator-min-microvolt = <3300000>; diff --git a/queue-4.14/compat_ioctl-handle-siocoutqnsd.patch b/queue-4.14/compat_ioctl-handle-siocoutqnsd.patch new file mode 100644 index 00000000000..07db315573b --- /dev/null +++ b/queue-4.14/compat_ioctl-handle-siocoutqnsd.patch @@ -0,0 +1,34 @@ +From 9d7bf41fafa5b5ddd4c13eb39446b0045f0a8167 Mon Sep 17 00:00:00 2001 +From: Arnd Bergmann +Date: Mon, 3 Jun 2019 23:06:00 +0200 +Subject: compat_ioctl: handle SIOCOUTQNSD + +From: Arnd Bergmann + +commit 9d7bf41fafa5b5ddd4c13eb39446b0045f0a8167 upstream. + +Unlike the normal SIOCOUTQ, SIOCOUTQNSD was never handled in compat +mode. Add it to the common socket compat handler along with similar +ones. + +Fixes: 2f4e1b397097 ("tcp: ioctl type SIOCOUTQNSD returns amount of data not sent") +Cc: Eric Dumazet +Cc: netdev@vger.kernel.org +Cc: "David S. Miller" +Signed-off-by: Arnd Bergmann +Signed-off-by: Greg Kroah-Hartman + +--- + net/socket.c | 1 + + 1 file changed, 1 insertion(+) + +--- a/net/socket.c ++++ b/net/socket.c +@@ -3267,6 +3267,7 @@ static int compat_sock_ioctl_trans(struc + case SIOCSARP: + case SIOCGARP: + case SIOCDARP: ++ case SIOCOUTQNSD: + case SIOCATMARK: + return sock_do_ioctl(net, sock, cmd, arg); + } diff --git a/queue-4.14/f2fs-fix-potential-overflow.patch b/queue-4.14/f2fs-fix-potential-overflow.patch new file mode 100644 index 00000000000..b05dcb0bd4b --- /dev/null +++ b/queue-4.14/f2fs-fix-potential-overflow.patch @@ -0,0 +1,48 @@ +From 1f0d5c911b64165c9754139a26c8c2fad352c132 Mon Sep 17 00:00:00 2001 +From: Chao Yu +Date: Thu, 7 Nov 2019 17:29:00 +0800 +Subject: f2fs: fix potential overflow + +From: Chao Yu + +commit 1f0d5c911b64165c9754139a26c8c2fad352c132 upstream. + +We expect 64-bit calculation result from below statement, however +in 32-bit machine, looped left shift operation on pgoff_t type +variable may cause overflow issue, fix it by forcing type cast. + +page->index << PAGE_SHIFT; + +Fixes: 26de9b117130 ("f2fs: avoid unnecessary updating inode during fsync") +Fixes: 0a2aa8fbb969 ("f2fs: refactor __exchange_data_block for speed up") +Signed-off-by: Chao Yu +Signed-off-by: Jaegeuk Kim +Signed-off-by: Greg Kroah-Hartman + +--- + fs/f2fs/data.c | 2 +- + fs/f2fs/file.c | 2 +- + 2 files changed, 2 insertions(+), 2 deletions(-) + +--- a/fs/f2fs/data.c ++++ b/fs/f2fs/data.c +@@ -1512,7 +1512,7 @@ static int __write_data_page(struct page + loff_t i_size = i_size_read(inode); + const pgoff_t end_index = ((unsigned long long) i_size) + >> PAGE_SHIFT; +- loff_t psize = (page->index + 1) << PAGE_SHIFT; ++ loff_t psize = (loff_t)(page->index + 1) << PAGE_SHIFT; + unsigned offset = 0; + bool need_balance_fs = false; + int err = 0; +--- a/fs/f2fs/file.c ++++ b/fs/f2fs/file.c +@@ -1059,7 +1059,7 @@ static int __clone_blkaddrs(struct inode + } + dn.ofs_in_node++; + i++; +- new_size = (dst + i) << PAGE_SHIFT; ++ new_size = (loff_t)(dst + i) << PAGE_SHIFT; + if (dst_inode->i_size < new_size) + f2fs_i_size_write(dst_inode, new_size); + } while (--ilen && (do_replace[i] || blkaddr[i] == NULL_ADDR)); diff --git a/queue-4.14/media-exynos4-is-fix-recursive-locking-in-isp_video_release.patch b/queue-4.14/media-exynos4-is-fix-recursive-locking-in-isp_video_release.patch new file mode 100644 index 00000000000..8397a240d2d --- /dev/null +++ b/queue-4.14/media-exynos4-is-fix-recursive-locking-in-isp_video_release.patch @@ -0,0 +1,36 @@ +From 704c6c80fb471d1bb0ef0d61a94617d1d55743cd Mon Sep 17 00:00:00 2001 +From: Seung-Woo Kim +Date: Fri, 18 Oct 2019 07:20:52 -0300 +Subject: media: exynos4-is: Fix recursive locking in isp_video_release() + +From: Seung-Woo Kim + +commit 704c6c80fb471d1bb0ef0d61a94617d1d55743cd upstream. + +>From isp_video_release(), &isp->video_lock is held and subsequent +vb2_fop_release() tries to lock vdev->lock which is same with the +previous one. Replace vb2_fop_release() with _vb2_fop_release() to +fix the recursive locking. + +Fixes: 1380f5754cb0 ("[media] videobuf2: Add missing lock held on vb2_fop_release") +Signed-off-by: Seung-Woo Kim +Reviewed-by: Sylwester Nawrocki +Signed-off-by: Hans Verkuil +Signed-off-by: Mauro Carvalho Chehab +Signed-off-by: Greg Kroah-Hartman + +--- + drivers/media/platform/exynos4-is/fimc-isp-video.c | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +--- a/drivers/media/platform/exynos4-is/fimc-isp-video.c ++++ b/drivers/media/platform/exynos4-is/fimc-isp-video.c +@@ -316,7 +316,7 @@ static int isp_video_release(struct file + ivc->streaming = 0; + } + +- vb2_fop_release(file); ++ _vb2_fop_release(file, NULL); + + if (v4l2_fh_is_singular_file(file)) { + fimc_pipeline_call(&ivc->ve, close); diff --git a/queue-4.14/media-ov6650-fix-.get_fmt-v4l2_subdev_format_try-support.patch b/queue-4.14/media-ov6650-fix-.get_fmt-v4l2_subdev_format_try-support.patch new file mode 100644 index 00000000000..93847bd577d --- /dev/null +++ b/queue-4.14/media-ov6650-fix-.get_fmt-v4l2_subdev_format_try-support.patch @@ -0,0 +1,52 @@ +From 39034bb0c26b76a2c3abc54aa28c185f18b40c2f Mon Sep 17 00:00:00 2001 +From: Janusz Krzysztofik +Date: Tue, 3 Sep 2019 17:11:41 -0300 +Subject: media: ov6650: Fix .get_fmt() V4L2_SUBDEV_FORMAT_TRY support + +From: Janusz Krzysztofik + +commit 39034bb0c26b76a2c3abc54aa28c185f18b40c2f upstream. + +Commit da298c6d98d5 ("[media] v4l2: replace video op g_mbus_fmt by pad +op get_fmt") converted a former ov6650_g_fmt() video operation callback +to an ov6650_get_fmt() pad operation callback. However, the converted +function disregards a format->which flag that pad operations should +obey and always returns active frame format settings. + +That can be fixed by always responding to V4L2_SUBDEV_FORMAT_TRY with +-EINVAL, or providing the response from a pad config argument, likely +updated by a former user call to V4L2_SUBDEV_FORMAT_TRY .set_fmt(). +Since implementation of the latter is trivial, go for it. + +Fixes: da298c6d98d5 ("[media] v4l2: replace video op g_mbus_fmt by pad op get_fmt") +Signed-off-by: Janusz Krzysztofik +Signed-off-by: Sakari Ailus +Signed-off-by: Mauro Carvalho Chehab +Signed-off-by: Greg Kroah-Hartman + +--- + drivers/media/i2c/ov6650.c | 12 +++++++++--- + 1 file changed, 9 insertions(+), 3 deletions(-) + +--- a/drivers/media/i2c/ov6650.c ++++ b/drivers/media/i2c/ov6650.c +@@ -531,10 +531,16 @@ static int ov6650_get_fmt(struct v4l2_su + *mf = ov6650_def_fmt; + + /* update media bus format code and frame size */ +- mf->width = priv->rect.width >> priv->half_scale; +- mf->height = priv->rect.height >> priv->half_scale; +- mf->code = priv->code; ++ if (format->which == V4L2_SUBDEV_FORMAT_TRY) { ++ mf->width = cfg->try_fmt.width; ++ mf->height = cfg->try_fmt.height; ++ mf->code = cfg->try_fmt.code; + ++ } else { ++ mf->width = priv->rect.width >> priv->half_scale; ++ mf->height = priv->rect.height >> priv->half_scale; ++ mf->code = priv->code; ++ } + return 0; + } + diff --git a/queue-4.14/media-ov6650-fix-incorrect-use-of-jpeg-colorspace.patch b/queue-4.14/media-ov6650-fix-incorrect-use-of-jpeg-colorspace.patch new file mode 100644 index 00000000000..7f8f5775e2e --- /dev/null +++ b/queue-4.14/media-ov6650-fix-incorrect-use-of-jpeg-colorspace.patch @@ -0,0 +1,94 @@ +From 12500731895ef09afc5b66b86b76c0884fb9c7bf Mon Sep 17 00:00:00 2001 +From: Janusz Krzysztofik +Date: Tue, 3 Sep 2019 17:11:39 -0300 +Subject: media: ov6650: Fix incorrect use of JPEG colorspace + +From: Janusz Krzysztofik + +commit 12500731895ef09afc5b66b86b76c0884fb9c7bf upstream. + +Since its initial submission, the driver selects V4L2_COLORSPACE_JPEG +for supported formats other than V4L2_MBUS_FMT_SBGGR8_1X8. According +to v4l2-compliance test program, V4L2_COLORSPACE_JPEG applies +exclusively to V4L2_PIX_FMT_JPEG. Since the sensor does not support +JPEG format, fix it to always select V4L2_COLORSPACE_SRGB. + +Fixes: 2f6e2404799a ("[media] SoC Camera: add driver for OV6650 sensor") +Signed-off-by: Janusz Krzysztofik +Signed-off-by: Sakari Ailus +Signed-off-by: Mauro Carvalho Chehab +Signed-off-by: Greg Kroah-Hartman + +--- + drivers/media/i2c/ov6650.c | 13 ++----------- + 1 file changed, 2 insertions(+), 11 deletions(-) + +--- a/drivers/media/i2c/ov6650.c ++++ b/drivers/media/i2c/ov6650.c +@@ -203,7 +203,6 @@ struct ov6650 { + unsigned long pclk_max; /* from resolution and format */ + struct v4l2_fract tpf; /* as requested with s_parm */ + u32 code; +- enum v4l2_colorspace colorspace; + }; + + +@@ -520,7 +519,7 @@ static int ov6650_get_fmt(struct v4l2_su + mf->width = priv->rect.width >> priv->half_scale; + mf->height = priv->rect.height >> priv->half_scale; + mf->code = priv->code; +- mf->colorspace = priv->colorspace; ++ mf->colorspace = V4L2_COLORSPACE_SRGB; + mf->field = V4L2_FIELD_NONE; + + return 0; +@@ -627,11 +626,6 @@ static int ov6650_s_fmt(struct v4l2_subd + priv->pclk_max = 8000000; + } + +- if (code == MEDIA_BUS_FMT_SBGGR8_1X8) +- priv->colorspace = V4L2_COLORSPACE_SRGB; +- else if (code != 0) +- priv->colorspace = V4L2_COLORSPACE_JPEG; +- + if (half_scale) { + dev_dbg(&client->dev, "max resolution: QCIF\n"); + coma_set |= COMA_QCIF; +@@ -666,7 +660,6 @@ static int ov6650_s_fmt(struct v4l2_subd + priv->code = code; + + if (!ret) { +- mf->colorspace = priv->colorspace; + mf->width = priv->rect.width >> half_scale; + mf->height = priv->rect.height >> half_scale; + } +@@ -689,6 +682,7 @@ static int ov6650_set_fmt(struct v4l2_su + &mf->height, 2, H_CIF, 1, 0); + + mf->field = V4L2_FIELD_NONE; ++ mf->colorspace = V4L2_COLORSPACE_SRGB; + + switch (mf->code) { + case MEDIA_BUS_FMT_Y10_1X10: +@@ -699,13 +693,11 @@ static int ov6650_set_fmt(struct v4l2_su + case MEDIA_BUS_FMT_YUYV8_2X8: + case MEDIA_BUS_FMT_VYUY8_2X8: + case MEDIA_BUS_FMT_UYVY8_2X8: +- mf->colorspace = V4L2_COLORSPACE_JPEG; + break; + default: + mf->code = MEDIA_BUS_FMT_SBGGR8_1X8; + /* fall through */ + case MEDIA_BUS_FMT_SBGGR8_1X8: +- mf->colorspace = V4L2_COLORSPACE_SRGB; + break; + } + +@@ -1020,7 +1012,6 @@ static int ov6650_probe(struct i2c_clien + priv->rect.height = H_CIF; + priv->half_scale = false; + priv->code = MEDIA_BUS_FMT_YUYV8_2X8; +- priv->colorspace = V4L2_COLORSPACE_JPEG; + + ret = ov6650_video_probe(client); + if (ret) diff --git a/queue-4.14/media-ov6650-fix-some-format-attributes-not-under-control.patch b/queue-4.14/media-ov6650-fix-some-format-attributes-not-under-control.patch new file mode 100644 index 00000000000..9f46815aad7 --- /dev/null +++ b/queue-4.14/media-ov6650-fix-some-format-attributes-not-under-control.patch @@ -0,0 +1,128 @@ +From 1c6a2b63095154bbf9e8f38d79487a728331bf65 Mon Sep 17 00:00:00 2001 +From: Janusz Krzysztofik +Date: Tue, 3 Sep 2019 17:11:40 -0300 +Subject: media: ov6650: Fix some format attributes not under control + +From: Janusz Krzysztofik + +commit 1c6a2b63095154bbf9e8f38d79487a728331bf65 upstream. + +User arguments passed to .get/set_fmt() pad operation callbacks may +contain unsupported values. The driver takes control over frame size +and pixel code as well as colorspace and field attributes but has never +cared for remainig format attributes, i.e., ycbcr_enc, quantization +and xfer_func, introduced by commit 11ff030c7365 ("[media] +v4l2-mediabus: improve colorspace support"). Fix it. + +Set up a static v4l2_mbus_framefmt structure with attributes +initialized to reasonable defaults and use it for updating content of +user provided arguments. In case of V4L2_SUBDEV_FORMAT_ACTIVE, +postpone frame size update, now performed from inside ov6650_s_fmt() +helper, util the user argument is first updated in ov6650_set_fmt() with +default frame format content. For V4L2_SUBDEV_FORMAT_TRY, don't copy +all attributes to pad config, only those handled by the driver, then +fill the response with the default frame format updated with resulting +pad config format code and frame size. + +Fixes: 11ff030c7365 ("[media] v4l2-mediabus: improve colorspace support") +Signed-off-by: Janusz Krzysztofik +Signed-off-by: Sakari Ailus +Signed-off-by: Mauro Carvalho Chehab +Signed-off-by: Greg Kroah-Hartman + +--- + drivers/media/i2c/ov6650.c | 51 ++++++++++++++++++++++++++++++++++----------- + 1 file changed, 39 insertions(+), 12 deletions(-) + +--- a/drivers/media/i2c/ov6650.c ++++ b/drivers/media/i2c/ov6650.c +@@ -215,6 +215,17 @@ static u32 ov6650_codes[] = { + MEDIA_BUS_FMT_Y8_1X8, + }; + ++static const struct v4l2_mbus_framefmt ov6650_def_fmt = { ++ .width = W_CIF, ++ .height = H_CIF, ++ .code = MEDIA_BUS_FMT_SBGGR8_1X8, ++ .colorspace = V4L2_COLORSPACE_SRGB, ++ .field = V4L2_FIELD_NONE, ++ .ycbcr_enc = V4L2_YCBCR_ENC_DEFAULT, ++ .quantization = V4L2_QUANTIZATION_DEFAULT, ++ .xfer_func = V4L2_XFER_FUNC_DEFAULT, ++}; ++ + /* read a register */ + static int ov6650_reg_read(struct i2c_client *client, u8 reg, u8 *val) + { +@@ -516,11 +527,13 @@ static int ov6650_get_fmt(struct v4l2_su + if (format->pad) + return -EINVAL; + ++ /* initialize response with default media bus frame format */ ++ *mf = ov6650_def_fmt; ++ ++ /* update media bus format code and frame size */ + mf->width = priv->rect.width >> priv->half_scale; + mf->height = priv->rect.height >> priv->half_scale; + mf->code = priv->code; +- mf->colorspace = V4L2_COLORSPACE_SRGB; +- mf->field = V4L2_FIELD_NONE; + + return 0; + } +@@ -659,10 +672,6 @@ static int ov6650_s_fmt(struct v4l2_subd + if (!ret) + priv->code = code; + +- if (!ret) { +- mf->width = priv->rect.width >> half_scale; +- mf->height = priv->rect.height >> half_scale; +- } + return ret; + } + +@@ -681,9 +690,6 @@ static int ov6650_set_fmt(struct v4l2_su + v4l_bound_align_image(&mf->width, 2, W_CIF, 1, + &mf->height, 2, H_CIF, 1, 0); + +- mf->field = V4L2_FIELD_NONE; +- mf->colorspace = V4L2_COLORSPACE_SRGB; +- + switch (mf->code) { + case MEDIA_BUS_FMT_Y10_1X10: + mf->code = MEDIA_BUS_FMT_Y8_1X8; +@@ -701,10 +707,31 @@ static int ov6650_set_fmt(struct v4l2_su + break; + } + +- if (format->which == V4L2_SUBDEV_FORMAT_ACTIVE) +- return ov6650_s_fmt(sd, mf); +- cfg->try_fmt = *mf; ++ if (format->which == V4L2_SUBDEV_FORMAT_TRY) { ++ /* store media bus format code and frame size in pad config */ ++ cfg->try_fmt.width = mf->width; ++ cfg->try_fmt.height = mf->height; ++ cfg->try_fmt.code = mf->code; ++ ++ /* return default mbus frame format updated with pad config */ ++ *mf = ov6650_def_fmt; ++ mf->width = cfg->try_fmt.width; ++ mf->height = cfg->try_fmt.height; ++ mf->code = cfg->try_fmt.code; ++ ++ } else { ++ /* apply new media bus format code and frame size */ ++ int ret = ov6650_s_fmt(sd, mf); + ++ if (ret) ++ return ret; ++ ++ /* return default format updated with active size and code */ ++ *mf = ov6650_def_fmt; ++ mf->width = priv->rect.width >> priv->half_scale; ++ mf->height = priv->rect.height >> priv->half_scale; ++ mf->code = priv->code; ++ } + return 0; + } + diff --git a/queue-4.14/mtd-spi-nor-fix-silent-truncation-in-spi_nor_read.patch b/queue-4.14/mtd-spi-nor-fix-silent-truncation-in-spi_nor_read.patch new file mode 100644 index 00000000000..0f020bd40e3 --- /dev/null +++ b/queue-4.14/mtd-spi-nor-fix-silent-truncation-in-spi_nor_read.patch @@ -0,0 +1,34 @@ +From a719a75a7761e4139dd099330d9fe3589d844f9b Mon Sep 17 00:00:00 2001 +From: Sergei Shtylyov +Date: Wed, 30 Oct 2019 21:48:59 +0300 +Subject: mtd: spi-nor: fix silent truncation in spi_nor_read() + +From: Sergei Shtylyov + +commit a719a75a7761e4139dd099330d9fe3589d844f9b upstream. + +spi_nor_read() assigns the result of 'ssize_t spi_nor_read_data()' +to the 'int ret' variable, while 'ssize_t' is a 64-bit type and *int* +is a 32-bit type on the 64-bit machines. This silent truncation isn't +really valid, so fix up the variable's type. + +Fixes: 59451e1233bd ("mtd: spi-nor: change return value of read/write") +Signed-off-by: Sergei Shtylyov +Signed-off-by: Tudor Ambarus +Signed-off-by: Greg Kroah-Hartman + +--- + drivers/mtd/spi-nor/spi-nor.c | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +--- a/drivers/mtd/spi-nor/spi-nor.c ++++ b/drivers/mtd/spi-nor/spi-nor.c +@@ -1216,7 +1216,7 @@ static int spi_nor_read(struct mtd_info + size_t *retlen, u_char *buf) + { + struct spi_nor *nor = mtd_to_spi_nor(mtd); +- int ret; ++ ssize_t ret; + + dev_dbg(nor->dev, "from 0x%08x, len %zd\n", (u32)from, len); + diff --git a/queue-4.14/mtd-spi-nor-fix-silent-truncation-in-spi_nor_read_raw.patch b/queue-4.14/mtd-spi-nor-fix-silent-truncation-in-spi_nor_read_raw.patch new file mode 100644 index 00000000000..8a654356823 --- /dev/null +++ b/queue-4.14/mtd-spi-nor-fix-silent-truncation-in-spi_nor_read_raw.patch @@ -0,0 +1,34 @@ +From 3d63ee5deb466fd66ed6ffb164a87ce36425cf36 Mon Sep 17 00:00:00 2001 +From: Sergei Shtylyov +Date: Wed, 30 Oct 2019 21:53:03 +0300 +Subject: mtd: spi-nor: fix silent truncation in spi_nor_read_raw() + +From: Sergei Shtylyov + +commit 3d63ee5deb466fd66ed6ffb164a87ce36425cf36 upstream. + +spi_nor_read_raw() assigns the result of 'ssize_t spi_nor_read_data()' +to the 'int ret' variable, while 'ssize_t' is a 64-bit type and *int* +is a 32-bit type on the 64-bit machines. This silent truncation isn't +really valid, so fix up the variable's type. + +Fixes: f384b352cbf0 ("mtd: spi-nor: parse Serial Flash Discoverable Parameters (SFDP) tables") +Signed-off-by: Sergei Shtylyov +Signed-off-by: Tudor Ambarus +Signed-off-by: Greg Kroah-Hartman + +--- + drivers/mtd/spi-nor/spi-nor.c | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +--- a/drivers/mtd/spi-nor/spi-nor.c ++++ b/drivers/mtd/spi-nor/spi-nor.c +@@ -1445,7 +1445,7 @@ static int macronix_quad_enable(struct s + */ + static int write_sr_cr(struct spi_nor *nor, u8 *sr_cr) + { +- int ret; ++ ssize_t ret; + + write_enable(nor); + diff --git a/queue-4.14/pci-ptm-remove-spurious-d-from-granularity-message.patch b/queue-4.14/pci-ptm-remove-spurious-d-from-granularity-message.patch new file mode 100644 index 00000000000..7ba86623389 --- /dev/null +++ b/queue-4.14/pci-ptm-remove-spurious-d-from-granularity-message.patch @@ -0,0 +1,37 @@ +From 127a7709495db52a41012deaebbb7afc231dad91 Mon Sep 17 00:00:00 2001 +From: Bjorn Helgaas +Date: Wed, 6 Nov 2019 15:30:48 -0600 +Subject: PCI/PTM: Remove spurious "d" from granularity message + +From: Bjorn Helgaas + +commit 127a7709495db52a41012deaebbb7afc231dad91 upstream. + +The granularity message has an extra "d": + + pci 0000:02:00.0: PTM enabled, 4dns granularity + +Remove the "d" so the message is simply "PTM enabled, 4ns granularity". + +Fixes: 8b2ec318eece ("PCI: Add PTM clock granularity information") +Link: https://lore.kernel.org/r/20191106222420.10216-2-helgaas@kernel.org +Signed-off-by: Bjorn Helgaas +Reviewed-by: Andrew Murray +Cc: Jonathan Yong +Signed-off-by: Greg Kroah-Hartman + +--- + drivers/pci/pcie/ptm.c | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +--- a/drivers/pci/pcie/ptm.c ++++ b/drivers/pci/pcie/ptm.c +@@ -29,7 +29,7 @@ static void pci_ptm_info(struct pci_dev + snprintf(clock_desc, sizeof(clock_desc), ">254ns"); + break; + default: +- snprintf(clock_desc, sizeof(clock_desc), "%udns", ++ snprintf(clock_desc, sizeof(clock_desc), "%uns", + dev->ptm_granularity); + break; + } diff --git a/queue-4.14/powerpc-powernv-disable-native-pcie-port-management.patch b/queue-4.14/powerpc-powernv-disable-native-pcie-port-management.patch new file mode 100644 index 00000000000..b8a10be4d32 --- /dev/null +++ b/queue-4.14/powerpc-powernv-disable-native-pcie-port-management.patch @@ -0,0 +1,76 @@ +From 9d72dcef891030545f39ad386a30cf91df517fb2 Mon Sep 17 00:00:00 2001 +From: Oliver O'Halloran +Date: Mon, 18 Nov 2019 17:55:53 +1100 +Subject: powerpc/powernv: Disable native PCIe port management + +From: Oliver O'Halloran + +commit 9d72dcef891030545f39ad386a30cf91df517fb2 upstream. + +On PowerNV the PCIe topology is (currently) managed by the powernv platform +code in Linux in cooperation with the platform firmware. Linux's native +PCIe port service drivers operate independently of both and this can cause +problems. + +The main issue is that the portbus driver will conflict with the platform +specific hotplug driver (pnv_php) over ownership of the MSI used to notify +the host when a hotplug event occurs. The portbus driver claims this MSI on +behalf of the individual port services because the same interrupt is used +for hotplug events, PMEs (on root ports), and link bandwidth change +notifications. The portbus driver will always claim the interrupt even if +the individual port service drivers, such as pciehp, are compiled out. + +The second, bigger, problem is that the hotplug port service driver +fundamentally does not work on PowerNV. The platform assumes that all +PCI devices have a corresponding arch-specific handle derived from the DT +node for the device (pci_dn) and without one the platform will not allow +a PCI device to be enabled. This problem is largely due to historical +baggage, but it can't be resolved without significant re-factoring of the +platform PCI support. + +We can fix these problems in the interim by setting the +"pcie_ports_disabled" flag during platform initialisation. The flag +indicates the platform owns the PCIe ports which stops the portbus driver +from being registered. + +This does have the side effect of disabling all port services drivers +that is: AER, PME, BW notifications, hotplug, and DPC. However, this is +not a huge disadvantage on PowerNV since these services are either unused +or handled through other means. + +Fixes: 66725152fb9f ("PCI/hotplug: PowerPC PowerNV PCI hotplug driver") +Signed-off-by: Oliver O'Halloran +Signed-off-by: Michael Ellerman +Link: https://lore.kernel.org/r/20191118065553.30362-1-oohall@gmail.com +Signed-off-by: Greg Kroah-Hartman + +--- + arch/powerpc/platforms/powernv/pci.c | 17 +++++++++++++++++ + 1 file changed, 17 insertions(+) + +--- a/arch/powerpc/platforms/powernv/pci.c ++++ b/arch/powerpc/platforms/powernv/pci.c +@@ -1118,6 +1118,23 @@ void __init pnv_pci_init(void) + if (!firmware_has_feature(FW_FEATURE_OPAL)) + return; + ++#ifdef CONFIG_PCIEPORTBUS ++ /* ++ * On PowerNV PCIe devices are (currently) managed in cooperation ++ * with firmware. This isn't *strictly* required, but there's enough ++ * assumptions baked into both firmware and the platform code that ++ * it's unwise to allow the portbus services to be used. ++ * ++ * We need to fix this eventually, but for now set this flag to disable ++ * the portbus driver. The AER service isn't required since that AER ++ * events are handled via EEH. The pciehp hotplug driver can't work ++ * without kernel changes (and portbus binding breaks pnv_php). The ++ * other services also require some thinking about how we're going ++ * to integrate them. ++ */ ++ pcie_ports_disabled = true; ++#endif ++ + /* Look for IODA IO-Hubs. */ + for_each_compatible_node(np, NULL, "ibm,ioda-hub") { + pnv_pci_init_ioda_hub(np); diff --git a/queue-4.14/rtc-msm6242-fix-reading-of-10-hour-digit.patch b/queue-4.14/rtc-msm6242-fix-reading-of-10-hour-digit.patch new file mode 100644 index 00000000000..307c5f95cf5 --- /dev/null +++ b/queue-4.14/rtc-msm6242-fix-reading-of-10-hour-digit.patch @@ -0,0 +1,40 @@ +From e34494c8df0cd96fc432efae121db3212c46ae48 Mon Sep 17 00:00:00 2001 +From: Kars de Jong +Date: Sat, 16 Nov 2019 12:05:48 +0100 +Subject: rtc: msm6242: Fix reading of 10-hour digit + +From: Kars de Jong + +commit e34494c8df0cd96fc432efae121db3212c46ae48 upstream. + +The driver was reading the wrong register as the 10-hour digit due to +a misplaced ')'. It was in fact reading the 1-second digit register due +to this bug. + +Also remove the use of a magic number for the hour mask and use the define +for it which was already present. + +Fixes: 4f9b9bba1dd1 ("rtc: Add an RTC driver for the Oki MSM6242") +Tested-by: Kars de Jong +Signed-off-by: Kars de Jong +Link: https://lore.kernel.org/r/20191116110548.8562-1-jongk@linux-m68k.org +Reviewed-by: Geert Uytterhoeven +Signed-off-by: Alexandre Belloni +Signed-off-by: Greg Kroah-Hartman + +--- + drivers/rtc/rtc-msm6242.c | 3 ++- + 1 file changed, 2 insertions(+), 1 deletion(-) + +--- a/drivers/rtc/rtc-msm6242.c ++++ b/drivers/rtc/rtc-msm6242.c +@@ -132,7 +132,8 @@ static int msm6242_read_time(struct devi + msm6242_read(priv, MSM6242_SECOND1); + tm->tm_min = msm6242_read(priv, MSM6242_MINUTE10) * 10 + + msm6242_read(priv, MSM6242_MINUTE1); +- tm->tm_hour = (msm6242_read(priv, MSM6242_HOUR10 & 3)) * 10 + ++ tm->tm_hour = (msm6242_read(priv, MSM6242_HOUR10) & ++ MSM6242_HOUR10_HR_MASK) * 10 + + msm6242_read(priv, MSM6242_HOUR1); + tm->tm_mday = msm6242_read(priv, MSM6242_DAY10) * 10 + + msm6242_read(priv, MSM6242_DAY1); diff --git a/queue-4.14/rtlwifi-remove-unnecessary-null-check-in-rtl_regd_init.patch b/queue-4.14/rtlwifi-remove-unnecessary-null-check-in-rtl_regd_init.patch new file mode 100644 index 00000000000..d34c6c76cdd --- /dev/null +++ b/queue-4.14/rtlwifi-remove-unnecessary-null-check-in-rtl_regd_init.patch @@ -0,0 +1,51 @@ +From 091c6e9c083f7ebaff00b37ad13562d51464d175 Mon Sep 17 00:00:00 2001 +From: Nathan Chancellor +Date: Tue, 22 Oct 2019 17:47:03 -0700 +Subject: rtlwifi: Remove unnecessary NULL check in rtl_regd_init + +From: Nathan Chancellor + +commit 091c6e9c083f7ebaff00b37ad13562d51464d175 upstream. + +When building with Clang + -Wtautological-pointer-compare: + +drivers/net/wireless/realtek/rtlwifi/regd.c:389:33: warning: comparison +of address of 'rtlpriv->regd' equal to a null pointer is always false +[-Wtautological-pointer-compare] + if (wiphy == NULL || &rtlpriv->regd == NULL) + ~~~~~~~~~^~~~ ~~~~ +1 warning generated. + +The address of an array member is never NULL unless it is the first +struct member so remove the unnecessary check. This was addressed in +the staging version of the driver in commit f986978b32b3 ("Staging: +rtlwifi: remove unnecessary NULL check"). + +While we are here, fix the following checkpatch warning: + +CHECK: Comparison to NULL could be written "!wiphy" +35: FILE: drivers/net/wireless/realtek/rtlwifi/regd.c:389: ++ if (wiphy == NULL) + +Fixes: 0c8173385e54 ("rtl8192ce: Add new driver") +Link:https://github.com/ClangBuiltLinux/linux/issues/750 +Signed-off-by: Nathan Chancellor +Acked-by: Ping-Ke Shih +Signed-off-by: Kalle Valo +Signed-off-by: Greg Kroah-Hartman + +--- + drivers/net/wireless/realtek/rtlwifi/regd.c | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +--- a/drivers/net/wireless/realtek/rtlwifi/regd.c ++++ b/drivers/net/wireless/realtek/rtlwifi/regd.c +@@ -427,7 +427,7 @@ int rtl_regd_init(struct ieee80211_hw *h + struct wiphy *wiphy = hw->wiphy; + struct country_code_to_enum_rd *country = NULL; + +- if (wiphy == NULL || &rtlpriv->regd == NULL) ++ if (!wiphy) + return -EINVAL; + + /* init country_code from efuse channel plan */ diff --git a/queue-4.14/scsi-sd-enable-compat-ioctls-for-sed-opal.patch b/queue-4.14/scsi-sd-enable-compat-ioctls-for-sed-opal.patch new file mode 100644 index 00000000000..e80ba36d6b9 --- /dev/null +++ b/queue-4.14/scsi-sd-enable-compat-ioctls-for-sed-opal.patch @@ -0,0 +1,61 @@ +From 142b2ac82e31c174936c5719fa12ae28f51a55b7 Mon Sep 17 00:00:00 2001 +From: Arnd Bergmann +Date: Fri, 15 Mar 2019 13:46:11 +0100 +Subject: scsi: sd: enable compat ioctls for sed-opal + +From: Arnd Bergmann + +commit 142b2ac82e31c174936c5719fa12ae28f51a55b7 upstream. + +The sed_ioctl() function is written to be compatible between +32-bit and 64-bit processes, however compat mode is only +wired up for nvme, not for sd. + +Add the missing call to sed_ioctl() in sd_compat_ioctl(). + +Fixes: d80210f25ff0 ("sd: add support for TCG OPAL self encrypting disks") +Cc: linux-scsi@vger.kernel.org +Cc: "James E.J. Bottomley" +Cc: "Martin K. Petersen" +Signed-off-by: Arnd Bergmann +Signed-off-by: Greg Kroah-Hartman + +--- + drivers/scsi/sd.c | 14 ++++++++++++-- + 1 file changed, 12 insertions(+), 2 deletions(-) + +--- a/drivers/scsi/sd.c ++++ b/drivers/scsi/sd.c +@@ -1697,20 +1697,30 @@ static void sd_rescan(struct device *dev + static int sd_compat_ioctl(struct block_device *bdev, fmode_t mode, + unsigned int cmd, unsigned long arg) + { +- struct scsi_device *sdev = scsi_disk(bdev->bd_disk)->device; ++ struct gendisk *disk = bdev->bd_disk; ++ struct scsi_disk *sdkp = scsi_disk(disk); ++ struct scsi_device *sdev = sdkp->device; ++ void __user *p = compat_ptr(arg); + int error; + ++ error = scsi_verify_blk_ioctl(bdev, cmd); ++ if (error < 0) ++ return error; ++ + error = scsi_ioctl_block_when_processing_errors(sdev, cmd, + (mode & FMODE_NDELAY) != 0); + if (error) + return error; ++ ++ if (is_sed_ioctl(cmd)) ++ return sed_ioctl(sdkp->opal_dev, cmd, p); + + /* + * Let the static ioctl translation table take care of it. + */ + if (!sdev->host->hostt->compat_ioctl) + return -ENOIOCTLCMD; +- return sdev->host->hostt->compat_ioctl(sdev, cmd, (void __user *)arg); ++ return sdev->host->hostt->compat_ioctl(sdev, cmd, p); + } + #endif + diff --git a/queue-4.14/series b/queue-4.14/series index dad64c0e948..54febbcd92b 100644 --- a/queue-4.14/series +++ b/queue-4.14/series @@ -41,3 +41,21 @@ mei-fix-modalias-documentation.patch clk-samsung-exynos5420-preserve-cpu-clocks-configuration-during-suspend-resume.patch pinctl-ti-iodelay-fix-error-checking-on-pinctrl_count_index_with_args-call.patch pinctrl-lewisburg-update-pin-list-according-to-v1.1v6.patch +scsi-sd-enable-compat-ioctls-for-sed-opal.patch +arm64-dts-apq8096-db820c-increase-load-on-l21-for-sdcard.patch +af_unix-add-compat_ioctl-support.patch +compat_ioctl-handle-siocoutqnsd.patch +pci-ptm-remove-spurious-d-from-granularity-message.patch +powerpc-powernv-disable-native-pcie-port-management.patch +tty-serial-imx-use-the-sg-count-from-dma_map_sg.patch +tty-serial-pch_uart-correct-usage-of-dma_unmap_sg.patch +media-ov6650-fix-incorrect-use-of-jpeg-colorspace.patch +media-ov6650-fix-some-format-attributes-not-under-control.patch +media-ov6650-fix-.get_fmt-v4l2_subdev_format_try-support.patch +media-exynos4-is-fix-recursive-locking-in-isp_video_release.patch +mtd-spi-nor-fix-silent-truncation-in-spi_nor_read.patch +mtd-spi-nor-fix-silent-truncation-in-spi_nor_read_raw.patch +spi-atmel-fix-handling-of-cs_change-set-on-non-last-xfer.patch +rtlwifi-remove-unnecessary-null-check-in-rtl_regd_init.patch +f2fs-fix-potential-overflow.patch +rtc-msm6242-fix-reading-of-10-hour-digit.patch diff --git a/queue-4.14/spi-atmel-fix-handling-of-cs_change-set-on-non-last-xfer.patch b/queue-4.14/spi-atmel-fix-handling-of-cs_change-set-on-non-last-xfer.patch new file mode 100644 index 00000000000..3d437dd1ed2 --- /dev/null +++ b/queue-4.14/spi-atmel-fix-handling-of-cs_change-set-on-non-last-xfer.patch @@ -0,0 +1,63 @@ +From fed8d8c7a6dc2a76d7764842853d81c770b0788e Mon Sep 17 00:00:00 2001 +From: Mans Rullgard +Date: Fri, 18 Oct 2019 17:35:04 +0200 +Subject: spi: atmel: fix handling of cs_change set on non-last xfer + +From: Mans Rullgard + +commit fed8d8c7a6dc2a76d7764842853d81c770b0788e upstream. + +The driver does the wrong thing when cs_change is set on a non-last +xfer in a message. When cs_change is set, the driver deactivates the +CS and leaves it off until a later xfer again has cs_change set whereas +it should be briefly toggling CS off and on again. + +This patch brings the behaviour of the driver back in line with the +documentation and common sense. The delay of 10 us is the same as is +used by the default spi_transfer_one_message() function in spi.c. +[gregory: rebased on for-5.5 from spi tree] +Fixes: 8090d6d1a415 ("spi: atmel: Refactor spi-atmel to use SPI framework queue") +Signed-off-by: Mans Rullgard +Acked-by: Nicolas Ferre +Signed-off-by: Gregory CLEMENT +Link: https://lore.kernel.org/r/20191018153504.4249-1-gregory.clement@bootlin.com +Signed-off-by: Mark Brown +Signed-off-by: Greg Kroah-Hartman + +--- + drivers/spi/spi-atmel.c | 10 +++------- + 1 file changed, 3 insertions(+), 7 deletions(-) + +--- a/drivers/spi/spi-atmel.c ++++ b/drivers/spi/spi-atmel.c +@@ -301,7 +301,6 @@ struct atmel_spi { + bool use_cs_gpios; + + bool keep_cs; +- bool cs_active; + + u32 fifo_size; + }; +@@ -1338,11 +1337,9 @@ static int atmel_spi_one_transfer(struct + &msg->transfers)) { + as->keep_cs = true; + } else { +- as->cs_active = !as->cs_active; +- if (as->cs_active) +- cs_activate(as, msg->spi); +- else +- cs_deactivate(as, msg->spi); ++ cs_deactivate(as, msg->spi); ++ udelay(10); ++ cs_activate(as, msg->spi); + } + } + +@@ -1365,7 +1362,6 @@ static int atmel_spi_transfer_one_messag + atmel_spi_lock(as); + cs_activate(as, spi); + +- as->cs_active = true; + as->keep_cs = false; + + msg->status = 0; diff --git a/queue-4.14/tty-serial-imx-use-the-sg-count-from-dma_map_sg.patch b/queue-4.14/tty-serial-imx-use-the-sg-count-from-dma_map_sg.patch new file mode 100644 index 00000000000..9627bc105a4 --- /dev/null +++ b/queue-4.14/tty-serial-imx-use-the-sg-count-from-dma_map_sg.patch @@ -0,0 +1,33 @@ +From 596fd8dffb745afcebc0ec6968e17fe29f02044c Mon Sep 17 00:00:00 2001 +From: Peng Fan +Date: Thu, 7 Nov 2019 06:42:53 +0000 +Subject: tty: serial: imx: use the sg count from dma_map_sg + +From: Peng Fan + +commit 596fd8dffb745afcebc0ec6968e17fe29f02044c upstream. + +The dmaengine_prep_slave_sg needs to use sg count returned +by dma_map_sg, not use sport->dma_tx_nents, because the return +value of dma_map_sg is not always same with "nents". + +Fixes: b4cdc8f61beb ("serial: imx: add DMA support for imx6q") +Signed-off-by: Peng Fan +Link: https://lore.kernel.org/r/1573108875-26530-1-git-send-email-peng.fan@nxp.com +Signed-off-by: Greg Kroah-Hartman + +--- + drivers/tty/serial/imx.c | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +--- a/drivers/tty/serial/imx.c ++++ b/drivers/tty/serial/imx.c +@@ -542,7 +542,7 @@ static void imx_dma_tx(struct imx_port * + dev_err(dev, "DMA mapping error for TX.\n"); + return; + } +- desc = dmaengine_prep_slave_sg(chan, sgl, sport->dma_tx_nents, ++ desc = dmaengine_prep_slave_sg(chan, sgl, ret, + DMA_MEM_TO_DEV, DMA_PREP_INTERRUPT); + if (!desc) { + dma_unmap_sg(dev, sgl, sport->dma_tx_nents, diff --git a/queue-4.14/tty-serial-pch_uart-correct-usage-of-dma_unmap_sg.patch b/queue-4.14/tty-serial-pch_uart-correct-usage-of-dma_unmap_sg.patch new file mode 100644 index 00000000000..5786f83cd24 --- /dev/null +++ b/queue-4.14/tty-serial-pch_uart-correct-usage-of-dma_unmap_sg.patch @@ -0,0 +1,65 @@ +From 74887542fdcc92ad06a48c0cca17cdf09fc8aa00 Mon Sep 17 00:00:00 2001 +From: Peng Fan +Date: Wed, 13 Nov 2019 05:37:42 +0000 +Subject: tty: serial: pch_uart: correct usage of dma_unmap_sg + +From: Peng Fan + +commit 74887542fdcc92ad06a48c0cca17cdf09fc8aa00 upstream. + +Per Documentation/DMA-API-HOWTO.txt, +To unmap a scatterlist, just call: + dma_unmap_sg(dev, sglist, nents, direction); + +.. note:: + + The 'nents' argument to the dma_unmap_sg call must be + the _same_ one you passed into the dma_map_sg call, + it should _NOT_ be the 'count' value _returned_ from the + dma_map_sg call. + +However in the driver, priv->nent is directly assigned with value +returned from dma_map_sg, and dma_unmap_sg use priv->nent for unmap, +this breaks the API usage. + +So introduce a new entry orig_nent to remember 'nents'. + +Fixes: da3564ee027e ("pch_uart: add multi-scatter processing") +Signed-off-by: Peng Fan +Link: https://lore.kernel.org/r/1573623259-6339-1-git-send-email-peng.fan@nxp.com +Signed-off-by: Greg Kroah-Hartman + +--- + drivers/tty/serial/pch_uart.c | 5 ++++- + 1 file changed, 4 insertions(+), 1 deletion(-) + +--- a/drivers/tty/serial/pch_uart.c ++++ b/drivers/tty/serial/pch_uart.c +@@ -247,6 +247,7 @@ struct eg20t_port { + struct dma_chan *chan_rx; + struct scatterlist *sg_tx_p; + int nent; ++ int orig_nent; + struct scatterlist sg_rx; + int tx_dma_use; + void *rx_buf_virt; +@@ -801,9 +802,10 @@ static void pch_dma_tx_complete(void *ar + } + xmit->tail &= UART_XMIT_SIZE - 1; + async_tx_ack(priv->desc_tx); +- dma_unmap_sg(port->dev, sg, priv->nent, DMA_TO_DEVICE); ++ dma_unmap_sg(port->dev, sg, priv->orig_nent, DMA_TO_DEVICE); + priv->tx_dma_use = 0; + priv->nent = 0; ++ priv->orig_nent = 0; + kfree(priv->sg_tx_p); + pch_uart_hal_enable_interrupt(priv, PCH_UART_HAL_TX_INT); + } +@@ -1027,6 +1029,7 @@ static unsigned int dma_handle_tx(struct + dev_err(priv->port.dev, "%s:dma_map_sg Failed\n", __func__); + return 0; + } ++ priv->orig_nent = num; + priv->nent = nent; + + for (i = 0; i < nent; i++, sg++) { -- 2.47.3