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: 525735 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");