media: staging: media: zoran: move module parameter checks to zoran_probe
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 <clabbe@baylibre.com> Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl> Signed-off-by: Mauro Carvalho Chehab <mchehab@kernel.org>
This commit is contained in:
parent
e783362eb5
commit
4d4389f64c
|
@ -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");
|
||||
|
|
Loading…
Reference in New Issue