Received: by 2002:a05:6a10:eb17:0:0:0:0 with SMTP id hx23csp749409pxb; Fri, 3 Sep 2021 12:33:04 -0700 (PDT) X-Google-Smtp-Source: ABdhPJyLBr+GgbQzaeBFKFOJnWt61xA1pHwL5FiozgZseB85ncfwj1zrIQH2Ev6izxbi7eOxzXsx X-Received: by 2002:a05:6602:2597:: with SMTP id p23mr426779ioo.195.1630697584229; Fri, 03 Sep 2021 12:33:04 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1630697584; cv=none; d=google.com; s=arc-20160816; b=Kdpslcjd5F4QxM+QSSRwpMFfGKRbGFyBbGdKiVqKuAH+KLldhw9zz8Ueh7GIbnUv12 c0uE0OYiHSrjSg2fPRf6rnFt7M9Y3oxrhU77cC2fuA0JOMVREaN2Jpf6Iqck5ijfFicX rtopM5pDDypJXxCsyV/HRsqUmfP1raonuaRRySMlaHPX2up5yD0KCJnlIGOkm/rfdMXS Ud7EqQwSStod6EWpxL4HYQ7KhafTEW4s2vzVOHk7L5dAa5OYjaEU16OkCgZ4nryPnjDJ mWNjtq8+vQGoz57MOR2aS4gIwIILsDTReVCwCTiUecKJg4er81EcB9HLU08EVkTmwRc5 /COA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=swEGGVp8+HI45UprzcHEDFUC6TlCIZ4vzEzvc39jOtk=; b=WAQ8Pnc+OkSk8i6NrlzFhzBih7vlHPUhTwCz6YxFychZhTHyBTh6T+fo+bul5r+5ng OksMxxHEInuVzEaRyEBK7yT/0MMQax2OJPIh0CTo/62MgjS2XyE5ahJfQ2SuvW2lPbEJ hr2JGemRw12dh05pC3On0Ds1Ifi8Ud//+WR9JeVhP9dDpWYaUlVBKdP0Ny/5Vz50tX9X CQtho86NZXPFRzdr1bYj3k1anO5ZHvnJS4rdl8FwApk91bdUKBFXaoCas2N/euHO4+eK N3V55HQ9iYCjAQuCNpgIl5nSMjw8jpLe9ztLETcHcMGd00dDqW6/xzIrd9A91ZkjSfoe v0cA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@baylibre-com.20150623.gappssmtp.com header.s=20150623 header.b=nP09Ad6H; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id t1si325561jao.24.2021.09.03.12.32.52; Fri, 03 Sep 2021 12:33:04 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@baylibre-com.20150623.gappssmtp.com header.s=20150623 header.b=nP09Ad6H; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1350991AbhICTRH (ORCPT + 99 others); Fri, 3 Sep 2021 15:17:07 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:48828 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1350620AbhICTQ4 (ORCPT ); Fri, 3 Sep 2021 15:16:56 -0400 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 ED74DC061760 for ; Fri, 3 Sep 2021 12:15:55 -0700 (PDT) Received: by mail-wm1-x334.google.com with SMTP id l7-20020a1c2507000000b002e6be5d86b3so199965wml.3 for ; Fri, 03 Sep 2021 12:15:55 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=baylibre-com.20150623.gappssmtp.com; s=20150623; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=swEGGVp8+HI45UprzcHEDFUC6TlCIZ4vzEzvc39jOtk=; b=nP09Ad6HNVqXaNtliuz1u1YK3VgmlOqZhQgX0q346tX9gIJryzBuLjEOsbhw0h8H33 23BAf+N/Bi03SBsKL34aI5ltgIwTWGX7WPMfxxnkPuCCXk36bCSPbzbS75bq2Ztywpts 2pSyqw/Okb3pYJTXpU14HNeF6VaG41ZKkuvDfMzbyjFcrsld2YhadBihifzLE/uQwogR omk/UmDL9kYD1pZY/Qxj7qCN3S/FX8HsWfVJeu5qyOLeXQdP6638bL+q+k6cd/W7/UrX kg2oRJfUROO3MWL6gZI5HBj4cqOm1dgEecK/5wiZE/OInDriDs1DMYnbLZN21nCjcfws ZnKA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; 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=A4YIIh5G1FlpbeU+i8f8MRO2goz7S8UryVeiha/fzmNeaPAi2Xquy7zViBnRY5D5Nt eXVw2LVYYhFbhh0vaNSmr56xpTn96fdG9FM4gOdm5k41rAzif0fvECvbO9EZvlYbDi+v 36owh12pVj8FtCnvdusGWLAWfmf7b2QAfTQMiHwLX7F9G31DwqYWS2GpjR7V5zzKOAVS upYvh0XYBR63gCVroffzxz+fPTX5llHOvPTDOhfGTDkTasfkw70YMddQveqiFL1G4Rbj 0X3BZz9uleWd46cmQs0QZOXSzLipzZZ1HkwuKD64SH2aricZjskERsm89ujJ0AzXbN8c DvJg== X-Gm-Message-State: AOAM5327xmi/DDJ8XNB+1AxrizV3ePjmNREKapUvmjrKbZNY0yqSB6OP LP9m8p+FUWgp5HUD+kRSzAfwMA== X-Received: by 2002:a05:600c:4ca2:: with SMTP id g34mr328858wmp.46.1630696554522; Fri, 03 Sep 2021 12:15:54 -0700 (PDT) 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 a133sm253397wme.5.2021.09.03.12.15.54 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 03 Sep 2021 12:15:54 -0700 (PDT) From: Corentin Labbe To: gregkh@linuxfoundation.org, mchehab@kernel.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 1/8] staging: media: zoran: move module parameter checks to zoran_probe Date: Fri, 3 Sep 2021 19:15:33 +0000 Message-Id: <20210903191540.3052775-2-clabbe@baylibre.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20210903191540.3052775-1-clabbe@baylibre.com> References: <20210903191540.3052775-1-clabbe@baylibre.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@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"); -- 2.32.0