From patchwork Mon Nov 26 18:01:23 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Michael Tretter X-Patchwork-Id: 10698903 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id C17A815A7 for ; Mon, 26 Nov 2018 18:17:47 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id B694A2A1BB for ; Mon, 26 Nov 2018 18:17:47 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id A9E702A192; Mon, 26 Nov 2018 18:17:47 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-7.9 required=2.0 tests=BAYES_00,MAILING_LIST_MULTI, RCVD_IN_DNSWL_HI autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 4FBC72A192 for ; Mon, 26 Nov 2018 18:17:47 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726694AbeK0FMk (ORCPT ); Tue, 27 Nov 2018 00:12:40 -0500 Received: from metis.ext.pengutronix.de ([85.220.165.71]:58669 "EHLO metis.ext.pengutronix.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726599AbeK0FMj (ORCPT ); Tue, 27 Nov 2018 00:12:39 -0500 Received: from dude.hi.pengutronix.de ([2001:67c:670:100:1d::7]) by metis.ext.pengutronix.de with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.89) (envelope-from ) id 1gRLCM-00074D-Am; Mon, 26 Nov 2018 19:01:30 +0100 Received: from mtr by dude.hi.pengutronix.de with local (Exim 4.91) (envelope-from ) id 1gRLCM-0003xe-1c; Mon, 26 Nov 2018 19:01:30 +0100 From: Michael Tretter To: hverkuil@xs4all.nl Cc: mchehab@kernel.org, linux-media@vger.kernel.org, Michael Tretter Subject: [PATCH 1/2] [media] v4l2-pci-skeleton: depend on CONFIG_SAMPLES Date: Mon, 26 Nov 2018 19:01:23 +0100 Message-Id: <20181126180124.15161-2-m.tretter@pengutronix.de> X-Mailer: git-send-email 2.19.1 In-Reply-To: <20181126180124.15161-1-m.tretter@pengutronix.de> References: <20181126180124.15161-1-m.tretter@pengutronix.de> MIME-Version: 1.0 X-SA-Exim-Connect-IP: 2001:67c:670:100:1d::7 X-SA-Exim-Mail-From: mtr@pengutronix.de X-SA-Exim-Scanned: No (on metis.ext.pengutronix.de); SAEximRunCond expanded to false X-PTX-Original-Recipient: linux-media@vger.kernel.org Sender: linux-media-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-media@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP 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 --- 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--- From patchwork Mon Nov 26 18:01:24 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Michael Tretter X-Patchwork-Id: 10698893 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 03F9015A7 for ; Mon, 26 Nov 2018 18:17:28 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id E1F0F2A192 for ; Mon, 26 Nov 2018 18:17:27 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id D5D1C2A1CD; Mon, 26 Nov 2018 18:17:27 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-7.9 required=2.0 tests=BAYES_00,MAILING_LIST_MULTI, RCVD_IN_DNSWL_HI autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 5F5302A192 for ; Mon, 26 Nov 2018 18:17:27 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1725739AbeK0FMV (ORCPT ); Tue, 27 Nov 2018 00:12:21 -0500 Received: from metis.ext.pengutronix.de ([85.220.165.71]:58669 "EHLO metis.ext.pengutronix.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725199AbeK0FMU (ORCPT ); Tue, 27 Nov 2018 00:12:20 -0500 Received: from dude.hi.pengutronix.de ([2001:67c:670:100:1d::7]) by metis.ext.pengutronix.de with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.89) (envelope-from ) id 1gRLCM-00074E-Am; Mon, 26 Nov 2018 19:01:30 +0100 Received: from mtr by dude.hi.pengutronix.de with local (Exim 4.91) (envelope-from ) id 1gRLCM-0003xi-22; Mon, 26 Nov 2018 19:01:30 +0100 From: Michael Tretter To: hverkuil@xs4all.nl Cc: mchehab@kernel.org, linux-media@vger.kernel.org, Michael Tretter Subject: [PATCH 2/2] [media] v4l2-pci-skeleton: replace vb2_buffer with vb2_v4l2_buffer Date: Mon, 26 Nov 2018 19:01:24 +0100 Message-Id: <20181126180124.15161-3-m.tretter@pengutronix.de> X-Mailer: git-send-email 2.19.1 In-Reply-To: <20181126180124.15161-1-m.tretter@pengutronix.de> References: <20181126180124.15161-1-m.tretter@pengutronix.de> MIME-Version: 1.0 X-SA-Exim-Connect-IP: 2001:67c:670:100:1d::7 X-SA-Exim-Mail-From: mtr@pengutronix.de X-SA-Exim-Scanned: No (on metis.ext.pengutronix.de); SAEximRunCond expanded to false X-PTX-Original-Recipient: linux-media@vger.kernel.org Sender: linux-media-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-media@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP 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 --- 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);