All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH 0/2] Fix v4l2-pci-skeleton driver
@ 2018-11-26 18:01 Michael Tretter
  2018-11-26 18:01 ` [PATCH 1/2] [media] v4l2-pci-skeleton: depend on CONFIG_SAMPLES Michael Tretter
  2018-11-26 18:01 ` [PATCH 2/2] [media] v4l2-pci-skeleton: replace vb2_buffer with vb2_v4l2_buffer Michael Tretter
  0 siblings, 2 replies; 3+ messages in thread
From: Michael Tretter @ 2018-11-26 18:01 UTC (permalink / raw)
  To: hverkuil; +Cc: mchehab, linux-media, Michael Tretter

This series fixes the v4l2-pci-skeleton driver to make it usable as a
reference for new v4l2 drivers again.

The driver was skipped when replacing vb2_buffer with vb2_v4l2_buffers for
v4l2 drivers. Moreover, VIDEO_PCI_SKELETON did not ensure that it is
actually build.

Michael Tretter (2):
  [media] v4l2-pci-skeleton: depend on CONFIG_SAMPLES
  [media] v4l2-pci-skeleton: replace vb2_buffer with vb2_v4l2_buffer

 drivers/media/v4l2-core/Kconfig |  1 +
 samples/v4l/v4l2-pci-skeleton.c | 11 ++++++-----
 2 files changed, 7 insertions(+), 5 deletions(-)

-- 
2.19.1

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

* [PATCH 1/2] [media] v4l2-pci-skeleton: depend on CONFIG_SAMPLES
  2018-11-26 18:01 [PATCH 0/2] Fix v4l2-pci-skeleton driver Michael Tretter
@ 2018-11-26 18:01 ` Michael Tretter
  2018-11-26 18:01 ` [PATCH 2/2] [media] v4l2-pci-skeleton: replace vb2_buffer with vb2_v4l2_buffer Michael Tretter
  1 sibling, 0 replies; 3+ messages in thread
From: Michael Tretter @ 2018-11-26 18:01 UTC (permalink / raw)
  To: hverkuil; +Cc: mchehab, linux-media, Michael Tretter

Commit 0185f8501762 ("[media] samples: v4l: from Documentation to
samples directory") moved the v4l2-pci-skeleton driver to the samples
directory. The samples are only be built, if CONFIG_SAMPLES is enabled.

Therefore, VIDEO_PCI_SKELETON is not enough to build the
v4l2-pci-skeleton driver, but SAMPLES needs to be enabled, too. Let
VIDEO_PCI_SKELETON depend on SAMPLES.

Signed-off-by: Michael Tretter <m.tretter@pengutronix.de>
---
 drivers/media/v4l2-core/Kconfig | 1 +
 1 file changed, 1 insertion(+)

diff --git a/drivers/media/v4l2-core/Kconfig b/drivers/media/v4l2-core/Kconfig
index b97090e85996..c0940f5c69b4 100644
--- a/drivers/media/v4l2-core/Kconfig
+++ b/drivers/media/v4l2-core/Kconfig
@@ -30,6 +30,7 @@ config VIDEO_FIXED_MINOR_RANGES
 config VIDEO_PCI_SKELETON
 	tristate "Skeleton PCI V4L2 driver"
 	depends on PCI
+	depends on SAMPLES
 	depends on VIDEO_V4L2 && VIDEOBUF2_CORE
 	depends on VIDEOBUF2_MEMOPS && VIDEOBUF2_DMA_CONTIG
 	---help---
-- 
2.19.1

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

* [PATCH 2/2] [media] v4l2-pci-skeleton: replace vb2_buffer with vb2_v4l2_buffer
  2018-11-26 18:01 [PATCH 0/2] Fix v4l2-pci-skeleton driver Michael Tretter
  2018-11-26 18:01 ` [PATCH 1/2] [media] v4l2-pci-skeleton: depend on CONFIG_SAMPLES Michael Tretter
@ 2018-11-26 18:01 ` Michael Tretter
  1 sibling, 0 replies; 3+ messages in thread
From: Michael Tretter @ 2018-11-26 18:01 UTC (permalink / raw)
  To: hverkuil; +Cc: mchehab, linux-media, Michael Tretter

Commit 2d7007153f0c ("[media] media: videobuf2: Restructure vb2_buffer")
replaced vb2_buffer with vb2_v4l2_buffer in all v4l2 drivers. The
restructuring skipped the v4l2-pci-skeleton, probably because it resides
outside the drivers directory.

The v4l2_buf_ops assume that the passed buffer is a vb2_v4l2_buffer.
This is not the case if the skel_buffer is based on vb2_buffer instead
of vb2_v4l2_buffer.

Replace vb2_buffer with vb2_v4l2_buffer in the skeleton to make sure
that future drivers that are based on the skeleton use vb2_v4l2_buffer.

Signed-off-by: Michael Tretter <m.tretter@pengutronix.de>
---
 samples/v4l/v4l2-pci-skeleton.c | 11 ++++++-----
 1 file changed, 6 insertions(+), 5 deletions(-)

diff --git a/samples/v4l/v4l2-pci-skeleton.c b/samples/v4l/v4l2-pci-skeleton.c
index f520e3aef9c6..27ec30952cfa 100644
--- a/samples/v4l/v4l2-pci-skeleton.c
+++ b/samples/v4l/v4l2-pci-skeleton.c
@@ -80,13 +80,13 @@ struct skeleton {
 };
 
 struct skel_buffer {
-	struct vb2_buffer vb;
+	struct vb2_v4l2_buffer vb;
 	struct list_head list;
 };
 
-static inline struct skel_buffer *to_skel_buffer(struct vb2_buffer *vb2)
+static inline struct skel_buffer *to_skel_buffer(struct vb2_v4l2_buffer *vbuf)
 {
-	return container_of(vb2, struct skel_buffer, vb);
+	return container_of(vbuf, struct skel_buffer, vb);
 }
 
 static const struct pci_device_id skeleton_pci_tbl[] = {
@@ -212,8 +212,9 @@ static int buffer_prepare(struct vb2_buffer *vb)
  */
 static void buffer_queue(struct vb2_buffer *vb)
 {
+	struct vb2_v4l2_buffer *vbuf = to_vb2_v4l2_buffer(vb);
 	struct skeleton *skel = vb2_get_drv_priv(vb->vb2_queue);
-	struct skel_buffer *buf = to_skel_buffer(vb);
+	struct skel_buffer *buf = to_skel_buffer(vbuf);
 	unsigned long flags;
 
 	spin_lock_irqsave(&skel->qlock, flags);
@@ -232,7 +233,7 @@ static void return_all_buffers(struct skeleton *skel,
 
 	spin_lock_irqsave(&skel->qlock, flags);
 	list_for_each_entry_safe(buf, node, &skel->buf_list, list) {
-		vb2_buffer_done(&buf->vb, state);
+		vb2_buffer_done(&buf->vb.vb2_buf, state);
 		list_del(&buf->list);
 	}
 	spin_unlock_irqrestore(&skel->qlock, flags);
-- 
2.19.1

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

end of thread, other threads:[~2018-11-27  5:12 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-11-26 18:01 [PATCH 0/2] Fix v4l2-pci-skeleton driver Michael Tretter
2018-11-26 18:01 ` [PATCH 1/2] [media] v4l2-pci-skeleton: depend on CONFIG_SAMPLES Michael Tretter
2018-11-26 18:01 ` [PATCH 2/2] [media] v4l2-pci-skeleton: replace vb2_buffer with vb2_v4l2_buffer Michael Tretter

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.