From: Greg Kroah-Hartman Date: Sun, 30 Sep 2018 12:45:47 +0000 (-0700) Subject: 4.9-stable patches X-Git-Tag: v4.18.12~31 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=838d4dde8f45e3ad32d273ed9592b361396f43e5;p=thirdparty%2Fkernel%2Fstable-queue.git 4.9-stable patches added patches: media-uvcvideo-support-realtek-s-uvc-1.5-device.patch slub-make-cpu_partial-unsigned-int.patch --- diff --git a/queue-4.9/media-uvcvideo-support-realtek-s-uvc-1.5-device.patch b/queue-4.9/media-uvcvideo-support-realtek-s-uvc-1.5-device.patch new file mode 100644 index 00000000000..3030957d3fc --- /dev/null +++ b/queue-4.9/media-uvcvideo-support-realtek-s-uvc-1.5-device.patch @@ -0,0 +1,96 @@ +From f620d1d7afc7db57ab59f35000752840c91f67e7 Mon Sep 17 00:00:00 2001 +From: ming_qian +Date: Tue, 8 May 2018 22:13:08 -0400 +Subject: media: uvcvideo: Support realtek's UVC 1.5 device + +From: ming_qian + +commit f620d1d7afc7db57ab59f35000752840c91f67e7 upstream. + +media: uvcvideo: Support UVC 1.5 video probe & commit controls + +The length of UVC 1.5 video control is 48, and it is 34 for UVC 1.1. +Change it to 48 for UVC 1.5 device, and the UVC 1.5 device can be +recognized. + +More changes to the driver are needed for full UVC 1.5 compatibility. +However, at least the UVC 1.5 Realtek RTS5847/RTS5852 cameras have been +reported to work well. + +[laurent.pinchart@ideasonboard.com: Factor out code to helper function, update size checks] + +Cc: stable@vger.kernel.org +Signed-off-by: ming_qian +Signed-off-by: Laurent Pinchart +Tested-by: Kai-Heng Feng +Tested-by: Ana Guerrero Lopez +Signed-off-by: Mauro Carvalho Chehab +Signed-off-by: Greg Kroah-Hartman + +--- + drivers/media/usb/uvc/uvc_video.c | 24 ++++++++++++++++++------ + 1 file changed, 18 insertions(+), 6 deletions(-) + +--- a/drivers/media/usb/uvc/uvc_video.c ++++ b/drivers/media/usb/uvc/uvc_video.c +@@ -163,14 +163,27 @@ static void uvc_fixup_video_ctrl(struct + } + } + ++static size_t uvc_video_ctrl_size(struct uvc_streaming *stream) ++{ ++ /* ++ * Return the size of the video probe and commit controls, which depends ++ * on the protocol version. ++ */ ++ if (stream->dev->uvc_version < 0x0110) ++ return 26; ++ else if (stream->dev->uvc_version < 0x0150) ++ return 34; ++ else ++ return 48; ++} ++ + static int uvc_get_video_ctrl(struct uvc_streaming *stream, + struct uvc_streaming_control *ctrl, int probe, __u8 query) + { ++ __u16 size = uvc_video_ctrl_size(stream); + __u8 *data; +- __u16 size; + int ret; + +- size = stream->dev->uvc_version >= 0x0110 ? 34 : 26; + if ((stream->dev->quirks & UVC_QUIRK_PROBE_DEF) && + query == UVC_GET_DEF) + return -EIO; +@@ -225,7 +238,7 @@ static int uvc_get_video_ctrl(struct uvc + ctrl->dwMaxVideoFrameSize = get_unaligned_le32(&data[18]); + ctrl->dwMaxPayloadTransferSize = get_unaligned_le32(&data[22]); + +- if (size == 34) { ++ if (size >= 34) { + ctrl->dwClockFrequency = get_unaligned_le32(&data[26]); + ctrl->bmFramingInfo = data[30]; + ctrl->bPreferedVersion = data[31]; +@@ -254,11 +267,10 @@ out: + static int uvc_set_video_ctrl(struct uvc_streaming *stream, + struct uvc_streaming_control *ctrl, int probe) + { ++ __u16 size = uvc_video_ctrl_size(stream); + __u8 *data; +- __u16 size; + int ret; + +- size = stream->dev->uvc_version >= 0x0110 ? 34 : 26; + data = kzalloc(size, GFP_KERNEL); + if (data == NULL) + return -ENOMEM; +@@ -275,7 +287,7 @@ static int uvc_set_video_ctrl(struct uvc + put_unaligned_le32(ctrl->dwMaxVideoFrameSize, &data[18]); + put_unaligned_le32(ctrl->dwMaxPayloadTransferSize, &data[22]); + +- if (size == 34) { ++ if (size >= 34) { + put_unaligned_le32(ctrl->dwClockFrequency, &data[26]); + data[30] = ctrl->bmFramingInfo; + data[31] = ctrl->bPreferedVersion; diff --git a/queue-4.9/series b/queue-4.9/series index 435890cc970..50a724dd49a 100644 --- a/queue-4.9/series +++ b/queue-4.9/series @@ -64,3 +64,5 @@ spi-rspi-fix-interrupted-dma-transfers.patch regulator-fix-crash-caused-by-null-driver-data.patch usb-fix-error-handling-in-usb_driver_claim_interface.patch usb-handle-null-config-in-usb_find_alt_setting.patch +slub-make-cpu_partial-unsigned-int.patch +media-uvcvideo-support-realtek-s-uvc-1.5-device.patch diff --git a/queue-4.9/slub-make-cpu_partial-unsigned-int.patch b/queue-4.9/slub-make-cpu_partial-unsigned-int.patch new file mode 100644 index 00000000000..9f4dda67027 --- /dev/null +++ b/queue-4.9/slub-make-cpu_partial-unsigned-int.patch @@ -0,0 +1,68 @@ +From e5d9998f3e09359b372a037a6ac55ba235d95d57 Mon Sep 17 00:00:00 2001 +From: Alexey Dobriyan +Date: Thu, 5 Apr 2018 16:21:10 -0700 +Subject: slub: make ->cpu_partial unsigned int + +From: Alexey Dobriyan + +commit e5d9998f3e09359b372a037a6ac55ba235d95d57 upstream. + + /* + * cpu_partial determined the maximum number of objects + * kept in the per cpu partial lists of a processor. + */ + +Can't be negative. + +Link: http://lkml.kernel.org/r/20180305200730.15812-15-adobriyan@gmail.com +Signed-off-by: Alexey Dobriyan +Acked-by: Christoph Lameter +Cc: Pekka Enberg +Cc: David Rientjes +Cc: Joonsoo Kim +Signed-off-by: Andrew Morton +Signed-off-by: Linus Torvalds +Signed-off-by: zhong jiang +Signed-off-by: Greg Kroah-Hartman + +--- + include/linux/slub_def.h | 3 ++- + mm/slub.c | 6 +++--- + 2 files changed, 5 insertions(+), 4 deletions(-) + +--- a/include/linux/slub_def.h ++++ b/include/linux/slub_def.h +@@ -67,7 +67,8 @@ struct kmem_cache { + int size; /* The size of an object including meta data */ + int object_size; /* The size of an object without meta data */ + int offset; /* Free pointer offset. */ +- int cpu_partial; /* Number of per cpu partial objects to keep around */ ++ /* Number of per cpu partial objects to keep around */ ++ unsigned int cpu_partial; + struct kmem_cache_order_objects oo; + + /* Allocation and freeing of slabs */ +--- a/mm/slub.c ++++ b/mm/slub.c +@@ -1793,7 +1793,7 @@ static void *get_partial_node(struct kme + { + struct page *page, *page2; + void *object = NULL; +- int available = 0; ++ unsigned int available = 0; + int objects; + + /* +@@ -4870,10 +4870,10 @@ static ssize_t cpu_partial_show(struct k + static ssize_t cpu_partial_store(struct kmem_cache *s, const char *buf, + size_t length) + { +- unsigned long objects; ++ unsigned int objects; + int err; + +- err = kstrtoul(buf, 10, &objects); ++ err = kstrtouint(buf, 10, &objects); + if (err) + return err; + if (objects && !kmem_cache_has_cpu_partial(s))