From patchwork Tue Dec 14 16:16:19 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Corentin LABBE X-Patchwork-Id: 12676291 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 0AC14C4321E for ; Tue, 14 Dec 2021 16:17:01 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S235633AbhLNQQr (ORCPT ); Tue, 14 Dec 2021 11:16:47 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:57916 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S235606AbhLNQQo (ORCPT ); Tue, 14 Dec 2021 11:16:44 -0500 Received: from mail-wm1-x32c.google.com (mail-wm1-x32c.google.com [IPv6:2a00:1450:4864:20::32c]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 4E142C06173E for ; Tue, 14 Dec 2021 08:16:44 -0800 (PST) Received: by mail-wm1-x32c.google.com with SMTP id p18so14622081wmq.5 for ; Tue, 14 Dec 2021 08:16:44 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=baylibre-com.20210112.gappssmtp.com; s=20210112; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=swEGGVp8+HI45UprzcHEDFUC6TlCIZ4vzEzvc39jOtk=; b=f7yW4PR6uPCjMNQmtaga5CpeiuDfS8xum2OkcCr6FcVQSriGW8zjOYCnsKzZpepu+w eAQe13kZ2yQpqB589GRmwdbQN4FiQY1FND9ZB/s4c6/yh33ChDLfE+Og0ZjrpFXe+bQR lAQ32r2sEVpUqmMjePGbbcz17tPxoM4B/5pZf0e6xFvGrnSPIp/kW3thAmyKJp30Qf1Z HnK+NVHDPDhAvwCDifSdLPQshjf/nCVI06xb6fY1+bPkXO20zjFCpErx/XGOApk8ty9d ySmUO76hrNBglX57iAYOfXK1HgTn75CbSEXoQaAZ2VHxOCO+RS6yg0LRfC0+yuQiSA6U L+Iw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=swEGGVp8+HI45UprzcHEDFUC6TlCIZ4vzEzvc39jOtk=; b=UCGoJ/sXVfSOLtUVwblOUY/wS90Vpc5ihG3f/ZXzQj1TPfPGlVLzv4WeTt5Z6xTtL8 sjPdsnun0CRQGnuQXXXptO27TiXeU6KMNfyJCHmJR3FR1zRz5rW+KSElS2drpFonphYC o/VmSExYwMPXWRBbKRK7RxnY3NBSZRGrdlrguTP0EMGCyrsTW9UmWdKY90fcG6SZD49z PlPXZKbCJFX8R+3W2mhWYjRhoXIsR4RfZuxQaFyYTthi6+ltJmaT2TGa1FP6ITPwijyT evLvHrsgXLpzuEafAnC2iFlG28ZnQFEEV7XqsIOIoHlr+O8m4b8QW8VeTBXd2O+sKSsJ SX+Q== X-Gm-Message-State: AOAM531tp7580g2WZ6OCRJgTw8EPLH3Wb/eQKvJG/SWMI7TnB5Ir0Hof aWKzZLiiOqQWN89FP+qi9YdEGg== X-Google-Smtp-Source: ABdhPJy+d7umVVyxM5jeSz1nNZI2qqhZLXKiePnhF+3DxISvMk460ggAsg70fmMCFjHsLiwj6bvNpw== X-Received: by 2002:a05:600c:1548:: with SMTP id f8mr47271806wmg.67.1639498602877; Tue, 14 Dec 2021 08:16:42 -0800 (PST) Received: from localhost.localdomain (laubervilliers-658-1-213-31.w90-63.abo.wanadoo.fr. [90.63.244.31]) by smtp.googlemail.com with ESMTPSA id a9sm295116wrt.66.2021.12.14.08.16.42 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 14 Dec 2021 08:16:42 -0800 (PST) From: Corentin Labbe To: mchehab@kernel.org, hverkuil@xs4all.nl, gregkh@linuxfoundation.org Cc: linux-kernel@vger.kernel.org, linux-media@vger.kernel.org, linux-staging@lists.linux.dev, mjpeg-users@lists.sourceforge.net, Corentin Labbe Subject: [PATCH v4 01/18] staging: media: zoran: move module parameter checks to zoran_probe Date: Tue, 14 Dec 2021 16:16:19 +0000 Message-Id: <20211214161636.1886900-2-clabbe@baylibre.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20211214161636.1886900-1-clabbe@baylibre.com> References: <20211214161636.1886900-1-clabbe@baylibre.com> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-media@vger.kernel.org We need to empty zoran_init() for removing it later. Furthermore, this permit to use pci_xxx instead of pr_xxx for prettier printing. Signed-off-by: Corentin Labbe --- drivers/staging/media/zoran/zoran_card.c | 64 ++++++++++++------------ 1 file changed, 33 insertions(+), 31 deletions(-) diff --git a/drivers/staging/media/zoran/zoran_card.c b/drivers/staging/media/zoran/zoran_card.c index f259585b0689..3bc0e64f1007 100644 --- a/drivers/staging/media/zoran/zoran_card.c +++ b/drivers/staging/media/zoran/zoran_card.c @@ -1067,6 +1067,39 @@ static int zoran_probe(struct pci_dev *pdev, const struct pci_device_id *ent) unsigned int nr; int err; + pci_info(pdev, "Zoran MJPEG board driver version %s\n", ZORAN_VERSION); + + /* check the parameters we have been given, adjust if necessary */ + if (v4l_nbufs < 2) + v4l_nbufs = 2; + if (v4l_nbufs > VIDEO_MAX_FRAME) + v4l_nbufs = VIDEO_MAX_FRAME; + /* The user specifies the in KB, we want them in byte (and page aligned) */ + v4l_bufsize = PAGE_ALIGN(v4l_bufsize * 1024); + if (v4l_bufsize < 32768) + v4l_bufsize = 32768; + /* 2 MB is arbitrary but sufficient for the maximum possible images */ + if (v4l_bufsize > 2048 * 1024) + v4l_bufsize = 2048 * 1024; + if (jpg_nbufs < 4) + jpg_nbufs = 4; + if (jpg_nbufs > BUZ_MAX_FRAME) + jpg_nbufs = BUZ_MAX_FRAME; + jpg_bufsize = PAGE_ALIGN(jpg_bufsize * 1024); + if (jpg_bufsize < 8192) + jpg_bufsize = 8192; + if (jpg_bufsize > (512 * 1024)) + jpg_bufsize = 512 * 1024; + /* Use parameter for vidmem or try to find a video card */ + if (vidmem) + pci_info(pdev, "%s: Using supplied video memory base address @ 0x%lx\n", + ZORAN_NAME, vidmem); + + /* some mainboards might not do PCI-PCI data transfer well */ + if (pci_pci_problems & (PCIPCI_FAIL | PCIAGP_FAIL | PCIPCI_ALIMAGIK)) + pci_warn(pdev, "%s: chipset does not support reliable PCI-PCI DMA\n", + ZORAN_NAME); + err = dma_set_mask_and_coherent(&pdev->dev, DMA_BIT_MASK(32)); if (err) return -ENODEV; @@ -1285,37 +1318,6 @@ static int __init zoran_init(void) { int res; - pr_info("Zoran MJPEG board driver version %s\n", ZORAN_VERSION); - - /* check the parameters we have been given, adjust if necessary */ - if (v4l_nbufs < 2) - v4l_nbufs = 2; - if (v4l_nbufs > VIDEO_MAX_FRAME) - v4l_nbufs = VIDEO_MAX_FRAME; - /* The user specifies the in KB, we want them in byte (and page aligned) */ - v4l_bufsize = PAGE_ALIGN(v4l_bufsize * 1024); - if (v4l_bufsize < 32768) - v4l_bufsize = 32768; - /* 2 MB is arbitrary but sufficient for the maximum possible images */ - if (v4l_bufsize > 2048 * 1024) - v4l_bufsize = 2048 * 1024; - if (jpg_nbufs < 4) - jpg_nbufs = 4; - if (jpg_nbufs > BUZ_MAX_FRAME) - jpg_nbufs = BUZ_MAX_FRAME; - jpg_bufsize = PAGE_ALIGN(jpg_bufsize * 1024); - if (jpg_bufsize < 8192) - jpg_bufsize = 8192; - if (jpg_bufsize > (512 * 1024)) - jpg_bufsize = 512 * 1024; - /* Use parameter for vidmem or try to find a video card */ - if (vidmem) - pr_info("%s: Using supplied video memory base address @ 0x%lx\n", ZORAN_NAME, vidmem); - - /* some mainboards might not do PCI-PCI data transfer well */ - if (pci_pci_problems & (PCIPCI_FAIL | PCIAGP_FAIL | PCIPCI_ALIMAGIK)) - pr_warn("%s: chipset does not support reliable PCI-PCI DMA\n", ZORAN_NAME); - res = pci_register_driver(&zoran_driver); if (res) { pr_err("Unable to register ZR36057 driver\n"); From patchwork Tue Dec 14 16:16:20 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Corentin LABBE X-Patchwork-Id: 12676281 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 3B53EC433F5 for ; Tue, 14 Dec 2021 16:16:48 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S235621AbhLNQQq (ORCPT ); Tue, 14 Dec 2021 11:16:46 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:57920 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S235620AbhLNQQp (ORCPT ); Tue, 14 Dec 2021 11:16:45 -0500 Received: from mail-wm1-x32e.google.com (mail-wm1-x32e.google.com [IPv6:2a00:1450:4864:20::32e]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 23811C06173E for ; Tue, 14 Dec 2021 08:16:45 -0800 (PST) Received: by mail-wm1-x32e.google.com with SMTP id p27-20020a05600c1d9b00b0033bf8532855so14107128wms.3 for ; Tue, 14 Dec 2021 08:16:45 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=baylibre-com.20210112.gappssmtp.com; s=20210112; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=ZX+m9eRP3G6qa3o26UuCwjfzdvb0rxacvbcUwg9LjVM=; b=T7EoM7c6Sk022NWt5q8QI8ShLGTFYSNYidgGL8J4+k0ABRAXcsARMRQMbJ0Zc5gLME vwl/OnAi09m6K9yCcSLj3M4uiDaS9NG1ibkgun+W+I9+ETW13U2juydwXkKP6CNaccE7 2ubatLNZY9OiZS/uiWFGCltszRFE0qfrVtx9t+RdUyaeUKny+ETTNkjlzlBKjdGV5Ps+ OtZI2/oK3d5/+Dx7Ptdw2Uj4y1QvK6Nyy6K8jlkdUxxCsxlTUyc7cOmxOzdtzafk3fUs rzOt6SNbm0SYqDNG0V7Kzcs/UaXuuMQfmk9TDaBkodkpUpYuwNlpPpFVdj7ZYd0twO/M /RoQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=ZX+m9eRP3G6qa3o26UuCwjfzdvb0rxacvbcUwg9LjVM=; b=fbs80267miwg6OquhlbFJURu13iRYEmC6LY9nJhalKt5RHrhY2zPRYXqrhDBbZTF+1 Bb86Zt+FFDAZQngRjYZo9bXwBmEdlDiA8AQZ/hExC0PgTSH5C5Ud/Do+HkP/et5o2+VW 9Wn/OKwx5fglLgty4bzxAMFEjGFVUsGFWXy+W5YK29FGfnIEkD0d3OyMf44HRD9CABt7 4nUMS4LX5+MiSuKZd5xoZHKyNoxxEcytDluiWBeqnIVUQ9bLIQqpQQUTGG9Cr39jUgWm 7QY+0L/cyp0oYBARGcK/DeXC6hBvUpNuISIHohDdpxUhYzPBWYSVoro5JYrlTZvY5V2y 9G8A== X-Gm-Message-State: AOAM530a24N25aEam5VYI8wnHFybYbC11MvdvunV+JtVxF09DqhYFAQM TN8pAGjTDUyYeBLHEhqDvOIGBA== X-Google-Smtp-Source: ABdhPJw6Q5uDW7bfECCayVdeOzj/tVZOc9GBRSpmdGpoot4fKLzdcuBHluJ/v6BPqVrCAASIM86lFw== X-Received: by 2002:a05:600c:3b28:: with SMTP id m40mr47730200wms.100.1639498603551; Tue, 14 Dec 2021 08:16:43 -0800 (PST) Received: from localhost.localdomain (laubervilliers-658-1-213-31.w90-63.abo.wanadoo.fr. [90.63.244.31]) by smtp.googlemail.com with ESMTPSA id a9sm295116wrt.66.2021.12.14.08.16.42 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 14 Dec 2021 08:16:43 -0800 (PST) From: Corentin Labbe To: mchehab@kernel.org, hverkuil@xs4all.nl, gregkh@linuxfoundation.org Cc: linux-kernel@vger.kernel.org, linux-media@vger.kernel.org, linux-staging@lists.linux.dev, mjpeg-users@lists.sourceforge.net, Corentin Labbe Subject: [PATCH v4 02/18] staging: media: zoran: use module_pci_driver Date: Tue, 14 Dec 2021 16:16:20 +0000 Message-Id: <20211214161636.1886900-3-clabbe@baylibre.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20211214161636.1886900-1-clabbe@baylibre.com> References: <20211214161636.1886900-1-clabbe@baylibre.com> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-media@vger.kernel.org Simplify code by using module_pci_driver() Signed-off-by: Corentin Labbe --- drivers/staging/media/zoran/zoran_card.c | 21 +-------------------- 1 file changed, 1 insertion(+), 20 deletions(-) diff --git a/drivers/staging/media/zoran/zoran_card.c b/drivers/staging/media/zoran/zoran_card.c index 3bc0e64f1007..f1465fbf98af 100644 --- a/drivers/staging/media/zoran/zoran_card.c +++ b/drivers/staging/media/zoran/zoran_card.c @@ -1314,23 +1314,4 @@ static struct pci_driver zoran_driver = { .remove = zoran_remove, }; -static int __init zoran_init(void) -{ - int res; - - res = pci_register_driver(&zoran_driver); - if (res) { - pr_err("Unable to register ZR36057 driver\n"); - return res; - } - - return 0; -} - -static void __exit zoran_exit(void) -{ - pci_unregister_driver(&zoran_driver); -} - -module_init(zoran_init); -module_exit(zoran_exit); +module_pci_driver(zoran_driver); From patchwork Tue Dec 14 16:16:21 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Corentin LABBE X-Patchwork-Id: 12676283 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id C8092C433FE for ; Tue, 14 Dec 2021 16:16:49 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S235645AbhLNQQs (ORCPT ); Tue, 14 Dec 2021 11:16:48 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:57922 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S235616AbhLNQQq (ORCPT ); Tue, 14 Dec 2021 11:16:46 -0500 Received: from mail-wm1-x329.google.com (mail-wm1-x329.google.com [IPv6:2a00:1450:4864:20::329]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id B171DC06173F for ; Tue, 14 Dec 2021 08:16:45 -0800 (PST) Received: by mail-wm1-x329.google.com with SMTP id c6-20020a05600c0ac600b0033c3aedd30aso14072116wmr.5 for ; Tue, 14 Dec 2021 08:16:45 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=baylibre-com.20210112.gappssmtp.com; s=20210112; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=UWYtJJBsa0LLLZRoFXWiICK8It/s64t7LfobsR7d4kA=; b=EoLYu7UrfWuEECfodtsBV6dRc4ZWw3wP1d2U+PETqSM2bMXzttgdgy/Uua7i+BB9gn ctespFvmt74uAPf3DxYTt1jHERuSpp7idcolqLysFGmcCj5Xjmjcm1mjGu1MXn/yyF1R l8DzKPIbOmaBprMAbWxCWPHSkqlHSsbPP9jxVfLtHEMZrnv77HxT/QVSssWXLDkANuJr mO/UVzPTL1h9mgCRcUlcvXdRPMtHGXjtRjDxLph7ZXuNIfAh5KTzaLlMfwAQ6wQnQ3jR tJgt+dBKoYoOEktOUu76hjEDSi/H/xdizIBzOsfEH65rrGn6mWXXnzJ2zXyLoZPdd6a5 nXXw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=UWYtJJBsa0LLLZRoFXWiICK8It/s64t7LfobsR7d4kA=; b=g2Hdk8loN6c5KbZcdzSiwwHW9dHosw2MaHW0RdL/hbjMeCSRdi2X07LkzIYHj/yYbw iG5VZmkfmdAO5EF/m+vAWPVLp4yTuAO0i1iEwstTFWjbzb7ybW7dnmoVIZRM6aPXd1Hr l00f5OziIywjSVGC7pu92IAV8oAouc7bdBJG4JnwacnJC4EJVenqb8/IwtrVOP5tOgwF I/+Am3Ot3uB/1vfa2TLhlOweDcNzamE5vwfPAQSlUlJ+v1689lov5WdtVwnFdT2m5kOf QuKs2cALxIW6U3DWnUpPuTdLpqYoSKydy7rakaOwQY3V+jFOh9QWNqH3eLhZ3ke7qblO X2+g== X-Gm-Message-State: AOAM532KYKeqKSTljpvVx88/H1gKSQfHl1MsU02V26UXC4QNLk1gzPnh HTjHqei4m1dkmbqKWC3z++e+g6MgmA6/OI08 X-Google-Smtp-Source: ABdhPJzPLZE0PqbYXIioP2UpsgERidaQz1L0B50wH1vp5+pcv0LlJw/R0RApXnewr2UT68g0nTwzWw== X-Received: by 2002:a1c:6a13:: with SMTP id f19mr8236047wmc.89.1639498604343; Tue, 14 Dec 2021 08:16:44 -0800 (PST) Received: from localhost.localdomain (laubervilliers-658-1-213-31.w90-63.abo.wanadoo.fr. [90.63.244.31]) by smtp.googlemail.com with ESMTPSA id a9sm295116wrt.66.2021.12.14.08.16.43 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 14 Dec 2021 08:16:44 -0800 (PST) From: Corentin Labbe To: mchehab@kernel.org, hverkuil@xs4all.nl, gregkh@linuxfoundation.org Cc: linux-kernel@vger.kernel.org, linux-media@vger.kernel.org, linux-staging@lists.linux.dev, mjpeg-users@lists.sourceforge.net, Corentin Labbe Subject: [PATCH v4 03/18] staging: media: zoran: rename debug module parameter Date: Tue, 14 Dec 2021 16:16:21 +0000 Message-Id: <20211214161636.1886900-4-clabbe@baylibre.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20211214161636.1886900-1-clabbe@baylibre.com> References: <20211214161636.1886900-1-clabbe@baylibre.com> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-media@vger.kernel.org All zoran module will be merged, so to prevent conflict, the debug module parameter need to be renamed Signed-off-by: Corentin Labbe --- drivers/staging/media/zoran/videocodec.c | 8 ++++---- drivers/staging/media/zoran/zr36016.c | 12 ++++++------ drivers/staging/media/zoran/zr36050.c | 8 ++++---- drivers/staging/media/zoran/zr36060.c | 9 ++++----- 4 files changed, 18 insertions(+), 19 deletions(-) diff --git a/drivers/staging/media/zoran/videocodec.c b/drivers/staging/media/zoran/videocodec.c index 28031d3fd757..31019b5f377e 100644 --- a/drivers/staging/media/zoran/videocodec.c +++ b/drivers/staging/media/zoran/videocodec.c @@ -26,13 +26,13 @@ #include "videocodec.h" -static int debug; -module_param(debug, int, 0); -MODULE_PARM_DESC(debug, "Debug level (0-4)"); +static int videocodec_debug; +module_param(videocodec_debug, int, 0); +MODULE_PARM_DESC(videocodec_debug, "Debug level (0-4)"); #define dprintk(num, format, args...) \ do { \ - if (debug >= num) \ + if (videocodec_debug >= num) \ printk(format, ##args); \ } while (0) diff --git a/drivers/staging/media/zoran/zr36016.c b/drivers/staging/media/zoran/zr36016.c index 9b350a885879..50605460a44b 100644 --- a/drivers/staging/media/zoran/zr36016.c +++ b/drivers/staging/media/zoran/zr36016.c @@ -22,14 +22,14 @@ /* amount of chips attached via this driver */ static int zr36016_codecs; -/* debugging is available via module parameter */ -static int debug; -module_param(debug, int, 0); -MODULE_PARM_DESC(debug, "Debug level (0-4)"); +static int zr36016_debug; +module_param(zr36016_debug, int, 0); +MODULE_PARM_DESC(zr36016_debug, "Debug level (0-4)"); + #define dprintk(num, format, args...) \ do { \ - if (debug >= num) \ + if (zr36016_debug >= num) \ printk(format, ##args); \ } while (0) @@ -120,7 +120,7 @@ static u8 zr36016_read_version(struct zr36016 *ptr) static int zr36016_basic_test(struct zr36016 *ptr) { - if (debug) { + if (zr36016_debug) { int i; zr36016_writei(ptr, ZR016I_PAX_LO, 0x55); diff --git a/drivers/staging/media/zoran/zr36050.c b/drivers/staging/media/zoran/zr36050.c index c62af27f2683..4dc7927fefc3 100644 --- a/drivers/staging/media/zoran/zr36050.c +++ b/drivers/staging/media/zoran/zr36050.c @@ -32,13 +32,13 @@ static int zr36050_codecs; /* debugging is available via module parameter */ -static int debug; -module_param(debug, int, 0); -MODULE_PARM_DESC(debug, "Debug level (0-4)"); +static int zr36050_debug; +module_param(zr36050_debug, int, 0); +MODULE_PARM_DESC(zr36050_debug, "Debug level (0-4)"); #define dprintk(num, format, args...) \ do { \ - if (debug >= num) \ + if (zr36050_debug >= num) \ printk(format, ##args); \ } while (0) diff --git a/drivers/staging/media/zoran/zr36060.c b/drivers/staging/media/zoran/zr36060.c index 1c3af11b5f24..7904d5b1f402 100644 --- a/drivers/staging/media/zoran/zr36060.c +++ b/drivers/staging/media/zoran/zr36060.c @@ -34,14 +34,13 @@ static bool low_bitrate; module_param(low_bitrate, bool, 0); MODULE_PARM_DESC(low_bitrate, "Buz compatibility option, halves bitrate"); -/* debugging is available via module parameter */ -static int debug; -module_param(debug, int, 0); -MODULE_PARM_DESC(debug, "Debug level (0-4)"); +static int zr36060_debug; +module_param(zr36060_debug, int, 0); +MODULE_PARM_DESC(zr36060_debug, "Debug level (0-4)"); #define dprintk(num, format, args...) \ do { \ - if (debug >= num) \ + if (zr36060_debug >= num) \ printk(format, ##args); \ } while (0) From patchwork Tue Dec 14 16:16:22 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Corentin LABBE X-Patchwork-Id: 12676313 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 6C7FAC433F5 for ; Tue, 14 Dec 2021 16:18:56 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233382AbhLNQSz (ORCPT ); Tue, 14 Dec 2021 11:18:55 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:57936 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S235628AbhLNQQr (ORCPT ); Tue, 14 Dec 2021 11:16:47 -0500 Received: from mail-wm1-x335.google.com (mail-wm1-x335.google.com [IPv6:2a00:1450:4864:20::335]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 99658C06173E for ; Tue, 14 Dec 2021 08:16:46 -0800 (PST) Received: by mail-wm1-x335.google.com with SMTP id j140-20020a1c2392000000b003399ae48f58so16608515wmj.5 for ; Tue, 14 Dec 2021 08:16:46 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=baylibre-com.20210112.gappssmtp.com; s=20210112; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=hut926V20OH93089sBQ+FiKkhdXp4O3nTh6QgQgaA7A=; b=SlxcsL4nFKbjXPbah55EeCqyCseVZJjko6sedSwnNOxVdBj/lH7lnCTmXUaSY7neRq GJQGRuvnR2yi75Hq0hBpyZyPBNI6i1Z035V0PEUEclE86UAHMgLwMr9/viGidiRUgwlV xGEsI2tTZFLYPgJXIPgtAwC0fUsS2dw1ufnT3FqEKl9O5mgglLtKCiEL2XY1wa0vGmT5 b9W2IHb8x4LnfY9AKOHgfB3/FlsGVQI4EkIda6OuSPPvhZYcXen8hbgLxO10uhATwOyT mIzyjSAKlUpTayWUald8zAbSynE3kvIxux28NOozK8WbTvBOv2JKF2M1zNDiHe5kAG+o JcxA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=hut926V20OH93089sBQ+FiKkhdXp4O3nTh6QgQgaA7A=; b=FjMFUnM4Qhu7WviyoYtJ8+TKt4RChTNLCRTBdmLrHUSyJBXlYGY1YpilYB49p955UA Tccc6ZJUoL2G9Rtbe8YmkzpD6zHxsDWHxLv++UPBypkLldu7/yR1u8eSZOhdI8UgWwZV c2/UzAuqNxO07uXDAOCKAOxvWx9zgR2+qhkWTXFZGuFcrF25mKhYQLcZcTiwrL2L4bjA EjxSAabYSMbZTd+nXTyjOF4i2pA+lSSzwAKzUq1E8qUa+IfGP1pJKuRtYTWPkMCHki5g 5E1ao3rExBfHSbhfHufcYEzkc+2IQA1QTfj7kNO7EGAXQZjrd7nADpcC8gxzYadiOJoH o4mA== X-Gm-Message-State: AOAM530FTywkusSG1CDgoLXoW7ajvEPiu2u/IgAE2OkJXC6mCSRglAo6 zaYj7yuGcvUrdPXYMSOLSrNIHg== X-Google-Smtp-Source: ABdhPJyLqAfusRVWFmULPpDBEmYjVePw93+cFLOzgza4/eC+u84tFZkh7nBf9qbrjGeF03It9IwQrA== X-Received: by 2002:a7b:cbd8:: with SMTP id n24mr8115216wmi.150.1639498605031; Tue, 14 Dec 2021 08:16:45 -0800 (PST) Received: from localhost.localdomain (laubervilliers-658-1-213-31.w90-63.abo.wanadoo.fr. [90.63.244.31]) by smtp.googlemail.com with ESMTPSA id a9sm295116wrt.66.2021.12.14.08.16.44 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 14 Dec 2021 08:16:44 -0800 (PST) From: Corentin Labbe To: mchehab@kernel.org, hverkuil@xs4all.nl, gregkh@linuxfoundation.org Cc: linux-kernel@vger.kernel.org, linux-media@vger.kernel.org, linux-staging@lists.linux.dev, mjpeg-users@lists.sourceforge.net, Corentin Labbe Subject: [PATCH v4 04/18] staging: media: zoran: add debugfs Date: Tue, 14 Dec 2021 16:16:22 +0000 Message-Id: <20211214161636.1886900-5-clabbe@baylibre.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20211214161636.1886900-1-clabbe@baylibre.com> References: <20211214161636.1886900-1-clabbe@baylibre.com> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-media@vger.kernel.org Add debugfs for displaying zoran debug and stats information. Signed-off-by: Corentin Labbe --- drivers/staging/media/zoran/Kconfig | 1 + drivers/staging/media/zoran/zoran.h | 2 ++ drivers/staging/media/zoran/zoran_card.c | 36 ++++++++++++++++++++++++ 3 files changed, 39 insertions(+) diff --git a/drivers/staging/media/zoran/Kconfig b/drivers/staging/media/zoran/Kconfig index 7874842033ca..6d6e4c93f873 100644 --- a/drivers/staging/media/zoran/Kconfig +++ b/drivers/staging/media/zoran/Kconfig @@ -2,6 +2,7 @@ config VIDEO_ZORAN tristate "Zoran ZR36057/36067 Video For Linux (Deprecated)" depends on PCI && I2C_ALGOBIT && VIDEO_V4L2 depends on !ALPHA + depends on DEBUG_FS select VIDEOBUF2_DMA_CONTIG help Say Y for support for MJPEG capture cards based on the Zoran diff --git a/drivers/staging/media/zoran/zoran.h b/drivers/staging/media/zoran/zoran.h index b1ad2a2b914c..981cb63ac9af 100644 --- a/drivers/staging/media/zoran/zoran.h +++ b/drivers/staging/media/zoran/zoran.h @@ -18,6 +18,7 @@ #ifndef _BUZ_H_ #define _BUZ_H_ +#include #include #include #include @@ -295,6 +296,7 @@ struct zoran { struct list_head queued_bufs; spinlock_t queued_bufs_lock; /* Protects queued_bufs */ struct zr_buffer *inuse[BUZ_NUM_STAT_COM * 2]; + struct dentry *dbgfs_dir; }; static inline struct zoran *to_zoran(struct v4l2_device *v4l2_dev) diff --git a/drivers/staging/media/zoran/zoran_card.c b/drivers/staging/media/zoran/zoran_card.c index f1465fbf98af..28a3363a8838 100644 --- a/drivers/staging/media/zoran/zoran_card.c +++ b/drivers/staging/media/zoran/zoran_card.c @@ -945,6 +945,8 @@ static void zoran_remove(struct pci_dev *pdev) if (!zr->initialized) goto exit_free; + debugfs_remove_recursive(zr->dbgfs_dir); + zoran_queue_exit(zr); /* unregister videocodec bus */ @@ -1051,6 +1053,37 @@ static const struct v4l2_ctrl_ops zoran_video_ctrl_ops = { .s_ctrl = zoran_video_set_ctrl, }; +static int zoran_debugfs_show(struct seq_file *seq, void *v) +{ + struct zoran *zr = seq->private; + + seq_printf(seq, "Running mode %x\n", zr->running); + seq_printf(seq, "Codec mode %x\n", zr->codec_mode); + seq_printf(seq, "Norm %llx\n", zr->norm); + seq_printf(seq, "Input %d\n", zr->input); + seq_printf(seq, "Buffersize %d\n", zr->buffer_size); + + seq_printf(seq, "V4L width %dx%d\n", zr->v4l_settings.width, zr->v4l_settings.height); + seq_printf(seq, "V4L bytesperline %d\n", zr->v4l_settings.bytesperline); + + seq_printf(seq, "JPG decimation %u\n", zr->jpg_settings.decimation); + seq_printf(seq, "JPG hor_dcm %u\n", zr->jpg_settings.hor_dcm); + seq_printf(seq, "JPG ver_dcm %u\n", zr->jpg_settings.ver_dcm); + seq_printf(seq, "JPG tmp_dcm %u\n", zr->jpg_settings.tmp_dcm); + seq_printf(seq, "JPG odd_even %u\n", zr->jpg_settings.odd_even); + seq_printf(seq, "JPG crop %dx%d %d %d\n", + zr->jpg_settings.img_x, + zr->jpg_settings.img_y, + zr->jpg_settings.img_width, + zr->jpg_settings.img_height); + + seq_printf(seq, "Prepared %u\n", zr->prepared); + seq_printf(seq, "Queued %u\n", zr->queued); + return 0; +} + +DEFINE_SHOW_ATTRIBUTE(zoran_debugfs); + /* * Scan for a Buz card (actually for the PCI controller ZR36057), * request the irq and map the io memory @@ -1286,6 +1319,9 @@ static int zoran_probe(struct pci_dev *pdev, const struct pci_device_id *ent) zr->map_mode = ZORAN_MAP_MODE_RAW; + zr->dbgfs_dir = debugfs_create_dir(ZR_DEVNAME(zr), NULL); + debugfs_create_file("debug", 0444, zr->dbgfs_dir, zr, + &zoran_debugfs_fops); return 0; zr_detach_vfe: From patchwork Tue Dec 14 16:16:23 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Corentin LABBE X-Patchwork-Id: 12676315 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 2F104C433EF for ; Tue, 14 Dec 2021 16:18:57 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229513AbhLNQS4 (ORCPT ); Tue, 14 Dec 2021 11:18:56 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:57940 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S235619AbhLNQQr (ORCPT ); Tue, 14 Dec 2021 11:16:47 -0500 Received: from mail-wm1-x331.google.com (mail-wm1-x331.google.com [IPv6:2a00:1450:4864:20::331]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 30573C061401 for ; Tue, 14 Dec 2021 08:16:47 -0800 (PST) Received: by mail-wm1-x331.google.com with SMTP id p27-20020a05600c1d9b00b0033bf8532855so14107226wms.3 for ; Tue, 14 Dec 2021 08:16:47 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=baylibre-com.20210112.gappssmtp.com; s=20210112; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=9d00CQxtuLbmKfZQEqLshscWS8poY4p1Q3lozDp6W9U=; b=SbE3bx+f/5vebISeux3XOeD2/aNUqaQrcGjt3G0WBt07k4+KjXOXMkOj2WEuEH+E3M I5IKN+AWdv18rkV7KuY46s0BFTo3fL6X/+pFlAxpWAN0peeUcujLQm7JX9fflkV92lZE kQXHf6kIL3cIqybWH0JG7yJZ+6UCSUm/aTgP5xxizgpx04PhaXggF1yukYCBLH/jnbbp 8i/cW9pTBL59dp3zusGeCLQQpMCABRwJ75FHqp+tg5so3vDe4QPPyIrM3kMqsNBAe1Fq ng9a5vfhSgSB4oJF3KbJQeCjRQwxD4nSDi/69hoPIKYynBsekIzz9+kLEd9TiMS3c9lj 2XjQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=9d00CQxtuLbmKfZQEqLshscWS8poY4p1Q3lozDp6W9U=; b=ab2+q+FCLxkvhKDR8XKLMmtI48LluWJuAh0Lh6FuuJuZCW7gSqH5SU0BoJYWZsUTXq K/BisO9ilAN/jo1z+ECL+9l955PKRYKwQhvsuaE92VyIdTxoY8KSFkzNFP0redFdfBkb Bi8wWxo25pOjVSsNHT9fxWiB7fbPiblqlw53PR0CnVDoO0R7yETxUDQkN+ILHlvyUaug PCjrpvuycjXjqb1voGNbBhKvszhKCkz7QMKtmZasaBC9OVuLaCU/OJFz1jQRtOFowryP 2u3gu556VJln7EnbKAHgAkVym0Jw95RcxgfNuKa0xxny4TlNAwLfr50LHcnudvgnBQD9 35ZA== X-Gm-Message-State: AOAM530tuQ5bHJk8J72Tge+V7rPyAU+8KoSjFjiXnSBIoMK6rIfvegmx 4uJu0JAXIm5XwnP7bPkag0Thhg== X-Google-Smtp-Source: ABdhPJxT+E9CvwN1wHLmBTZX39LG4/yvi+mSQhr8wnCEGOY+hEFTHWQf2InARJC78rU3psWOJsVn1g== X-Received: by 2002:a05:600c:1914:: with SMTP id j20mr47607517wmq.26.1639498605740; Tue, 14 Dec 2021 08:16:45 -0800 (PST) Received: from localhost.localdomain (laubervilliers-658-1-213-31.w90-63.abo.wanadoo.fr. [90.63.244.31]) by smtp.googlemail.com with ESMTPSA id a9sm295116wrt.66.2021.12.14.08.16.45 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 14 Dec 2021 08:16:45 -0800 (PST) From: Corentin Labbe To: mchehab@kernel.org, hverkuil@xs4all.nl, gregkh@linuxfoundation.org Cc: linux-kernel@vger.kernel.org, linux-media@vger.kernel.org, linux-staging@lists.linux.dev, mjpeg-users@lists.sourceforge.net, Corentin Labbe Subject: [PATCH v4 05/18] staging: media: zoran: videocode: remove procfs Date: Tue, 14 Dec 2021 16:16:23 +0000 Message-Id: <20211214161636.1886900-6-clabbe@baylibre.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20211214161636.1886900-1-clabbe@baylibre.com> References: <20211214161636.1886900-1-clabbe@baylibre.com> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-media@vger.kernel.org Now we have a debugfs, we can remove all PROCFS stuff. We keep videocodec_debugfs_show(), it will be used later Signed-off-by: Corentin Labbe --- drivers/staging/media/zoran/videocodec.c | 24 +----------------------- drivers/staging/media/zoran/videocodec.h | 3 +++ 2 files changed, 4 insertions(+), 23 deletions(-) diff --git a/drivers/staging/media/zoran/videocodec.c b/drivers/staging/media/zoran/videocodec.c index 31019b5f377e..5bab7ba56257 100644 --- a/drivers/staging/media/zoran/videocodec.c +++ b/drivers/staging/media/zoran/videocodec.c @@ -16,14 +16,6 @@ #include #include -// kernel config is here (procfs flag) - -#ifdef CONFIG_PROC_FS -#include -#include -#include -#endif - #include "videocodec.h" static int videocodec_debug; @@ -265,8 +257,7 @@ int videocodec_unregister(const struct videocodec *codec) } EXPORT_SYMBOL(videocodec_unregister); -#ifdef CONFIG_PROC_FS -static int proc_videocodecs_show(struct seq_file *m, void *v) +int videocodec_debugfs_show(struct seq_file *m) { struct codec_list *h = codeclist_top; struct attached_list *a; @@ -293,32 +284,19 @@ static int proc_videocodecs_show(struct seq_file *m, void *v) return 0; } -#endif /* ===================== */ /* hook in driver module */ /* ===================== */ static int __init videocodec_init(void) { -#ifdef CONFIG_PROC_FS - static struct proc_dir_entry *videocodec_proc_entry; -#endif - pr_info("Linux video codec intermediate layer: %s\n", VIDEOCODEC_VERSION); -#ifdef CONFIG_PROC_FS - videocodec_proc_entry = proc_create_single("videocodecs", 0, NULL, proc_videocodecs_show); - if (!videocodec_proc_entry) - pr_err("videocodec: can't init procfs.\n"); -#endif return 0; } static void __exit videocodec_exit(void) { -#ifdef CONFIG_PROC_FS - remove_proc_entry("videocodecs", NULL); -#endif } module_init(videocodec_init); diff --git a/drivers/staging/media/zoran/videocodec.h b/drivers/staging/media/zoran/videocodec.h index 8a5003dda9f4..3a508d326049 100644 --- a/drivers/staging/media/zoran/videocodec.h +++ b/drivers/staging/media/zoran/videocodec.h @@ -123,6 +123,7 @@ M zr36055[1] 0001 0000c001 00000000 (zr36050[1]) #ifndef __LINUX_VIDEOCODEC_H #define __LINUX_VIDEOCODEC_H +#include #include #define CODEC_DO_COMPRESSION 0 @@ -305,4 +306,6 @@ extern int videocodec_unregister(const struct videocodec *); /* the other calls are directly done via the videocodec structure! */ +int videocodec_debugfs_show(struct seq_file *m); + #endif /*ifndef __LINUX_VIDEOCODEC_H */ From patchwork Tue Dec 14 16:16:24 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Corentin LABBE X-Patchwork-Id: 12676287 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 8D864C433FE for ; Tue, 14 Dec 2021 16:17:00 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S235678AbhLNQQw (ORCPT ); Tue, 14 Dec 2021 11:16:52 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:57948 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S235642AbhLNQQs (ORCPT ); Tue, 14 Dec 2021 11:16:48 -0500 Received: from mail-wm1-x32b.google.com (mail-wm1-x32b.google.com [IPv6:2a00:1450:4864:20::32b]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 0B2D9C061747 for ; Tue, 14 Dec 2021 08:16:48 -0800 (PST) Received: by mail-wm1-x32b.google.com with SMTP id i12so14653568wmq.4 for ; Tue, 14 Dec 2021 08:16:47 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=baylibre-com.20210112.gappssmtp.com; s=20210112; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=flIdsS0epokCC1Fa2U8TWwSIjl6RXHfFR0T9jD6BkKs=; b=M0Zdj53y+pvGXE+r1pQU/NT/NCMxIPMYRCKz2kUtHku4VCRhBAbcAKaVX2ztzjvS3j AU7ALThAmXR2VPfpZt1mGybjwveWwQvhNh9EsoRM63gAswQqFSFfphnj83ceYn/Two3C 0TtBK/yAdpKWiNtmGwBcygIz756mBhXZNKJuGaN9AGEM6tGgN9lJmpLqqiTPNhKsKUdb JYq6NjGWuFvSoq2ruR6h5GOnDhLRzHLjjrJcGJUEE4G36jOLjdp7ERCgLXyIn8lzxAWx BKGPFsJHFt33emNge0F34vVVQVWRdIgD6MdjVRjbrSR0JYMuLDZhDfKLWLhAtAe+sCtU YASQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=flIdsS0epokCC1Fa2U8TWwSIjl6RXHfFR0T9jD6BkKs=; b=6ASq5u1bVH1C5vtkgbS/W2kMA4O7zejpFrWvCcq1n7kX4Y7xNKOxM7F5Cd7OL3o+7c 44ZHYtQqAyuf9yUb6k+9dm3T0NpKbVGn/FmK9xUrnjqpxIB9mbvkg9cW6gz4qDjqbRAJ YhkBCybMX0JQ1wRUigADNK95Qs8XKoaP15SWIY3kQxFQB7dhfLfCUM0JjBTyR14e/jFT wp12N/1KlKj1qLi/AhG1hWpOvLYy0m6E0wRp0evH+R4NVz4Tp3kof6/TWDyZ6oikcb8k rVFK6eVS5K1yZbqTkel1bIALwMXl8L4rOr7OzqXFnoq9eMXtuXT6VXbvel3vTz4fZ/gu 9OTw== X-Gm-Message-State: AOAM531oAxoqVxzi59mCfPfLBc3ZcZWCVqj4GCXVmcc4XH/OKuiCHERo 0w2V/2Yx8F07H59nqUOFobqTAw== X-Google-Smtp-Source: ABdhPJynmLtLApXFsbS+kAMwy1Yefq6f5/LuMM27GbzFftzvwERUexCVl8Rh78mf2k51TgS2i6h9Bg== X-Received: by 2002:a05:600c:4408:: with SMTP id u8mr24131492wmn.177.1639498606480; Tue, 14 Dec 2021 08:16:46 -0800 (PST) Received: from localhost.localdomain (laubervilliers-658-1-213-31.w90-63.abo.wanadoo.fr. [90.63.244.31]) by smtp.googlemail.com with ESMTPSA id a9sm295116wrt.66.2021.12.14.08.16.45 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 14 Dec 2021 08:16:46 -0800 (PST) From: Corentin Labbe To: mchehab@kernel.org, hverkuil@xs4all.nl, gregkh@linuxfoundation.org Cc: linux-kernel@vger.kernel.org, linux-media@vger.kernel.org, linux-staging@lists.linux.dev, mjpeg-users@lists.sourceforge.net, Corentin Labbe Subject: [PATCH v4 06/18] staging: media: zoran: merge all modules Date: Tue, 14 Dec 2021 16:16:24 +0000 Message-Id: <20211214161636.1886900-7-clabbe@baylibre.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20211214161636.1886900-1-clabbe@baylibre.com> References: <20211214161636.1886900-1-clabbe@baylibre.com> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-media@vger.kernel.org The zoran driver is split in many modules, but this lead to some problems. One of them is that load order is incorrect when everything is built-in. Having more than one module is useless, so merge all zoran modules in one. Signed-off-by: Corentin Labbe --- drivers/staging/media/zoran/Kconfig | 14 +-- drivers/staging/media/zoran/Makefile | 8 +- drivers/staging/media/zoran/videocodec.c | 36 +------ drivers/staging/media/zoran/videocodec.h | 1 - drivers/staging/media/zoran/zoran_card.c | 119 +++++++++++++++++++---- drivers/staging/media/zoran/zr36016.c | 13 +-- drivers/staging/media/zoran/zr36016.h | 2 + drivers/staging/media/zoran/zr36050.c | 16 +-- drivers/staging/media/zoran/zr36050.h | 2 + drivers/staging/media/zoran/zr36060.c | 14 +-- drivers/staging/media/zoran/zr36060.h | 2 + 11 files changed, 125 insertions(+), 102 deletions(-) diff --git a/drivers/staging/media/zoran/Kconfig b/drivers/staging/media/zoran/Kconfig index 6d6e4c93f873..4067fa93d44d 100644 --- a/drivers/staging/media/zoran/Kconfig +++ b/drivers/staging/media/zoran/Kconfig @@ -15,7 +15,7 @@ config VIDEO_ZORAN module will be called zr36067. config VIDEO_ZORAN_DC30 - tristate "Pinnacle/Miro DC30(+) support" + bool "Pinnacle/Miro DC30(+) support" depends on VIDEO_ZORAN select VIDEO_ADV7175 if MEDIA_SUBDRV_AUTOSELECT select VIDEO_VPX3220 if MEDIA_SUBDRV_AUTOSELECT @@ -25,7 +25,7 @@ config VIDEO_ZORAN_DC30 zr36050 MJPEG codec and zr36016 VFE. config VIDEO_ZORAN_ZR36060 - tristate "Zoran ZR36060" + bool "Zoran ZR36060" depends on VIDEO_ZORAN help Say Y to support Zoran boards based on 36060 chips. @@ -33,7 +33,7 @@ config VIDEO_ZORAN_ZR36060 and 33 R10 and AverMedia 6 boards. config VIDEO_ZORAN_BUZ - tristate "Iomega Buz support" + bool "Iomega Buz support" depends on VIDEO_ZORAN_ZR36060 select VIDEO_SAA711X if MEDIA_SUBDRV_AUTOSELECT select VIDEO_SAA7185 if MEDIA_SUBDRV_AUTOSELECT @@ -41,7 +41,7 @@ config VIDEO_ZORAN_BUZ Support for the Iomega Buz MJPEG capture/playback card. config VIDEO_ZORAN_DC10 - tristate "Pinnacle/Miro DC10(+) support" + bool "Pinnacle/Miro DC10(+) support" depends on VIDEO_ZORAN_ZR36060 select VIDEO_SAA7110 if MEDIA_SUBDRV_AUTOSELECT select VIDEO_ADV7175 if MEDIA_SUBDRV_AUTOSELECT @@ -50,7 +50,7 @@ config VIDEO_ZORAN_DC10 card. config VIDEO_ZORAN_LML33 - tristate "Linux Media Labs LML33 support" + bool "Linux Media Labs LML33 support" depends on VIDEO_ZORAN_ZR36060 select VIDEO_BT819 if MEDIA_SUBDRV_AUTOSELECT select VIDEO_BT856 if MEDIA_SUBDRV_AUTOSELECT @@ -59,7 +59,7 @@ config VIDEO_ZORAN_LML33 card. config VIDEO_ZORAN_LML33R10 - tristate "Linux Media Labs LML33R10 support" + bool "Linux Media Labs LML33R10 support" depends on VIDEO_ZORAN_ZR36060 select VIDEO_SAA711X if MEDIA_SUBDRV_AUTOSELECT select VIDEO_ADV7170 if MEDIA_SUBDRV_AUTOSELECT @@ -68,7 +68,7 @@ config VIDEO_ZORAN_LML33R10 card. config VIDEO_ZORAN_AVS6EYES - tristate "AverMedia 6 Eyes support" + bool "AverMedia 6 Eyes support" depends on VIDEO_ZORAN_ZR36060 select VIDEO_BT856 if MEDIA_SUBDRV_AUTOSELECT select VIDEO_BT866 if MEDIA_SUBDRV_AUTOSELECT diff --git a/drivers/staging/media/zoran/Makefile b/drivers/staging/media/zoran/Makefile index 7023158e3892..9603bac0195c 100644 --- a/drivers/staging/media/zoran/Makefile +++ b/drivers/staging/media/zoran/Makefile @@ -1,7 +1,7 @@ # SPDX-License-Identifier: GPL-2.0 zr36067-objs := zoran_device.o \ - zoran_driver.o zoran_card.o + zoran_driver.o zoran_card.o videocodec.o -obj-$(CONFIG_VIDEO_ZORAN) += zr36067.o videocodec.o -obj-$(CONFIG_VIDEO_ZORAN_DC30) += zr36050.o zr36016.o -obj-$(CONFIG_VIDEO_ZORAN_ZR36060) += zr36060.o +obj-$(CONFIG_VIDEO_ZORAN) += zr36067.o +zr36067-$(CONFIG_VIDEO_ZORAN_DC30) += zr36050.o zr36016.o +zr36067-$(CONFIG_VIDEO_ZORAN_ZR36060) += zr36060.o diff --git a/drivers/staging/media/zoran/videocodec.c b/drivers/staging/media/zoran/videocodec.c index 5bab7ba56257..3af7d02bd910 100644 --- a/drivers/staging/media/zoran/videocodec.c +++ b/drivers/staging/media/zoran/videocodec.c @@ -8,8 +8,6 @@ * (c) 2002 Wolfgang Scherr */ -#define VIDEOCODEC_VERSION "v0.2" - #include #include #include @@ -72,12 +70,9 @@ struct videocodec *videocodec_attach(struct videocodec_master *master) if ((master->flags & h->codec->flags) == master->flags) { dprintk(4, "%s: try '%s'\n", __func__, h->codec->name); - if (!try_module_get(h->codec->owner)) - return NULL; - codec = kmemdup(h->codec, sizeof(struct videocodec), GFP_KERNEL); if (!codec) - goto out_module_put; + goto out_kfree; res = strlen(codec->name); snprintf(codec->name + res, sizeof(codec->name) - res, "[%d]", h->attached); @@ -113,13 +108,10 @@ struct videocodec *videocodec_attach(struct videocodec_master *master) pr_err("%s: no codec found!\n", __func__); return NULL; - out_module_put: - module_put(h->codec->owner); out_kfree: kfree(codec); return NULL; } -EXPORT_SYMBOL(videocodec_attach); int videocodec_detach(struct videocodec *codec) { @@ -160,7 +152,6 @@ int videocodec_detach(struct videocodec *codec) prev->next = a->next; dprintk(4, "videocodec: delete middle\n"); } - module_put(a->codec->owner); kfree(a->codec); kfree(a); h->attached -= 1; @@ -175,7 +166,6 @@ int videocodec_detach(struct videocodec *codec) pr_err("%s: given codec not found!\n", __func__); return -EINVAL; } -EXPORT_SYMBOL(videocodec_detach); int videocodec_register(const struct videocodec *codec) { @@ -208,7 +198,6 @@ int videocodec_register(const struct videocodec *codec) return 0; } -EXPORT_SYMBOL(videocodec_register); int videocodec_unregister(const struct videocodec *codec) { @@ -255,7 +244,6 @@ int videocodec_unregister(const struct videocodec *codec) pr_err("%s: given codec not found!\n", __func__); return -EINVAL; } -EXPORT_SYMBOL(videocodec_unregister); int videocodec_debugfs_show(struct seq_file *m) { @@ -284,25 +272,3 @@ int videocodec_debugfs_show(struct seq_file *m) return 0; } - -/* ===================== */ -/* hook in driver module */ -/* ===================== */ -static int __init videocodec_init(void) -{ - pr_info("Linux video codec intermediate layer: %s\n", VIDEOCODEC_VERSION); - - return 0; -} - -static void __exit videocodec_exit(void) -{ -} - -module_init(videocodec_init); -module_exit(videocodec_exit); - -MODULE_AUTHOR("Wolfgang Scherr "); -MODULE_DESCRIPTION("Intermediate API module for video codecs " - VIDEOCODEC_VERSION); -MODULE_LICENSE("GPL"); diff --git a/drivers/staging/media/zoran/videocodec.h b/drivers/staging/media/zoran/videocodec.h index 3a508d326049..9dea348fee40 100644 --- a/drivers/staging/media/zoran/videocodec.h +++ b/drivers/staging/media/zoran/videocodec.h @@ -234,7 +234,6 @@ struct jpeg_app_marker { }; struct videocodec { - struct module *owner; /* -- filled in by slave device during register -- */ char name[32]; unsigned long magic; /* may be used for client<->master attaching */ diff --git a/drivers/staging/media/zoran/zoran_card.c b/drivers/staging/media/zoran/zoran_card.c index 28a3363a8838..a7750442ef9e 100644 --- a/drivers/staging/media/zoran/zoran_card.c +++ b/drivers/staging/media/zoran/zoran_card.c @@ -29,6 +29,9 @@ #include "zoran.h" #include "zoran_card.h" #include "zoran_device.h" +#include "zr36016.h" +#include "zr36050.h" +#include "zr36060.h" extern const struct zoran_format zoran_formats[]; @@ -266,6 +269,96 @@ static const char *codecid_to_modulename(u16 codecid) return name; } +static int codec_init(struct zoran *zr, u16 codecid) +{ + switch (codecid) { + case CODEC_TYPE_ZR36060: +#ifdef CONFIG_VIDEO_ZORAN_ZR36060 + return zr36060_init_module(); +#else + pci_err(zr->pci_dev, "ZR36060 support is not enabled\n"); + return -EINVAL; +#endif + break; + case CODEC_TYPE_ZR36050: +#ifdef CONFIG_VIDEO_ZORAN_DC30 + return zr36050_init_module(); +#else + pci_err(zr->pci_dev, "ZR36050 support is not enabled\n"); + return -EINVAL; +#endif + break; + case CODEC_TYPE_ZR36016: +#ifdef CONFIG_VIDEO_ZORAN_DC30 + return zr36016_init_module(); +#else + pci_err(zr->pci_dev, "ZR36016 support is not enabled\n"); + return -EINVAL; +#endif + break; + } + + pci_err(zr->pci_dev, "unknown codec id %x\n", codecid); + return -EINVAL; +} + +static void codec_exit(struct zoran *zr, u16 codecid) +{ + switch (codecid) { + case CODEC_TYPE_ZR36060: +#ifdef CONFIG_VIDEO_ZORAN_ZR36060 + zr36060_cleanup_module(); +#endif + break; + case CODEC_TYPE_ZR36050: +#ifdef CONFIG_VIDEO_ZORAN_DC30 + zr36050_cleanup_module(); +#endif + break; + case CODEC_TYPE_ZR36016: +#ifdef CONFIG_VIDEO_ZORAN_DC30 + zr36016_cleanup_module(); +#endif + break; + } +} + +static int videocodec_init(struct zoran *zr) +{ + const char *codec_name, *vfe_name; + int result; + + codec_name = codecid_to_modulename(zr->card.video_codec); + if (codec_name) { + result = codec_init(zr, zr->card.video_codec); + if (result < 0) { + pci_err(zr->pci_dev, "failed to load video codec %s: %d\n", + codec_name, result); + return result; + } + } + vfe_name = codecid_to_modulename(zr->card.video_vfe); + if (vfe_name) { + result = codec_init(zr, zr->card.video_vfe); + if (result < 0) { + pci_err(zr->pci_dev, "failed to load video vfe %s: %d\n", + vfe_name, result); + if (codec_name) + codec_exit(zr, zr->card.video_codec); + return result; + } + } + return 0; +} + +static void videocodec_exit(struct zoran *zr) +{ + if (zr->card.video_codec != CODEC_TYPE_NONE) + codec_exit(zr, zr->card.video_codec); + if (zr->card.video_vfe != CODEC_TYPE_NONE) + codec_exit(zr, zr->card.video_vfe); +} + // struct tvnorm { // u16 wt, wa, h_start, h_sync_start, ht, ha, v_start; // }; @@ -954,6 +1047,7 @@ static void zoran_remove(struct pci_dev *pdev) videocodec_detach(zr->codec); if (zr->vfe) videocodec_detach(zr->vfe); + videocodec_exit(zr); /* unregister i2c bus */ zoran_unregister_i2c(zr); @@ -1079,6 +1173,8 @@ static int zoran_debugfs_show(struct seq_file *seq, void *v) seq_printf(seq, "Prepared %u\n", zr->prepared); seq_printf(seq, "Queued %u\n", zr->queued); + + videocodec_debugfs_show(seq); return 0; } @@ -1096,7 +1192,6 @@ static int zoran_probe(struct pci_dev *pdev, const struct pci_device_id *ent) struct videocodec_master *master_vfe = NULL; struct videocodec_master *master_codec = NULL; int card_num; - const char *codec_name, *vfe_name; unsigned int nr; int err; @@ -1258,23 +1353,9 @@ static int zoran_probe(struct pci_dev *pdev, const struct pci_device_id *ent) zr->card.addrs_encoder); pci_info(zr->pci_dev, "Initializing videocodec bus...\n"); - - if (zr->card.video_codec) { - codec_name = codecid_to_modulename(zr->card.video_codec); - if (codec_name) { - result = request_module(codec_name); - if (result) - pci_err(pdev, "failed to load modules %s: %d\n", codec_name, result); - } - } - if (zr->card.video_vfe) { - vfe_name = codecid_to_modulename(zr->card.video_vfe); - if (vfe_name) { - result = request_module(vfe_name); - if (result < 0) - pci_err(pdev, "failed to load modules %s: %d\n", vfe_name, result); - } - } + err = videocodec_init(zr); + if (err) + goto zr_unreg_i2c; /* reset JPEG codec */ jpeg_codec_sleep(zr, 1); @@ -1328,6 +1409,8 @@ static int zoran_probe(struct pci_dev *pdev, const struct pci_device_id *ent) videocodec_detach(zr->vfe); zr_detach_codec: videocodec_detach(zr->codec); +zr_unreg_videocodec: + videocodec_exit(zr); zr_unreg_i2c: zoran_unregister_i2c(zr); zr_free_irq: diff --git a/drivers/staging/media/zoran/zr36016.c b/drivers/staging/media/zoran/zr36016.c index 50605460a44b..26c7c32b6bc0 100644 --- a/drivers/staging/media/zoran/zr36016.c +++ b/drivers/staging/media/zoran/zr36016.c @@ -390,7 +390,6 @@ static int zr36016_setup(struct videocodec *codec) } static const struct videocodec zr36016_codec = { - .owner = THIS_MODULE, .name = "zr36016", .magic = 0L, /* magic not used */ .flags = @@ -409,14 +408,13 @@ static const struct videocodec zr36016_codec = { HOOK IN DRIVER AS KERNEL MODULE ========================================================================= */ -static int __init zr36016_init_module(void) +int zr36016_init_module(void) { - //dprintk(1, "ZR36016 driver %s\n",ZR016_VERSION); zr36016_codecs = 0; return videocodec_register(&zr36016_codec); } -static void __exit zr36016_cleanup_module(void) +void zr36016_cleanup_module(void) { if (zr36016_codecs) { dprintk(1, @@ -425,10 +423,3 @@ static void __exit zr36016_cleanup_module(void) } videocodec_unregister(&zr36016_codec); } - -module_init(zr36016_init_module); -module_exit(zr36016_cleanup_module); - -MODULE_AUTHOR("Wolfgang Scherr "); -MODULE_DESCRIPTION("Driver module for ZR36016 video frontends"); -MODULE_LICENSE("GPL"); diff --git a/drivers/staging/media/zoran/zr36016.h b/drivers/staging/media/zoran/zr36016.h index 1475f971cc24..04afba35669d 100644 --- a/drivers/staging/media/zoran/zr36016.h +++ b/drivers/staging/media/zoran/zr36016.h @@ -89,4 +89,6 @@ struct zr36016 { #define ZR016_SIGN 0x02 #define ZR016_YMCS 0x01 +int zr36016_init_module(void); +void zr36016_cleanup_module(void); #endif /*fndef ZR36016_H */ diff --git a/drivers/staging/media/zoran/zr36050.c b/drivers/staging/media/zoran/zr36050.c index 4dc7927fefc3..38f7021e7b06 100644 --- a/drivers/staging/media/zoran/zr36050.c +++ b/drivers/staging/media/zoran/zr36050.c @@ -5,8 +5,6 @@ * Copyright (C) 2001 Wolfgang Scherr */ -#define ZR050_VERSION "v0.7.1" - #include #include #include @@ -798,7 +796,6 @@ static int zr36050_setup(struct videocodec *codec) } static const struct videocodec zr36050_codec = { - .owner = THIS_MODULE, .name = "zr36050", .magic = 0L, // magic not used .flags = @@ -817,14 +814,13 @@ static const struct videocodec zr36050_codec = { HOOK IN DRIVER AS KERNEL MODULE ========================================================================= */ -static int __init zr36050_init_module(void) +int zr36050_init_module(void) { - //dprintk(1, "ZR36050 driver %s\n",ZR050_VERSION); zr36050_codecs = 0; return videocodec_register(&zr36050_codec); } -static void __exit zr36050_cleanup_module(void) +void zr36050_cleanup_module(void) { if (zr36050_codecs) { dprintk(1, @@ -833,11 +829,3 @@ static void __exit zr36050_cleanup_module(void) } videocodec_unregister(&zr36050_codec); } - -module_init(zr36050_init_module); -module_exit(zr36050_cleanup_module); - -MODULE_AUTHOR("Wolfgang Scherr "); -MODULE_DESCRIPTION("Driver module for ZR36050 jpeg processors " - ZR050_VERSION); -MODULE_LICENSE("GPL"); diff --git a/drivers/staging/media/zoran/zr36050.h b/drivers/staging/media/zoran/zr36050.h index 8f972d045b58..f9b58f4c77b9 100644 --- a/drivers/staging/media/zoran/zr36050.h +++ b/drivers/staging/media/zoran/zr36050.h @@ -160,4 +160,6 @@ struct zr36050 { #define ZR050_U_COMPONENT 1 #define ZR050_V_COMPONENT 2 +int zr36050_init_module(void); +void zr36050_cleanup_module(void); #endif /*fndef ZR36050_H */ diff --git a/drivers/staging/media/zoran/zr36060.c b/drivers/staging/media/zoran/zr36060.c index 7904d5b1f402..d0c369e31c81 100644 --- a/drivers/staging/media/zoran/zr36060.c +++ b/drivers/staging/media/zoran/zr36060.c @@ -5,8 +5,6 @@ * Copyright (C) 2002 Laurent Pinchart */ -#define ZR060_VERSION "v0.7" - #include #include #include @@ -831,7 +829,6 @@ static int zr36060_setup(struct videocodec *codec) } static const struct videocodec zr36060_codec = { - .owner = THIS_MODULE, .name = "zr36060", .magic = 0L, // magic not used .flags = @@ -846,13 +843,13 @@ static const struct videocodec zr36060_codec = { // others are not used }; -static int __init zr36060_init_module(void) +int zr36060_init_module(void) { zr36060_codecs = 0; return videocodec_register(&zr36060_codec); } -static void __exit zr36060_cleanup_module(void) +void zr36060_cleanup_module(void) { if (zr36060_codecs) { dprintk(1, @@ -863,10 +860,3 @@ static void __exit zr36060_cleanup_module(void) /* however, we can't just stay alive */ videocodec_unregister(&zr36060_codec); } - -module_init(zr36060_init_module); -module_exit(zr36060_cleanup_module); - -MODULE_AUTHOR("Laurent Pinchart "); -MODULE_DESCRIPTION("Driver module for ZR36060 jpeg processors " ZR060_VERSION); -MODULE_LICENSE("GPL"); diff --git a/drivers/staging/media/zoran/zr36060.h b/drivers/staging/media/zoran/zr36060.h index d2cdc26bf625..fbf5429534ac 100644 --- a/drivers/staging/media/zoran/zr36060.h +++ b/drivers/staging/media/zoran/zr36060.h @@ -198,4 +198,6 @@ struct zr36060 { #define ZR060_SR_H_SCALE2 BIT(0) #define ZR060_SR_H_SCALE4 (2 << 0) +int zr36060_init_module(void); +void zr36060_cleanup_module(void); #endif /*fndef ZR36060_H */ From patchwork Tue Dec 14 16:16:25 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Corentin LABBE X-Patchwork-Id: 12676311 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 89F8CC433EF for ; Tue, 14 Dec 2021 16:18:54 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S235661AbhLNQQu (ORCPT ); Tue, 14 Dec 2021 11:16:50 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:57952 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231547AbhLNQQt (ORCPT ); Tue, 14 Dec 2021 11:16:49 -0500 Received: from mail-wm1-x32a.google.com (mail-wm1-x32a.google.com [IPv6:2a00:1450:4864:20::32a]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id BC86AC061574 for ; Tue, 14 Dec 2021 08:16:48 -0800 (PST) Received: by mail-wm1-x32a.google.com with SMTP id z206so407987wmc.1 for ; Tue, 14 Dec 2021 08:16:48 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=baylibre-com.20210112.gappssmtp.com; s=20210112; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=nB4e6hJ4iiTdgUlpoHX4JiHqvuWD9iBvhiQUSGuoJO4=; b=59L0AuG56Iu6wwan57pufjqXT1E/Ejz7PsGUmlgkWNgVwSn99f/tO3kplfpUM5b/3X Y11pSsiW5S2/GPySPaDzI7Y9AJi9WUmq1kzr7gJL9i5zTlHA7oW7FJ97MOTiCNayOKvT aoF96qlX3EBEU1FtkSxP2uOlO0g6WqXI/ErLkTiBfWSHLsIc3E4bQAQ6gNF2AAo9fb8X iN8ys2RvdQr8bCwEsN2i+dwvZkoO7rGymUsul20Pnh9RDGZUmGhbZZ7mumBPXOAkSjwj 4ZcvvTsVit8Rn2CRd+l7wrLmP7BruIB1588cwg5NXZ2X9lcraRf0j+k3fk17GjMQXNZV OrxA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=nB4e6hJ4iiTdgUlpoHX4JiHqvuWD9iBvhiQUSGuoJO4=; b=Ct3QysFYp8ax6evBXa6IPOv5K1+PCHe4tbQL3CV9ObvMOcmMI+uGA+mgUHiBXSun5t 3LVIFgm1XMs1R3Kg0CVstfteOwY2XPNN9NXvbh58LB4n+Q6jelxx5a3VDbe8Uwsskwyu 0Bl80TL6u05mGL+DAlR6xrZgal2K52/xcjDTrgHOelyeBkxrxXftlwd0tF9JD3vfuGhH 0kriw7Szz1cr7beDh//Vv2of9dCVImI9RnlQP/kev22qOvRUmhMix33HgkMtVyn74MKk Owc6vMQwidxIsBMqV6PFPcf4kB5iIzQfTQVBwzNvhLT5CyDUejBVNNsjdt31jLo80K3w TKeA== X-Gm-Message-State: AOAM530d5JXSlOY8HespNPpGwGB/M0115esypj4Jjjus9N4iwTOLW6O1 QfdiVcUBycBLBR6rRl6Ezlv9Ow== X-Google-Smtp-Source: ABdhPJyNUjeIiGBnw2kscF6JUnOWj7m4wL9wSYkMZkYG1aCLf2zXnYTHDMKbZQk0kFLEsXPlzGVx8w== X-Received: by 2002:a7b:cc96:: with SMTP id p22mr7978156wma.69.1639498607266; Tue, 14 Dec 2021 08:16:47 -0800 (PST) Received: from localhost.localdomain (laubervilliers-658-1-213-31.w90-63.abo.wanadoo.fr. [90.63.244.31]) by smtp.googlemail.com with ESMTPSA id a9sm295116wrt.66.2021.12.14.08.16.46 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 14 Dec 2021 08:16:46 -0800 (PST) From: Corentin Labbe To: mchehab@kernel.org, hverkuil@xs4all.nl, gregkh@linuxfoundation.org Cc: linux-kernel@vger.kernel.org, linux-media@vger.kernel.org, linux-staging@lists.linux.dev, mjpeg-users@lists.sourceforge.net, Corentin Labbe Subject: [PATCH v4 07/18] staging: media: zoran: remove vidmem Date: Tue, 14 Dec 2021 16:16:25 +0000 Message-Id: <20211214161636.1886900-8-clabbe@baylibre.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20211214161636.1886900-1-clabbe@baylibre.com> References: <20211214161636.1886900-1-clabbe@baylibre.com> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-media@vger.kernel.org The vidmem parameter is no longer necessary since we removed framebuffer support. Signed-off-by: Corentin Labbe --- drivers/staging/media/zoran/zoran_card.c | 15 --------------- 1 file changed, 15 deletions(-) diff --git a/drivers/staging/media/zoran/zoran_card.c b/drivers/staging/media/zoran/zoran_card.c index a7750442ef9e..9cd49f85a56e 100644 --- a/drivers/staging/media/zoran/zoran_card.c +++ b/drivers/staging/media/zoran/zoran_card.c @@ -39,17 +39,6 @@ static int card[BUZ_MAX] = { [0 ... (BUZ_MAX - 1)] = -1 }; module_param_array(card, int, NULL, 0444); MODULE_PARM_DESC(card, "Card type"); -/* - * The video mem address of the video card. The driver has a little database - * for some videocards to determine it from there. If your video card is not - * in there you have either to give it to the driver as a parameter or set - * in a VIDIOCSFBUF ioctl - */ - -static unsigned long vidmem; /* default = 0 - Video memory base address */ -module_param_hw(vidmem, ulong, iomem, 0444); -MODULE_PARM_DESC(vidmem, "Default video memory base address"); - /* Default input and video norm at startup of the driver. */ static unsigned int default_input; /* default 0 = Composite, 1 = S-Video */ @@ -1218,10 +1207,6 @@ static int zoran_probe(struct pci_dev *pdev, const struct pci_device_id *ent) jpg_bufsize = 8192; if (jpg_bufsize > (512 * 1024)) jpg_bufsize = 512 * 1024; - /* Use parameter for vidmem or try to find a video card */ - if (vidmem) - pci_info(pdev, "%s: Using supplied video memory base address @ 0x%lx\n", - ZORAN_NAME, vidmem); /* some mainboards might not do PCI-PCI data transfer well */ if (pci_pci_problems & (PCIPCI_FAIL | PCIAGP_FAIL | PCIPCI_ALIMAGIK)) From patchwork Tue Dec 14 16:16:26 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Corentin LABBE X-Patchwork-Id: 12676285 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 6A021C433EF for ; Tue, 14 Dec 2021 16:17:00 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S235664AbhLNQQv (ORCPT ); Tue, 14 Dec 2021 11:16:51 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:57958 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S235653AbhLNQQt (ORCPT ); Tue, 14 Dec 2021 11:16:49 -0500 Received: from mail-wm1-x32c.google.com (mail-wm1-x32c.google.com [IPv6:2a00:1450:4864:20::32c]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 74620C06173F for ; Tue, 14 Dec 2021 08:16:49 -0800 (PST) Received: by mail-wm1-x32c.google.com with SMTP id o29so14676526wms.2 for ; Tue, 14 Dec 2021 08:16:49 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=baylibre-com.20210112.gappssmtp.com; s=20210112; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=UA8BDGo2OVkSvlZ3tUQzBXeiycsp95ppqXmRxbwChls=; b=lPlyiZsBUx9rsBJDdMTq2wr4L/oSmmbTyLzUFpPfupwVY9F3T1uo5hqgnMIWYXCRbC gJfka644gNTgt4Aec9uON1siGCuw/inSXxBh+t5FEfJHrSW1rrRZMDThjf4z2Fj7/gnK zB+bMMFO8VEW9VQs8pruunCOubn7Fnz0HmNypiNNy6wF6SB8ru92C4UYGpbJ2RjIau1/ Lepd0pPAuKkl9iW4ytoY9OuFju/ztMuXv1EYGzv4qASRye2lV2YA4OpSeNj+8yO2KDvL lvyfMcx5WcdrUyfhaB1qUEozn9+yg5jn+1ZeqqdxGxIpkIhWji+6WVAbkOgbFgEMdoos tYCA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=UA8BDGo2OVkSvlZ3tUQzBXeiycsp95ppqXmRxbwChls=; b=rEtW+y2fWkGblUPz7l+Kd2oUuDRUSge66meFUva3ugaHzfHRImNdoygZSp2oPnBHeK X74LW//5FV5y05TUxiEqGZ93YWdIib+wwzcrvTQNpX9HJV/8zQ6RnsG93Hs48vJvUNUo BLyjfanCZJJ+E1bD1mS8+bhMfCHfhq36Cn2uFoMLP0aVu9PL7rr3GBLqwXmTshlDsHao 0x+08WOL+3Lk3oKP58dgLlXh1PNG0G3NPCnQczm5QoAfrvViXZSQAwev3vW7RA+O109A 8NhTENEwOtDvjEOETVgi2rWrvXiARp7/5wGLVRohXcvZpUu8WINe6xl1Ig7KGcE6nBmg uPFg== X-Gm-Message-State: AOAM532BFwEthjc3pA8vRHZLJ6BNEudAWkAXNda5siW5TTOBzT62FuLp l3QUzEo7CUeDZQdXhHc0xphIHw== X-Google-Smtp-Source: ABdhPJycnYG9Wj1oMJhRrLpX6nANFczZItpIJn4xfa7CiSTzUXXCSyUn1ZNB6Bnzrf6UqRcia4toLQ== X-Received: by 2002:a05:600c:a55:: with SMTP id c21mr47570609wmq.191.1639498608030; Tue, 14 Dec 2021 08:16:48 -0800 (PST) Received: from localhost.localdomain (laubervilliers-658-1-213-31.w90-63.abo.wanadoo.fr. [90.63.244.31]) by smtp.googlemail.com with ESMTPSA id a9sm295116wrt.66.2021.12.14.08.16.47 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 14 Dec 2021 08:16:47 -0800 (PST) From: Corentin Labbe To: mchehab@kernel.org, hverkuil@xs4all.nl, gregkh@linuxfoundation.org Cc: linux-kernel@vger.kernel.org, linux-media@vger.kernel.org, linux-staging@lists.linux.dev, mjpeg-users@lists.sourceforge.net, Corentin Labbe Subject: [PATCH v4 08/18] staging: media: zoran: move videodev alloc Date: Tue, 14 Dec 2021 16:16:26 +0000 Message-Id: <20211214161636.1886900-9-clabbe@baylibre.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20211214161636.1886900-1-clabbe@baylibre.com> References: <20211214161636.1886900-1-clabbe@baylibre.com> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-media@vger.kernel.org Move some code out of zr36057_init() and create new functions for handling zr->video_dev. This permit to ease code reading and fix a zr->video_dev memory leak. Signed-off-by: Corentin Labbe --- drivers/staging/media/zoran/zoran.h | 2 +- drivers/staging/media/zoran/zoran_card.c | 80 ++++++++++++++-------- drivers/staging/media/zoran/zoran_driver.c | 5 +- 3 files changed, 54 insertions(+), 33 deletions(-) diff --git a/drivers/staging/media/zoran/zoran.h b/drivers/staging/media/zoran/zoran.h index 981cb63ac9af..c36b33f42b16 100644 --- a/drivers/staging/media/zoran/zoran.h +++ b/drivers/staging/media/zoran/zoran.h @@ -315,6 +315,6 @@ static inline struct zoran *to_zoran(struct v4l2_device *v4l2_dev) #endif -int zoran_queue_init(struct zoran *zr, struct vb2_queue *vq); +int zoran_queue_init(struct zoran *zr, struct vb2_queue *vq, int dir); void zoran_queue_exit(struct zoran *zr); int zr_set_buf(struct zoran *zr); diff --git a/drivers/staging/media/zoran/zoran_card.c b/drivers/staging/media/zoran/zoran_card.c index 9cd49f85a56e..19eb3150074a 100644 --- a/drivers/staging/media/zoran/zoran_card.c +++ b/drivers/staging/media/zoran/zoran_card.c @@ -885,6 +885,52 @@ int zoran_check_jpg_settings(struct zoran *zr, return 0; } +static int zoran_init_video_device(struct zoran *zr, struct video_device *video_dev, int dir) +{ + int err; + + /* Now add the template and register the device unit. */ + *video_dev = zoran_template; + video_dev->v4l2_dev = &zr->v4l2_dev; + video_dev->lock = &zr->lock; + video_dev->device_caps = V4L2_CAP_STREAMING | dir; + + strscpy(video_dev->name, ZR_DEVNAME(zr), sizeof(video_dev->name)); + /* + * It's not a mem2mem device, but you can both capture and output from one and the same + * device. This should really be split up into two device nodes, but that's a job for + * another day. + */ + video_dev->vfl_dir = VFL_DIR_M2M; + zoran_queue_init(zr, &zr->vq, V4L2_BUF_TYPE_VIDEO_CAPTURE); + + err = video_register_device(video_dev, VFL_TYPE_VIDEO, video_nr[zr->id]); + if (err < 0) + return err; + video_set_drvdata(video_dev, zr); + return 0; +} + +static void zoran_exit_video_devices(struct zoran *zr) +{ + video_unregister_device(zr->video_dev); + kfree(zr->video_dev); +} + +static int zoran_init_video_devices(struct zoran *zr) +{ + int err; + + zr->video_dev = video_device_alloc(); + if (!zr->video_dev) + return -ENOMEM; + + err = zoran_init_video_device(zr, zr->video_dev, V4L2_CAP_VIDEO_CAPTURE); + if (err) + kfree(zr->video_dev); + return err; +} + void zoran_open_init_params(struct zoran *zr) { int i; @@ -956,17 +1002,11 @@ static int zr36057_init(struct zoran *zr) zoran_open_init_params(zr); /* allocate memory *before* doing anything to the hardware in case allocation fails */ - zr->video_dev = video_device_alloc(); - if (!zr->video_dev) { - err = -ENOMEM; - goto exit; - } zr->stat_com = dma_alloc_coherent(&zr->pci_dev->dev, BUZ_NUM_STAT_COM * sizeof(u32), &zr->p_sc, GFP_KERNEL); if (!zr->stat_com) { - err = -ENOMEM; - goto exit_video; + return -ENOMEM; } for (j = 0; j < BUZ_NUM_STAT_COM; j++) zr->stat_com[j] = cpu_to_le32(1); /* mark as unavailable to zr36057 */ @@ -979,26 +1019,9 @@ static int zr36057_init(struct zoran *zr) goto exit_statcom; } - /* Now add the template and register the device unit. */ - *zr->video_dev = zoran_template; - zr->video_dev->v4l2_dev = &zr->v4l2_dev; - zr->video_dev->lock = &zr->lock; - zr->video_dev->device_caps = V4L2_CAP_STREAMING | V4L2_CAP_VIDEO_CAPTURE; - - strscpy(zr->video_dev->name, ZR_DEVNAME(zr), sizeof(zr->video_dev->name)); - /* - * It's not a mem2mem device, but you can both capture and output from one and the same - * device. This should really be split up into two device nodes, but that's a job for - * another day. - */ - zr->video_dev->vfl_dir = VFL_DIR_M2M; - - zoran_queue_init(zr, &zr->vq); - - err = video_register_device(zr->video_dev, VFL_TYPE_VIDEO, video_nr[zr->id]); - if (err < 0) + err = zoran_init_video_devices(zr); + if (err) goto exit_statcomb; - video_set_drvdata(zr->video_dev, zr); zoran_init_hardware(zr); if (!pass_through) { @@ -1013,9 +1036,6 @@ static int zr36057_init(struct zoran *zr) dma_free_coherent(&zr->pci_dev->dev, BUZ_NUM_STAT_COM * sizeof(u32) * 2, zr->stat_comb, zr->p_scb); exit_statcom: dma_free_coherent(&zr->pci_dev->dev, BUZ_NUM_STAT_COM * sizeof(u32), zr->stat_com, zr->p_sc); -exit_video: - kfree(zr->video_dev); -exit: return err; } @@ -1050,7 +1070,7 @@ static void zoran_remove(struct pci_dev *pdev) dma_free_coherent(&zr->pci_dev->dev, BUZ_NUM_STAT_COM * sizeof(u32) * 2, zr->stat_comb, zr->p_scb); pci_release_regions(pdev); pci_disable_device(zr->pci_dev); - video_unregister_device(zr->video_dev); + zoran_exit_video_devices(zr); exit_free: v4l2_ctrl_handler_free(&zr->hdl); v4l2_device_unregister(&zr->v4l2_dev); diff --git a/drivers/staging/media/zoran/zoran_driver.c b/drivers/staging/media/zoran/zoran_driver.c index 46382e43f1bf..551db338c7f7 100644 --- a/drivers/staging/media/zoran/zoran_driver.c +++ b/drivers/staging/media/zoran/zoran_driver.c @@ -1008,7 +1008,7 @@ static const struct vb2_ops zr_video_qops = { .wait_finish = vb2_ops_wait_finish, }; -int zoran_queue_init(struct zoran *zr, struct vb2_queue *vq) +int zoran_queue_init(struct zoran *zr, struct vb2_queue *vq, int dir) { int err; @@ -1016,7 +1016,8 @@ int zoran_queue_init(struct zoran *zr, struct vb2_queue *vq) INIT_LIST_HEAD(&zr->queued_bufs); vq->dev = &zr->pci_dev->dev; - vq->type = V4L2_BUF_TYPE_VIDEO_CAPTURE; + vq->type = dir; + vq->io_modes = VB2_USERPTR | VB2_DMABUF | VB2_MMAP | VB2_READ | VB2_WRITE; vq->drv_priv = zr; vq->buf_struct_size = sizeof(struct zr_buffer); From patchwork Tue Dec 14 16:16:27 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Corentin LABBE X-Patchwork-Id: 12676297 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id ADEE5C4332F for ; Tue, 14 Dec 2021 16:17:04 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S235749AbhLNQRB (ORCPT ); Tue, 14 Dec 2021 11:17:01 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:57966 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S235658AbhLNQQu (ORCPT ); Tue, 14 Dec 2021 11:16:50 -0500 Received: from mail-wm1-x32e.google.com (mail-wm1-x32e.google.com [IPv6:2a00:1450:4864:20::32e]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 2FC09C061574 for ; Tue, 14 Dec 2021 08:16:50 -0800 (PST) Received: by mail-wm1-x32e.google.com with SMTP id z206so408045wmc.1 for ; Tue, 14 Dec 2021 08:16:50 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=baylibre-com.20210112.gappssmtp.com; s=20210112; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=CZZLzZT+BfXZxuiWnfdsUBig8FB5HFw4bFDfrJMVxBE=; b=ZbsiTILxVwE+Mq5B2ldENFVbQR3Ef5AQqGKImqM0vYBNKQRq4VXebDs+VzMeA7lNyo 9k54ajpM/gxe33caNzDBWOZGapQ0IWdBl6+aBicSLAhYUXs5WRO0ssUhuFxr3Gn82cVs 03Nt9F7xT7O4eWf+Zqe3d9VAyldbE/boIdNFU7a+SlGYaFFfSHQtotbOkBOgH4gzJBYh 9xMDVLENbS5jCHEPoXwukvV4uaetTmqJBdxJA7aeh3LiYv3devjViiEVL1LA+WUVmFZy pMyw/b/Cng9TZw4ko0qDgDvlEMTQzoMfifNSVOuvUipev7O6ZubH9f2kXIzvI8ZpVu/d 280g== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=CZZLzZT+BfXZxuiWnfdsUBig8FB5HFw4bFDfrJMVxBE=; b=TFvu2CmjgMIx3r07B67UaNd3NEY8k9i8NAdxtIIw3/ROBXeHFN32PNWiXhrB+j+Hlm QDtpPpST8FYnvMsoqo2yerIPgqVXNmTXDHC+zjD3BjTz6/wGWeAJ+Is8vsak78YrKVew QRjib9fTcjoLOnfy4dK2+IUfetQHIK358xrcuSGTseQ0vziq5XHS08dpvYuiHcxLISN9 ARMwnzJUnYCYBQdwsTx0Y+cxvnqYWQVZsYnt4W7YeMiRRwBykilt8OWTQLImiI6bsIzf RJZQQlUgQiTS0ZC6eBxaQPe4oSZKqmBxoVTlO0LavE5fPlWsQUcKqlb8UiuDDPgfi7zq +/UA== X-Gm-Message-State: AOAM530RglGaggPrnNLp/02WktIRYUOgVITZxaZxp+MzDHE2sTQnJAyW lMoJPECh10x6pBZcI9Tc+3th9w== X-Google-Smtp-Source: ABdhPJybmeQUJDbSW+3oV4zoGrLw5BsgeTTY17hfAtBVbVlqViN7SPJa0Cp1TzI6xxs3Sofx3yGN+A== X-Received: by 2002:a7b:c1c5:: with SMTP id a5mr47072072wmj.149.1639498608721; Tue, 14 Dec 2021 08:16:48 -0800 (PST) Received: from localhost.localdomain (laubervilliers-658-1-213-31.w90-63.abo.wanadoo.fr. [90.63.244.31]) by smtp.googlemail.com with ESMTPSA id a9sm295116wrt.66.2021.12.14.08.16.48 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 14 Dec 2021 08:16:48 -0800 (PST) From: Corentin Labbe To: mchehab@kernel.org, hverkuil@xs4all.nl, gregkh@linuxfoundation.org Cc: linux-kernel@vger.kernel.org, linux-media@vger.kernel.org, linux-staging@lists.linux.dev, mjpeg-users@lists.sourceforge.net, Corentin Labbe Subject: [PATCH v4 09/18] staging: media: zoran: move config select on primary kconfig Date: Tue, 14 Dec 2021 16:16:27 +0000 Message-Id: <20211214161636.1886900-10-clabbe@baylibre.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20211214161636.1886900-1-clabbe@baylibre.com> References: <20211214161636.1886900-1-clabbe@baylibre.com> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-media@vger.kernel.org Since all kconfigs for card selection are bool, this causes all selected modules to be always built-in. Prevent this by moving selects to the main tristate kconfig. By doing this, remove also all "if MEDIA_SUBDRV_AUTOSELECT" which are wrong, since zoran always need them to work. Signed-off-by: Corentin Labbe --- drivers/staging/media/zoran/Kconfig | 23 ++++++++++------------- 1 file changed, 10 insertions(+), 13 deletions(-) diff --git a/drivers/staging/media/zoran/Kconfig b/drivers/staging/media/zoran/Kconfig index 4067fa93d44d..faef008b8554 100644 --- a/drivers/staging/media/zoran/Kconfig +++ b/drivers/staging/media/zoran/Kconfig @@ -4,6 +4,16 @@ config VIDEO_ZORAN depends on !ALPHA depends on DEBUG_FS select VIDEOBUF2_DMA_CONTIG + select VIDEO_ADV7170 if VIDEO_ZORAN_LML33R10 + select VIDEO_ADV7175 if VIDEO_ZORAN_DC10 || VIDEO_ZORAN_DC30 + select VIDEO_BT819 if VIDEO_ZORAN_LML33 + select VIDEO_BT856 if VIDEO_ZORAN_LML33 || VIDEO_ZORAN_AVS6EYES + select VIDEO_BT866 if VIDEO_ZORAN_AVS6EYES + select VIDEO_KS0127 if VIDEO_ZORAN_AVS6EYES + select VIDEO_SAA711X if VIDEO_ZORAN_BUZ || VIDEO_ZORAN_LML33R10 + select VIDEO_SAA7110 if VIDEO_ZORAN_DC10 + select VIDEO_SAA7185 if VIDEO_ZORAN_BUZ + select VIDEO_VPX3220 if VIDEO_ZORAN_DC30 help Say Y for support for MJPEG capture cards based on the Zoran 36057/36067 PCI controller chipset. This includes the Iomega @@ -17,8 +27,6 @@ config VIDEO_ZORAN config VIDEO_ZORAN_DC30 bool "Pinnacle/Miro DC30(+) support" depends on VIDEO_ZORAN - select VIDEO_ADV7175 if MEDIA_SUBDRV_AUTOSELECT - select VIDEO_VPX3220 if MEDIA_SUBDRV_AUTOSELECT help Support for the Pinnacle/Miro DC30(+) MJPEG capture/playback card. This also supports really old DC10 cards based on the @@ -35,16 +43,12 @@ config VIDEO_ZORAN_ZR36060 config VIDEO_ZORAN_BUZ bool "Iomega Buz support" depends on VIDEO_ZORAN_ZR36060 - select VIDEO_SAA711X if MEDIA_SUBDRV_AUTOSELECT - select VIDEO_SAA7185 if MEDIA_SUBDRV_AUTOSELECT help Support for the Iomega Buz MJPEG capture/playback card. config VIDEO_ZORAN_DC10 bool "Pinnacle/Miro DC10(+) support" depends on VIDEO_ZORAN_ZR36060 - select VIDEO_SAA7110 if MEDIA_SUBDRV_AUTOSELECT - select VIDEO_ADV7175 if MEDIA_SUBDRV_AUTOSELECT help Support for the Pinnacle/Miro DC10(+) MJPEG capture/playback card. @@ -52,8 +56,6 @@ config VIDEO_ZORAN_DC10 config VIDEO_ZORAN_LML33 bool "Linux Media Labs LML33 support" depends on VIDEO_ZORAN_ZR36060 - select VIDEO_BT819 if MEDIA_SUBDRV_AUTOSELECT - select VIDEO_BT856 if MEDIA_SUBDRV_AUTOSELECT help Support for the Linux Media Labs LML33 MJPEG capture/playback card. @@ -61,8 +63,6 @@ config VIDEO_ZORAN_LML33 config VIDEO_ZORAN_LML33R10 bool "Linux Media Labs LML33R10 support" depends on VIDEO_ZORAN_ZR36060 - select VIDEO_SAA711X if MEDIA_SUBDRV_AUTOSELECT - select VIDEO_ADV7170 if MEDIA_SUBDRV_AUTOSELECT help support for the Linux Media Labs LML33R10 MJPEG capture/playback card. @@ -70,8 +70,5 @@ config VIDEO_ZORAN_LML33R10 config VIDEO_ZORAN_AVS6EYES bool "AverMedia 6 Eyes support" depends on VIDEO_ZORAN_ZR36060 - select VIDEO_BT856 if MEDIA_SUBDRV_AUTOSELECT - select VIDEO_BT866 if MEDIA_SUBDRV_AUTOSELECT - select VIDEO_KS0127 if MEDIA_SUBDRV_AUTOSELECT help Support for the AverMedia 6 Eyes video surveillance card. From patchwork Tue Dec 14 16:16:28 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Corentin LABBE X-Patchwork-Id: 12676289 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id D50BBC43217 for ; Tue, 14 Dec 2021 16:17:00 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S235686AbhLNQQy (ORCPT ); Tue, 14 Dec 2021 11:16:54 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:57974 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S235665AbhLNQQv (ORCPT ); Tue, 14 Dec 2021 11:16:51 -0500 Received: from mail-wm1-x336.google.com (mail-wm1-x336.google.com [IPv6:2a00:1450:4864:20::336]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 6730DC06173E for ; Tue, 14 Dec 2021 08:16:51 -0800 (PST) Received: by mail-wm1-x336.google.com with SMTP id a83-20020a1c9856000000b00344731e044bso1195090wme.1 for ; Tue, 14 Dec 2021 08:16:51 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=baylibre-com.20210112.gappssmtp.com; s=20210112; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=uoSsJQeMeV1S/aZ9+Qs931neAcHv5KnV5JpeQ9wVWNQ=; b=NNYQ5qKRBHiVUROM7zfHeFUyjM9pi4CEzhvUmxRUxTqNKA15SkhIeGUFY73oBhN1BJ Ya8SOx6ibFbPhn01ud/oZQcHvDGqCPZbW9yr/rkH9kZ/9ZCOHPA+2pDk6o4wK36zPzVK 85pTVJMSVzuy5TcH02TU24QA+JTeVOe9GmMSH9iWPt8ZzyRmVHTux1aAqkUcIJiPAWZa vITHXDfLBAhbpUHIbGBr7nbhWIHL4qBrFxsm0njunwqYysGA+AUNLejRzfEYkPLPOfBp 4uYls4zmiJYQqlHcbU1ELFH3LfDEpnwMs78D3KpSZtVJwFTlmk3g6x911diNAiCrIk0D hUOQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=uoSsJQeMeV1S/aZ9+Qs931neAcHv5KnV5JpeQ9wVWNQ=; b=fNuwuiEL2vrad4+oLDsIOI8snfphxWRwN+NEpmmmQE9UnbjVKsjbtmPwxd5P9wOxus sxzAgKSKKre30f0GmIt3e1iHJY6uKT0Z43yiCC+XmX79xnEVQqwOx8FbtMco/Bx7jbAa DQTZPpfUGv6nnZ3Huy7kJI0K8oBlTWCm3DuA0VCArti1malYFkVQIf9iDUz2B/zbcf4h BoxfkkDLZ8inftxsy6U7Vrq8dZWtcX1apM7eY64j5fD03qBBOSgYurevQbUj6SPczmou B9PWFl0XGYca28UrJN5gEsgurbwCpf4JhLjUQXTfkPAaOfRiQpeE8zj2vtXkoKg++IIY X7cQ== X-Gm-Message-State: AOAM5302yEFGcIbzecpWoKw0K4jtPMJJ938pZn1O+jb2vlnFplDVQoyA rF0yS0VJGL6hcfUnUCLFnJsR3w== X-Google-Smtp-Source: ABdhPJxiat8mqGQk0rzmDCTJ2P+wIrD4jaQUuNvztLW+VhHLOH/5Wduf2SjBu+iA3HIgB6sZD3Mlbg== X-Received: by 2002:a05:600c:1548:: with SMTP id f8mr47272583wmg.67.1639498609517; Tue, 14 Dec 2021 08:16:49 -0800 (PST) Received: from localhost.localdomain (laubervilliers-658-1-213-31.w90-63.abo.wanadoo.fr. [90.63.244.31]) by smtp.googlemail.com with ESMTPSA id a9sm295116wrt.66.2021.12.14.08.16.48 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 14 Dec 2021 08:16:49 -0800 (PST) From: Corentin Labbe To: mchehab@kernel.org, hverkuil@xs4all.nl, gregkh@linuxfoundation.org Cc: linux-kernel@vger.kernel.org, linux-media@vger.kernel.org, linux-staging@lists.linux.dev, mjpeg-users@lists.sourceforge.net, Corentin Labbe Subject: [PATCH v4 10/18] staging: media: zoran: introduce zoran_i2c_init Date: Tue, 14 Dec 2021 16:16:28 +0000 Message-Id: <20211214161636.1886900-11-clabbe@baylibre.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20211214161636.1886900-1-clabbe@baylibre.com> References: <20211214161636.1886900-1-clabbe@baylibre.com> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-media@vger.kernel.org Reduces the size of the probe function by adding zoran_i2c_init/zoran_i2c_exit functions. Signed-off-by: Corentin Labbe --- drivers/staging/media/zoran/zoran_card.c | 73 ++++++++++++++++++------ 1 file changed, 54 insertions(+), 19 deletions(-) diff --git a/drivers/staging/media/zoran/zoran_card.c b/drivers/staging/media/zoran/zoran_card.c index 19eb3150074a..a00ad40244d0 100644 --- a/drivers/staging/media/zoran/zoran_card.c +++ b/drivers/staging/media/zoran/zoran_card.c @@ -931,6 +931,53 @@ static int zoran_init_video_devices(struct zoran *zr) return err; } +/* + * v4l2_device_unregister() will care about removing zr->encoder/zr->decoder + * via v4l2_i2c_subdev_unregister() + */ +static int zoran_i2c_init(struct zoran *zr) +{ + int err; + + pci_info(zr->pci_dev, "Initializing i2c bus...\n"); + + err = zoran_register_i2c(zr); + if (err) { + pci_err(zr->pci_dev, "%s - cannot initialize i2c bus\n", __func__); + return err; + } + + zr->decoder = v4l2_i2c_new_subdev(&zr->v4l2_dev, &zr->i2c_adapter, + zr->card.i2c_decoder, 0, + zr->card.addrs_decoder); + if (!zr->decoder) { + pci_err(zr->pci_dev, "Fail to get decoder %s\n", zr->card.i2c_decoder); + err = -EINVAL; + goto error_decoder; + } + + if (zr->card.i2c_encoder) { + zr->encoder = v4l2_i2c_new_subdev(&zr->v4l2_dev, &zr->i2c_adapter, + zr->card.i2c_encoder, 0, + zr->card.addrs_encoder); + if (!zr->encoder) { + pci_err(zr->pci_dev, "Fail to get encoder %s\n", zr->card.i2c_encoder); + err = -EINVAL; + goto error_decoder; + } + } + return 0; + +error_decoder: + zoran_unregister_i2c(zr); + return err; +} + +static void zoran_i2c_exit(struct zoran *zr) +{ + zoran_unregister_i2c(zr); +} + void zoran_open_init_params(struct zoran *zr) { int i; @@ -1059,7 +1106,7 @@ static void zoran_remove(struct pci_dev *pdev) videocodec_exit(zr); /* unregister i2c bus */ - zoran_unregister_i2c(zr); + zoran_i2c_exit(zr); /* disable PCI bus-mastering */ zoran_set_pci_master(zr, 0); /* put chip into reset */ @@ -1340,22 +1387,10 @@ static int zoran_probe(struct pci_dev *pdev, const struct pci_device_id *ent) } zr36057_restart(zr); - /* i2c */ - pci_info(zr->pci_dev, "Initializing i2c bus...\n"); - if (zoran_register_i2c(zr) < 0) { - pci_err(pdev, "%s - can't initialize i2c bus\n", __func__); + err = zoran_i2c_init(zr); + if (err) goto zr_free_irq; - } - - zr->decoder = v4l2_i2c_new_subdev(&zr->v4l2_dev, &zr->i2c_adapter, - zr->card.i2c_decoder, 0, - zr->card.addrs_decoder); - - if (zr->card.i2c_encoder) - zr->encoder = v4l2_i2c_new_subdev(&zr->v4l2_dev, &zr->i2c_adapter, - zr->card.i2c_encoder, 0, - zr->card.addrs_encoder); pci_info(zr->pci_dev, "Initializing videocodec bus...\n"); err = videocodec_init(zr); @@ -1370,15 +1405,15 @@ static int zoran_probe(struct pci_dev *pdev, const struct pci_device_id *ent) if (zr->card.video_codec != 0) { master_codec = zoran_setup_videocodec(zr, zr->card.video_codec); if (!master_codec) - goto zr_unreg_i2c; + goto zr_unreg_videocodec; zr->codec = videocodec_attach(master_codec); if (!zr->codec) { pci_err(pdev, "%s - no codec found\n", __func__); - goto zr_unreg_i2c; + goto zr_unreg_videocodec; } if (zr->codec->type != zr->card.video_codec) { pci_err(pdev, "%s - wrong codec\n", __func__); - goto zr_detach_codec; + goto zr_unreg_videocodec; } } if (zr->card.video_vfe != 0) { @@ -1417,7 +1452,7 @@ static int zoran_probe(struct pci_dev *pdev, const struct pci_device_id *ent) zr_unreg_videocodec: videocodec_exit(zr); zr_unreg_i2c: - zoran_unregister_i2c(zr); + zoran_i2c_exit(zr); zr_free_irq: btwrite(0, ZR36057_SPGPPCR); pci_free_irq(zr->pci_dev, 0, zr); From patchwork Tue Dec 14 16:16:29 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Corentin LABBE X-Patchwork-Id: 12676317 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 763D5C4332F for ; Tue, 14 Dec 2021 16:18:58 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233492AbhLNQS5 (ORCPT ); Tue, 14 Dec 2021 11:18:57 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:57976 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S235669AbhLNQQw (ORCPT ); Tue, 14 Dec 2021 11:16:52 -0500 Received: from mail-wm1-x329.google.com (mail-wm1-x329.google.com [IPv6:2a00:1450:4864:20::329]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id BB2F5C06173F for ; Tue, 14 Dec 2021 08:16:51 -0800 (PST) Received: by mail-wm1-x329.google.com with SMTP id y196so14629555wmc.3 for ; Tue, 14 Dec 2021 08:16:51 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=baylibre-com.20210112.gappssmtp.com; s=20210112; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=TsNFpY1RRkr+DNPQxSAx+z1PDhyA43H0wT6kfJ2Z97I=; b=r2KgfOmb4y/Ab/0mkI4tt7WWdvvqhTCbve13AEruCqs1m8cQ6GMW+iCB/Nl6T5ijHd 0z4TqVTqnOgCtgoIuSJY4qua46CSaPqxrBroEKC0DS2/cbRyJsDHLVEUFZ2w4XI/sISG GRGuoTT+PWiukf+Mwr0Pvo2HWRekn6wf6nLvUNXED/Qyi/sukQulC+kMqMfWhh27c0B4 c3FoRy/+MeswvAkJjeZx4mzPMCe5my7ZV1UTwPBHEWZCJJMQ0GbtT9DaTz8z6IpeQs+o flflL1EmId2IOw0bTo6RF/u7+MlVdm+bC50+2yG5Enx1auGOeI7g3eXHbv7vrViv2obm HkKw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=TsNFpY1RRkr+DNPQxSAx+z1PDhyA43H0wT6kfJ2Z97I=; b=Qm2GmCqGyiZLEdEy+9fRrtBHmWA3uJDB/FzMupzHhU1+9JTixZMIIN+KwBljpVr++j h6IHs4AoMNOtp60AWuFot5kF8/b2OJ6ksyPnA6hhAiryP4s/WlwNH0hToEpeCBimVAYM uZrAVk2r92NTVLCR4ifCo9qaszNlz2cDosCyieC4CD34Wb3ukd88IxLZjBcldPLNfiX9 k3tdJ/IcdbGEqErEN0QfcMXXtNdkABrMgMz/iGyvXHEvEzXHd+oW9KnYs6ZgCy7rnnma RYTGGXxHS1eiTFGi4YVzjfsCcJ+UP1CeBze1y+HDG5MD4GlESCabCsfHqOipNqHmkZpO tAgw== X-Gm-Message-State: AOAM532rOu5k8AwqfzQqG3lhBhCxMUyWziuXGxPQtDRzJrEEaHGmKVIT 48god62t2pJK5Fs53uzLxBDDFQ== X-Google-Smtp-Source: ABdhPJx37pLCNLvqnCrEl6O5Qe/Rq60aJvQbHzOdJsWEFbxCtoEvmyIGJewcsg/q1i3nBKkL4mAsxw== X-Received: by 2002:a1c:9d13:: with SMTP id g19mr47517867wme.41.1639498610376; Tue, 14 Dec 2021 08:16:50 -0800 (PST) Received: from localhost.localdomain (laubervilliers-658-1-213-31.w90-63.abo.wanadoo.fr. [90.63.244.31]) by smtp.googlemail.com with ESMTPSA id a9sm295116wrt.66.2021.12.14.08.16.49 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 14 Dec 2021 08:16:50 -0800 (PST) From: Corentin Labbe To: mchehab@kernel.org, hverkuil@xs4all.nl, gregkh@linuxfoundation.org Cc: linux-kernel@vger.kernel.org, linux-media@vger.kernel.org, linux-staging@lists.linux.dev, mjpeg-users@lists.sourceforge.net, Corentin Labbe , kernel test robot Subject: [PATCH v4 11/18] staging: media: zoran: fix usage of vb2_dma_contig_set_max_seg_size Date: Tue, 14 Dec 2021 16:16:29 +0000 Message-Id: <20211214161636.1886900-12-clabbe@baylibre.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20211214161636.1886900-1-clabbe@baylibre.com> References: <20211214161636.1886900-1-clabbe@baylibre.com> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-media@vger.kernel.org vb2_dma_contig_set_max_seg_size need to have a size in parameter and not a DMA_BIT_MASK(). While fixing this issue, also fix error handling of all DMA size setting. Reported-by: kernel test robot Fixes: d4ae3689226e5 ("media: zoran: device support only 32bit DMA address") Signed-off-by: Corentin Labbe --- drivers/staging/media/zoran/zoran_card.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/drivers/staging/media/zoran/zoran_card.c b/drivers/staging/media/zoran/zoran_card.c index a00ad40244d0..4ea2fbf189b9 100644 --- a/drivers/staging/media/zoran/zoran_card.c +++ b/drivers/staging/media/zoran/zoran_card.c @@ -1282,8 +1282,10 @@ static int zoran_probe(struct pci_dev *pdev, const struct pci_device_id *ent) err = dma_set_mask_and_coherent(&pdev->dev, DMA_BIT_MASK(32)); if (err) - return -ENODEV; - vb2_dma_contig_set_max_seg_size(&pdev->dev, DMA_BIT_MASK(32)); + return err; + err = vb2_dma_contig_set_max_seg_size(&pdev->dev, U32_MAX); + if (err) + return err; nr = zoran_num++; if (nr >= BUZ_MAX) { From patchwork Tue Dec 14 16:16:30 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Corentin LABBE X-Patchwork-Id: 12676293 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 06176C433F5 for ; Tue, 14 Dec 2021 16:17:02 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S235655AbhLNQRA (ORCPT ); Tue, 14 Dec 2021 11:17:00 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:57990 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S235680AbhLNQQx (ORCPT ); Tue, 14 Dec 2021 11:16:53 -0500 Received: from mail-wm1-x336.google.com (mail-wm1-x336.google.com [IPv6:2a00:1450:4864:20::336]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 80213C06173E for ; Tue, 14 Dec 2021 08:16:52 -0800 (PST) Received: by mail-wm1-x336.google.com with SMTP id z8-20020a05600c220800b0034565e837b6so101028wml.1 for ; Tue, 14 Dec 2021 08:16:52 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=baylibre-com.20210112.gappssmtp.com; s=20210112; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=Cc85KOSJveTQ5eUslKSoOpG1/P3POvZ1CMxkHgm/5RE=; b=eqgJZTbUd3GU32oL2NCQwxiUv24pUfxflF/jSVzxt+P8j074XM2jgaLEDwXREfnd4M E6DKK8HbLrvBppR6w6WDtlkt2PVeWUnfxvJiiGFhnTExAGt+oFdIfL2SqLwTAg6kYEoj sn3m0KPu7quufTYWBOflD9l+Ewe2kX9gRnetqTnhxWAxFAnk2MkVm77bC8H6N0I5J7Yw cM94CbIZ7NTrg50h2RdnrIeMZKRGsKbUCb2SNRuZVTf3kjMK5wcevbmAuLqBNT08brPv qouRVU0Upr1slpBB4IdYW3kzP7jtiDQEX6lyu2yL8hmH0HF2GeAEu6Buy7SrSTyyGC78 Mw6A== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=Cc85KOSJveTQ5eUslKSoOpG1/P3POvZ1CMxkHgm/5RE=; b=4Jf+2zj68s6PVzscF9zizJlagvBCD+3GyeekHlgu04kUbsKaHNVBxmjlf4LEq191z3 7pxYoK2eIyzDsTpRjoNIqAyeEJIZx+H4jzgRf6WTTwrg60T6D8EQ8SYQGd2M/e+S2bkc 3T2S8EsAn9OCjEOMm0wi4caaU+ODjE5NDri2fWFQtwyNup1jP+vk7KBXe/YdFqtfIktg OA2fsBheZhUxF5j/EznO7/h0aPTj0x2LqHHVzMtBJ9DcL0BATEj6krH7DPxtNs8hB8V7 BQq1KJahnqhwBUQkOziG7CZgEsaBq/tc85zwwjxgvRrMYfG1KRP0ZTm2nTdjV3h4uEmW QSyg== X-Gm-Message-State: AOAM531uVN+MnAHuqR+NM18Py34RqO4rFYa+pnnH+O89gG9rRK3NqqzC tV+s5pokQvjR0aJYMQ/dyy4a/Q== X-Google-Smtp-Source: ABdhPJzuqu+bXvDNN6q7EtLdAP4LSz6ESuo5fKzElMyk/rK1gkQD/2D4OU2WFkSuVQS+IMIsGIm0Rw== X-Received: by 2002:a7b:cbd8:: with SMTP id n24mr8115905wmi.150.1639498611085; Tue, 14 Dec 2021 08:16:51 -0800 (PST) Received: from localhost.localdomain (laubervilliers-658-1-213-31.w90-63.abo.wanadoo.fr. [90.63.244.31]) by smtp.googlemail.com with ESMTPSA id a9sm295116wrt.66.2021.12.14.08.16.50 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 14 Dec 2021 08:16:50 -0800 (PST) From: Corentin Labbe To: mchehab@kernel.org, hverkuil@xs4all.nl, gregkh@linuxfoundation.org Cc: linux-kernel@vger.kernel.org, linux-media@vger.kernel.org, linux-staging@lists.linux.dev, mjpeg-users@lists.sourceforge.net, Corentin Labbe Subject: [PATCH v4 12/18] staging: media: zoran: clean unused code Date: Tue, 14 Dec 2021 16:16:30 +0000 Message-Id: <20211214161636.1886900-13-clabbe@baylibre.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20211214161636.1886900-1-clabbe@baylibre.com> References: <20211214161636.1886900-1-clabbe@baylibre.com> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-media@vger.kernel.org It remains some unused code from old zoran buffer handling. Let's remove them. Signed-off-by: Corentin Labbe --- drivers/staging/media/zoran/zoran.h | 14 --------- drivers/staging/media/zoran/zoran_card.c | 36 ---------------------- drivers/staging/media/zoran/zoran_device.h | 2 -- drivers/staging/media/zoran/zoran_driver.c | 2 -- 4 files changed, 54 deletions(-) diff --git a/drivers/staging/media/zoran/zoran.h b/drivers/staging/media/zoran/zoran.h index c36b33f42b16..654c95fa5aba 100644 --- a/drivers/staging/media/zoran/zoran.h +++ b/drivers/staging/media/zoran/zoran.h @@ -54,22 +54,8 @@ static inline struct zr_buffer *vb2_to_zr_buffer(struct vb2_buffer *vb) #define BUZ_NUM_STAT_COM 4 #define BUZ_MASK_STAT_COM 3 -#define BUZ_MAX_FRAME 256 /* Must be a power of 2 */ -#define BUZ_MASK_FRAME 255 /* Must be BUZ_MAX_FRAME-1 */ - #define BUZ_MAX_INPUT 16 -#if VIDEO_MAX_FRAME <= 32 -# define V4L_MAX_FRAME 32 -#elif VIDEO_MAX_FRAME <= 64 -# define V4L_MAX_FRAME 64 -#else -# error "Too many video frame buffers to handle" -#endif -#define V4L_MASK_FRAME (V4L_MAX_FRAME - 1) - -#define MAX_FRAME (BUZ_MAX_FRAME > VIDEO_MAX_FRAME ? BUZ_MAX_FRAME : VIDEO_MAX_FRAME) - #include "zr36057.h" enum card_type { diff --git a/drivers/staging/media/zoran/zoran_card.c b/drivers/staging/media/zoran/zoran_card.c index 4ea2fbf189b9..59df1e7691f9 100644 --- a/drivers/staging/media/zoran/zoran_card.c +++ b/drivers/staging/media/zoran/zoran_card.c @@ -60,20 +60,6 @@ static int video_nr[BUZ_MAX] = { [0 ... (BUZ_MAX - 1)] = -1 }; module_param_array(video_nr, int, NULL, 0444); MODULE_PARM_DESC(video_nr, "Video device number (-1=Auto)"); -int v4l_nbufs = 4; -int v4l_bufsize = 864; /* Everybody should be able to work with this setting */ -module_param(v4l_nbufs, int, 0644); -MODULE_PARM_DESC(v4l_nbufs, "Maximum number of V4L buffers to use"); -module_param(v4l_bufsize, int, 0644); -MODULE_PARM_DESC(v4l_bufsize, "Maximum size per V4L buffer (in kB)"); - -int jpg_nbufs = 32; -int jpg_bufsize = 512; /* max size for 100% quality full-PAL frame */ -module_param(jpg_nbufs, int, 0644); -MODULE_PARM_DESC(jpg_nbufs, "Maximum number of JPG buffers to use"); -module_param(jpg_bufsize, int, 0644); -MODULE_PARM_DESC(jpg_bufsize, "Maximum size per JPG buffer (in kB)"); - /* 1=Pass through TV signal when device is not used */ /* 0=Show color bar when device is not used (LML33: only if lml33dpath=1) */ int pass_through; @@ -1253,28 +1239,6 @@ static int zoran_probe(struct pci_dev *pdev, const struct pci_device_id *ent) pci_info(pdev, "Zoran MJPEG board driver version %s\n", ZORAN_VERSION); - /* check the parameters we have been given, adjust if necessary */ - if (v4l_nbufs < 2) - v4l_nbufs = 2; - if (v4l_nbufs > VIDEO_MAX_FRAME) - v4l_nbufs = VIDEO_MAX_FRAME; - /* The user specifies the in KB, we want them in byte (and page aligned) */ - v4l_bufsize = PAGE_ALIGN(v4l_bufsize * 1024); - if (v4l_bufsize < 32768) - v4l_bufsize = 32768; - /* 2 MB is arbitrary but sufficient for the maximum possible images */ - if (v4l_bufsize > 2048 * 1024) - v4l_bufsize = 2048 * 1024; - if (jpg_nbufs < 4) - jpg_nbufs = 4; - if (jpg_nbufs > BUZ_MAX_FRAME) - jpg_nbufs = BUZ_MAX_FRAME; - jpg_bufsize = PAGE_ALIGN(jpg_bufsize * 1024); - if (jpg_bufsize < 8192) - jpg_bufsize = 8192; - if (jpg_bufsize > (512 * 1024)) - jpg_bufsize = 512 * 1024; - /* some mainboards might not do PCI-PCI data transfer well */ if (pci_pci_problems & (PCIPCI_FAIL | PCIAGP_FAIL | PCIPCI_ALIMAGIK)) pci_warn(pdev, "%s: chipset does not support reliable PCI-PCI DMA\n", diff --git a/drivers/staging/media/zoran/zoran_device.h b/drivers/staging/media/zoran/zoran_device.h index 6c5d70238228..322b04c55d41 100644 --- a/drivers/staging/media/zoran/zoran_device.h +++ b/drivers/staging/media/zoran/zoran_device.h @@ -47,9 +47,7 @@ extern void zr36057_restart(struct zoran *zr); extern const struct zoran_format zoran_formats[]; -extern int v4l_nbufs; extern int v4l_bufsize; -extern int jpg_nbufs; extern int jpg_bufsize; extern int pass_through; diff --git a/drivers/staging/media/zoran/zoran_driver.c b/drivers/staging/media/zoran/zoran_driver.c index 551db338c7f7..31993c266976 100644 --- a/drivers/staging/media/zoran/zoran_driver.c +++ b/drivers/staging/media/zoran/zoran_driver.c @@ -153,8 +153,6 @@ static __u32 zoran_v4l2_calc_bufsize(struct zoran_jpg_settings *settings) result <<= 1; } - if (result > jpg_bufsize) - return jpg_bufsize; if (result < 8192) return 8192; From patchwork Tue Dec 14 16:16:31 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Corentin LABBE X-Patchwork-Id: 12676319 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id B30E9C433EF for ; Tue, 14 Dec 2021 16:18:59 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233565AbhLNQS6 (ORCPT ); Tue, 14 Dec 2021 11:18:58 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:58020 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S235733AbhLNQQ6 (ORCPT ); Tue, 14 Dec 2021 11:16:58 -0500 Received: from mail-wm1-x32c.google.com (mail-wm1-x32c.google.com [IPv6:2a00:1450:4864:20::32c]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 07924C061574 for ; Tue, 14 Dec 2021 08:16:58 -0800 (PST) Received: by mail-wm1-x32c.google.com with SMTP id z8-20020a05600c220800b0034565e837b6so101168wml.1 for ; Tue, 14 Dec 2021 08:16:57 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=baylibre-com.20210112.gappssmtp.com; s=20210112; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=5DMKsH1cCiElIcvlchVrud05bdBtUx8WxuBusFpvIlQ=; b=xty511YeuRTDMbnIO3IEz89SkP9HsC/N6v112nakzzwPZAEgplHV6cYWMBlRmVbNFD Hw9o23EQFloHp/o8WLnLIG8novQzwcegulCnIW9HO4iHXTwrNIjAFi1+WdrRLAUmw0o/ iBVzL0UQN0KE8GZGl/kI2r0ltq4a5589tDlLl2gX+EIdiAcPEiDbZdsCp36tc0m5r6xA MRKh9sJx4fgRGTZBf7hh0N4CwZDx12GqMFoneAPR6StIRIwSLt30/JX+KZ+rabxlTmMi x31sQJJhVG+myeWdcppENgbBhOU9OmewYynqhvHtgw1d2kY1a0aTcyyw6UjiFvs+K6w3 EEFA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=5DMKsH1cCiElIcvlchVrud05bdBtUx8WxuBusFpvIlQ=; b=IV3aC29msuInY2Jl3o+cClytR5haCtwa9CNrIOwJPScZnT45OshGGZiGTwlFE/RFqJ z0r7zmsvO929o9MIIlLU1emk0WlTIhnHnMW6VAleE+PUatCq6FpWpExHtBu0QfRm1D7G 35WGYOhiARoC1ojrQc2XICR6NqFDB0tsGb/In5bmPYxuNyBzxkCmf3kTMlAm3b9ccqGF +sI16QC9Qo/im5Mql0qbPuJZk1dqrBN/IGwp5/ToI3shj7WLFf4RB6XB+LPV0UqK0HnA ARaDAOeh2gUIP7rI3D9XqjiDYQ2PtpZFgulw+2P/rlvaTJf09cDfW4jdf/W7+j9ZRaYu 4C+w== X-Gm-Message-State: AOAM533NM8Ub32e0vUiPSLz4MfIyjjGYxCYJWcbaZPx6BeL55bYI03xB vrC5Pk+fj4y5h6jgic70OHvYWA== X-Google-Smtp-Source: ABdhPJxbC5ThkNwS+fn4bggjwWj1iTz5yWy2QITxtbnVLkM3XfCqpR8BEbecGTpn1TJ0uEhDwtG4dQ== X-Received: by 2002:a7b:c257:: with SMTP id b23mr8287134wmj.67.1639498616631; Tue, 14 Dec 2021 08:16:56 -0800 (PST) Received: from localhost.localdomain (laubervilliers-658-1-213-31.w90-63.abo.wanadoo.fr. [90.63.244.31]) by smtp.googlemail.com with ESMTPSA id a9sm295116wrt.66.2021.12.14.08.16.51 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 14 Dec 2021 08:16:51 -0800 (PST) From: Corentin Labbe To: mchehab@kernel.org, hverkuil@xs4all.nl, gregkh@linuxfoundation.org Cc: linux-kernel@vger.kernel.org, linux-media@vger.kernel.org, linux-staging@lists.linux.dev, mjpeg-users@lists.sourceforge.net, Corentin Labbe Subject: [PATCH v4 13/18] staging: media: zoran: fix counting buffer in reserve Date: Tue, 14 Dec 2021 16:16:31 +0000 Message-Id: <20211214161636.1886900-14-clabbe@baylibre.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20211214161636.1886900-1-clabbe@baylibre.com> References: <20211214161636.1886900-1-clabbe@baylibre.com> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-media@vger.kernel.org After each capture, zoran driver complains that it remains some unused buffer. This is due to a missing count handling. Signed-off-by: Corentin Labbe --- drivers/staging/media/zoran/zoran_driver.c | 1 + 1 file changed, 1 insertion(+) diff --git a/drivers/staging/media/zoran/zoran_driver.c b/drivers/staging/media/zoran/zoran_driver.c index 31993c266976..32d76876c683 100644 --- a/drivers/staging/media/zoran/zoran_driver.c +++ b/drivers/staging/media/zoran/zoran_driver.c @@ -887,6 +887,7 @@ int zr_set_buf(struct zoran *zr) return -EINVAL; } list_del(&buf->queue); + zr->buf_in_reserve--; spin_unlock_irqrestore(&zr->queued_bufs_lock, flags); vbuf = &buf->vbuf; From patchwork Tue Dec 14 16:16:32 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Corentin LABBE X-Patchwork-Id: 12676295 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id CDF78C43219 for ; Tue, 14 Dec 2021 16:17:04 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S235756AbhLNQRC (ORCPT ); Tue, 14 Dec 2021 11:17:02 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:58030 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S235740AbhLNQQ7 (ORCPT ); Tue, 14 Dec 2021 11:16:59 -0500 Received: from mail-wr1-x42a.google.com (mail-wr1-x42a.google.com [IPv6:2a00:1450:4864:20::42a]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id CD349C06173E for ; Tue, 14 Dec 2021 08:16:58 -0800 (PST) Received: by mail-wr1-x42a.google.com with SMTP id j3so33311725wrp.1 for ; Tue, 14 Dec 2021 08:16:58 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=baylibre-com.20210112.gappssmtp.com; s=20210112; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=jsAZmzA84HYr0fSj6Nj30TuRXcwtejrxLGTaWhzAlMQ=; b=Jkgd5bP2htU6ML5q7CKo+fwr8qGgeOdl7vKmxlxevccWOC5a+p7ykDSeeS2ziPy/s+ GEwgjtqrspok2T/pINKHxN1vu+b8eIloHYQjoLvRfacYMNDLKmmlRfanyR19mttzDchO P6CspvtzORLWonE9y0FaoQLjH7lRsOt8yWqhoFGe/nZDwfF2+QmoL4nk6uEF/Hk2fhcE PDRcBz9jK9PlalTp6Cfzuz+56i+EcgKCKeXQ6SuLUkJlBA0VMCNg6xytq12dUfzI2x1G DGGO7aB1qSddlKfLoF9drhc1ekejuFpy4g9vlr/CgjnmWA0Uu7a1BsSR7AIpSsxtwU9M B/jA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=jsAZmzA84HYr0fSj6Nj30TuRXcwtejrxLGTaWhzAlMQ=; b=7iepy9V/L+h7EzTSsZkWdXTcrwdT7SjIY19TStrGhj0L60oJ7nnCR52fvnznoBV0OI cxdce2oq/qPaF5dpTH8e1QXRSVE2zgKnLI1M2FD5215NXnZV32hLEo72+k6C3BVUtP2W ogReHVXIJwbLtqX321lTdpB8frhnEjYvfWUwEXqOyQ7eRRv8k7czN8PpN4+HET85RkF6 7LhVU8MxvKYg4fIFSJDjd//5fg0iWKbShFxpO6RNOBH/krz1xv6BceGdj99bcZFkG4Ny TykKl8qM+/3fOkKQdlwCxm4k1Qhuv43qlrb/UqjbTQxusIrhXeviU+t8uMF1xoNcVuqt 5V4Q== X-Gm-Message-State: AOAM530SFQi45d2VjdiKOJr+2TICFP5I7kPUqyeamXNyXsnmsPwBSo5T UGCMHI+e2dkqkjfGgNiGwBNTQAi8viGusLeO X-Google-Smtp-Source: ABdhPJxnf2p7/7jIa5LrKasySq737CXPpzkhbrROQqeWGNd+jJArY7j2Vhv5EdFT0fhauh2j0pcoHg== X-Received: by 2002:adf:fa0b:: with SMTP id m11mr6781251wrr.152.1639498617427; Tue, 14 Dec 2021 08:16:57 -0800 (PST) Received: from localhost.localdomain (laubervilliers-658-1-213-31.w90-63.abo.wanadoo.fr. [90.63.244.31]) by smtp.googlemail.com with ESMTPSA id a9sm295116wrt.66.2021.12.14.08.16.56 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 14 Dec 2021 08:16:57 -0800 (PST) From: Corentin Labbe To: mchehab@kernel.org, hverkuil@xs4all.nl, gregkh@linuxfoundation.org Cc: linux-kernel@vger.kernel.org, linux-media@vger.kernel.org, linux-staging@lists.linux.dev, mjpeg-users@lists.sourceforge.net, Corentin Labbe Subject: [PATCH v4 14/18] staging: media: zoran: calculate the right buffer number for zoran_reap_stat_com Date: Tue, 14 Dec 2021 16:16:32 +0000 Message-Id: <20211214161636.1886900-15-clabbe@baylibre.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20211214161636.1886900-1-clabbe@baylibre.com> References: <20211214161636.1886900-1-clabbe@baylibre.com> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-media@vger.kernel.org On the case tmp_dcim=1, the index of buffer is miscalculated. This generate a NULL pointer dereference later. So let's fix the calcul and add a check to prevent this to reappear. Signed-off-by: Corentin Labbe --- drivers/staging/media/zoran/zoran_device.c | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/drivers/staging/media/zoran/zoran_device.c b/drivers/staging/media/zoran/zoran_device.c index 5b12a730a229..294e459307c3 100644 --- a/drivers/staging/media/zoran/zoran_device.c +++ b/drivers/staging/media/zoran/zoran_device.c @@ -814,7 +814,7 @@ static void zoran_reap_stat_com(struct zoran *zr) if (zr->jpg_settings.tmp_dcm == 1) i = (zr->jpg_dma_tail - zr->jpg_err_shift) & BUZ_MASK_STAT_COM; else - i = ((zr->jpg_dma_tail - zr->jpg_err_shift) & 1) * 2 + 1; + i = ((zr->jpg_dma_tail - zr->jpg_err_shift) & 1) * 2; stat_com = le32_to_cpu(zr->stat_com[i]); if ((stat_com & 1) == 0) { @@ -826,6 +826,11 @@ static void zoran_reap_stat_com(struct zoran *zr) size = (stat_com & GENMASK(22, 1)) >> 1; buf = zr->inuse[i]; + if (!buf) { + spin_unlock_irqrestore(&zr->queued_bufs_lock, flags); + pci_err(zr->pci_dev, "No buffer at slot %d\n", i); + return; + } buf->vbuf.vb2_buf.timestamp = ktime_get_ns(); if (zr->codec_mode == BUZ_MODE_MOTION_COMPRESS) { From patchwork Tue Dec 14 16:16:33 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Corentin LABBE X-Patchwork-Id: 12676299 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 3549AC433F5 for ; Tue, 14 Dec 2021 16:17:07 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S235763AbhLNQRE (ORCPT ); Tue, 14 Dec 2021 11:17:04 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:58038 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S235746AbhLNQRA (ORCPT ); Tue, 14 Dec 2021 11:17:00 -0500 Received: from mail-wr1-x431.google.com (mail-wr1-x431.google.com [IPv6:2a00:1450:4864:20::431]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id A55BEC061748 for ; Tue, 14 Dec 2021 08:16:59 -0800 (PST) Received: by mail-wr1-x431.google.com with SMTP id u17so33297695wrt.3 for ; Tue, 14 Dec 2021 08:16:59 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=baylibre-com.20210112.gappssmtp.com; s=20210112; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=ICPd1tzuZ7vBRZTDItUFPBijrAJP5npUCpdRZVWQpyc=; b=thEVmTMs5DTlfoOpHzrZBD3PjLUeTbdsz83ia8HE/GBuuJb3YB2bU7kE5zgt1NmQHY 8Lx4HBTEa1gHjH3mflr8GhyyRiHwpj09aDDkafUV/EeooIDzhpzo/sQ59Fcf9FNFRdXz YumV6DQC/UR3QF7g44Q8oOV9XhfDLBdTsPSBZpfxrG4CtlTGe57S86sj8PdB4Hcd49mK E9TYa5zVccNh6uUrlrpiJui5qBWp4yqpJTcb5xwtzAm/XL1St/KHMpXcc1YKxoG5+a64 lnk9glkaPAVVTLs7FD+J4ENPZ7UCo/WF+mjRd5b3Nvc41SGEit1Lz887JtjZoOOvMhmC 6rng== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=ICPd1tzuZ7vBRZTDItUFPBijrAJP5npUCpdRZVWQpyc=; b=mqQuIWp5piBSk/Xt/WrvCHmAuZUQyecT10lDSqKmw2eNyA37nXK2tlJthV1XPtnBnH wfwOM2fzhKa4WQmt6ptgqRief9+fGJg9FtNjSi3QXtUmhwEO0s+kwVH2tC9NYowk/tYI iNDvL/P7snEJmBZcqJTQy5aOXhRsW5zWaRk/Y41IYzxnCco6aCKApjl0mxjgrtNpNJOY hteR7k0Bl6oSgYJv+jz8THEJQpKmx9j1I6ZB8C7UM6XFzbIG6u1RKC9WIQ+l3Cnz8EpU q3YJvvneLhTWOvLwgqSsDRFmVLQsCb1OHie7hkWtAbIjYumXRlCZkSHKtrnbEc974r23 6n/g== X-Gm-Message-State: AOAM531F25JUuknAnE8xUS7wb7oCsXKsWKEMIpgN6PeX8LmTYbM7Ovvo lYDEdlI82wRIPQwjX4/2tMwR+A== X-Google-Smtp-Source: ABdhPJwH7Eq9WQ+rKmlD9G25wOEd94cIlE4mLnuQP9/3kScvz7wHibZZ0qa118cUbUU6v0O5fG5mDA== X-Received: by 2002:a05:6000:1048:: with SMTP id c8mr6488849wrx.352.1639498618220; Tue, 14 Dec 2021 08:16:58 -0800 (PST) Received: from localhost.localdomain (laubervilliers-658-1-213-31.w90-63.abo.wanadoo.fr. [90.63.244.31]) by smtp.googlemail.com with ESMTPSA id a9sm295116wrt.66.2021.12.14.08.16.57 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 14 Dec 2021 08:16:57 -0800 (PST) From: Corentin Labbe To: mchehab@kernel.org, hverkuil@xs4all.nl, gregkh@linuxfoundation.org Cc: linux-kernel@vger.kernel.org, linux-media@vger.kernel.org, linux-staging@lists.linux.dev, mjpeg-users@lists.sourceforge.net, Hans Verkuil , Corentin Labbe Subject: [PATCH v4 15/18] staging: media: zoran: fix various V4L2 compliance errors Date: Tue, 14 Dec 2021 16:16:33 +0000 Message-Id: <20211214161636.1886900-16-clabbe@baylibre.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20211214161636.1886900-1-clabbe@baylibre.com> References: <20211214161636.1886900-1-clabbe@baylibre.com> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-media@vger.kernel.org From: Hans Verkuil This fixes several issues found with 'v4l2-compliance -s': 1) read()/write() is supported, but not reported in the capabilities 2) S_STD(G_STD()) failed: setting the same standard should just return 0. 3) G_PARM failed to set readbuffers. 4) different field values in the format vs. what v4l2_buffer reported. 5) zero the sequence number when starting streaming. 6) drop VB_USERPTR: makes no sense with dma_contig streaming. Signed-off-by: Hans Verkuil Signed-off-by: Corentin Labbe --- drivers/staging/media/zoran/zoran_card.c | 2 +- drivers/staging/media/zoran/zoran_driver.c | 13 ++++++++++--- 2 files changed, 11 insertions(+), 4 deletions(-) diff --git a/drivers/staging/media/zoran/zoran_card.c b/drivers/staging/media/zoran/zoran_card.c index 59df1e7691f9..e6d3558323a9 100644 --- a/drivers/staging/media/zoran/zoran_card.c +++ b/drivers/staging/media/zoran/zoran_card.c @@ -879,7 +879,7 @@ static int zoran_init_video_device(struct zoran *zr, struct video_device *video_ *video_dev = zoran_template; video_dev->v4l2_dev = &zr->v4l2_dev; video_dev->lock = &zr->lock; - video_dev->device_caps = V4L2_CAP_STREAMING | dir; + video_dev->device_caps = V4L2_CAP_STREAMING | V4L2_CAP_READWRITE | dir; strscpy(video_dev->name, ZR_DEVNAME(zr), sizeof(video_dev->name)); /* diff --git a/drivers/staging/media/zoran/zoran_driver.c b/drivers/staging/media/zoran/zoran_driver.c index 32d76876c683..dd19ee023d91 100644 --- a/drivers/staging/media/zoran/zoran_driver.c +++ b/drivers/staging/media/zoran/zoran_driver.c @@ -253,8 +253,6 @@ static int zoran_querycap(struct file *file, void *__fh, struct v4l2_capability strscpy(cap->card, ZR_DEVNAME(zr), sizeof(cap->card)); strscpy(cap->driver, "zoran", sizeof(cap->driver)); snprintf(cap->bus_info, sizeof(cap->bus_info), "PCI:%s", pci_name(zr->pci_dev)); - cap->device_caps = zr->video_dev->device_caps; - cap->capabilities = cap->device_caps | V4L2_CAP_DEVICE_CAPS; return 0; } @@ -580,6 +578,9 @@ static int zoran_s_std(struct file *file, void *__fh, v4l2_std_id std) struct zoran *zr = video_drvdata(file); int res = 0; + if (zr->norm == std) + return 0; + if (zr->running != ZORAN_MAP_MODE_NONE) return -EBUSY; @@ -737,6 +738,7 @@ static int zoran_g_parm(struct file *file, void *priv, struct v4l2_streamparm *p if (parm->type != V4L2_BUF_TYPE_VIDEO_CAPTURE) return -EINVAL; + parm->parm.capture.readbuffers = 9; return 0; } @@ -867,6 +869,10 @@ int zr_set_buf(struct zoran *zr) vbuf = &buf->vbuf; buf->vbuf.field = V4L2_FIELD_INTERLACED; + if (BUZ_MAX_HEIGHT < (zr->v4l_settings.height * 2)) + buf->vbuf.field = V4L2_FIELD_INTERLACED; + else + buf->vbuf.field = V4L2_FIELD_TOP; vb2_set_plane_payload(&buf->vbuf.vb2_buf, 0, zr->buffer_size); vb2_buffer_done(&buf->vbuf.vb2_buf, VB2_BUF_STATE_DONE); zr->inuse[0] = NULL; @@ -927,6 +933,7 @@ static int zr_vb2_start_streaming(struct vb2_queue *vq, unsigned int count) zr->stat_com[j] = cpu_to_le32(1); zr->inuse[j] = NULL; } + zr->vbseq = 0; if (zr->map_mode != ZORAN_MAP_MODE_RAW) { pci_info(zr->pci_dev, "START JPG\n"); @@ -1017,7 +1024,7 @@ int zoran_queue_init(struct zoran *zr, struct vb2_queue *vq, int dir) vq->dev = &zr->pci_dev->dev; vq->type = dir; - vq->io_modes = VB2_USERPTR | VB2_DMABUF | VB2_MMAP | VB2_READ | VB2_WRITE; + vq->io_modes = VB2_DMABUF | VB2_MMAP | VB2_READ | VB2_WRITE; vq->drv_priv = zr; vq->buf_struct_size = sizeof(struct zr_buffer); vq->ops = &zr_video_qops; From patchwork Tue Dec 14 16:16:34 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Corentin LABBE X-Patchwork-Id: 12676305 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 4F4EAC4332F for ; Tue, 14 Dec 2021 16:17:13 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S235706AbhLNQRL (ORCPT ); Tue, 14 Dec 2021 11:17:11 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:58046 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S235684AbhLNQRA (ORCPT ); Tue, 14 Dec 2021 11:17:00 -0500 Received: from mail-wm1-x334.google.com (mail-wm1-x334.google.com [IPv6:2a00:1450:4864:20::334]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 64E24C061574 for ; Tue, 14 Dec 2021 08:17:00 -0800 (PST) Received: by mail-wm1-x334.google.com with SMTP id i8-20020a7bc948000000b0030db7b70b6bso16628643wml.1 for ; Tue, 14 Dec 2021 08:17:00 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=baylibre-com.20210112.gappssmtp.com; s=20210112; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=yfJZtohVWDSZMzjIFwnIJSA32PL2KWx5qeRnts2nEJc=; b=WRjX41ehg7tciFFyuUTxc/2pAQAgBOczsZ1wOBkNu9SkIKofB5qwSh65Y2JXD/fSt6 cVGQuYsv6LmXoJHcwimQvOALb8GzauatmczbDujeftSOyWBwFK9PNwP5k7/02sK30t/T G6kgUHJTD9Y3MkSBsHGkVItKWCSuynRtYM92UewPaLNPos1e7Ua7Esj5QwMRD2WDNZDp pnYHBfs/wxNw846mwfjY+7gsv2zumarrT5fS/3UJKP3hBX9vAiZf8YxQqUMyhyzhibho 56TBaLydOPoetIsFqKhivK5vprH6W2J6dozBVeN1feZYUqDpy/0qi0jp9xG8h4q0jU5g H08A== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=yfJZtohVWDSZMzjIFwnIJSA32PL2KWx5qeRnts2nEJc=; b=gFNO0Uxx4OVZn3Mv3lw/z0aLnfLAnl0CLNFO++pbe3/s805+yChKskJKSDmv01rfJv y1r/znp5xHT+AVpS0XvGDLcglWi8UwuhqjSZKlvlCpJ8D48XF7ZPCjta6ngM7FZKQp88 QJGgjesE/YWkhzKrDfQ/hCWhGXaWTOOcvtWOPXiGPuijxM/W3DGmbVCr20+HX1IS6RiR V2aQ4G0tYzlF9q7Sopg0SOa38K9B6tf0doKG/a2Ay2E3c4HKN3fM2jpLv5Lt3TJqeWXM 9IrhHw4svPmwmA4t4wGtMFaYfY5G0fG8W6tCakklG+U2IcrXLm2LWk7uHLR8t8zY84+x cacQ== X-Gm-Message-State: AOAM533EWt9xXlKXCUWSeaJL46WoMmAZBQq88P/VRZDBmdtcDcVRsxO2 +sokIWzbQfqBJKtDcl12UszE0Q== X-Google-Smtp-Source: ABdhPJyEECFe5E5h2hoiIPTiQTsMGX5ROjNLPvytp+z8hY51tg+CyIAMgQrNSBpvSwVes3YzLv5CEQ== X-Received: by 2002:a1c:9d13:: with SMTP id g19mr47518896wme.41.1639498619019; Tue, 14 Dec 2021 08:16:59 -0800 (PST) Received: from localhost.localdomain (laubervilliers-658-1-213-31.w90-63.abo.wanadoo.fr. [90.63.244.31]) by smtp.googlemail.com with ESMTPSA id a9sm295116wrt.66.2021.12.14.08.16.58 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 14 Dec 2021 08:16:58 -0800 (PST) From: Corentin Labbe To: mchehab@kernel.org, hverkuil@xs4all.nl, gregkh@linuxfoundation.org Cc: linux-kernel@vger.kernel.org, linux-media@vger.kernel.org, linux-staging@lists.linux.dev, mjpeg-users@lists.sourceforge.net, Hans Verkuil , Corentin Labbe Subject: [PATCH v4 16/18] staging: media: zoran: fix TRY_FMT handling Date: Tue, 14 Dec 2021 16:16:34 +0000 Message-Id: <20211214161636.1886900-17-clabbe@baylibre.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20211214161636.1886900-1-clabbe@baylibre.com> References: <20211214161636.1886900-1-clabbe@baylibre.com> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-media@vger.kernel.org From: Hans Verkuil TRY_FMT must not set actual capture values (zr->buffer_size in this case), since it is a 'try' only. zoran_try_fmt_vid_cap() also didn't fill in fmt->fmt.pix.bytesperline and fmt->fmt.pix.sizeimage correctly. Signed-off-by: Hans Verkuil Signed-off-by: Corentin Labbe --- drivers/staging/media/zoran/zoran_driver.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/drivers/staging/media/zoran/zoran_driver.c b/drivers/staging/media/zoran/zoran_driver.c index dd19ee023d91..367fe4be8357 100644 --- a/drivers/staging/media/zoran/zoran_driver.c +++ b/drivers/staging/media/zoran/zoran_driver.c @@ -398,7 +398,6 @@ static int zoran_try_fmt_vid_out(struct file *file, void *__fh, V4L2_FIELD_TOP : V4L2_FIELD_BOTTOM); fmt->fmt.pix.sizeimage = zoran_v4l2_calc_bufsize(&settings); - zr->buffer_size = fmt->fmt.pix.sizeimage; fmt->fmt.pix.bytesperline = 0; fmt->fmt.pix.colorspace = V4L2_COLORSPACE_SMPTE170M; return res; @@ -433,6 +432,8 @@ static int zoran_try_fmt_vid_cap(struct file *file, void *__fh, bpp = DIV_ROUND_UP(zoran_formats[i].depth, 8); v4l_bound_align_image(&fmt->fmt.pix.width, BUZ_MIN_WIDTH, BUZ_MAX_WIDTH, bpp == 2 ? 1 : 2, &fmt->fmt.pix.height, BUZ_MIN_HEIGHT, BUZ_MAX_HEIGHT, 0, 0); + fmt->fmt.pix.bytesperline = fmt->fmt.pix.width * bpp; + fmt->fmt.pix.sizeimage = fmt->fmt.pix.bytesperline * fmt->fmt.pix.height; return 0; } From patchwork Tue Dec 14 16:16:35 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Corentin LABBE X-Patchwork-Id: 12676303 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id B3E11C433EF for ; Tue, 14 Dec 2021 16:17:12 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S235774AbhLNQRK (ORCPT ); Tue, 14 Dec 2021 11:17:10 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:58054 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S235750AbhLNQRB (ORCPT ); Tue, 14 Dec 2021 11:17:01 -0500 Received: from mail-wm1-x333.google.com (mail-wm1-x333.google.com [IPv6:2a00:1450:4864:20::333]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 41237C061747 for ; Tue, 14 Dec 2021 08:17:01 -0800 (PST) Received: by mail-wm1-x333.google.com with SMTP id p18so14622781wmq.5 for ; Tue, 14 Dec 2021 08:17:01 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=baylibre-com.20210112.gappssmtp.com; s=20210112; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=WMS2o1RG6OOY773SExtf5pXJlS02JecjKlii7tDnHds=; b=fyTyd1+IJ1YqPGsfBd4bZVOxshAxJ9rrqy+OZzJyky9cvyAjtNrL21Rl3BgayWNIce bQ1iHqVMZPISJlOCLD6SR4wLM/F2MiyYQ2lLyhO6RsmKoPgFtDcWFUvcKrvLyVUr1dAh 2xTVFum1JoBn8Cub5a1Zt+QoJEqyDlfMsYR0FJ04o5yUtKFp9YOwchcVJd2HliHmwjRL SUIq1BT565wtBOnJcvLnz5+wOSj3J80G7jxwqbVgnjA3UVMjfGHh+LE5LoZrgtOvkDS3 vvv17otElycjl+sgZDpywDqrhKa/CixETfhuW05tXrbcJwb8BopPWzoW6mP3bC2ss5ru LNQQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=WMS2o1RG6OOY773SExtf5pXJlS02JecjKlii7tDnHds=; b=EO17cyQJSdQHhqU+fj/bQ0ppLdIAOt1MW6FQr0WZnTdFgvkB9ByJVaQj26DgGpyzFO FBgFgFa00tWlU28xeALdVeep/LaK0IPrNN+aCFjiIcbe2YAVpSnhggo9WJJM25vGqzmD o/psPbr5RQCb8L438A8nNXZoIHoUo2Eeqn2BAMN5PNVV2EIoqxxMvjJoKbu3zm03w2Ub 16TW5JEl5PQ0wEZQUUIykiL8lBAVv/2zqDcUG3UOc2XgUDH9mB1CgQOcwcZ15i4YIexJ VEfzLEcgWU1N/8ki1Kv+vGeFjOzJXuPV9TIrjvUimoMpvShA0M3BvjXIENfsTkgMQT5Y 5ZJw== X-Gm-Message-State: AOAM532kh8BVcemsJI5AvNbM5zjzSSSCAIA+YT5GemcQejefGDz574E9 UdqDeXGqw6h4GK4s4zDQp3wshLfRbQ2U10hL X-Google-Smtp-Source: ABdhPJwXKcjNUUPBit4ldRqWlkvBv7lzavL92IzSrDie60QDhC4S7rMjzkaBphXmgZfN4e4FRhASJw== X-Received: by 2002:a05:600c:3b28:: with SMTP id m40mr47732150wms.100.1639498619766; Tue, 14 Dec 2021 08:16:59 -0800 (PST) Received: from localhost.localdomain (laubervilliers-658-1-213-31.w90-63.abo.wanadoo.fr. [90.63.244.31]) by smtp.googlemail.com with ESMTPSA id a9sm295116wrt.66.2021.12.14.08.16.59 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 14 Dec 2021 08:16:59 -0800 (PST) From: Corentin Labbe To: mchehab@kernel.org, hverkuil@xs4all.nl, gregkh@linuxfoundation.org Cc: linux-kernel@vger.kernel.org, linux-media@vger.kernel.org, linux-staging@lists.linux.dev, mjpeg-users@lists.sourceforge.net, Hans Verkuil , Corentin Labbe Subject: [PATCH v4 17/18] staging: media: zoran: drop kernel log spam Date: Tue, 14 Dec 2021 16:16:35 +0000 Message-Id: <20211214161636.1886900-18-clabbe@baylibre.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20211214161636.1886900-1-clabbe@baylibre.com> References: <20211214161636.1886900-1-clabbe@baylibre.com> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-media@vger.kernel.org From: Hans Verkuil Do not spam the kernel log with messages that result from incorrect userspace input. Those should be either dropped completely (the error code gives sufficient info) or changed to debug messages. Signed-off-by: Hans Verkuil Signed-off-by: Corentin Labbe --- drivers/staging/media/zoran/zoran_device.c | 8 ++++---- drivers/staging/media/zoran/zoran_driver.c | 22 +++++++++++----------- 2 files changed, 15 insertions(+), 15 deletions(-) diff --git a/drivers/staging/media/zoran/zoran_device.c b/drivers/staging/media/zoran/zoran_device.c index 294e459307c3..8f60db4e44c1 100644 --- a/drivers/staging/media/zoran/zoran_device.c +++ b/drivers/staging/media/zoran/zoran_device.c @@ -239,7 +239,7 @@ static void zr36057_set_vfe(struct zoran *zr, int video_width, int video_height, wa = tvn->wa; ha = tvn->ha; - pci_info(zr->pci_dev, "set_vfe() - width = %d, height = %d\n", video_width, video_height); + pci_dbg(zr->pci_dev, "set_vfe() - width = %d, height = %d\n", video_width, video_height); if (video_width < BUZ_MIN_WIDTH || video_height < BUZ_MIN_HEIGHT || @@ -664,7 +664,7 @@ void zr36057_enable_jpg(struct zoran *zr, enum zoran_codec_mode mode) zr36057_set_jpg(zr, mode); // \P_Reset, ... Video param, FIFO clear_interrupt_counters(zr); - pci_info(zr->pci_dev, "enable_jpg(MOTION_COMPRESS)\n"); + pci_dbg(zr->pci_dev, "enable_jpg(MOTION_COMPRESS)\n"); break; } @@ -693,7 +693,7 @@ void zr36057_enable_jpg(struct zoran *zr, enum zoran_codec_mode mode) zr36057_set_jpg(zr, mode); // \P_Reset, ... Video param, FIFO clear_interrupt_counters(zr); - pci_info(zr->pci_dev, "enable_jpg(MOTION_DECOMPRESS)\n"); + pci_dbg(zr->pci_dev, "enable_jpg(MOTION_DECOMPRESS)\n"); break; case BUZ_MODE_IDLE: @@ -720,7 +720,7 @@ void zr36057_enable_jpg(struct zoran *zr, enum zoran_codec_mode mode) decoder_call(zr, video, s_stream, 1); encoder_call(zr, video, s_routing, 0, 0, 0); - pci_info(zr->pci_dev, "enable_jpg(IDLE)\n"); + pci_dbg(zr->pci_dev, "enable_jpg(IDLE)\n"); break; } } diff --git a/drivers/staging/media/zoran/zoran_driver.c b/drivers/staging/media/zoran/zoran_driver.c index 367fe4be8357..013efdecd582 100644 --- a/drivers/staging/media/zoran/zoran_driver.c +++ b/drivers/staging/media/zoran/zoran_driver.c @@ -171,7 +171,7 @@ static int zoran_v4l_set_format(struct zoran *zr, int width, int height, if (height < BUZ_MIN_HEIGHT || width < BUZ_MIN_WIDTH || height > BUZ_MAX_HEIGHT || width > BUZ_MAX_WIDTH) { - pci_err(zr->pci_dev, "%s - wrong frame size (%dx%d)\n", __func__, width, height); + pci_dbg(zr->pci_dev, "%s - wrong frame size (%dx%d)\n", __func__, width, height); return -EINVAL; } @@ -181,7 +181,7 @@ static int zoran_v4l_set_format(struct zoran *zr, int width, int height, /* Check against available buffer size */ if (height * width * bpp > zr->buffer_size) { - pci_err(zr->pci_dev, "%s - video buffer size (%d kB) is too small\n", + pci_dbg(zr->pci_dev, "%s - video buffer size (%d kB) is too small\n", __func__, zr->buffer_size >> 10); return -EINVAL; } @@ -189,7 +189,7 @@ static int zoran_v4l_set_format(struct zoran *zr, int width, int height, /* The video front end needs 4-byte alinged line sizes */ if ((bpp == 2 && (width & 1)) || (bpp == 3 && (width & 3))) { - pci_err(zr->pci_dev, "%s - wrong frame alignment\n", __func__); + pci_dbg(zr->pci_dev, "%s - wrong frame alignment\n", __func__); return -EINVAL; } @@ -205,7 +205,7 @@ static int zoran_set_norm(struct zoran *zr, v4l2_std_id norm) { if (!(norm & zr->card.norms)) { - pci_err(zr->pci_dev, "%s - unsupported norm %llx\n", __func__, norm); + pci_dbg(zr->pci_dev, "%s - unsupported norm %llx\n", __func__, norm); return -EINVAL; } @@ -231,7 +231,7 @@ static int zoran_set_input(struct zoran *zr, int input) return 0; if (input < 0 || input >= zr->card.inputs) { - pci_err(zr->pci_dev, "%s - unsupported input %d\n", __func__, input); + pci_dbg(zr->pci_dev, "%s - unsupported input %d\n", __func__, input); return -EINVAL; } @@ -532,7 +532,7 @@ static int zoran_s_fmt_vid_cap(struct file *file, void *__fh, if (fmt->fmt.pix.pixelformat == zoran_formats[i].fourcc) break; if (i == NUM_FORMATS) { - pci_err(zr->pci_dev, "VIDIOC_S_FMT - unknown/unsupported format 0x%x\n", + pci_dbg(zr->pci_dev, "VIDIOC_S_FMT - unknown/unsupported format 0x%x\n", fmt->fmt.pix.pixelformat); /* TODO do not return here to fix the TRY_FMT cannot handle an invalid pixelformat*/ return -EINVAL; @@ -666,7 +666,7 @@ static int zoran_g_selection(struct file *file, void *__fh, struct v4l2_selectio if (sel->type != V4L2_BUF_TYPE_VIDEO_OUTPUT && sel->type != V4L2_BUF_TYPE_VIDEO_CAPTURE) { - pci_err(zr->pci_dev, "%s invalid selection type combination\n", __func__); + pci_dbg(zr->pci_dev, "%s invalid selection type combination\n", __func__); return -EINVAL; } @@ -712,7 +712,7 @@ static int zoran_s_selection(struct file *file, void *__fh, struct v4l2_selectio return -EINVAL; if (zr->map_mode == ZORAN_MAP_MODE_RAW) { - pci_err(zr->pci_dev, "VIDIOC_S_SELECTION - subcapture only supported for compressed capture\n"); + pci_dbg(zr->pci_dev, "VIDIOC_S_SELECTION - subcapture only supported for compressed capture\n"); return -EINVAL; } @@ -937,7 +937,7 @@ static int zr_vb2_start_streaming(struct vb2_queue *vq, unsigned int count) zr->vbseq = 0; if (zr->map_mode != ZORAN_MAP_MODE_RAW) { - pci_info(zr->pci_dev, "START JPG\n"); + pci_dbg(zr->pci_dev, "START JPG\n"); zr36057_restart(zr); zoran_init_hardware(zr); if (zr->map_mode == ZORAN_MAP_MODE_JPG_REC) @@ -951,7 +951,7 @@ static int zr_vb2_start_streaming(struct vb2_queue *vq, unsigned int count) return 0; } - pci_info(zr->pci_dev, "START RAW\n"); + pci_dbg(zr->pci_dev, "START RAW\n"); zr36057_restart(zr); zoran_init_hardware(zr); @@ -1001,7 +1001,7 @@ static void zr_vb2_stop_streaming(struct vb2_queue *vq) } spin_unlock_irqrestore(&zr->queued_bufs_lock, flags); if (zr->buf_in_reserve) - pci_err(zr->pci_dev, "Buffer remaining %d\n", zr->buf_in_reserve); + pci_dbg(zr->pci_dev, "Buffer remaining %d\n", zr->buf_in_reserve); zr->map_mode = ZORAN_MAP_MODE_RAW; } From patchwork Tue Dec 14 16:16:36 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Corentin LABBE X-Patchwork-Id: 12676301 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 54959C433F5 for ; Tue, 14 Dec 2021 16:17:09 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S235772AbhLNQRI (ORCPT ); Tue, 14 Dec 2021 11:17:08 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:58066 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S235740AbhLNQRD (ORCPT ); Tue, 14 Dec 2021 11:17:03 -0500 Received: from mail-wm1-x32f.google.com (mail-wm1-x32f.google.com [IPv6:2a00:1450:4864:20::32f]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 3EC83C061751 for ; Tue, 14 Dec 2021 08:17:02 -0800 (PST) Received: by mail-wm1-x32f.google.com with SMTP id g191-20020a1c9dc8000000b0032fbf912885so14094396wme.4 for ; Tue, 14 Dec 2021 08:17:02 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=baylibre-com.20210112.gappssmtp.com; s=20210112; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=wrJsFtsuhtmLSJTTjlYvfNHYFw/pI3X8Oa33ZAzpSDM=; b=kZHKqp9yyvcmhytOSIWGLFtmRf0wd7t8lKKCUbHH3jmUD/6CKDF+dOuwhpDIADAIOC VDF+rlH1t0LjkIfDF4qq0jwzZypNZP9Ak7gH1NKrRItJJ7ufpH6Qf7uFxK6Kqh/b+oAc XTWW0bizCMjbpGVCtiBrMWt6/nB/rJ68ZWc3+UFdgpoGBX6qQRXKMxtV644Z6lobHftx EwYewMz06AGiI97RTHU3CaafXEgJMvCF7hR/Y4iXEYVdgqGs6g0QgP5KCojKvTiYMStd guxnjgC+I0eGxpg1849YD0B96QyWj6tewmZHiX0L4s+RDfZRK83mO7zuIuDH1dhfLOYE 2bXw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=wrJsFtsuhtmLSJTTjlYvfNHYFw/pI3X8Oa33ZAzpSDM=; b=MMzho1TtF6JTOEdbLxhOzec7Y2UZSNWZ/E/SUOBbM/r5S3Di+Iyjp/EtHlLb/EQrtb MUI/+tm3bl3z0I2WTAu4dPhQTRitlZ1uCtAGZ9BNQkxN6OGY2FTyXlaWWkYwvaUqwigJ YPmNM4uhs0v9J4isEKrD1R2Q6A9AzxICGZxnCZ4ewUCPHEjkJlXLfSCt7jE9CBLlWoDt AKFgaRrpUmJzqYlp+lufM/9Ms20xIuFGYaF69Dj5WISplHR9psO/zpgwl8PBOhAo3mRI CwL+TwDMq8b39hjwW3ioLaLhyR3hGybTr3o3WWW6TthleDBW+V4/nocLVwRzJL3kvr4V 1BLg== X-Gm-Message-State: AOAM530XPjhYjWg5/FOxGsTGcpPUAergs6713ztNsgVxNo4zn/gnSks2 L5JlULXQwSdCCg00yt8438sGcdhZ9aHEWJJb X-Google-Smtp-Source: ABdhPJyD/VPTazW+yxv00pyfOaW0IYRXn/a0BIPW8dVg9XI/oBl+yweYxgfPwERXa22rX7ifKTGPQw== X-Received: by 2002:a1c:6a13:: with SMTP id f19mr8237955wmc.89.1639498620640; Tue, 14 Dec 2021 08:17:00 -0800 (PST) Received: from localhost.localdomain (laubervilliers-658-1-213-31.w90-63.abo.wanadoo.fr. [90.63.244.31]) by smtp.googlemail.com with ESMTPSA id a9sm295116wrt.66.2021.12.14.08.16.59 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 14 Dec 2021 08:17:00 -0800 (PST) From: Corentin Labbe To: mchehab@kernel.org, hverkuil@xs4all.nl, gregkh@linuxfoundation.org Cc: linux-kernel@vger.kernel.org, linux-media@vger.kernel.org, linux-staging@lists.linux.dev, mjpeg-users@lists.sourceforge.net, Hans Verkuil , Corentin Labbe Subject: [PATCH v4 18/18] staging: media: zoran: drop read/write support Date: Tue, 14 Dec 2021 16:16:36 +0000 Message-Id: <20211214161636.1886900-19-clabbe@baylibre.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20211214161636.1886900-1-clabbe@baylibre.com> References: <20211214161636.1886900-1-clabbe@baylibre.com> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-media@vger.kernel.org From: Hans Verkuil This makes no sense for MJPEG formats and it is just easier to drop support for this altogether. Signed-off-by: Hans Verkuil Signed-off-by: Corentin Labbe --- drivers/staging/media/zoran/zoran_card.c | 2 +- drivers/staging/media/zoran/zoran_driver.c | 12 ------------ 2 files changed, 1 insertion(+), 13 deletions(-) diff --git a/drivers/staging/media/zoran/zoran_card.c b/drivers/staging/media/zoran/zoran_card.c index e6d3558323a9..59df1e7691f9 100644 --- a/drivers/staging/media/zoran/zoran_card.c +++ b/drivers/staging/media/zoran/zoran_card.c @@ -879,7 +879,7 @@ static int zoran_init_video_device(struct zoran *zr, struct video_device *video_ *video_dev = zoran_template; video_dev->v4l2_dev = &zr->v4l2_dev; video_dev->lock = &zr->lock; - video_dev->device_caps = V4L2_CAP_STREAMING | V4L2_CAP_READWRITE | dir; + video_dev->device_caps = V4L2_CAP_STREAMING | dir; strscpy(video_dev->name, ZR_DEVNAME(zr), sizeof(video_dev->name)); /* diff --git a/drivers/staging/media/zoran/zoran_driver.c b/drivers/staging/media/zoran/zoran_driver.c index 013efdecd582..4304b7e21709 100644 --- a/drivers/staging/media/zoran/zoran_driver.c +++ b/drivers/staging/media/zoran/zoran_driver.c @@ -734,15 +734,6 @@ static int zoran_s_selection(struct file *file, void *__fh, struct v4l2_selectio return res; } -static int zoran_g_parm(struct file *file, void *priv, struct v4l2_streamparm *parm) -{ - if (parm->type != V4L2_BUF_TYPE_VIDEO_CAPTURE) - return -EINVAL; - - parm->parm.capture.readbuffers = 9; - return 0; -} - /* * Output is disabled temporarily * Zoran is picky about jpeg data it accepts. At least it seems to unsupport COM and APPn. @@ -750,7 +741,6 @@ static int zoran_g_parm(struct file *file, void *priv, struct v4l2_streamparm *p */ static const struct v4l2_ioctl_ops zoran_ioctl_ops = { .vidioc_querycap = zoran_querycap, - .vidioc_g_parm = zoran_g_parm, .vidioc_s_selection = zoran_s_selection, .vidioc_g_selection = zoran_g_selection, .vidioc_enum_input = zoran_enum_input, @@ -786,8 +776,6 @@ static const struct v4l2_file_operations zoran_fops = { .unlocked_ioctl = video_ioctl2, .open = v4l2_fh_open, .release = vb2_fop_release, - .read = vb2_fop_read, - .write = vb2_fop_write, .mmap = vb2_fop_mmap, .poll = vb2_fop_poll, };