All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH 1/6] [media] vb2: only check ret if we assigned it
@ 2017-02-15 17:55 Gustavo Padovan
  2017-02-15 17:55 ` [PATCH 2/6] [media] ivtv: improve subscribe_event handling Gustavo Padovan
                   ` (4 more replies)
  0 siblings, 5 replies; 8+ messages in thread
From: Gustavo Padovan @ 2017-02-15 17:55 UTC (permalink / raw)
  To: linux-media
  Cc: Gustavo Padovan, Pawel Osciak, Marek Szyprowski, Kyungmin Park,
	Mauro Carvalho Chehab, open list

From: Gustavo Padovan <gustavo.padovan@collabora.com>

Move the ret check to the right level under if (pb). It is not
used by the code before that point if pb is NULL.

Signed-off-by: Gustavo Padovan <gustavo.padovan@collabora.com>
---
 drivers/media/v4l2-core/videobuf2-core.c | 14 ++++++++------
 1 file changed, 8 insertions(+), 6 deletions(-)

diff --git a/drivers/media/v4l2-core/videobuf2-core.c b/drivers/media/v4l2-core/videobuf2-core.c
index 7c1d390..94afbbf9 100644
--- a/drivers/media/v4l2-core/videobuf2-core.c
+++ b/drivers/media/v4l2-core/videobuf2-core.c
@@ -984,11 +984,12 @@ static int __qbuf_userptr(struct vb2_buffer *vb, const void *pb)
 
 	memset(planes, 0, sizeof(planes[0]) * vb->num_planes);
 	/* Copy relevant information provided by the userspace */
-	if (pb)
+	if (pb) {
 		ret = call_bufop(vb->vb2_queue, fill_vb2_buffer,
 				 vb, pb, planes);
-	if (ret)
-		return ret;
+		if (ret)
+			return ret;
+	}
 
 	for (plane = 0; plane < vb->num_planes; ++plane) {
 		/* Skip the plane if already verified */
@@ -1101,11 +1102,12 @@ static int __qbuf_dmabuf(struct vb2_buffer *vb, const void *pb)
 
 	memset(planes, 0, sizeof(planes[0]) * vb->num_planes);
 	/* Copy relevant information provided by the userspace */
-	if (pb)
+	if (pb) {
 		ret = call_bufop(vb->vb2_queue, fill_vb2_buffer,
 				 vb, pb, planes);
-	if (ret)
-		return ret;
+		if (ret)
+			return ret;
+	}
 
 	for (plane = 0; plane < vb->num_planes; ++plane) {
 		struct dma_buf *dbuf = dma_buf_get(planes[plane].m.fd);
-- 
2.9.3

^ permalink raw reply related	[flat|nested] 8+ messages in thread

* [PATCH 2/6] [media] ivtv: improve subscribe_event handling
  2017-02-15 17:55 [PATCH 1/6] [media] vb2: only check ret if we assigned it Gustavo Padovan
@ 2017-02-15 17:55 ` Gustavo Padovan
  2017-02-15 17:55 ` [PATCH 3/6] [media] solo6x10: improve subscribe event handling Gustavo Padovan
                   ` (3 subsequent siblings)
  4 siblings, 0 replies; 8+ messages in thread
From: Gustavo Padovan @ 2017-02-15 17:55 UTC (permalink / raw)
  To: linux-media; +Cc: Gustavo Padovan, Andy Walls, Mauro Carvalho Chehab, open list

From: Gustavo Padovan <gustavo.padovan@collabora.com>

Simplify logic and call v4l2_ctrl_subscribe_event() directly instead
of copying its content over to ivtv_subscribe_event().

Signed-off-by: Gustavo Padovan <gustavo.padovan@collabora.com>
---
 drivers/media/pci/ivtv/ivtv-ioctl.c | 4 +---
 1 file changed, 1 insertion(+), 3 deletions(-)

diff --git a/drivers/media/pci/ivtv/ivtv-ioctl.c b/drivers/media/pci/ivtv/ivtv-ioctl.c
index f956188..670462d 100644
--- a/drivers/media/pci/ivtv/ivtv-ioctl.c
+++ b/drivers/media/pci/ivtv/ivtv-ioctl.c
@@ -1506,10 +1506,8 @@ static int ivtv_subscribe_event(struct v4l2_fh *fh, const struct v4l2_event_subs
 	case V4L2_EVENT_VSYNC:
 	case V4L2_EVENT_EOS:
 		return v4l2_event_subscribe(fh, sub, 0, NULL);
-	case V4L2_EVENT_CTRL:
-		return v4l2_event_subscribe(fh, sub, 0, &v4l2_ctrl_sub_ev_ops);
 	default:
-		return -EINVAL;
+		return v4l2_ctrl_subscribe_event(fh, sub);
 	}
 }
 
-- 
2.9.3

^ permalink raw reply related	[flat|nested] 8+ messages in thread

* [PATCH 3/6] [media] solo6x10: improve subscribe event handling
  2017-02-15 17:55 [PATCH 1/6] [media] vb2: only check ret if we assigned it Gustavo Padovan
  2017-02-15 17:55 ` [PATCH 2/6] [media] ivtv: improve subscribe_event handling Gustavo Padovan
@ 2017-02-15 17:55 ` Gustavo Padovan
  2017-02-23 11:28   ` Andrey Utkin
  2017-02-15 17:55 ` [PATCH 4/6] [media] tw5864: " Gustavo Padovan
                   ` (2 subsequent siblings)
  4 siblings, 1 reply; 8+ messages in thread
From: Gustavo Padovan @ 2017-02-15 17:55 UTC (permalink / raw)
  To: linux-media
  Cc: Gustavo Padovan, Bluecherry Maintainers, Andrey Utkin,
	Ismael Luceno, Mauro Carvalho Chehab, open list

From: Gustavo Padovan <gustavo.padovan@collabora.com>

We already check for the V4L2_EVENT_CTRL inside
v4l2_ctrl_subscribe_event() so just move the function to the default:
branch of the switch and let it does the job for us.

Signed-off-by: Gustavo Padovan <gustavo.padovan@collabora.com>
---
 drivers/media/pci/solo6x10/solo6x10-v4l2-enc.c | 5 ++---
 1 file changed, 2 insertions(+), 3 deletions(-)

diff --git a/drivers/media/pci/solo6x10/solo6x10-v4l2-enc.c b/drivers/media/pci/solo6x10/solo6x10-v4l2-enc.c
index 25a2137..25f9f2e 100644
--- a/drivers/media/pci/solo6x10/solo6x10-v4l2-enc.c
+++ b/drivers/media/pci/solo6x10/solo6x10-v4l2-enc.c
@@ -1140,14 +1140,13 @@ static int solo_subscribe_event(struct v4l2_fh *fh,
 {
 
 	switch (sub->type) {
-	case V4L2_EVENT_CTRL:
-		return v4l2_ctrl_subscribe_event(fh, sub);
 	case V4L2_EVENT_MOTION_DET:
 		/* Allow for up to 30 events (1 second for NTSC) to be
 		 * stored. */
 		return v4l2_event_subscribe(fh, sub, 30, NULL);
+	default:
+		return v4l2_ctrl_subscribe_event(fh, sub);
 	}
-	return -EINVAL;
 }
 
 static const struct v4l2_file_operations solo_enc_fops = {
-- 
2.9.3

^ permalink raw reply related	[flat|nested] 8+ messages in thread

* [PATCH 4/6] [media] tw5864: improve subscribe event handling
  2017-02-15 17:55 [PATCH 1/6] [media] vb2: only check ret if we assigned it Gustavo Padovan
  2017-02-15 17:55 ` [PATCH 2/6] [media] ivtv: improve subscribe_event handling Gustavo Padovan
  2017-02-15 17:55 ` [PATCH 3/6] [media] solo6x10: improve subscribe event handling Gustavo Padovan
@ 2017-02-15 17:55 ` Gustavo Padovan
  2017-02-23 11:28   ` Andrey Utkin
  2017-02-15 17:55 ` [PATCH 5/6] [media] vivid: " Gustavo Padovan
  2017-02-15 17:55 ` [PATCH 6/6] [media] go7007: " Gustavo Padovan
  4 siblings, 1 reply; 8+ messages in thread
From: Gustavo Padovan @ 2017-02-15 17:55 UTC (permalink / raw)
  To: linux-media
  Cc: Gustavo Padovan, Bluecherry Maintainers, Andrey Utkin,
	Mauro Carvalho Chehab, open list

From: Gustavo Padovan <gustavo.padovan@collabora.com>

We already check for the V4L2_EVENT_CTRL inside
v4l2_ctrl_subscribe_event() so just move this function to the default:
branch of the switch and let it does the job for us.

Signed-off-by: Gustavo Padovan <gustavo.padovan@collabora.com>
---
 drivers/media/pci/tw5864/tw5864-video.c | 5 ++---
 1 file changed, 2 insertions(+), 3 deletions(-)

diff --git a/drivers/media/pci/tw5864/tw5864-video.c b/drivers/media/pci/tw5864/tw5864-video.c
index 9421216..6d5ed8e 100644
--- a/drivers/media/pci/tw5864/tw5864-video.c
+++ b/drivers/media/pci/tw5864/tw5864-video.c
@@ -664,15 +664,14 @@ static int tw5864_subscribe_event(struct v4l2_fh *fh,
 				  const struct v4l2_event_subscription *sub)
 {
 	switch (sub->type) {
-	case V4L2_EVENT_CTRL:
-		return v4l2_ctrl_subscribe_event(fh, sub);
 	case V4L2_EVENT_MOTION_DET:
 		/*
 		 * Allow for up to 30 events (1 second for NTSC) to be stored.
 		 */
 		return v4l2_event_subscribe(fh, sub, 30, NULL);
+	default:
+		return v4l2_ctrl_subscribe_event(fh, sub);
 	}
-	return -EINVAL;
 }
 
 static void tw5864_frame_interval_set(struct tw5864_input *input)
-- 
2.9.3

^ permalink raw reply related	[flat|nested] 8+ messages in thread

* [PATCH 5/6] [media] vivid: improve subscribe event handling
  2017-02-15 17:55 [PATCH 1/6] [media] vb2: only check ret if we assigned it Gustavo Padovan
                   ` (2 preceding siblings ...)
  2017-02-15 17:55 ` [PATCH 4/6] [media] tw5864: " Gustavo Padovan
@ 2017-02-15 17:55 ` Gustavo Padovan
  2017-02-15 17:55 ` [PATCH 6/6] [media] go7007: " Gustavo Padovan
  4 siblings, 0 replies; 8+ messages in thread
From: Gustavo Padovan @ 2017-02-15 17:55 UTC (permalink / raw)
  To: linux-media
  Cc: Gustavo Padovan, Hans Verkuil, Mauro Carvalho Chehab, open list

From: Gustavo Padovan <gustavo.padovan@collabora.com>

We already check for the V4L2_EVENT_CTRL inside
v4l2_ctrl_subscribe_event() so just move this fuction to the default:
branch of the switch and let it does the job for us.

Signed-off-by: Gustavo Padovan <gustavo.padovan@collabora.com>
---
 drivers/media/platform/vivid/vivid-vid-out.c | 4 +---
 1 file changed, 1 insertion(+), 3 deletions(-)

diff --git a/drivers/media/platform/vivid/vivid-vid-out.c b/drivers/media/platform/vivid/vivid-vid-out.c
index 7ba52ee..1a33730 100644
--- a/drivers/media/platform/vivid/vivid-vid-out.c
+++ b/drivers/media/platform/vivid/vivid-vid-out.c
@@ -1172,14 +1172,12 @@ int vidioc_subscribe_event(struct v4l2_fh *fh,
 			const struct v4l2_event_subscription *sub)
 {
 	switch (sub->type) {
-	case V4L2_EVENT_CTRL:
-		return v4l2_ctrl_subscribe_event(fh, sub);
 	case V4L2_EVENT_SOURCE_CHANGE:
 		if (fh->vdev->vfl_dir == VFL_DIR_RX)
 			return v4l2_src_change_event_subscribe(fh, sub);
 		break;
 	default:
-		break;
+		return v4l2_ctrl_subscribe_event(fh, sub);
 	}
 	return -EINVAL;
 }
-- 
2.9.3

^ permalink raw reply related	[flat|nested] 8+ messages in thread

* [PATCH 6/6] [media] go7007: improve subscribe event handling
  2017-02-15 17:55 [PATCH 1/6] [media] vb2: only check ret if we assigned it Gustavo Padovan
                   ` (3 preceding siblings ...)
  2017-02-15 17:55 ` [PATCH 5/6] [media] vivid: " Gustavo Padovan
@ 2017-02-15 17:55 ` Gustavo Padovan
  4 siblings, 0 replies; 8+ messages in thread
From: Gustavo Padovan @ 2017-02-15 17:55 UTC (permalink / raw)
  To: linux-media
  Cc: Gustavo Padovan, Hans Verkuil, Mauro Carvalho Chehab, open list

From: Gustavo Padovan <gustavo.padovan@collabora.com>

We already check for the V4L2_EVENT_CTRL inside
v4l2_ctrl_subscribe_event() so just move this function to the default:
branch of the switch and let it does the job for us.

Signed-off-by: Gustavo Padovan <gustavo.padovan@collabora.com>
---
 drivers/media/usb/go7007/go7007-v4l2.c | 5 ++---
 1 file changed, 2 insertions(+), 3 deletions(-)

diff --git a/drivers/media/usb/go7007/go7007-v4l2.c b/drivers/media/usb/go7007/go7007-v4l2.c
index 4eaba0c..ed5ec97 100644
--- a/drivers/media/usb/go7007/go7007-v4l2.c
+++ b/drivers/media/usb/go7007/go7007-v4l2.c
@@ -792,14 +792,13 @@ static int vidioc_subscribe_event(struct v4l2_fh *fh,
 {
 
 	switch (sub->type) {
-	case V4L2_EVENT_CTRL:
-		return v4l2_ctrl_subscribe_event(fh, sub);
 	case V4L2_EVENT_MOTION_DET:
 		/* Allow for up to 30 events (1 second for NTSC) to be
 		 * stored. */
 		return v4l2_event_subscribe(fh, sub, 30, NULL);
+	default:
+		return v4l2_ctrl_subscribe_event(fh, sub);
 	}
-	return -EINVAL;
 }
 
 
-- 
2.9.3

^ permalink raw reply related	[flat|nested] 8+ messages in thread

* Re: [PATCH 3/6] [media] solo6x10: improve subscribe event handling
  2017-02-15 17:55 ` [PATCH 3/6] [media] solo6x10: improve subscribe event handling Gustavo Padovan
@ 2017-02-23 11:28   ` Andrey Utkin
  0 siblings, 0 replies; 8+ messages in thread
From: Andrey Utkin @ 2017-02-23 11:28 UTC (permalink / raw)
  To: Gustavo Padovan
  Cc: linux-media, Gustavo Padovan, Bluecherry Maintainers,
	Ismael Luceno, Mauro Carvalho Chehab, open list

Hi Gustavo,

Thanks for the patches, and sorry for delay.

Acked-by: Andrey Utkin <andrey.utkin@corp.bluecherry.net>

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: [PATCH 4/6] [media] tw5864: improve subscribe event handling
  2017-02-15 17:55 ` [PATCH 4/6] [media] tw5864: " Gustavo Padovan
@ 2017-02-23 11:28   ` Andrey Utkin
  0 siblings, 0 replies; 8+ messages in thread
From: Andrey Utkin @ 2017-02-23 11:28 UTC (permalink / raw)
  To: Gustavo Padovan
  Cc: linux-media, Gustavo Padovan, Bluecherry Maintainers,
	Mauro Carvalho Chehab, open list

Hi Gustavo,

Thanks for the patches, and sorry for delay.

Acked-by: Andrey Utkin <andrey.utkin@corp.bluecherry.net>

^ permalink raw reply	[flat|nested] 8+ messages in thread

end of thread, other threads:[~2017-02-23 11:57 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-02-15 17:55 [PATCH 1/6] [media] vb2: only check ret if we assigned it Gustavo Padovan
2017-02-15 17:55 ` [PATCH 2/6] [media] ivtv: improve subscribe_event handling Gustavo Padovan
2017-02-15 17:55 ` [PATCH 3/6] [media] solo6x10: improve subscribe event handling Gustavo Padovan
2017-02-23 11:28   ` Andrey Utkin
2017-02-15 17:55 ` [PATCH 4/6] [media] tw5864: " Gustavo Padovan
2017-02-23 11:28   ` Andrey Utkin
2017-02-15 17:55 ` [PATCH 5/6] [media] vivid: " Gustavo Padovan
2017-02-15 17:55 ` [PATCH 6/6] [media] go7007: " Gustavo Padovan

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.