From 18490a1ad8ea624820c2b86d05edc9b7bd456e9b Mon Sep 17 00:00:00 2001 From: Julia Lawall Date: Tue, 9 Feb 2021 22:13:33 +0100 Subject: media: use getter/setter functions Use getter and setter functions, for a variety of data types. Signed-off-by: Julia Lawall Signed-off-by: Hans Verkuil Signed-off-by: Mauro Carvalho Chehab --- drivers/media/pci/ivtv/ivtv-driver.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'drivers/media/pci') diff --git a/drivers/media/pci/ivtv/ivtv-driver.c b/drivers/media/pci/ivtv/ivtv-driver.c index 6e448cb3b51c..c4a069b3b9d1 100644 --- a/drivers/media/pci/ivtv/ivtv-driver.c +++ b/drivers/media/pci/ivtv/ivtv-driver.c @@ -1393,7 +1393,7 @@ int ivtv_init_on_first_open(struct ivtv *itv) static void ivtv_remove(struct pci_dev *pdev) { - struct v4l2_device *v4l2_dev = dev_get_drvdata(&pdev->dev); + struct v4l2_device *v4l2_dev = pci_get_drvdata(pdev); struct ivtv *itv = to_ivtv(v4l2_dev); int i; -- cgit v1.2.3 From 911edeff2264bc307f242c3aab8331ef5800295a Mon Sep 17 00:00:00 2001 From: Bhaskar Chowdhury Date: Sat, 13 Feb 2021 16:00:14 +0100 Subject: media: drivers/media/pci/cx18: Fix a spelling minimze to minimize in the file cx18-firmware.c s/minimze/minimize/ Signed-off-by: Bhaskar Chowdhury Signed-off-by: Hans Verkuil Signed-off-by: Mauro Carvalho Chehab --- drivers/media/pci/cx18/cx18-firmware.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'drivers/media/pci') diff --git a/drivers/media/pci/cx18/cx18-firmware.c b/drivers/media/pci/cx18/cx18-firmware.c index 876b96c11290..fdac310d7477 100644 --- a/drivers/media/pci/cx18/cx18-firmware.c +++ b/drivers/media/pci/cx18/cx18-firmware.c @@ -244,7 +244,7 @@ void cx18_init_power(struct cx18 *cx, int lowpwr) * an error of less than 0.13 ppm which is way, way better than any off * the shelf crystal will have for accuracy anyway. * - * Below I aim to run the PLLs' VCOs near 400 MHz to minimze errors. + * Below I aim to run the PLLs' VCOs near 400 MHz to minimize errors. * * Many thanks to Jeff Campbell and Mike Bradley for their extensive * investigation, experimentation, testing, and suggested solutions of -- cgit v1.2.3 From 611ce3395e34cc20cb07c507314d77c1bb4a06ca Mon Sep 17 00:00:00 2001 From: Bhaskar Chowdhury Date: Sat, 13 Feb 2021 16:08:05 +0100 Subject: media: drivers: media: pci: cx18: Couple of spell fixes in the file cx18-av-core.c s/minimze/minimize/ s/initallize/initialize/ Signed-off-by: Bhaskar Chowdhury Signed-off-by: Hans Verkuil Signed-off-by: Mauro Carvalho Chehab --- drivers/media/pci/cx18/cx18-av-core.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'drivers/media/pci') diff --git a/drivers/media/pci/cx18/cx18-av-core.c b/drivers/media/pci/cx18/cx18-av-core.c index b33eb08631b1..11cfe35fd730 100644 --- a/drivers/media/pci/cx18/cx18-av-core.c +++ b/drivers/media/pci/cx18/cx18-av-core.c @@ -89,7 +89,7 @@ static void cx18_av_init(struct cx18 *cx) /* * The crystal freq used in calculations in this driver will be * 28.636360 MHz. - * Aim to run the PLLs' VCOs near 400 MHz to minimze errors. + * Aim to run the PLLs' VCOs near 400 MHz to minimize errors. */ /* @@ -122,7 +122,7 @@ static void cx18_av_initialize(struct v4l2_subdev *sd) cx18_av_write4_expect(cx, CXADEC_DL_CTL, 0x03000000, 0x03000000, 0x13000000); - /* initallize the PLL by toggling sleep bit */ + /* initialize the PLL by toggling sleep bit */ v = cx18_av_read4(cx, CXADEC_HOST_REG1); /* enable sleep mode - register appears to be read only... */ cx18_av_write4_expect(cx, CXADEC_HOST_REG1, v | 1, v, 0xfffe); -- cgit v1.2.3 From 937da4fd2ca125a6024ef86816e07590d657ed90 Mon Sep 17 00:00:00 2001 From: Bhaskar Chowdhury Date: Sat, 13 Feb 2021 16:13:20 +0100 Subject: media: drivers: media: pci: cx18: Spelling fix of minimze to minimize in the file cx18-av-audio.c s/minimze/minimize/ Signed-off-by: Bhaskar Chowdhury Signed-off-by: Hans Verkuil Signed-off-by: Mauro Carvalho Chehab --- drivers/media/pci/cx18/cx18-av-audio.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'drivers/media/pci') diff --git a/drivers/media/pci/cx18/cx18-av-audio.c b/drivers/media/pci/cx18/cx18-av-audio.c index ee2b802d2895..833baa934448 100644 --- a/drivers/media/pci/cx18/cx18-av-audio.c +++ b/drivers/media/pci/cx18/cx18-av-audio.c @@ -46,7 +46,7 @@ static int set_audclk_freq(struct cx18 *cx, u32 freq) * an error of less than 0.13 ppm which is way, way better than any off * the shelf crystal will have for accuracy anyway. * - * Below I aim to run the PLLs' VCOs near 400 MHz to minimze error. + * Below I aim to run the PLLs' VCOs near 400 MHz to minimize error. * * Many thanks to Jeff Campbell and Mike Bradley for their extensive * investigation, experimentation, testing, and suggested solutions of -- cgit v1.2.3 From 0aa3bdca3850b73623b377aa1da54c29979259a6 Mon Sep 17 00:00:00 2001 From: Yang Li Date: Mon, 22 Feb 2021 09:08:01 +0100 Subject: media: solo6x10: Switch to using the new API kobj_to_dev() fixed the following coccicheck: ./drivers/media/pci/solo6x10/solo6x10-core.c:371:60-61: WARNING opportunity for kobj_to_dev() Reported-by: Abaci Robot Signed-off-by: Yang Li Signed-off-by: Hans Verkuil Signed-off-by: Mauro Carvalho Chehab --- drivers/media/pci/solo6x10/solo6x10-core.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'drivers/media/pci') diff --git a/drivers/media/pci/solo6x10/solo6x10-core.c b/drivers/media/pci/solo6x10/solo6x10-core.c index d497afc7e7b7..4a546eeefe38 100644 --- a/drivers/media/pci/solo6x10/solo6x10-core.c +++ b/drivers/media/pci/solo6x10/solo6x10-core.c @@ -368,7 +368,7 @@ static ssize_t sdram_show(struct file *file, struct kobject *kobj, struct bin_attribute *a, char *buf, loff_t off, size_t count) { - struct device *dev = container_of(kobj, struct device, kobj); + struct device *dev = kobj_to_dev(kobj); struct solo_dev *solo_dev = container_of(dev, struct solo_dev, dev); const int size = solo_dev->sdram_size; -- cgit v1.2.3 From 24df8b74c8b2fb42c49ffe8585562da0c96446ff Mon Sep 17 00:00:00 2001 From: Julian Braha Date: Thu, 25 Feb 2021 09:06:58 +0100 Subject: media: drivers: media: pci: sta2x11: fix Kconfig dependency on GPIOLIB When STA2X11_VIP is enabled, and GPIOLIB is disabled, Kbuild gives the following warning: WARNING: unmet direct dependencies detected for VIDEO_ADV7180 Depends on [n]: MEDIA_SUPPORT [=y] && GPIOLIB [=n] && VIDEO_V4L2 [=y] && I2C [=y] Selected by [y]: - STA2X11_VIP [=y] && MEDIA_SUPPORT [=y] && MEDIA_PCI_SUPPORT [=y] && MEDIA_CAMERA_SUPPORT [=y] && PCI [=y] && VIDEO_V4L2 [=y] && VIRT_TO_BUS [=y] && I2C [=y] && (STA2X11 [=n] || COMPILE_TEST [=y]) && MEDIA_SUBDRV_AUTOSELECT [=y] This is because STA2X11_VIP selects VIDEO_ADV7180 without selecting or depending on GPIOLIB, despite VIDEO_ADV7180 depending on GPIOLIB. Signed-off-by: Julian Braha Signed-off-by: Hans Verkuil Signed-off-by: Mauro Carvalho Chehab --- drivers/media/pci/sta2x11/Kconfig | 1 + 1 file changed, 1 insertion(+) (limited to 'drivers/media/pci') diff --git a/drivers/media/pci/sta2x11/Kconfig b/drivers/media/pci/sta2x11/Kconfig index 4dd98f94a91e..27bb78513631 100644 --- a/drivers/media/pci/sta2x11/Kconfig +++ b/drivers/media/pci/sta2x11/Kconfig @@ -3,6 +3,7 @@ config STA2X11_VIP tristate "STA2X11 VIP Video For Linux" depends on PCI && VIDEO_V4L2 && VIRT_TO_BUS && I2C depends on STA2X11 || COMPILE_TEST + select GPIOLIB if MEDIA_SUBDRV_AUTOSELECT select VIDEO_ADV7180 if MEDIA_SUBDRV_AUTOSELECT select VIDEOBUF2_DMA_CONTIG select MEDIA_CONTROLLER -- cgit v1.2.3 From 4e1cb753c04d74e06d7ca826ea0bcb02526af03e Mon Sep 17 00:00:00 2001 From: Tasos Sahanidis Date: Wed, 3 Mar 2021 19:30:18 +0100 Subject: media: saa7134: use sg_dma_len when building pgtable The new AMD IOMMU DMA implementation concatenates sglist entries under certain conditions, and because saa7134 accessed the length member directly, it did not support this scenario. This fixes IO_PAGE_FAULTs and choppy DMA audio by using the sg_dma_len macro. Fixes: be62dbf554c5 ("iommu/amd: Convert AMD iommu driver to the dma-iommu api") Signed-off-by: Tasos Sahanidis Signed-off-by: Hans Verkuil Signed-off-by: Mauro Carvalho Chehab --- drivers/media/pci/saa7134/saa7134-core.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'drivers/media/pci') diff --git a/drivers/media/pci/saa7134/saa7134-core.c b/drivers/media/pci/saa7134/saa7134-core.c index 391572a6ec76..efb757d5168a 100644 --- a/drivers/media/pci/saa7134/saa7134-core.c +++ b/drivers/media/pci/saa7134/saa7134-core.c @@ -243,7 +243,7 @@ int saa7134_pgtable_build(struct pci_dev *pci, struct saa7134_pgtable *pt, ptr = pt->cpu + startpage; for (i = 0; i < length; i++, list = sg_next(list)) { - for (p = 0; p * 4096 < list->length; p++, ptr++) + for (p = 0; p * 4096 < sg_dma_len(list); p++, ptr++) *ptr = cpu_to_le32(sg_dma_address(list) + list->offset + p * 4096); } -- cgit v1.2.3 From b5fe86307e42e3a62c58c6b6a54c8db55b2632ae Mon Sep 17 00:00:00 2001 From: Qinglang Miao Date: Mon, 21 Sep 2020 15:10:37 +0200 Subject: media: ngene: simplify the return expression of eeprom_write_ushort() Simplify the return expression. Signed-off-by: Qinglang Miao Signed-off-by: Hans Verkuil Signed-off-by: Mauro Carvalho Chehab --- drivers/media/pci/ngene/ngene-cards.c | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-) (limited to 'drivers/media/pci') diff --git a/drivers/media/pci/ngene/ngene-cards.c b/drivers/media/pci/ngene/ngene-cards.c index 8bfb3d8ea610..7dbc21e1a2ca 100644 --- a/drivers/media/pci/ngene/ngene-cards.c +++ b/drivers/media/pci/ngene/ngene-cards.c @@ -934,15 +934,11 @@ static int eeprom_read_ushort(struct i2c_adapter *adapter, u16 tag, u16 *data) static int eeprom_write_ushort(struct i2c_adapter *adapter, u16 tag, u16 data) { - int stat; u8 buf[2]; buf[0] = data >> 8; buf[1] = data & 0xff; - stat = WriteEEProm(adapter, tag, 2, buf); - if (stat) - return stat; - return 0; + return WriteEEProm(adapter, tag, 2, buf); } static s16 osc_deviation(void *priv, s16 deviation, int flag) -- cgit v1.2.3 From 5f864cfbf59bfed2057bd214ce7fbf6ad420d54b Mon Sep 17 00:00:00 2001 From: Brad Love Date: Tue, 26 Jan 2021 05:52:05 +0100 Subject: media: cx23885: add more quirks for reset DMA on some AMD IOMMU The folowing AMD IOMMU are affected by the RiSC engine stall, requiring a reset to maintain continual operation. After being added to the broken_dev_id list the systems are functional long term. 0x1481 is the PCI ID for the IOMMU found on Starship/Matisse 0x1419 is the PCI ID for the IOMMU found on 15h (Models 10h-1fh) family 0x5a23 is the PCI ID for the IOMMU found on RD890S/RD990 Signed-off-by: Brad Love Signed-off-by: Hans Verkuil Signed-off-by: Mauro Carvalho Chehab --- drivers/media/pci/cx23885/cx23885-core.c | 9 +++++++++ 1 file changed, 9 insertions(+) (limited to 'drivers/media/pci') diff --git a/drivers/media/pci/cx23885/cx23885-core.c b/drivers/media/pci/cx23885/cx23885-core.c index 22f55a7840a6..d0ca260ecf70 100644 --- a/drivers/media/pci/cx23885/cx23885-core.c +++ b/drivers/media/pci/cx23885/cx23885-core.c @@ -2077,6 +2077,15 @@ static struct { * 0x1423 is the PCI ID for the IOMMU found on Kaveri */ { PCI_VENDOR_ID_AMD, 0x1423 }, + /* 0x1481 is the PCI ID for the IOMMU found on Starship/Matisse + */ + { PCI_VENDOR_ID_AMD, 0x1481 }, + /* 0x1419 is the PCI ID for the IOMMU found on 15h (Models 10h-1fh) family + */ + { PCI_VENDOR_ID_AMD, 0x1419 }, + /* 0x5a23 is the PCI ID for the IOMMU found on RD890S/RD990 + */ + { PCI_VENDOR_ID_ATI, 0x5a23 }, }; static bool cx23885_does_need_dma_reset(void) -- cgit v1.2.3 From cb1318fd80c37085e63a79a1fe96fd82399d9469 Mon Sep 17 00:00:00 2001 From: Brad Love Date: Tue, 26 Jan 2021 05:52:06 +0100 Subject: media: cx23885: Fix various Hauppauge device analog capture inputs Reports indicated S-Video capture did not work on HVR1265_K4, so all devices on hand were audited and corrected to become fully functional. ImpactVCB-e - Remove extraneous composite inputs - Fix S-Video inputs HVR5525 - Add routing and config for composite capture - Add routing and config for S-Video capture - Add routing for audio on both composite/S-Video HVR1265_K4 - Remove non-existent composite capture - Add routing and config for S-Video capture Signed-off-by: Brad Love Signed-off-by: Hans Verkuil Signed-off-by: Mauro Carvalho Chehab --- drivers/media/pci/cx23885/cx23885-cards.c | 28 ++++++++++++++-------------- 1 file changed, 14 insertions(+), 14 deletions(-) (limited to 'drivers/media/pci') diff --git a/drivers/media/pci/cx23885/cx23885-cards.c b/drivers/media/pci/cx23885/cx23885-cards.c index 03eee606af91..0160f909f38c 100644 --- a/drivers/media/pci/cx23885/cx23885-cards.c +++ b/drivers/media/pci/cx23885/cx23885-cards.c @@ -657,14 +657,11 @@ struct cx23885_board cx23885_boards[] = { .porta = CX23885_ANALOG_VIDEO, .input = {{ .type = CX23885_VMUX_COMPOSITE1, - .vmux = CX25840_VIN7_CH3 | - CX25840_VIN4_CH2 | - CX25840_VIN6_CH1, + .vmux = CX25840_VIN6_CH1, .amux = CX25840_AUDIO7, }, { .type = CX23885_VMUX_SVIDEO, - .vmux = CX25840_VIN7_CH3 | - CX25840_VIN4_CH2 | + .vmux = CX25840_VIN4_CH2 | CX25840_VIN8_CH1 | CX25840_SVIDEO_ON, .amux = CX25840_AUDIO7, @@ -715,6 +712,16 @@ struct cx23885_board cx23885_boards[] = { CX25840_VIN2_CH1 | CX25840_DIF_ON, .amux = CX25840_AUDIO8, + }, { + .type = CX23885_VMUX_COMPOSITE1, + .vmux = CX25840_VIN6_CH1, + .amux = CX25840_AUDIO7, + }, { + .type = CX23885_VMUX_SVIDEO, + .vmux = CX25840_VIN7_CH3 | + CX25840_VIN8_CH1 | + CX25840_SVIDEO_ON, + .amux = CX25840_AUDIO7, } }, }, [CX23885_BOARD_VIEWCAST_260E] = { @@ -822,17 +829,10 @@ struct cx23885_board cx23885_boards[] = { CX25840_VIN2_CH1 | CX25840_DIF_ON, .amux = CX25840_AUDIO8, - }, { - .type = CX23885_VMUX_COMPOSITE1, - .vmux = CX25840_VIN7_CH3 | - CX25840_VIN4_CH2 | - CX25840_VIN6_CH1, - .amux = CX25840_AUDIO7, }, { .type = CX23885_VMUX_SVIDEO, - .vmux = CX25840_VIN7_CH3 | - CX25840_VIN4_CH2 | - CX25840_VIN8_CH1 | + .vmux = CX25840_VIN4_CH2 | + CX25840_VIN6_CH1 | CX25840_SVIDEO_ON, .amux = CX25840_AUDIO7, } }, -- cgit v1.2.3 From efb8225ce66516eabd8882e1682d5e370bdf862e Mon Sep 17 00:00:00 2001 From: Christophe JAILLET Date: Sat, 30 Jan 2021 07:32:00 +0100 Subject: media: ngene: switch from 'pci_' to 'dma_' API The wrappers in include/linux/pci-dma-compat.h should go away. The patch has been generated with the coccinelle script below and has been hand modified to replace GFP_ with a correct flag. It has been compile tested. When memory is allocated, GFP_KERNEL can be used because in all cases, it is called from a probe function and no lock is taken in the between. The call chain is: ngene_probe (probe function, used in ngene-cards.c) --> ngene_get_buffers --> AllocCommonBuffers (call dma_alloc_coherent) --> create_ring_buffer (call dma_alloc_coherent) --> AllocateRingBuffers (call dma_alloc_coherent) @@ @@ - PCI_DMA_BIDIRECTIONAL + DMA_BIDIRECTIONAL @@ @@ - PCI_DMA_TODEVICE + DMA_TO_DEVICE @@ @@ - PCI_DMA_FROMDEVICE + DMA_FROM_DEVICE @@ @@ - PCI_DMA_NONE + DMA_NONE @@ expression e1, e2, e3; @@ - pci_alloc_consistent(e1, e2, e3) + dma_alloc_coherent(&e1->dev, e2, e3, GFP_) @@ expression e1, e2, e3; @@ - pci_zalloc_consistent(e1, e2, e3) + dma_alloc_coherent(&e1->dev, e2, e3, GFP_) @@ expression e1, e2, e3, e4; @@ - pci_free_consistent(e1, e2, e3, e4) + dma_free_coherent(&e1->dev, e2, e3, e4) @@ expression e1, e2, e3, e4; @@ - pci_map_single(e1, e2, e3, e4) + dma_map_single(&e1->dev, e2, e3, e4) @@ expression e1, e2, e3, e4; @@ - pci_unmap_single(e1, e2, e3, e4) + dma_unmap_single(&e1->dev, e2, e3, e4) @@ expression e1, e2, e3, e4, e5; @@ - pci_map_page(e1, e2, e3, e4, e5) + dma_map_page(&e1->dev, e2, e3, e4, e5) @@ expression e1, e2, e3, e4; @@ - pci_unmap_page(e1, e2, e3, e4) + dma_unmap_page(&e1->dev, e2, e3, e4) @@ expression e1, e2, e3, e4; @@ - pci_map_sg(e1, e2, e3, e4) + dma_map_sg(&e1->dev, e2, e3, e4) @@ expression e1, e2, e3, e4; @@ - pci_unmap_sg(e1, e2, e3, e4) + dma_unmap_sg(&e1->dev, e2, e3, e4) @@ expression e1, e2, e3, e4; @@ - pci_dma_sync_single_for_cpu(e1, e2, e3, e4) + dma_sync_single_for_cpu(&e1->dev, e2, e3, e4) @@ expression e1, e2, e3, e4; @@ - pci_dma_sync_single_for_device(e1, e2, e3, e4) + dma_sync_single_for_device(&e1->dev, e2, e3, e4) @@ expression e1, e2, e3, e4; @@ - pci_dma_sync_sg_for_cpu(e1, e2, e3, e4) + dma_sync_sg_for_cpu(&e1->dev, e2, e3, e4) @@ expression e1, e2, e3, e4; @@ - pci_dma_sync_sg_for_device(e1, e2, e3, e4) + dma_sync_sg_for_device(&e1->dev, e2, e3, e4) @@ expression e1, e2; @@ - pci_dma_mapping_error(e1, e2) + dma_mapping_error(&e1->dev, e2) @@ expression e1, e2; @@ - pci_set_dma_mask(e1, e2) + dma_set_mask(&e1->dev, e2) @@ expression e1, e2; @@ - pci_set_consistent_dma_mask(e1, e2) + dma_set_coherent_mask(&e1->dev, e2) Signed-off-by: Christophe JAILLET Signed-off-by: Hans Verkuil Signed-off-by: Mauro Carvalho Chehab --- drivers/media/pci/ngene/ngene-core.c | 56 ++++++++++++++++++------------------ 1 file changed, 28 insertions(+), 28 deletions(-) (limited to 'drivers/media/pci') diff --git a/drivers/media/pci/ngene/ngene-core.c b/drivers/media/pci/ngene/ngene-core.c index f9f94f47d76b..07f342db6701 100644 --- a/drivers/media/pci/ngene/ngene-core.c +++ b/drivers/media/pci/ngene/ngene-core.c @@ -763,23 +763,22 @@ static void free_ringbuffer(struct ngene *dev, struct SRingBufferDescriptor *rb) for (j = 0; j < rb->NumBuffers; j++, Cur = Cur->Next) { if (Cur->Buffer1) - pci_free_consistent(dev->pci_dev, - rb->Buffer1Length, - Cur->Buffer1, - Cur->scList1->Address); + dma_free_coherent(&dev->pci_dev->dev, + rb->Buffer1Length, Cur->Buffer1, + Cur->scList1->Address); if (Cur->Buffer2) - pci_free_consistent(dev->pci_dev, - rb->Buffer2Length, - Cur->Buffer2, - Cur->scList2->Address); + dma_free_coherent(&dev->pci_dev->dev, + rb->Buffer2Length, Cur->Buffer2, + Cur->scList2->Address); } if (rb->SCListMem) - pci_free_consistent(dev->pci_dev, rb->SCListMemSize, - rb->SCListMem, rb->PASCListMem); + dma_free_coherent(&dev->pci_dev->dev, rb->SCListMemSize, + rb->SCListMem, rb->PASCListMem); - pci_free_consistent(dev->pci_dev, rb->MemSize, rb->Head, rb->PAHead); + dma_free_coherent(&dev->pci_dev->dev, rb->MemSize, rb->Head, + rb->PAHead); } static void free_idlebuffer(struct ngene *dev, @@ -813,15 +812,13 @@ static void free_common_buffers(struct ngene *dev) } if (dev->OverflowBuffer) - pci_free_consistent(dev->pci_dev, - OVERFLOW_BUFFER_SIZE, - dev->OverflowBuffer, dev->PAOverflowBuffer); + dma_free_coherent(&dev->pci_dev->dev, OVERFLOW_BUFFER_SIZE, + dev->OverflowBuffer, dev->PAOverflowBuffer); if (dev->FWInterfaceBuffer) - pci_free_consistent(dev->pci_dev, - 4096, - dev->FWInterfaceBuffer, - dev->PAFWInterfaceBuffer); + dma_free_coherent(&dev->pci_dev->dev, 4096, + dev->FWInterfaceBuffer, + dev->PAFWInterfaceBuffer); } /****************************************************************************/ @@ -848,7 +845,7 @@ static int create_ring_buffer(struct pci_dev *pci_dev, if (MemSize < 4096) MemSize = 4096; - Head = pci_alloc_consistent(pci_dev, MemSize, &tmp); + Head = dma_alloc_coherent(&pci_dev->dev, MemSize, &tmp, GFP_KERNEL); PARingBufferHead = tmp; if (!Head) @@ -899,7 +896,8 @@ static int AllocateRingBuffers(struct pci_dev *pci_dev, if (SCListMemSize < 4096) SCListMemSize = 4096; - SCListMem = pci_alloc_consistent(pci_dev, SCListMemSize, &tmp); + SCListMem = dma_alloc_coherent(&pci_dev->dev, SCListMemSize, &tmp, + GFP_KERNEL); PASCListMem = tmp; if (SCListMem == NULL) @@ -918,8 +916,8 @@ static int AllocateRingBuffers(struct pci_dev *pci_dev, for (i = 0; i < pRingBuffer->NumBuffers; i += 1, Cur = Cur->Next) { u64 PABuffer; - void *Buffer = pci_alloc_consistent(pci_dev, Buffer1Length, - &tmp); + void *Buffer = dma_alloc_coherent(&pci_dev->dev, + Buffer1Length, &tmp, GFP_KERNEL); PABuffer = tmp; if (Buffer == NULL) @@ -951,7 +949,8 @@ static int AllocateRingBuffers(struct pci_dev *pci_dev, if (!Buffer2Length) continue; - Buffer = pci_alloc_consistent(pci_dev, Buffer2Length, &tmp); + Buffer = dma_alloc_coherent(&pci_dev->dev, Buffer2Length, + &tmp, GFP_KERNEL); PABuffer = tmp; if (Buffer == NULL) @@ -1040,17 +1039,18 @@ static int AllocCommonBuffers(struct ngene *dev) { int status = 0, i; - dev->FWInterfaceBuffer = pci_alloc_consistent(dev->pci_dev, 4096, - &dev->PAFWInterfaceBuffer); + dev->FWInterfaceBuffer = dma_alloc_coherent(&dev->pci_dev->dev, 4096, + &dev->PAFWInterfaceBuffer, + GFP_KERNEL); if (!dev->FWInterfaceBuffer) return -ENOMEM; dev->hosttongene = dev->FWInterfaceBuffer; dev->ngenetohost = dev->FWInterfaceBuffer + 256; dev->EventBuffer = dev->FWInterfaceBuffer + 512; - dev->OverflowBuffer = pci_zalloc_consistent(dev->pci_dev, - OVERFLOW_BUFFER_SIZE, - &dev->PAOverflowBuffer); + dev->OverflowBuffer = dma_alloc_coherent(&dev->pci_dev->dev, + OVERFLOW_BUFFER_SIZE, + &dev->PAOverflowBuffer, GFP_KERNEL); if (!dev->OverflowBuffer) return -ENOMEM; -- cgit v1.2.3 From c2d6a60dc4657f6aeb19241e41d8e831ef259620 Mon Sep 17 00:00:00 2001 From: Hans Verkuil Date: Tue, 9 Mar 2021 13:15:36 +0100 Subject: media: media/pci: fix kerneldoc issues in two headers This fixes these kerneldoc warnings: drivers/media/pci/tw686x/tw686x.h:143: warning: Function parameter or member 'v4l2_dev' not described in 'tw686x_dev' drivers/media/pci/tw686x/tw686x.h:143: warning: Function parameter or member 'snd_card' not described in 'tw686x_dev' drivers/media/pci/tw686x/tw686x.h:143: warning: Function parameter or member 'name' not described in 'tw686x_dev' drivers/media/pci/tw686x/tw686x.h:143: warning: Function parameter or member 'type' not described in 'tw686x_dev' drivers/media/pci/tw686x/tw686x.h:143: warning: Function parameter or member 'dma_mode' not described in 'tw686x_dev' drivers/media/pci/tw686x/tw686x.h:143: warning: Function parameter or member 'pci_dev' not described in 'tw686x_dev' drivers/media/pci/tw686x/tw686x.h:143: warning: Function parameter or member 'mmio' not described in 'tw686x_dev' drivers/media/pci/tw686x/tw686x.h:143: warning: Function parameter or member 'dma_ops' not described in 'tw686x_dev' drivers/media/pci/tw686x/tw686x.h:143: warning: Function parameter or member 'video_channels' not described in 'tw686x_dev' drivers/media/pci/tw686x/tw686x.h:143: warning: Function parameter or member 'audio_channels' not described in 'tw686x_dev' drivers/media/pci/tw686x/tw686x.h:143: warning: Function parameter or member 'audio_rate' not described in 'tw686x_dev' drivers/media/pci/tw686x/tw686x.h:143: warning: Function parameter or member 'period_size' not described in 'tw686x_dev' drivers/media/pci/tw686x/tw686x.h:143: warning: Function parameter or member 'audio_enabled' not described in 'tw686x_dev' drivers/media/pci/tw686x/tw686x.h:143: warning: Function parameter or member 'dma_delay_timer' not described in 'tw686x_dev' drivers/media/pci/tw686x/tw686x.h:143: warning: Function parameter or member 'pending_dma_en' not described in 'tw686x_dev' drivers/media/pci/tw686x/tw686x.h:143: warning: Function parameter or member 'pending_dma_cmd' not described in 'tw686x_dev' drivers/media/pci/sta2x11/sta2x11_vip.h:25: warning: Function parameter or member 'i2c_id' not described in 'vip_config' drivers/media/pci/sta2x11/sta2x11_vip.h:25: warning: Function parameter or member 'i2c_addr' not described in 'vip_config' Signed-off-by: Hans Verkuil Signed-off-by: Mauro Carvalho Chehab --- drivers/media/pci/sta2x11/sta2x11_vip.h | 2 ++ drivers/media/pci/tw686x/tw686x.h | 10 +++++----- 2 files changed, 7 insertions(+), 5 deletions(-) (limited to 'drivers/media/pci') diff --git a/drivers/media/pci/sta2x11/sta2x11_vip.h b/drivers/media/pci/sta2x11/sta2x11_vip.h index a8cf140a050b..de6000e7943e 100644 --- a/drivers/media/pci/sta2x11/sta2x11_vip.h +++ b/drivers/media/pci/sta2x11/sta2x11_vip.h @@ -14,6 +14,8 @@ * @pwr_pin: ADV powerdown pin * @reset_name: ADV reset name * @reset_pin: ADV reset pin + * @i2c_id: ADV i2c adapter ID + * @i2c_addr: ADV i2c address */ struct vip_config { const char *pwr_name; diff --git a/drivers/media/pci/tw686x/tw686x.h b/drivers/media/pci/tw686x/tw686x.h index 48dd1e03d806..21a98995065c 100644 --- a/drivers/media/pci/tw686x/tw686x.h +++ b/drivers/media/pci/tw686x/tw686x.h @@ -111,12 +111,12 @@ struct tw686x_dma_ops { u32 hw_dma_mode; }; -/** - * struct tw686x_dev - global device status - * @lock: spinlock controlling access to the - * shared device registers (DMA enable/disable). - */ +/* struct tw686x_dev - global device status */ struct tw686x_dev { + /* + * spinlock controlling access to the shared device registers + * (DMA enable/disable) + */ spinlock_t lock; struct v4l2_device v4l2_dev; -- cgit v1.2.3 From c759b2970c561e3b56aa030deb13db104262adfe Mon Sep 17 00:00:00 2001 From: Daniel Niv Date: Thu, 11 Mar 2021 03:53:00 +0100 Subject: media: media/saa7164: fix saa7164_encoder_register() memory leak bugs Add a fix for the memory leak bugs that can occur when the saa7164_encoder_register() function fails. The function allocates memory without explicitly freeing it when errors occur. Add a better error handling that deallocate the unused buffers before the function exits during a fail. Signed-off-by: Daniel Niv Signed-off-by: Hans Verkuil Signed-off-by: Mauro Carvalho Chehab --- drivers/media/pci/saa7164/saa7164-encoder.c | 20 +++++++++++--------- 1 file changed, 11 insertions(+), 9 deletions(-) (limited to 'drivers/media/pci') diff --git a/drivers/media/pci/saa7164/saa7164-encoder.c b/drivers/media/pci/saa7164/saa7164-encoder.c index 11e1eb6a6809..1d1d32e043f1 100644 --- a/drivers/media/pci/saa7164/saa7164-encoder.c +++ b/drivers/media/pci/saa7164/saa7164-encoder.c @@ -1008,7 +1008,7 @@ int saa7164_encoder_register(struct saa7164_port *port) printk(KERN_ERR "%s() failed (errno = %d), NO PCI configuration\n", __func__, result); result = -ENOMEM; - goto failed; + goto fail_pci; } /* Establish encoder defaults here */ @@ -1062,7 +1062,7 @@ int saa7164_encoder_register(struct saa7164_port *port) 100000, ENCODER_DEF_BITRATE); if (hdl->error) { result = hdl->error; - goto failed; + goto fail_hdl; } port->std = V4L2_STD_NTSC_M; @@ -1080,7 +1080,7 @@ int saa7164_encoder_register(struct saa7164_port *port) printk(KERN_INFO "%s: can't allocate mpeg device\n", dev->name); result = -ENOMEM; - goto failed; + goto fail_hdl; } port->v4l_device->ctrl_handler = hdl; @@ -1091,10 +1091,7 @@ int saa7164_encoder_register(struct saa7164_port *port) if (result < 0) { printk(KERN_INFO "%s: can't register mpeg device\n", dev->name); - /* TODO: We're going to leak here if we don't dealloc - The buffers above. The unreg function can't deal wit it. - */ - goto failed; + goto fail_reg; } printk(KERN_INFO "%s: registered device video%d [mpeg]\n", @@ -1116,9 +1113,14 @@ int saa7164_encoder_register(struct saa7164_port *port) saa7164_api_set_encoder(port); saa7164_api_get_encoder(port); + return 0; - result = 0; -failed: +fail_reg: + video_device_release(port->v4l_device); + port->v4l_device = NULL; +fail_hdl: + v4l2_ctrl_handler_free(hdl); +fail_pci: return result; } -- cgit v1.2.3 From 4b19f9716ad89af51f07f9b611aabfd5fd80c625 Mon Sep 17 00:00:00 2001 From: Bhaskar Chowdhury Date: Mon, 15 Mar 2021 02:39:58 +0100 Subject: media: pci: saa7164: Rudimentary spelling fixes in the file saa7164-types.h s/structues/structures/ s/decies/decides/ Signed-off-by: Bhaskar Chowdhury Acked-by: Randy Dunlap Signed-off-by: Hans Verkuil Signed-off-by: Mauro Carvalho Chehab --- drivers/media/pci/saa7164/saa7164-types.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'drivers/media/pci') diff --git a/drivers/media/pci/saa7164/saa7164-types.h b/drivers/media/pci/saa7164/saa7164-types.h index 34dd2be6fce4..00f163b38d40 100644 --- a/drivers/media/pci/saa7164/saa7164-types.h +++ b/drivers/media/pci/saa7164/saa7164-types.h @@ -7,7 +7,7 @@ /* TODO: Cleanup and shorten the namespace */ -/* Some structues are passed directly to/from the firmware and +/* Some structures are passed directly to/from the firmware and * have strict alignment requirements. This is one of them. */ struct tmComResHWDescr { @@ -28,7 +28,7 @@ struct tmComResHWDescr { /* This is DWORD aligned on windows but I can't find the right * gcc syntax to match the binary data from the device. * I've manually padded with Reserved[3] bytes to match the hardware, - * but this could break if GCC decies to pack in a different way. + * but this could break if GCC decides to pack in a different way. */ struct tmComResInterfaceDescr { u8 bLength; -- cgit v1.2.3 From 79f382b9a9d84cd099b79cf92aa9f73d0aa64481 Mon Sep 17 00:00:00 2001 From: zuoqilin Date: Wed, 17 Mar 2021 04:08:04 +0100 Subject: media: media/pci/pt1: Assign value when defining variables When defining variables and assigning values can be done at the same time. Signed-off-by: zuoqilin Signed-off-by: Hans Verkuil Signed-off-by: Mauro Carvalho Chehab --- drivers/media/pci/pt1/pt1.c | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) (limited to 'drivers/media/pci') diff --git a/drivers/media/pci/pt1/pt1.c b/drivers/media/pci/pt1/pt1.c index 72b191cfeb54..f2aa36814fba 100644 --- a/drivers/media/pci/pt1/pt1.c +++ b/drivers/media/pci/pt1/pt1.c @@ -334,8 +334,7 @@ static int pt1_sync(struct pt1 *pt1) static u64 pt1_identify(struct pt1 *pt1) { int i; - u64 id; - id = 0; + u64 id = 0; for (i = 0; i < 57; i++) { id |= (u64)(pt1_read_reg(pt1, 0) >> 30 & 1) << i; pt1_write_reg(pt1, 0, 0x00000008); @@ -1122,8 +1121,7 @@ static int pt1_i2c_end(struct pt1 *pt1, int addr) static void pt1_i2c_begin(struct pt1 *pt1, int *addrp) { - int addr; - addr = 0; + int addr = 0; pt1_i2c_emit(pt1, addr, 0, 0, 1, 1, addr /* itself */); addr = addr + 1; -- cgit v1.2.3 From bb5d418076f8c6cea8adaeffc0bbcd2032c814f0 Mon Sep 17 00:00:00 2001 From: Christophe JAILLET Date: Sun, 21 Mar 2021 08:58:11 +0100 Subject: media: cx25821: switch from 'pci_' to 'dma_' API The wrappers in include/linux/pci-dma-compat.h should go away. The patch has been generated with the coccinelle script below and has been hand modified to replace GFP_ with a correct flag. It has been compile tested. When memory is allocated in 'cx25821_riscmem_alloc()' GFP_KERNEL can be used because either this flag is already used in the call chain, or it is called from a 'buf_prepare' function. The call chains are: vb2_ops.buf_prepare (in cx25821-video.c) cx25821_buffer_prepare (in cx25821-video.c) cx25821_risc_buffer cx25821_riscmem_alloc snd_cx25821_hw_params (in cx25821-alsa.c) <-- use GFP_KERNEL cx25821_risc_databuffer_audio cx25821_riscmem_alloc @@ @@ - PCI_DMA_BIDIRECTIONAL + DMA_BIDIRECTIONAL @@ @@ - PCI_DMA_TODEVICE + DMA_TO_DEVICE @@ @@ - PCI_DMA_FROMDEVICE + DMA_FROM_DEVICE @@ @@ - PCI_DMA_NONE + DMA_NONE @@ expression e1, e2, e3; @@ - pci_alloc_consistent(e1, e2, e3) + dma_alloc_coherent(&e1->dev, e2, e3, GFP_) @@ expression e1, e2, e3; @@ - pci_zalloc_consistent(e1, e2, e3) + dma_alloc_coherent(&e1->dev, e2, e3, GFP_) @@ expression e1, e2, e3, e4; @@ - pci_free_consistent(e1, e2, e3, e4) + dma_free_coherent(&e1->dev, e2, e3, e4) @@ expression e1, e2, e3, e4; @@ - pci_map_single(e1, e2, e3, e4) + dma_map_single(&e1->dev, e2, e3, e4) @@ expression e1, e2, e3, e4; @@ - pci_unmap_single(e1, e2, e3, e4) + dma_unmap_single(&e1->dev, e2, e3, e4) @@ expression e1, e2, e3, e4, e5; @@ - pci_map_page(e1, e2, e3, e4, e5) + dma_map_page(&e1->dev, e2, e3, e4, e5) @@ expression e1, e2, e3, e4; @@ - pci_unmap_page(e1, e2, e3, e4) + dma_unmap_page(&e1->dev, e2, e3, e4) @@ expression e1, e2, e3, e4; @@ - pci_map_sg(e1, e2, e3, e4) + dma_map_sg(&e1->dev, e2, e3, e4) @@ expression e1, e2, e3, e4; @@ - pci_unmap_sg(e1, e2, e3, e4) + dma_unmap_sg(&e1->dev, e2, e3, e4) @@ expression e1, e2, e3, e4; @@ - pci_dma_sync_single_for_cpu(e1, e2, e3, e4) + dma_sync_single_for_cpu(&e1->dev, e2, e3, e4) @@ expression e1, e2, e3, e4; @@ - pci_dma_sync_single_for_device(e1, e2, e3, e4) + dma_sync_single_for_device(&e1->dev, e2, e3, e4) @@ expression e1, e2, e3, e4; @@ - pci_dma_sync_sg_for_cpu(e1, e2, e3, e4) + dma_sync_sg_for_cpu(&e1->dev, e2, e3, e4) @@ expression e1, e2, e3, e4; @@ - pci_dma_sync_sg_for_device(e1, e2, e3, e4) + dma_sync_sg_for_device(&e1->dev, e2, e3, e4) @@ expression e1, e2; @@ - pci_dma_mapping_error(e1, e2) + dma_mapping_error(&e1->dev, e2) @@ expression e1, e2; @@ - pci_set_dma_mask(e1, e2) + dma_set_mask(&e1->dev, e2) @@ expression e1, e2; @@ - pci_set_consistent_dma_mask(e1, e2) + dma_set_coherent_mask(&e1->dev, e2) Signed-off-by: Christophe JAILLET Signed-off-by: Hans Verkuil Signed-off-by: Mauro Carvalho Chehab --- drivers/media/pci/cx25821/cx25821-alsa.c | 2 +- drivers/media/pci/cx25821/cx25821-core.c | 10 +++++----- 2 files changed, 6 insertions(+), 6 deletions(-) (limited to 'drivers/media/pci') diff --git a/drivers/media/pci/cx25821/cx25821-alsa.c b/drivers/media/pci/cx25821/cx25821-alsa.c index 608fbaf0f659..3b0074e25b31 100644 --- a/drivers/media/pci/cx25821/cx25821-alsa.c +++ b/drivers/media/pci/cx25821/cx25821-alsa.c @@ -403,7 +403,7 @@ static int dsp_buffer_free(struct cx25821_audio_dev *chip) dprintk(2, "Freeing buffer\n"); cx25821_alsa_dma_unmap(chip); cx25821_alsa_dma_free(chip->buf); - pci_free_consistent(chip->pci, risc->size, risc->cpu, risc->dma); + dma_free_coherent(&chip->pci->dev, risc->size, risc->cpu, risc->dma); kfree(chip->buf); chip->buf = NULL; diff --git a/drivers/media/pci/cx25821/cx25821-core.c b/drivers/media/pci/cx25821/cx25821-core.c index 07b6d0c49bbf..40c10ca94def 100644 --- a/drivers/media/pci/cx25821/cx25821-core.c +++ b/drivers/media/pci/cx25821/cx25821-core.c @@ -977,11 +977,11 @@ int cx25821_riscmem_alloc(struct pci_dev *pci, dma_addr_t dma = 0; if (risc->cpu && risc->size < size) { - pci_free_consistent(pci, risc->size, risc->cpu, risc->dma); + dma_free_coherent(&pci->dev, risc->size, risc->cpu, risc->dma); risc->cpu = NULL; } if (NULL == risc->cpu) { - cpu = pci_zalloc_consistent(pci, size, &dma); + cpu = dma_alloc_coherent(&pci->dev, size, &dma, GFP_KERNEL); if (NULL == cpu) return -ENOMEM; risc->cpu = cpu; @@ -1202,8 +1202,8 @@ void cx25821_free_buffer(struct cx25821_dev *dev, struct cx25821_buffer *buf) { if (WARN_ON(buf->risc.size == 0)) return; - pci_free_consistent(dev->pci, - buf->risc.size, buf->risc.cpu, buf->risc.dma); + dma_free_coherent(&dev->pci->dev, buf->risc.size, buf->risc.cpu, + buf->risc.dma); memset(&buf->risc, 0, sizeof(buf->risc)); } @@ -1302,7 +1302,7 @@ static int cx25821_initdev(struct pci_dev *pci_dev, dev->pci_lat, (unsigned long long)dev->base_io_addr); pci_set_master(pci_dev); - err = pci_set_dma_mask(pci_dev, 0xffffffff); + err = dma_set_mask(&pci_dev->dev, 0xffffffff); if (err) { pr_err("%s/0: Oops: no 32bit PCI DMA ???\n", dev->name); err = -EIO; -- cgit v1.2.3 From 2e774b36997926d120f5ce0b977d8dc1956a5454 Mon Sep 17 00:00:00 2001 From: Christophe JAILLET Date: Sun, 13 Sep 2020 16:57:16 +0200 Subject: media: mantis: switch from 'pci_' to 'dma_' API The wrappers in include/linux/pci-dma-compat.h should go away. The patch has been generated with the coccinelle script below and has been hand modified to replace GFP_ with a correct flag. It has been compile tested. When memory is allocated in 'mantis_alloc_buffers()' (mantis_dma.c) GFP_KERNEL can be used because it is called from 'mantis_dma_init()' which is only called from probe functions and no lock is taken in the between. @@ @@ - PCI_DMA_BIDIRECTIONAL + DMA_BIDIRECTIONAL @@ @@ - PCI_DMA_TODEVICE + DMA_TO_DEVICE @@ @@ - PCI_DMA_FROMDEVICE + DMA_FROM_DEVICE @@ @@ - PCI_DMA_NONE + DMA_NONE @@ expression e1, e2, e3; @@ - pci_alloc_consistent(e1, e2, e3) + dma_alloc_coherent(&e1->dev, e2, e3, GFP_) @@ expression e1, e2, e3; @@ - pci_zalloc_consistent(e1, e2, e3) + dma_alloc_coherent(&e1->dev, e2, e3, GFP_) @@ expression e1, e2, e3, e4; @@ - pci_free_consistent(e1, e2, e3, e4) + dma_free_coherent(&e1->dev, e2, e3, e4) @@ expression e1, e2, e3, e4; @@ - pci_map_single(e1, e2, e3, e4) + dma_map_single(&e1->dev, e2, e3, e4) @@ expression e1, e2, e3, e4; @@ - pci_unmap_single(e1, e2, e3, e4) + dma_unmap_single(&e1->dev, e2, e3, e4) @@ expression e1, e2, e3, e4, e5; @@ - pci_map_page(e1, e2, e3, e4, e5) + dma_map_page(&e1->dev, e2, e3, e4, e5) @@ expression e1, e2, e3, e4; @@ - pci_unmap_page(e1, e2, e3, e4) + dma_unmap_page(&e1->dev, e2, e3, e4) @@ expression e1, e2, e3, e4; @@ - pci_map_sg(e1, e2, e3, e4) + dma_map_sg(&e1->dev, e2, e3, e4) @@ expression e1, e2, e3, e4; @@ - pci_unmap_sg(e1, e2, e3, e4) + dma_unmap_sg(&e1->dev, e2, e3, e4) @@ expression e1, e2, e3, e4; @@ - pci_dma_sync_single_for_cpu(e1, e2, e3, e4) + dma_sync_single_for_cpu(&e1->dev, e2, e3, e4) @@ expression e1, e2, e3, e4; @@ - pci_dma_sync_single_for_device(e1, e2, e3, e4) + dma_sync_single_for_device(&e1->dev, e2, e3, e4) @@ expression e1, e2, e3, e4; @@ - pci_dma_sync_sg_for_cpu(e1, e2, e3, e4) + dma_sync_sg_for_cpu(&e1->dev, e2, e3, e4) @@ expression e1, e2, e3, e4; @@ - pci_dma_sync_sg_for_device(e1, e2, e3, e4) + dma_sync_sg_for_device(&e1->dev, e2, e3, e4) @@ expression e1, e2; @@ - pci_dma_mapping_error(e1, e2) + dma_mapping_error(&e1->dev, e2) @@ expression e1, e2; @@ - pci_set_dma_mask(e1, e2) + dma_set_mask(&e1->dev, e2) @@ expression e1, e2; @@ - pci_set_consistent_dma_mask(e1, e2) + dma_set_coherent_mask(&e1->dev, e2) Link: https://lore.kernel.org/linux-media/20200913145716.361507-1-christophe.jaillet@wanadoo.fr Signed-off-by: Christophe JAILLET Signed-off-by: Mauro Carvalho Chehab --- drivers/media/pci/mantis/mantis_dma.c | 20 ++++++++++---------- drivers/media/pci/mantis/mantis_pci.c | 2 +- 2 files changed, 11 insertions(+), 11 deletions(-) (limited to 'drivers/media/pci') diff --git a/drivers/media/pci/mantis/mantis_dma.c b/drivers/media/pci/mantis/mantis_dma.c index 4df571ff272b..80c843936493 100644 --- a/drivers/media/pci/mantis/mantis_dma.c +++ b/drivers/media/pci/mantis/mantis_dma.c @@ -52,8 +52,8 @@ int mantis_dma_exit(struct mantis_pci *mantis) mantis->buf_cpu, MANTIS_BUF_SIZE); - pci_free_consistent(mantis->pdev, MANTIS_BUF_SIZE, - mantis->buf_cpu, mantis->buf_dma); + dma_free_coherent(&mantis->pdev->dev, MANTIS_BUF_SIZE, + mantis->buf_cpu, mantis->buf_dma); mantis->buf_cpu = NULL; } @@ -64,8 +64,8 @@ int mantis_dma_exit(struct mantis_pci *mantis) mantis->risc_cpu, MANTIS_RISC_SIZE); - pci_free_consistent(mantis->pdev, MANTIS_RISC_SIZE, - mantis->risc_cpu, mantis->risc_dma); + dma_free_coherent(&mantis->pdev->dev, MANTIS_RISC_SIZE, + mantis->risc_cpu, mantis->risc_dma); mantis->risc_cpu = NULL; } @@ -77,9 +77,9 @@ EXPORT_SYMBOL_GPL(mantis_dma_exit); static inline int mantis_alloc_buffers(struct mantis_pci *mantis) { if (!mantis->buf_cpu) { - mantis->buf_cpu = pci_alloc_consistent(mantis->pdev, - MANTIS_BUF_SIZE, - &mantis->buf_dma); + mantis->buf_cpu = dma_alloc_coherent(&mantis->pdev->dev, + MANTIS_BUF_SIZE, + &mantis->buf_dma, GFP_KERNEL); if (!mantis->buf_cpu) { dprintk(MANTIS_ERROR, 1, "DMA buffer allocation failed"); @@ -92,9 +92,9 @@ static inline int mantis_alloc_buffers(struct mantis_pci *mantis) mantis->buf_cpu, MANTIS_BUF_SIZE); } if (!mantis->risc_cpu) { - mantis->risc_cpu = pci_alloc_consistent(mantis->pdev, - MANTIS_RISC_SIZE, - &mantis->risc_dma); + mantis->risc_cpu = dma_alloc_coherent(&mantis->pdev->dev, + MANTIS_RISC_SIZE, + &mantis->risc_dma, GFP_KERNEL); if (!mantis->risc_cpu) { dprintk(MANTIS_ERROR, 1, diff --git a/drivers/media/pci/mantis/mantis_pci.c b/drivers/media/pci/mantis/mantis_pci.c index 3bfb3e99c93a..9fbce74b00c8 100644 --- a/drivers/media/pci/mantis/mantis_pci.c +++ b/drivers/media/pci/mantis/mantis_pci.c @@ -55,7 +55,7 @@ int mantis_pci_init(struct mantis_pci *mantis) goto fail0; } - err = pci_set_consistent_dma_mask(pdev, DMA_BIT_MASK(32)); + err = dma_set_coherent_mask(&pdev->dev, DMA_BIT_MASK(32)); if (err != 0) { dprintk(MANTIS_ERROR, 1, "ERROR: Unable to obtain 32 bit DMA <%i>", err); ret = -ENOMEM; -- cgit v1.2.3 From 519648bed470441eac680314724ee4128f422a92 Mon Sep 17 00:00:00 2001 From: Necip Fazil Yildiran Date: Tue, 22 Sep 2020 15:22:22 +0200 Subject: media: mantis: remove orphan mantis_core.c There is no Makefile rule to have drivers/media/pci/mantis/mantis_core.o in build since the code overhaul with commit b3b961448f70 ("V4L/DVB (13795): [Mantis/Hopper] Code overhaul, add Hopper devices into the PCI ID list"). It looks like drivers/media/pci/mantis/mantis_core.c is a leftover. Remove the orphan code. Link: https://lore.kernel.org/linux-media/20200922132221.2051769-1-fazilyildiran@gmail.com Fixes: b3b961448f70 ("V4L/DVB (13795): [Mantis/Hopper] Code overhaul, add Hopper devices into the PCI ID list"). Signed-off-by: Necip Fazil Yildiran Signed-off-by: Mauro Carvalho Chehab --- drivers/media/pci/mantis/mantis_ca.c | 1 - drivers/media/pci/mantis/mantis_core.c | 200 --------------------------------- drivers/media/pci/mantis/mantis_core.h | 2 - 3 files changed, 203 deletions(-) delete mode 100644 drivers/media/pci/mantis/mantis_core.c (limited to 'drivers/media/pci') diff --git a/drivers/media/pci/mantis/mantis_ca.c b/drivers/media/pci/mantis/mantis_ca.c index f2baf5e5c921..0fad0a923e35 100644 --- a/drivers/media/pci/mantis/mantis_ca.c +++ b/drivers/media/pci/mantis/mantis_ca.c @@ -109,7 +109,6 @@ static int mantis_ts_control(struct dvb_ca_en50221 *en50221, int slot) struct mantis_pci *mantis = ca->ca_priv; dprintk(MANTIS_DEBUG, 1, "Slot(%d): TS control", slot); -/* mantis_set_direction(mantis, 1); */ /* Enable TS through CAM */ return 0; } diff --git a/drivers/media/pci/mantis/mantis_core.c b/drivers/media/pci/mantis/mantis_core.c deleted file mode 100644 index f303f68d4ef2..000000000000 --- a/drivers/media/pci/mantis/mantis_core.c +++ /dev/null @@ -1,200 +0,0 @@ -// SPDX-License-Identifier: GPL-2.0-or-later -/* - Mantis PCI bridge driver - - Copyright (C) Manu Abraham (abraham.manu@gmail.com) - -*/ - -#include "mantis_common.h" -#include "mantis_core.h" -#include "mantis_vp1033.h" -#include "mantis_vp1034.h" -#include "mantis_vp1041.h" -#include "mantis_vp2033.h" -#include "mantis_vp2040.h" -#include "mantis_vp3030.h" - -static int read_eeprom_byte(struct mantis_pci *mantis, u8 *data, u8 length) -{ - int err; - struct i2c_msg msg[] = { - { - .addr = 0x50, - .flags = 0, - .buf = data, - .len = 1 - }, { - .addr = 0x50, - .flags = I2C_M_RD, - .buf = data, - .len = length - }, - }; - - err = i2c_transfer(&mantis->adapter, msg, 2); - if (err < 0) { - dprintk(verbose, MANTIS_ERROR, 1, - "ERROR: i2c read: < err=%i d0=0x%02x d1=0x%02x >", - err, data[0], data[1]); - - return err; - } - - return 0; -} - -static int get_mac_address(struct mantis_pci *mantis) -{ - int err; - - mantis->mac_address[0] = 0x08; - err = read_eeprom_byte(mantis, &mantis->mac_address[0], 6); - if (err < 0) { - dprintk(verbose, MANTIS_ERROR, 1, "Mantis EEPROM read error"); - - return err; - } - dprintk(verbose, MANTIS_ERROR, 0, - " MAC Address=[%pM]\n", mantis->mac_address); - - return 0; -} - -#define MANTIS_MODEL_UNKNOWN "UNKNOWN" -#define MANTIS_DEV_UNKNOWN "UNKNOWN" - -struct mantis_hwconfig unknown_device = { - .model_name = MANTIS_MODEL_UNKNOWN, - .dev_type = MANTIS_DEV_UNKNOWN, -}; - -static void mantis_load_config(struct mantis_pci *mantis) -{ - switch (mantis->subsystem_device) { - case MANTIS_VP_1033_DVB_S: /* VP-1033 */ - mantis->hwconfig = &vp1033_mantis_config; - break; - case MANTIS_VP_1034_DVB_S: /* VP-1034 */ - mantis->hwconfig = &vp1034_mantis_config; - break; - case MANTIS_VP_1041_DVB_S2: /* VP-1041 */ - case TECHNISAT_SKYSTAR_HD2: - mantis->hwconfig = &vp1041_mantis_config; - break; - case MANTIS_VP_2033_DVB_C: /* VP-2033 */ - mantis->hwconfig = &vp2033_mantis_config; - break; - case MANTIS_VP_2040_DVB_C: /* VP-2040 */ - case CINERGY_C: /* VP-2040 clone */ - case TECHNISAT_CABLESTAR_HD2: - mantis->hwconfig = &vp2040_mantis_config; - break; - case MANTIS_VP_3030_DVB_T: /* VP-3030 */ - mantis->hwconfig = &vp3030_mantis_config; - break; - default: - mantis->hwconfig = &unknown_device; - break; - } -} - -int mantis_core_init(struct mantis_pci *mantis) -{ - int err = 0; - - mantis_load_config(mantis); - dprintk(verbose, MANTIS_ERROR, 0, "found a %s PCI %s device on (%02x:%02x.%x),\n", - mantis->hwconfig->model_name, mantis->hwconfig->dev_type, - mantis->pdev->bus->number, PCI_SLOT(mantis->pdev->devfn), PCI_FUNC(mantis->pdev->devfn)); - dprintk(verbose, MANTIS_ERROR, 0, " Mantis Rev %d [%04x:%04x], ", - mantis->revision, - mantis->subsystem_vendor, mantis->subsystem_device); - dprintk(verbose, MANTIS_ERROR, 0, - "irq: %d, latency: %d\n memory: 0x%lx, mmio: 0x%p\n", - mantis->pdev->irq, mantis->latency, - mantis->mantis_addr, mantis->mantis_mmio); - - err = mantis_i2c_init(mantis); - if (err < 0) { - dprintk(verbose, MANTIS_ERROR, 1, "Mantis I2C init failed"); - return err; - } - err = get_mac_address(mantis); - if (err < 0) { - dprintk(verbose, MANTIS_ERROR, 1, "get MAC address failed"); - return err; - } - err = mantis_dma_init(mantis); - if (err < 0) { - dprintk(verbose, MANTIS_ERROR, 1, "Mantis DMA init failed"); - return err; - } - err = mantis_dvb_init(mantis); - if (err < 0) { - dprintk(verbose, MANTIS_DEBUG, 1, "Mantis DVB init failed"); - return err; - } - err = mantis_uart_init(mantis); - if (err < 0) { - dprintk(verbose, MANTIS_DEBUG, 1, "Mantis UART init failed"); - return err; - } - - return 0; -} - -int mantis_core_exit(struct mantis_pci *mantis) -{ - mantis_dma_stop(mantis); - dprintk(verbose, MANTIS_ERROR, 1, "DMA engine stopping"); - - mantis_uart_exit(mantis); - dprintk(verbose, MANTIS_ERROR, 1, "UART exit failed"); - - if (mantis_dma_exit(mantis) < 0) - dprintk(verbose, MANTIS_ERROR, 1, "DMA exit failed"); - if (mantis_dvb_exit(mantis) < 0) - dprintk(verbose, MANTIS_ERROR, 1, "DVB exit failed"); - if (mantis_i2c_exit(mantis) < 0) - dprintk(verbose, MANTIS_ERROR, 1, "I2C adapter delete.. failed"); - - return 0; -} - -/* Turn the given bit on or off. */ -void gpio_set_bits(struct mantis_pci *mantis, u32 bitpos, u8 value) -{ - u32 cur; - - cur = mmread(MANTIS_GPIF_ADDR); - if (value) - mantis->gpio_status = cur | (1 << bitpos); - else - mantis->gpio_status = cur & (~(1 << bitpos)); - - mmwrite(mantis->gpio_status, MANTIS_GPIF_ADDR); - mmwrite(0x00, MANTIS_GPIF_DOUT); - udelay(100); -} - -/* direction = 0 , no CI passthrough ; 1 , CI passthrough */ -void mantis_set_direction(struct mantis_pci *mantis, int direction) -{ - u32 reg; - - reg = mmread(0x28); - dprintk(verbose, MANTIS_DEBUG, 1, "TS direction setup"); - if (direction == 0x01) { - /* to CI */ - reg |= 0x04; - mmwrite(reg, 0x28); - reg &= 0xff - 0x04; - mmwrite(reg, 0x28); - } else { - reg &= 0xff - 0x04; - mmwrite(reg, 0x28); - reg |= 0x04; - mmwrite(reg, 0x28); - } -} diff --git a/drivers/media/pci/mantis/mantis_core.h b/drivers/media/pci/mantis/mantis_core.h index 1b0468ff791c..93c89a10a2c7 100644 --- a/drivers/media/pci/mantis/mantis_core.h +++ b/drivers/media/pci/mantis/mantis_core.h @@ -39,7 +39,5 @@ extern void mantis_dma_start(struct mantis_pci *mantis); extern void mantis_dma_stop(struct mantis_pci *mantis); extern int mantis_i2c_init(struct mantis_pci *mantis); extern int mantis_i2c_exit(struct mantis_pci *mantis); -extern int mantis_core_init(struct mantis_pci *mantis); -extern int mantis_core_exit(struct mantis_pci *mantis); #endif /* __MANTIS_CORE_H */ -- cgit v1.2.3 From 6f4eaea21b1acc78367389d8f0bdb30e158a37d9 Mon Sep 17 00:00:00 2001 From: Hans Verkuil Date: Tue, 23 Mar 2021 17:12:42 +0100 Subject: media: cobalt: fix initial EDID The EDID failed with two edid-decode warnings: Block 1, CTA-861 Extension Block: Video Data Block: VIC 16 is the preferred timing, overriding the first detailed timings. Is this intended? Video Capability Data Block: S_PT is equal to S_IT and S_CE, so should be set to 0 instead. In addition, the first DTD had a wrong vsync value (6 instead of 5). Signed-off-by: Hans Verkuil Signed-off-by: Mauro Carvalho Chehab --- drivers/media/pci/cobalt/cobalt-driver.c | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) (limited to 'drivers/media/pci') diff --git a/drivers/media/pci/cobalt/cobalt-driver.c b/drivers/media/pci/cobalt/cobalt-driver.c index 0695078ef812..9c754e01c186 100644 --- a/drivers/media/pci/cobalt/cobalt-driver.c +++ b/drivers/media/pci/cobalt/cobalt-driver.c @@ -56,19 +56,19 @@ static u8 edid[256] = { 0x45, 0x59, 0x61, 0x59, 0x81, 0x99, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x02, 0x3a, 0x80, 0x18, 0x71, 0x38, 0x2d, 0x40, 0x58, 0x2c, - 0x46, 0x00, 0xe0, 0x0e, 0x11, 0x00, 0x00, 0x1e, + 0x45, 0x00, 0xe0, 0x0e, 0x11, 0x00, 0x00, 0x1e, 0x00, 0x00, 0x00, 0xfd, 0x00, 0x18, 0x55, 0x18, 0x5e, 0x11, 0x00, 0x0a, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x00, 0x00, 0x00, 0xfc, 0x00, 0x63, 0x6f, 0x62, 0x61, 0x6c, 0x74, 0x0a, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x9c, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x9d, - 0x02, 0x03, 0x1f, 0xf0, 0x4a, 0x90, 0x1f, 0x04, + 0x02, 0x03, 0x1f, 0xf1, 0x4a, 0x10, 0x1f, 0x04, 0x13, 0x22, 0x21, 0x20, 0x02, 0x11, 0x01, 0x23, 0x09, 0x07, 0x07, 0x68, 0x03, 0x0c, 0x00, 0x10, - 0x00, 0x00, 0x22, 0x0f, 0xe2, 0x00, 0xea, 0x00, + 0x00, 0x00, 0x22, 0x0f, 0xe2, 0x00, 0xca, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, @@ -80,7 +80,7 @@ static u8 edid[256] = { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xa7, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x46, }; static void cobalt_set_interrupt(struct cobalt *cobalt, bool enable) -- cgit v1.2.3 From 9ca53286a3e9069dcf2818165d3a9e01f781c871 Mon Sep 17 00:00:00 2001 From: Xiaofeng Cao Date: Wed, 24 Mar 2021 04:29:06 +0100 Subject: media: drivers/media/pci/bt8xx/bttv-cards: fix typos change 'vodeo' to 'video' change 'nevery' to 'never' change 'is' to 'it' change 'connevted' to 'connected' change 'swichers' to 'switchers' change 'strucure' to 'structure' change 'unblanced' to 'unbalanced' change 'fonctionality' to 'functionality' Signed-off-by: Xiaofeng Cao Acked-by: Randy Dunlap Signed-off-by: Hans Verkuil Signed-off-by: Mauro Carvalho Chehab --- drivers/media/pci/bt8xx/bttv-cards.c | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) (limited to 'drivers/media/pci') diff --git a/drivers/media/pci/bt8xx/bttv-cards.c b/drivers/media/pci/bt8xx/bttv-cards.c index ca20b806e82d..c2b5ab287dd7 100644 --- a/drivers/media/pci/bt8xx/bttv-cards.c +++ b/drivers/media/pci/bt8xx/bttv-cards.c @@ -2011,7 +2011,7 @@ struct tvcard bttv_tvcards[] = { /* .audio_inputs= 0, */ .svhs = 9, .gpiomask = 0x00, - .gpiomask2 = 0x03, /* used for external vodeo mux */ + .gpiomask2 = 0x03, /* used for external video mux */ .muxsel = MUXSEL(2, 2, 2, 2, 3, 3, 3, 3, 1, 0), .muxsel_hook = phytec_muxsel, .gpiomux = { 0, 0, 0, 0 }, /* card has no audio */ @@ -2025,7 +2025,7 @@ struct tvcard bttv_tvcards[] = { /* .audio_inputs= 0, */ .svhs = 9, .gpiomask = 0x00, - .gpiomask2 = 0x03, /* used for external vodeo mux */ + .gpiomask2 = 0x03, /* used for external video mux */ .muxsel = MUXSEL(2, 2, 2, 2, 3, 3, 3, 3, 1, 1), .muxsel_hook = phytec_muxsel, .gpiomux = { 0, 0, 0, 0 }, /* card has no audio */ @@ -2180,8 +2180,8 @@ struct tvcard bttv_tvcards[] = { [BTTV_BOARD_PICOLO_TETRA_CHIP] = { /*Eric DEBIEF */ /*EURESYS Picolo Tetra : 4 Conexant Fusion 878A, no audio, video input set with analog multiplexers GPIO controlled*/ - /* adds picolo_tetra_muxsel(), picolo_tetra_init(), the following declaration strucure, and #define BTTV_BOARD_PICOLO_TETRA_CHIP*/ - /*0x79 in bttv.h*/ + /*adds picolo_tetra_muxsel(), picolo_tetra_init(), the following declaration*/ + /*structure and #define BTTV_BOARD_PICOLO_TETRA_CHIP 0x79 in bttv.h*/ .name = "Euresys Picolo Tetra", .video_inputs = 4, /* .audio_inputs= 0, */ @@ -2506,7 +2506,7 @@ struct tvcard bttv_tvcards[] = { one external BNC composite input (mux 2) three internal composite inputs (unknown muxes) an 18-bit stereo A/D (CS5331A), which has: - one external stereo unblanced (RCA) audio connection + one external stereo unbalanced (RCA) audio connection one (or 3?) internal stereo balanced (XLR) audio connection input is selected via gpio to a 14052B mux (mask=0x300, unbal=0x000, bal=0x100, ??=0x200,0x300) @@ -3924,7 +3924,7 @@ static void osprey_eeprom(struct bttv *btv, const u8 ee[256]) u32 serial = 0; int cardid = -1; - /* This code will nevery actually get called in this case.... */ + /* This code will never actually get called in this case.... */ if (btv->c.type == BTTV_BOARD_UNKNOWN) { /* this might be an antique... check for MMAC label in eeprom */ if (!strncmp(ee, "MMAC", 4)) { @@ -4086,7 +4086,7 @@ static void avermedia_eeprom(struct bttv *btv) /* * For Voodoo TV/FM and Voodoo 200. These cards' tuners use a TDA9880 * analog demod, which is not I2C controlled like the newer and more common - * TDA9887 series. Instead is has two tri-state input pins, S0 and S1, + * TDA9887 series. Instead it has two tri-state input pins, S0 and S1, * that control the IF for the video and audio. Apparently, bttv GPIO * 0x10000 is connected to S0. S0 low selects a 38.9 MHz VIF for B/G/D/K/I * (i.e., PAL) while high selects 45.75 MHz for M/N (i.e., NTSC). @@ -4144,7 +4144,7 @@ static void init_PXC200(struct bttv *btv) int tmp; u32 val; - /* Initialise GPIO-connevted stuff */ + /* Initialise GPIO-connected stuff */ gpio_inout(0xffffff, (1<<13)); gpio_write(0); udelay(3); @@ -4580,7 +4580,7 @@ static void xguard_muxsel(struct bttv *btv, unsigned int input) } static void picolo_tetra_init(struct bttv *btv) { - /*This is the video input redirection fonctionality : I DID NOT USED IT. */ + /*This is the video input redirection functionality : I DID NOT USE IT. */ btwrite (0x08<<16,BT848_GPIO_DATA);/*GPIO[19] [==> 4053 B+C] set to 1 */ btwrite (0x04<<16,BT848_GPIO_DATA);/*GPIO[18] [==> 4053 A] set to 1*/ } @@ -4598,7 +4598,7 @@ static void picolo_tetra_muxsel (struct bttv* btv, unsigned int input) * ivc120_muxsel [Added by Alan Garfield ] * * The IVC120G security card has 4 i2c controlled TDA8540 matrix - * swichers to provide 16 channels to MUX0. The TDA8540's have + * switchers to provide 16 channels to MUX0. The TDA8540's have * 4 independent outputs and as such the IVC120G also has the * optional "Monitor Out" bus. This allows the card to be looking * at one input while the monitor is looking at another. -- cgit v1.2.3 From 73c9a3f3b3465be8b7c71ba736c2696290a43bf8 Mon Sep 17 00:00:00 2001 From: Bhaskar Chowdhury Date: Wed, 24 Mar 2021 15:17:43 +0100 Subject: media: cx88: Fix a typo s/sillicon/silicon/ Signed-off-by: Bhaskar Chowdhury Acked-by: Randy Dunlap Signed-off-by: Hans Verkuil Signed-off-by: Mauro Carvalho Chehab --- drivers/media/pci/cx88/cx88-cards.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'drivers/media/pci') diff --git a/drivers/media/pci/cx88/cx88-cards.c b/drivers/media/pci/cx88/cx88-cards.c index 8e224fc0474d..f01e48c23f8e 100644 --- a/drivers/media/pci/cx88/cx88-cards.c +++ b/drivers/media/pci/cx88/cx88-cards.c @@ -3206,7 +3206,7 @@ static int cx88_xc4000_tuner_callback(struct cx88_core *core, /* * Tuner callback function. Currently only needed for the Pinnacle - * PCTV HD 800i with an xc5000 sillicon tuner. This is used for both + * PCTV HD 800i with an xc5000 silicon tuner. This is used for both * analog tuner attach (tuner-core.c) and dvb tuner attach (cx88-dvb.c) */ static int cx88_xc5000_tuner_callback(struct cx88_core *core, -- cgit v1.2.3 From a7de6eac6f6f73d48d97a6c93032107775f4593b Mon Sep 17 00:00:00 2001 From: Sakari Ailus Date: Mon, 15 Feb 2021 08:55:12 +0100 Subject: media: ipu3-cio2: Fix pixel-rate derived link frequency The driver uses v4l2_get_link_freq() helper to obtain the link frequency using the LINK_FREQ but also the PIXEL_RATE control. The divisor for the pixel rate derived link frequency was wrong, missing the bus uses double data rate. Fix this. Reported-by: Laurent Pinchart Fixes: 4b6c129e87a3 ("media: ipu3-cio2: Use v4l2_get_link_freq helper") Signed-off-by: Sakari Ailus Reviewed-by: Laurent Pinchart Reviewed-by: Bingbu Cao Signed-off-by: Mauro Carvalho Chehab --- drivers/media/pci/intel/ipu3/ipu3-cio2-main.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'drivers/media/pci') diff --git a/drivers/media/pci/intel/ipu3/ipu3-cio2-main.c b/drivers/media/pci/intel/ipu3/ipu3-cio2-main.c index 6e8c0c230e11..fecef85bd62e 100644 --- a/drivers/media/pci/intel/ipu3/ipu3-cio2-main.c +++ b/drivers/media/pci/intel/ipu3/ipu3-cio2-main.c @@ -302,7 +302,7 @@ static int cio2_csi2_calc_timing(struct cio2_device *cio2, struct cio2_queue *q, if (!q->sensor) return -ENODEV; - freq = v4l2_get_link_freq(q->sensor->ctrl_handler, bpp, lanes); + freq = v4l2_get_link_freq(q->sensor->ctrl_handler, bpp, lanes * 2); if (freq < 0) { dev_err(dev, "error %lld, invalid link_freq\n", freq); return freq; -- cgit v1.2.3 From 7a77379fe1d36b83009a9aee68031e22792c4091 Mon Sep 17 00:00:00 2001 From: Christophe JAILLET Date: Sun, 28 Mar 2021 10:08:19 +0200 Subject: media: cx23885: switch from 'pci_' to 'dma_' API The wrappers in include/linux/pci-dma-compat.h should go away. The patch has been generated with the coccinelle script below and has been hand modified to replace GFP_ with a correct flag. It has been compile tested. When memory is allocated in 'cx23885_risc_buffer()' GFP_KERNEL can be used because this function is only called from a vb2_ops buf_prepare function. The call chain is: cx23885_video_qops.buf_prepare (cx23885-video.c) --> buffer_prepare (cx23885-video.c) --> cx23885_risc_buffer When memory is allocated in 'cx23885_risc_databuffer()' GFP_KERNEL can be used because this function is only called from a function that already uses GFP_KERNEL or from a vb2_ops buf_prepare function. The call chains are: snd_cx23885_hw_params (cx23885-alsa.c) --> use GFP_KERNEL --> cx23885_risc_databuffer cx23885_qops.buffer_prepare (cx23885-417.c) or dvb_qops.buffer_prepare (cx23885-dvb.c) --> cx23885_buf_prepare --> cx23885_risc_databuffer When memory is allocated in 'cx23885_risc_vbibuffer()' GFP_KERNEL can be used because this function is only called from a vb2_ops buf_prepare function. The call chains are: cx23885_vbi_qops.buffer_prepare (cx23885-vbi.c) --> cx23885_risc_vbibuffer @@ @@ - PCI_DMA_BIDIRECTIONAL + DMA_BIDIRECTIONAL @@ @@ - PCI_DMA_TODEVICE + DMA_TO_DEVICE @@ @@ - PCI_DMA_FROMDEVICE + DMA_FROM_DEVICE @@ @@ - PCI_DMA_NONE + DMA_NONE @@ expression e1, e2, e3; @@ - pci_alloc_consistent(e1, e2, e3) + dma_alloc_coherent(&e1->dev, e2, e3, GFP_) @@ expression e1, e2, e3; @@ - pci_zalloc_consistent(e1, e2, e3) + dma_alloc_coherent(&e1->dev, e2, e3, GFP_) @@ expression e1, e2, e3, e4; @@ - pci_free_consistent(e1, e2, e3, e4) + dma_free_coherent(&e1->dev, e2, e3, e4) @@ expression e1, e2, e3, e4; @@ - pci_map_single(e1, e2, e3, e4) + dma_map_single(&e1->dev, e2, e3, e4) @@ expression e1, e2, e3, e4; @@ - pci_unmap_single(e1, e2, e3, e4) + dma_unmap_single(&e1->dev, e2, e3, e4) @@ expression e1, e2, e3, e4, e5; @@ - pci_map_page(e1, e2, e3, e4, e5) + dma_map_page(&e1->dev, e2, e3, e4, e5) @@ expression e1, e2, e3, e4; @@ - pci_unmap_page(e1, e2, e3, e4) + dma_unmap_page(&e1->dev, e2, e3, e4) @@ expression e1, e2, e3, e4; @@ - pci_map_sg(e1, e2, e3, e4) + dma_map_sg(&e1->dev, e2, e3, e4) @@ expression e1, e2, e3, e4; @@ - pci_unmap_sg(e1, e2, e3, e4) + dma_unmap_sg(&e1->dev, e2, e3, e4) @@ expression e1, e2, e3, e4; @@ - pci_dma_sync_single_for_cpu(e1, e2, e3, e4) + dma_sync_single_for_cpu(&e1->dev, e2, e3, e4) @@ expression e1, e2, e3, e4; @@ - pci_dma_sync_single_for_device(e1, e2, e3, e4) + dma_sync_single_for_device(&e1->dev, e2, e3, e4) @@ expression e1, e2, e3, e4; @@ - pci_dma_sync_sg_for_cpu(e1, e2, e3, e4) + dma_sync_sg_for_cpu(&e1->dev, e2, e3, e4) @@ expression e1, e2, e3, e4; @@ - pci_dma_sync_sg_for_device(e1, e2, e3, e4) + dma_sync_sg_for_device(&e1->dev, e2, e3, e4) @@ expression e1, e2; @@ - pci_dma_mapping_error(e1, e2) + dma_mapping_error(&e1->dev, e2) @@ expression e1, e2; @@ - pci_set_dma_mask(e1, e2) + dma_set_mask(&e1->dev, e2) @@ expression e1, e2; @@ - pci_set_consistent_dma_mask(e1, e2) + dma_set_coherent_mask(&e1->dev, e2) Signed-off-by: Christophe JAILLET Signed-off-by: Hans Verkuil Signed-off-by: Mauro Carvalho Chehab --- drivers/media/pci/cx23885/cx23885-alsa.c | 2 +- drivers/media/pci/cx23885/cx23885-core.c | 13 ++++++++----- 2 files changed, 9 insertions(+), 6 deletions(-) (limited to 'drivers/media/pci') diff --git a/drivers/media/pci/cx23885/cx23885-alsa.c b/drivers/media/pci/cx23885/cx23885-alsa.c index 13689c5dd47f..ab14d35214aa 100644 --- a/drivers/media/pci/cx23885/cx23885-alsa.c +++ b/drivers/media/pci/cx23885/cx23885-alsa.c @@ -266,7 +266,7 @@ static int dsp_buffer_free(struct cx23885_audio_dev *chip) cx23885_alsa_dma_unmap(chip); cx23885_alsa_dma_free(chip->buf); risc = &chip->buf->risc; - pci_free_consistent(chip->pci, risc->size, risc->cpu, risc->dma); + dma_free_coherent(&chip->pci->dev, risc->size, risc->cpu, risc->dma); kfree(chip->buf); chip->buf = NULL; diff --git a/drivers/media/pci/cx23885/cx23885-core.c b/drivers/media/pci/cx23885/cx23885-core.c index d0ca260ecf70..f8f2ff3b00c3 100644 --- a/drivers/media/pci/cx23885/cx23885-core.c +++ b/drivers/media/pci/cx23885/cx23885-core.c @@ -1218,7 +1218,8 @@ int cx23885_risc_buffer(struct pci_dev *pci, struct cx23885_riscmem *risc, / PAGE_SIZE + lines); instructions += 5; risc->size = instructions * 12; - risc->cpu = pci_alloc_consistent(pci, risc->size, &risc->dma); + risc->cpu = dma_alloc_coherent(&pci->dev, risc->size, &risc->dma, + GFP_KERNEL); if (risc->cpu == NULL) return -ENOMEM; @@ -1255,7 +1256,8 @@ int cx23885_risc_databuffer(struct pci_dev *pci, instructions += 4; risc->size = instructions * 12; - risc->cpu = pci_alloc_consistent(pci, risc->size, &risc->dma); + risc->cpu = dma_alloc_coherent(&pci->dev, risc->size, &risc->dma, + GFP_KERNEL); if (risc->cpu == NULL) return -ENOMEM; @@ -1293,7 +1295,8 @@ int cx23885_risc_vbibuffer(struct pci_dev *pci, struct cx23885_riscmem *risc, / PAGE_SIZE + lines); instructions += 5; risc->size = instructions * 12; - risc->cpu = pci_alloc_consistent(pci, risc->size, &risc->dma); + risc->cpu = dma_alloc_coherent(&pci->dev, risc->size, &risc->dma, + GFP_KERNEL); if (risc->cpu == NULL) return -ENOMEM; /* write risc instructions */ @@ -1322,7 +1325,7 @@ void cx23885_free_buffer(struct cx23885_dev *dev, struct cx23885_buffer *buf) { struct cx23885_riscmem *risc = &buf->risc; - pci_free_consistent(dev->pci, risc->size, risc->cpu, risc->dma); + dma_free_coherent(&dev->pci->dev, risc->size, risc->cpu, risc->dma); } static void cx23885_tsport_reg_dump(struct cx23885_tsport *port) @@ -2159,7 +2162,7 @@ static int cx23885_initdev(struct pci_dev *pci_dev, (unsigned long long)pci_resource_start(pci_dev, 0)); pci_set_master(pci_dev); - err = pci_set_dma_mask(pci_dev, 0xffffffff); + err = dma_set_mask(&pci_dev->dev, 0xffffffff); if (err) { pr_err("%s/0: Oops: no 32bit PCI DMA ???\n", dev->name); goto fail_ctrl; -- cgit v1.2.3 From c1dbcf62e1fd6a49c773dc25a715b2e02e27df80 Mon Sep 17 00:00:00 2001 From: Christophe JAILLET Date: Sun, 28 Mar 2021 19:02:18 +0200 Subject: media: tw686x: switch from 'pci_' to 'dma_' API The wrappers in include/linux/pci-dma-compat.h should go away. The patch has been generated with the coccinelle script below and has been hand modified to replace GFP_ with a correct flag. It has been compile tested. When memory is allocated in 'tw686x_audio_dma_alloc()' (tw686x-audio.c) GFP_KERNEL can be used because it is only called from a probe function and no spinlock is taken in the between. The call chain is: tw686x_probe (tw686x-core.c) --> tw686x_audio_init (tw686x-audio.c) --> tw686x_audio_dma_alloc (tw686x-audio.c) When memory is allocated in 'tw686x_memcpy_dma_alloc()' and in 'tw686x_sg_dma_alloc()' (tw686x-video.c) GFP_KERNEL can be used because these functions are .alloc functions from a tw686x_dma_ops structure. @@ @@ - PCI_DMA_BIDIRECTIONAL + DMA_BIDIRECTIONAL @@ @@ - PCI_DMA_TODEVICE + DMA_TO_DEVICE @@ @@ - PCI_DMA_FROMDEVICE + DMA_FROM_DEVICE @@ @@ - PCI_DMA_NONE + DMA_NONE @@ expression e1, e2, e3; @@ - pci_alloc_consistent(e1, e2, e3) + dma_alloc_coherent(&e1->dev, e2, e3, GFP_) @@ expression e1, e2, e3; @@ - pci_zalloc_consistent(e1, e2, e3) + dma_alloc_coherent(&e1->dev, e2, e3, GFP_) @@ expression e1, e2, e3, e4; @@ - pci_free_consistent(e1, e2, e3, e4) + dma_free_coherent(&e1->dev, e2, e3, e4) @@ expression e1, e2, e3, e4; @@ - pci_map_single(e1, e2, e3, e4) + dma_map_single(&e1->dev, e2, e3, e4) @@ expression e1, e2, e3, e4; @@ - pci_unmap_single(e1, e2, e3, e4) + dma_unmap_single(&e1->dev, e2, e3, e4) @@ expression e1, e2, e3, e4, e5; @@ - pci_map_page(e1, e2, e3, e4, e5) + dma_map_page(&e1->dev, e2, e3, e4, e5) @@ expression e1, e2, e3, e4; @@ - pci_unmap_page(e1, e2, e3, e4) + dma_unmap_page(&e1->dev, e2, e3, e4) @@ expression e1, e2, e3, e4; @@ - pci_map_sg(e1, e2, e3, e4) + dma_map_sg(&e1->dev, e2, e3, e4) @@ expression e1, e2, e3, e4; @@ - pci_unmap_sg(e1, e2, e3, e4) + dma_unmap_sg(&e1->dev, e2, e3, e4) @@ expression e1, e2, e3, e4; @@ - pci_dma_sync_single_for_cpu(e1, e2, e3, e4) + dma_sync_single_for_cpu(&e1->dev, e2, e3, e4) @@ expression e1, e2, e3, e4; @@ - pci_dma_sync_single_for_device(e1, e2, e3, e4) + dma_sync_single_for_device(&e1->dev, e2, e3, e4) @@ expression e1, e2, e3, e4; @@ - pci_dma_sync_sg_for_cpu(e1, e2, e3, e4) + dma_sync_sg_for_cpu(&e1->dev, e2, e3, e4) @@ expression e1, e2, e3, e4; @@ - pci_dma_sync_sg_for_device(e1, e2, e3, e4) + dma_sync_sg_for_device(&e1->dev, e2, e3, e4) @@ expression e1, e2; @@ - pci_dma_mapping_error(e1, e2) + dma_mapping_error(&e1->dev, e2) @@ expression e1, e2; @@ - pci_set_dma_mask(e1, e2) + dma_set_mask(&e1->dev, e2) @@ expression e1, e2; @@ - pci_set_consistent_dma_mask(e1, e2) + dma_set_coherent_mask(&e1->dev, e2) Signed-off-by: Christophe JAILLET Signed-off-by: Hans Verkuil Signed-off-by: Mauro Carvalho Chehab --- drivers/media/pci/tw686x/tw686x-audio.c | 13 +++++++------ drivers/media/pci/tw686x/tw686x-core.c | 2 +- drivers/media/pci/tw686x/tw686x-video.c | 17 ++++++++--------- 3 files changed, 16 insertions(+), 16 deletions(-) (limited to 'drivers/media/pci') diff --git a/drivers/media/pci/tw686x/tw686x-audio.c b/drivers/media/pci/tw686x/tw686x-audio.c index 54144e23a487..74cba1368cfa 100644 --- a/drivers/media/pci/tw686x/tw686x-audio.c +++ b/drivers/media/pci/tw686x/tw686x-audio.c @@ -300,9 +300,9 @@ static void tw686x_audio_dma_free(struct tw686x_dev *dev, for (pb = 0; pb < 2; pb++) { if (!ac->dma_descs[pb].virt) continue; - pci_free_consistent(dev->pci_dev, ac->dma_descs[pb].size, - ac->dma_descs[pb].virt, - ac->dma_descs[pb].phys); + dma_free_coherent(&dev->pci_dev->dev, ac->dma_descs[pb].size, + ac->dma_descs[pb].virt, + ac->dma_descs[pb].phys); ac->dma_descs[pb].virt = NULL; } } @@ -313,7 +313,7 @@ static int tw686x_audio_dma_alloc(struct tw686x_dev *dev, int pb; /* - * In the memcpy DMA mode we allocate a consistent buffer + * In the memcpy DMA mode we allocate a coherent buffer * and use it for the DMA capture. Otherwise, DMA * acts on the ALSA buffers as received in pcm_prepare. */ @@ -324,8 +324,9 @@ static int tw686x_audio_dma_alloc(struct tw686x_dev *dev, u32 reg = pb ? ADMA_B_ADDR[ac->ch] : ADMA_P_ADDR[ac->ch]; void *virt; - virt = pci_alloc_consistent(dev->pci_dev, AUDIO_DMA_SIZE_MAX, - &ac->dma_descs[pb].phys); + virt = dma_alloc_coherent(&dev->pci_dev->dev, + AUDIO_DMA_SIZE_MAX, + &ac->dma_descs[pb].phys, GFP_KERNEL); if (!virt) { dev_err(&dev->pci_dev->dev, "dma%d: unable to allocate audio DMA %s-buffer\n", diff --git a/drivers/media/pci/tw686x/tw686x-core.c b/drivers/media/pci/tw686x/tw686x-core.c index 74ae4f0dcee7..6676e069b515 100644 --- a/drivers/media/pci/tw686x/tw686x-core.c +++ b/drivers/media/pci/tw686x/tw686x-core.c @@ -276,7 +276,7 @@ static int tw686x_probe(struct pci_dev *pci_dev, } pci_set_master(pci_dev); - err = pci_set_dma_mask(pci_dev, DMA_BIT_MASK(32)); + err = dma_set_mask(&pci_dev->dev, DMA_BIT_MASK(32)); if (err) { dev_err(&pci_dev->dev, "32-bit PCI DMA not supported\n"); err = -EIO; diff --git a/drivers/media/pci/tw686x/tw686x-video.c b/drivers/media/pci/tw686x/tw686x-video.c index 1ced2b0ddb24..b227e9e78ebd 100644 --- a/drivers/media/pci/tw686x/tw686x-video.c +++ b/drivers/media/pci/tw686x/tw686x-video.c @@ -92,8 +92,8 @@ static void tw686x_memcpy_dma_free(struct tw686x_video_channel *vc, } if (desc->virt) { - pci_free_consistent(dev->pci_dev, desc->size, - desc->virt, desc->phys); + dma_free_coherent(&dev->pci_dev->dev, desc->size, desc->virt, + desc->phys); desc->virt = NULL; } } @@ -110,8 +110,8 @@ static int tw686x_memcpy_dma_alloc(struct tw686x_video_channel *vc, "Allocating buffer but previous still here\n"); len = (vc->width * vc->height * vc->format->depth) >> 3; - virt = pci_alloc_consistent(dev->pci_dev, len, - &vc->dma_descs[pb].phys); + virt = dma_alloc_coherent(&dev->pci_dev->dev, len, + &vc->dma_descs[pb].phys, GFP_KERNEL); if (!virt) { v4l2_err(&dev->v4l2_dev, "dma%d: unable to allocate %s-buffer\n", @@ -258,8 +258,8 @@ static void tw686x_sg_dma_free(struct tw686x_video_channel *vc, struct tw686x_dev *dev = vc->dev; if (desc->size) { - pci_free_consistent(dev->pci_dev, desc->size, - desc->virt, desc->phys); + dma_free_coherent(&dev->pci_dev->dev, desc->size, desc->virt, + desc->phys); desc->virt = NULL; } @@ -276,9 +276,8 @@ static int tw686x_sg_dma_alloc(struct tw686x_video_channel *vc, void *virt; if (desc->size) { - - virt = pci_alloc_consistent(dev->pci_dev, desc->size, - &desc->phys); + virt = dma_alloc_coherent(&dev->pci_dev->dev, desc->size, + &desc->phys, GFP_KERNEL); if (!virt) { v4l2_err(&dev->v4l2_dev, "dma%d: unable to allocate %s-buffer\n", -- cgit v1.2.3 From e999db587312e5b798421d803495f41d1283d7d7 Mon Sep 17 00:00:00 2001 From: Christophe JAILLET Date: Sun, 28 Mar 2021 20:31:01 +0200 Subject: media: tw68: switch from 'pci_' to 'dma_' API The wrappers in include/linux/pci-dma-compat.h should go away. The patch has been generated with the coccinelle script below and has been hand modified to replace GFP_ with a correct flag. It has been compile tested. When memory is allocated in 'tw68_risc_buffer()' (tw68-risc.c) GFP_KERNEL can be used because this function is only called from a vb2_ops buf_prepare function. The call chain is: tw68_video_qops.buf_prepare (tw68-video.c) --> tw68_buf_prepare (tw68-video.c) --> tw68_risc_buffer @@ @@ - PCI_DMA_BIDIRECTIONAL + DMA_BIDIRECTIONAL @@ @@ - PCI_DMA_TODEVICE + DMA_TO_DEVICE @@ @@ - PCI_DMA_FROMDEVICE + DMA_FROM_DEVICE @@ @@ - PCI_DMA_NONE + DMA_NONE @@ expression e1, e2, e3; @@ - pci_alloc_consistent(e1, e2, e3) + dma_alloc_coherent(&e1->dev, e2, e3, GFP_) @@ expression e1, e2, e3; @@ - pci_zalloc_consistent(e1, e2, e3) + dma_alloc_coherent(&e1->dev, e2, e3, GFP_) @@ expression e1, e2, e3, e4; @@ - pci_free_consistent(e1, e2, e3, e4) + dma_free_coherent(&e1->dev, e2, e3, e4) @@ expression e1, e2, e3, e4; @@ - pci_map_single(e1, e2, e3, e4) + dma_map_single(&e1->dev, e2, e3, e4) @@ expression e1, e2, e3, e4; @@ - pci_unmap_single(e1, e2, e3, e4) + dma_unmap_single(&e1->dev, e2, e3, e4) @@ expression e1, e2, e3, e4, e5; @@ - pci_map_page(e1, e2, e3, e4, e5) + dma_map_page(&e1->dev, e2, e3, e4, e5) @@ expression e1, e2, e3, e4; @@ - pci_unmap_page(e1, e2, e3, e4) + dma_unmap_page(&e1->dev, e2, e3, e4) @@ expression e1, e2, e3, e4; @@ - pci_map_sg(e1, e2, e3, e4) + dma_map_sg(&e1->dev, e2, e3, e4) @@ expression e1, e2, e3, e4; @@ - pci_unmap_sg(e1, e2, e3, e4) + dma_unmap_sg(&e1->dev, e2, e3, e4) @@ expression e1, e2, e3, e4; @@ - pci_dma_sync_single_for_cpu(e1, e2, e3, e4) + dma_sync_single_for_cpu(&e1->dev, e2, e3, e4) @@ expression e1, e2, e3, e4; @@ - pci_dma_sync_single_for_device(e1, e2, e3, e4) + dma_sync_single_for_device(&e1->dev, e2, e3, e4) @@ expression e1, e2, e3, e4; @@ - pci_dma_sync_sg_for_cpu(e1, e2, e3, e4) + dma_sync_sg_for_cpu(&e1->dev, e2, e3, e4) @@ expression e1, e2, e3, e4; @@ - pci_dma_sync_sg_for_device(e1, e2, e3, e4) + dma_sync_sg_for_device(&e1->dev, e2, e3, e4) @@ expression e1, e2; @@ - pci_dma_mapping_error(e1, e2) + dma_mapping_error(&e1->dev, e2) @@ expression e1, e2; @@ - pci_set_dma_mask(e1, e2) + dma_set_mask(&e1->dev, e2) @@ expression e1, e2; @@ - pci_set_consistent_dma_mask(e1, e2) + dma_set_coherent_mask(&e1->dev, e2) Signed-off-by: Christophe JAILLET Signed-off-by: Hans Verkuil Signed-off-by: Mauro Carvalho Chehab --- drivers/media/pci/tw68/tw68-core.c | 2 +- drivers/media/pci/tw68/tw68-risc.c | 3 ++- drivers/media/pci/tw68/tw68-video.c | 2 +- 3 files changed, 4 insertions(+), 3 deletions(-) (limited to 'drivers/media/pci') diff --git a/drivers/media/pci/tw68/tw68-core.c b/drivers/media/pci/tw68/tw68-core.c index bf15fa7c0ea1..35dd19b2427e 100644 --- a/drivers/media/pci/tw68/tw68-core.c +++ b/drivers/media/pci/tw68/tw68-core.c @@ -248,7 +248,7 @@ static int tw68_initdev(struct pci_dev *pci_dev, dev->name, pci_name(pci_dev), dev->pci_rev, pci_dev->irq, dev->pci_lat, (u64)pci_resource_start(pci_dev, 0)); pci_set_master(pci_dev); - err = pci_set_dma_mask(pci_dev, DMA_BIT_MASK(32)); + err = dma_set_mask(&pci_dev->dev, DMA_BIT_MASK(32)); if (err) { pr_info("%s: Oops: no 32bit PCI DMA ???\n", dev->name); goto fail1; diff --git a/drivers/media/pci/tw68/tw68-risc.c b/drivers/media/pci/tw68/tw68-risc.c index eef0c5281f61..dacb136c4f3a 100644 --- a/drivers/media/pci/tw68/tw68-risc.c +++ b/drivers/media/pci/tw68/tw68-risc.c @@ -151,7 +151,8 @@ int tw68_risc_buffer(struct pci_dev *pci, instructions = fields * (1 + (((bpl + padding) * lines) / PAGE_SIZE) + lines) + 4; buf->size = instructions * 8; - buf->cpu = pci_alloc_consistent(pci, buf->size, &buf->dma); + buf->cpu = dma_alloc_coherent(&pci->dev, buf->size, &buf->dma, + GFP_KERNEL); if (buf->cpu == NULL) return -ENOMEM; diff --git a/drivers/media/pci/tw68/tw68-video.c b/drivers/media/pci/tw68/tw68-video.c index 10986fcd66a5..fe94944d0531 100644 --- a/drivers/media/pci/tw68/tw68-video.c +++ b/drivers/media/pci/tw68/tw68-video.c @@ -485,7 +485,7 @@ static void tw68_buf_finish(struct vb2_buffer *vb) struct tw68_dev *dev = vb2_get_drv_priv(vq); struct tw68_buf *buf = container_of(vbuf, struct tw68_buf, vb); - pci_free_consistent(dev->pci, buf->size, buf->cpu, buf->dma); + dma_free_coherent(&dev->pci->dev, buf->size, buf->cpu, buf->dma); } static int tw68_start_streaming(struct vb2_queue *q, unsigned int count) -- cgit v1.2.3 From a2e2c1b86209f056d1630983749baf0cd92af5ee Mon Sep 17 00:00:00 2001 From: Hans Verkuil Date: Wed, 7 Apr 2021 16:11:57 +0200 Subject: media: cobalt: drop static for sd_fmt The struct v4l2_subdev_format sd_fmt cannot be static since it can be written back by the subdev. Just have it on the stack. Signed-off-by: Hans Verkuil Signed-off-by: Mauro Carvalho Chehab --- drivers/media/pci/cobalt/cobalt-driver.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'drivers/media/pci') diff --git a/drivers/media/pci/cobalt/cobalt-driver.c b/drivers/media/pci/cobalt/cobalt-driver.c index 9c754e01c186..839503e654f4 100644 --- a/drivers/media/pci/cobalt/cobalt-driver.c +++ b/drivers/media/pci/cobalt/cobalt-driver.c @@ -572,7 +572,7 @@ static int cobalt_subdevs_hsma_init(struct cobalt *cobalt) .addr = 0x20, .platform_data = &adv7842_pdata, }; - static struct v4l2_subdev_format sd_fmt = { + struct v4l2_subdev_format sd_fmt = { .pad = ADV7842_PAD_SOURCE, .which = V4L2_SUBDEV_FORMAT_ACTIVE, .format.code = MEDIA_BUS_FMT_YUYV8_1X16, -- cgit v1.2.3 From d6bed580ebd1cc34f5abb49ee74b5e6ff84f8636 Mon Sep 17 00:00:00 2001 From: Arnd Bergmann Date: Mon, 22 Mar 2021 11:07:24 +0100 Subject: media: flexcop: avoid -Wempty-body warning Building with 'make W=1' shows many warnings -Wempty-body warnings like drivers/media/common/b2c2/flexcop-misc.c: In function 'flexcop_determine_revision': drivers/media/common/b2c2/flexcop-misc.c:35:85: error: suggest braces around empty body in an 'else' statement [-Werror=empty-body] 35 | deb_info("this FlexCop has the 6 basic main hardware pid filter.\n"); drivers/media/usb/b2c2/flexcop-usb.c: In function 'flexcop_usb_process_frame': drivers/media/usb/b2c2/flexcop-usb.c:357:79: error: suggest braces around empty body in an 'else' statement [-Werror=empty-body] 357 | deb_ts("not ts packet %*ph\n", 4, b+2); | ^ drivers/media/common/b2c2/flexcop-misc.c: In function 'flexcop_determine_revision': drivers/media/common/b2c2/flexcop-misc.c:35:85: error: suggest braces around empty body in an 'else' statement [-Werror=empty-body] 35 | deb_info("this FlexCop has the 6 basic main hardware pid filter.\n"); | ^ Change the empty dprintk() macros to no_printk(), which avoids this warning and adds format string checking. Signed-off-by: Arnd Bergmann Signed-off-by: Sean Young Signed-off-by: Mauro Carvalho Chehab --- drivers/media/pci/b2c2/flexcop-pci.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'drivers/media/pci') diff --git a/drivers/media/pci/b2c2/flexcop-pci.c b/drivers/media/pci/b2c2/flexcop-pci.c index a9d9520a94c6..6a4c7cb0ad0f 100644 --- a/drivers/media/pci/b2c2/flexcop-pci.c +++ b/drivers/media/pci/b2c2/flexcop-pci.c @@ -18,11 +18,11 @@ module_param(irq_chk_intv, int, 0644); MODULE_PARM_DESC(irq_chk_intv, "set the interval for IRQ streaming watchdog."); #ifdef CONFIG_DVB_B2C2_FLEXCOP_DEBUG -#define dprintk(level,args...) \ - do { if ((debug & level)) printk(args); } while (0) +#define dprintk(level, args...) \ + do { if ((debug & (level))) printk(args); } while (0) #define DEBSTATUS "" #else -#define dprintk(level,args...) +#define dprintk(level, args...) no_printk(args) #define DEBSTATUS " (debugging is not enabled)" #endif -- cgit v1.2.3 From 98965af1ebc3a652a597cee902f462f496ef9e11 Mon Sep 17 00:00:00 2001 From: Tian Tao Date: Thu, 8 Apr 2021 08:04:13 +0200 Subject: media: cx25821: remove unused including Remove including that don't need it. Signed-off-by: Tian Tao Signed-off-by: Zhiqi Song Signed-off-by: Hans Verkuil Signed-off-by: Mauro Carvalho Chehab --- drivers/media/pci/cx25821/cx25821.h | 1 - 1 file changed, 1 deletion(-) (limited to 'drivers/media/pci') diff --git a/drivers/media/pci/cx25821/cx25821.h b/drivers/media/pci/cx25821/cx25821.h index 017307984094..3aa7604fb944 100644 --- a/drivers/media/pci/cx25821/cx25821.h +++ b/drivers/media/pci/cx25821/cx25821.h @@ -28,7 +28,6 @@ #include "cx25821-sram.h" #include "cx25821-audio.h" -#include #include #define UNSET (-1U) -- cgit v1.2.3