From: Ben Hutchings <ben@decadent.org.uk>
Date: Sat, 07 May 2016 01:39:00 +0100
Subject: videobuf2: Avoid ABI change in 4.5.3
Forwarded: not-needed

The new flag in vb2_queue doesn't grow the structure but only uses
up padding, so just hide it from genksyms.

Move the new member of vb2_buf_ops to the end and add another flag
in vb2_queue to indicate whether it's valid.  Hide them both from
genksyms.  Set and check the flag as necessary.

---
--- a/drivers/media/v4l2-core/videobuf2-core.c
+++ b/drivers/media/v4l2-core/videobuf2-core.c
@@ -1665,7 +1665,8 @@ static int __vb2_get_done_vb(struct vb2_
 	 * Only remove the buffer from done_list if v4l2_buffer can handle all
 	 * the planes.
 	 */
-	ret = call_bufop(q, verify_planes_array, *vb, pb);
+	ret = q->have_verify_planes_array ?
+		call_bufop(q, verify_planes_array, *vb, pb) : 0;
 	if (!ret)
 		list_del(&(*vb)->done_entry);
 	spin_unlock_irqrestore(&q->done_lock, flags);
--- a/drivers/media/v4l2-core/videobuf2-v4l2.c
+++ b/drivers/media/v4l2-core/videobuf2-v4l2.c
@@ -767,6 +767,7 @@ int vb2_queue_init(struct vb2_queue *q)
 		q->buf_struct_size = sizeof(struct vb2_v4l2_buffer);
 
 	q->buf_ops = &v4l2_buf_ops;
+	q->have_verify_planes_array = 1;
 	q->is_multiplanar = V4L2_TYPE_IS_MULTIPLANAR(q->type);
 	q->is_output = V4L2_TYPE_IS_OUTPUT(q->type);
 	q->copy_timestamp = (q->timestamp_flags & V4L2_BUF_FLAG_TIMESTAMP_MASK)
--- a/include/media/videobuf2-core.h
+++ b/include/media/videobuf2-core.h
@@ -387,11 +387,14 @@ struct vb2_ops {
  *			the vb2_buffer struct.
  */
 struct vb2_buf_ops {
-	int (*verify_planes_array)(struct vb2_buffer *vb, const void *pb);
 	void (*fill_user_buffer)(struct vb2_buffer *vb, void *pb);
 	int (*fill_vb2_buffer)(struct vb2_buffer *vb, const void *pb,
 				struct vb2_plane *planes);
 	void (*copy_timestamp)(struct vb2_buffer *vb, const void *pb);
+#ifndef __GENKSYMS__
+	/* Only valid if vb2_queue::have_verify_planes_array is set */
+	int (*verify_planes_array)(struct vb2_buffer *vb, const void *pb);
+#endif
 };
 
 /**
@@ -470,7 +473,11 @@ struct vb2_queue {
 	unsigned			fileio_read_once:1;
 	unsigned			fileio_write_immediately:1;
 	unsigned			allow_zero_bytesused:1;
+#ifndef __GENKSYMS__
 	unsigned		   quirk_poll_must_check_waiting_for_buffers:1;
+	unsigned			have_verify_planes_array:1;
+	/* 27 bits spare */
+#endif
 
 	struct mutex			*lock;
 	void				*owner;
