LinuxQuestions.org
Review your favorite Linux distribution.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Software > Linux - Kernel
User Name
Password
Linux - Kernel This forum is for all discussion relating to the Linux kernel.

Notices


Reply
  Search this Thread
Old 08-19-2022, 04:41 AM   #1
Swaggajackin
Member
 
Registered: Jan 2022
Posts: 55

Rep: Reputation: 22
[SOLVED] Seeking help with Kernel 5.18 changing PCI_SET_DMA_MASK() to DMA_SET_MASK()


Hello, I have a capture card I use under Slackware-current, however it seems the 5.18 kernel no longer allows me to build the capture cards driver because PCI_SET_DMA_MASK() was changed to DMA_SET_MASK().

(Full source code here for the device driver (/src/sources/avstream/capture.c): http://www.magewell.com/files/driver...ux_4236.tar.gz)

The issue appears to occur here:
Code:
//Line 290:

    if ((sizeof(dma_addr_t) > 4) &&
            !pci_set_dma_mask(pdev, DMA_BIT_MASK(64))) {
        xi_debug(1, "dma 64 OK!\n");
    } else {
        xi_debug(1, "dma 64 not OK!\n");
        if ((pci_set_dma_mask(pdev, DMA_BIT_MASK(64)) < 0) &&
                (pci_set_dma_mask(pdev, DMA_BIT_MASK(32))) < 0) {
            xi_debug(0, "DMA configuration failed\n");
            goto disable_pci;
        }
    }
It throws the following error:

Code:
/root/driver/ProCaptureForLinux_4236/mwcap_build/sources/avstream/capture.c:291:14: error: implicit declaration of function ‘pci_set_dma_mask’ [-Werror=implicit-function-declaration]
  291 |             !pci_set_dma_mask(pdev, DMA_BIT_MASK(64))) {
      |              ^~~~~~~~~~~~~~~~
cc1: some warnings being treated as errors
make[2]: *** [scripts/Makefile.build:289: /root/driver/ProCaptureForLinux_4236/mwcap_build/sources/avstream/capture.o] Error 1
make[1]: *** [Makefile:1838: /root/driver/ProCaptureForLinux_4236/mwcap_build] Error 2
make[1]: Leaving directory '/usr/src/linux-5.18.17'
make: *** [Makefile:33: all] Error 2
make: Leaving directory '/root/driver/ProCaptureForLinux_4236/mwcap_build'

ERROR: Failed to build module!
I tried changed pci_set_dma_mask() to dma_set_mask(), but I get this error:

Code:
root/driver/ProCaptureForLinux_4236/mwcap_build/sources/avstream/capture.c:295:27: error: passing argument 1 of ‘dma_set_mask’ from incompatible pointer type [-Werror=incompatible-pointer-types]
  295 |         if ((dma_set_mask(pdev, DMA_BIT_MASK(64)) < 0) &&
My C is very poor and limited. I've contacted the device manufacturer asking for an update to resolve this, but in the mean time I was hoping someone who is knowledgable with this could help me fix this as it just seems to be a change of renaming a function and arguments. Would someone please help me fix this module compile issue?

Last edited by Swaggajackin; 08-19-2022 at 08:15 AM.
 
Old 08-19-2022, 05:37 AM   #2
Swaggajackin
Member
 
Registered: Jan 2022
Posts: 55

Original Poster
Rep: Reputation: 22
Seems this rabbit hole is too big for an easy fix. Changing:
Code:
Line 239:  static int xi_cap_probe(struct pci_dev *pdev, const struct pci_device_id *ent)
To:
Code:
static int xi_cap_probe(struct device *pdev, const struct pci_device_id *ent)
Gets it past the DMA_SET_MASK(), but now errors at PCI_ENABLE_DEVICE(), as it's asking for struct pci_dev. So not sure how to fix this. I'll attempt to rollback the kernel until they provide an official fix.
 
Old 08-19-2022, 07:28 AM   #3
petelq
Member
 
Registered: Aug 2008
Location: Yorkshire
Distribution: openSUSE(Leap and Tumbleweed) and a (not so) regularly changing third and fourth
Posts: 629

Rep: Reputation: Disabled
I think your line needs to change from
Code:
!pci_set_dma_mask(pdev, DMA_BIT_MASK(64)))
to
Code:
dma_set_mask(pdev->dev, DMA_BIT_MASK(64)))
on each occasion.
This is an extract from a patch I created for an ethernet driver I use
Code:
 use_dac &&
-            !pci_set_dma_mask(pdev, DMA_BIT_MASK(64)) &&
-            !pci_set_consistent_dma_mask(pdev, DMA_BIT_MASK(64))) {
+            !dma_set_mask(&pdev->dev, DMA_BIT_MASK(64)) &&
+            !dma_set_coherent_mask(&pdev->dev, DMA_BIT_MASK(64))) {
                 dev->features |= NETIF_F_HIGHDMA;
so you get the idea.

Last edited by petelq; 08-19-2022 at 07:35 AM.
 
2 members found this post helpful.
Old 08-19-2022, 08:14 AM   #4
Swaggajackin
Member
 
Registered: Jan 2022
Posts: 55

Original Poster
Rep: Reputation: 22
Quote:
Originally Posted by petelq View Post
I think your line needs to change from
Code:
!pci_set_dma_mask(pdev, DMA_BIT_MASK(64)))
to
Code:
dma_set_mask(pdev->dev, DMA_BIT_MASK(64)))
on each occasion.
This is an extract from a patch I created for an ethernet driver I use
Code:
 use_dac &&
-            !pci_set_dma_mask(pdev, DMA_BIT_MASK(64)) &&
-            !pci_set_consistent_dma_mask(pdev, DMA_BIT_MASK(64))) {
+            !dma_set_mask(&pdev->dev, DMA_BIT_MASK(64)) &&
+            !dma_set_coherent_mask(&pdev->dev, DMA_BIT_MASK(64))) {
                 dev->features |= NETIF_F_HIGHDMA;
so you get the idea.
Thank you so much Pete, this worked and my capture card is functioning correctly again.
 
  


Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
seeking my own kernel configuration details & kernel build SaintDanBert Linux Mint 2 03-13-2013 08:15 PM
seeking HOWTO -- EmperorLinux(tm) kernel SaintDanBert Linux - Hardware 1 12-08-2009 04:06 AM
seeking help with realtek8180 (linksys) under kernel 2.4.33 fil.krohnengold Linux - Wireless Networking 2 01-11-2007 03:02 PM
Seeking USB IO Device for 2.4 Kernel osomoore Linux - Hardware 1 09-28-2006 10:30 AM
Seeking Kernel Source for Zaurus 6000L skunkburner Linux - Laptop and Netbook 5 03-23-2005 01:26 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - Software > Linux - Kernel

All times are GMT -5. The time now is 04:44 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration